text
stringlengths
101
197k
meta
stringlengths
167
272
' <SnippetGlobalPageCode> Public NotInheritable Class GlobalPage Inherits Page ' <SnippetNavCommands> Dim rootPage As Page Protected Overrides Sub OnNavigatedTo(e As Navigation.NavigationEventArgs) rootPage = e.Parameter frame1.Navigate(GetType(Page1), Me) End Sub Private Sub Back_Click(sender As Object, e As RoutedEventArgs) If frame1.CanGoBack() = True Then frame1.GoBack() ElseIf rootPage IsNot Nothing AndAlso rootPage.Frame.CanGoBack() = True Then rootPage.Frame.GoBack() End If End Sub Private Sub Page1Button_Click(sender As Object, e As RoutedEventArgs) frame1.Navigate(GetType(Page1), Me) End Sub Private Sub Page2Button_Click(sender As Object, e As RoutedEventArgs) frame1.Navigate(GetType(Page2), Me) End Sub ' </SnippetNavCommands> End Class ' </SnippetGlobalPageCode>
{'repo_name': 'MicrosoftDocs/winrt-api', 'stars': '106', 'repo_language': 'JavaScript', 'file_name': 'AssemblyInfo.cs', 'mime_type': 'text/plain', 'hash': -6761506454487488499, 'source_dataset': 'data'}
/* * Copyright 2004-2020 H2 Group. Multiple-Licensed under the MPL 2.0, * and the EPL 1.0 (https://h2database.com/html/license.html). * Initial Developer: H2 Group */ package org.h2.util.json; import java.math.BigDecimal; import java.util.ArrayDeque; import java.util.Collections; import java.util.HashSet; import java.util.List; /** * JSON validation target with unique keys. */ public final class JSONValidationTargetWithUniqueKeys extends JSONValidationTarget { private final ArrayDeque<Object> stack; private final ArrayDeque<String> names; private boolean needSeparator; private String memberName; private JSONItemType type; /** * Creates new instance of JSON validation target with unique keys. */ public JSONValidationTargetWithUniqueKeys() { stack = new ArrayDeque<>(); names = new ArrayDeque<>(); } @Override public void startObject() { beforeValue(); names.push(memberName != null ? memberName : ""); memberName = null; stack.push(new HashSet<>()); } @Override public void endObject() { if (memberName != null) { throw new IllegalStateException(); } if (!(stack.poll() instanceof HashSet)) { throw new IllegalStateException(); } memberName = names.pop(); afterValue(JSONItemType.OBJECT); } @Override public void startArray() { beforeValue(); names.push(memberName != null ? memberName : ""); memberName = null; stack.push(Collections.emptyList()); } @Override public void endArray() { if (!(stack.poll() instanceof List)) { throw new IllegalStateException(); } memberName = names.pop(); afterValue(JSONItemType.ARRAY); } @Override public void member(String name) { if (memberName != null || !(stack.peek() instanceof HashSet)) { throw new IllegalStateException(); } memberName = name; beforeValue(); } @Override public void valueNull() { beforeValue(); afterValue(JSONItemType.SCALAR); } @Override public void valueFalse() { beforeValue(); afterValue(JSONItemType.SCALAR); } @Override public void valueTrue() { beforeValue(); afterValue(JSONItemType.SCALAR); } @Override public void valueNumber(BigDecimal number) { beforeValue(); afterValue(JSONItemType.SCALAR); } @Override public void valueString(String string) { beforeValue(); afterValue(JSONItemType.SCALAR); } private void beforeValue() { if (memberName == null && stack.peek() instanceof HashSet) { throw new IllegalStateException(); } if (needSeparator) { if (stack.isEmpty()) { throw new IllegalStateException(); } needSeparator = false; } } @SuppressWarnings("unchecked") private void afterValue(JSONItemType type) { Object parent = stack.peek(); if (parent == null) { this.type = type; } else if (parent instanceof HashSet) { if (!((HashSet<String>) parent).add(memberName)) { throw new IllegalStateException(); } } needSeparator = true; memberName = null; } @Override public boolean isPropertyExpected() { return memberName == null && stack.peek() instanceof HashSet; } @Override public boolean isValueSeparatorExpected() { return needSeparator; } @Override public JSONItemType getResult() { if (!stack.isEmpty() || type == null) { throw new IllegalStateException(); } return type; } }
{'repo_name': 'codefollower/H2-Research', 'stars': '355', 'repo_language': 'Java', 'file_name': '1_install_service.bat', 'mime_type': 'text/x-msdos-batch', 'hash': -9163146242080363446, 'source_dataset': 'data'}
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. */ package com.microsoft.azure.management.network.v2017_10_01; import com.microsoft.azure.SubResource; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.serializer.JsonFlatten; /** * Request routing rule of an application gateway. */ @JsonFlatten public class ApplicationGatewayRequestRoutingRule extends SubResource { /** * Rule type. Possible values include: 'Basic', 'PathBasedRouting'. */ @JsonProperty(value = "properties.ruleType") private ApplicationGatewayRequestRoutingRuleType ruleType; /** * Backend address pool resource of the application gateway. */ @JsonProperty(value = "properties.backendAddressPool") private SubResource backendAddressPool; /** * Frontend port resource of the application gateway. */ @JsonProperty(value = "properties.backendHttpSettings") private SubResource backendHttpSettings; /** * Http listener resource of the application gateway. */ @JsonProperty(value = "properties.httpListener") private SubResource httpListener; /** * URL path map resource of the application gateway. */ @JsonProperty(value = "properties.urlPathMap") private SubResource urlPathMap; /** * Redirect configuration resource of the application gateway. */ @JsonProperty(value = "properties.redirectConfiguration") private SubResource redirectConfiguration; /** * Provisioning state of the request routing rule resource. Possible values * are: 'Updating', 'Deleting', and 'Failed'. */ @JsonProperty(value = "properties.provisioningState") private String provisioningState; /** * Name of the resource that is unique within a resource group. This name * can be used to access the resource. */ @JsonProperty(value = "name") private String name; /** * A unique read-only string that changes whenever the resource is updated. */ @JsonProperty(value = "etag") private String etag; /** * Type of the resource. */ @JsonProperty(value = "type") private String type; /** * Get rule type. Possible values include: 'Basic', 'PathBasedRouting'. * * @return the ruleType value */ public ApplicationGatewayRequestRoutingRuleType ruleType() { return this.ruleType; } /** * Set rule type. Possible values include: 'Basic', 'PathBasedRouting'. * * @param ruleType the ruleType value to set * @return the ApplicationGatewayRequestRoutingRule object itself. */ public ApplicationGatewayRequestRoutingRule withRuleType(ApplicationGatewayRequestRoutingRuleType ruleType) { this.ruleType = ruleType; return this; } /** * Get backend address pool resource of the application gateway. * * @return the backendAddressPool value */ public SubResource backendAddressPool() { return this.backendAddressPool; } /** * Set backend address pool resource of the application gateway. * * @param backendAddressPool the backendAddressPool value to set * @return the ApplicationGatewayRequestRoutingRule object itself. */ public ApplicationGatewayRequestRoutingRule withBackendAddressPool(SubResource backendAddressPool) { this.backendAddressPool = backendAddressPool; return this; } /** * Get frontend port resource of the application gateway. * * @return the backendHttpSettings value */ public SubResource backendHttpSettings() { return this.backendHttpSettings; } /** * Set frontend port resource of the application gateway. * * @param backendHttpSettings the backendHttpSettings value to set * @return the ApplicationGatewayRequestRoutingRule object itself. */ public ApplicationGatewayRequestRoutingRule withBackendHttpSettings(SubResource backendHttpSettings) { this.backendHttpSettings = backendHttpSettings; return this; } /** * Get http listener resource of the application gateway. * * @return the httpListener value */ public SubResource httpListener() { return this.httpListener; } /** * Set http listener resource of the application gateway. * * @param httpListener the httpListener value to set * @return the ApplicationGatewayRequestRoutingRule object itself. */ public ApplicationGatewayRequestRoutingRule withHttpListener(SubResource httpListener) { this.httpListener = httpListener; return this; } /** * Get uRL path map resource of the application gateway. * * @return the urlPathMap value */ public SubResource urlPathMap() { return this.urlPathMap; } /** * Set uRL path map resource of the application gateway. * * @param urlPathMap the urlPathMap value to set * @return the ApplicationGatewayRequestRoutingRule object itself. */ public ApplicationGatewayRequestRoutingRule withUrlPathMap(SubResource urlPathMap) { this.urlPathMap = urlPathMap; return this; } /** * Get redirect configuration resource of the application gateway. * * @return the redirectConfiguration value */ public SubResource redirectConfiguration() { return this.redirectConfiguration; } /** * Set redirect configuration resource of the application gateway. * * @param redirectConfiguration the redirectConfiguration value to set * @return the ApplicationGatewayRequestRoutingRule object itself. */ public ApplicationGatewayRequestRoutingRule withRedirectConfiguration(SubResource redirectConfiguration) { this.redirectConfiguration = redirectConfiguration; return this; } /** * Get provisioning state of the request routing rule resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. * * @return the provisioningState value */ public String provisioningState() { return this.provisioningState; } /** * Set provisioning state of the request routing rule resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. * * @param provisioningState the provisioningState value to set * @return the ApplicationGatewayRequestRoutingRule object itself. */ public ApplicationGatewayRequestRoutingRule withProvisioningState(String provisioningState) { this.provisioningState = provisioningState; return this; } /** * Get name of the resource that is unique within a resource group. This name can be used to access the resource. * * @return the name value */ public String name() { return this.name; } /** * Set name of the resource that is unique within a resource group. This name can be used to access the resource. * * @param name the name value to set * @return the ApplicationGatewayRequestRoutingRule object itself. */ public ApplicationGatewayRequestRoutingRule withName(String name) { this.name = name; return this; } /** * Get a unique read-only string that changes whenever the resource is updated. * * @return the etag value */ public String etag() { return this.etag; } /** * Set a unique read-only string that changes whenever the resource is updated. * * @param etag the etag value to set * @return the ApplicationGatewayRequestRoutingRule object itself. */ public ApplicationGatewayRequestRoutingRule withEtag(String etag) { this.etag = etag; return this; } /** * Get type of the resource. * * @return the type value */ public String type() { return this.type; } /** * Set type of the resource. * * @param type the type value to set * @return the ApplicationGatewayRequestRoutingRule object itself. */ public ApplicationGatewayRequestRoutingRule withType(String type) { this.type = type; return this; } }
{'repo_name': 'Azure/azure-sdk-for-java', 'stars': '587', 'repo_language': 'Java', 'file_name': 'MetricSpecification.java', 'mime_type': 'text/x-java', 'hash': -871512291859593340, 'source_dataset': 'data'}
/* IMPORTANT! This file is auto-generated each time you save your project - if you alter its contents, your changes may be overwritten! */ #include <juce_core/juce_core.mm>
{'repo_name': 'juce-framework/JUCE', 'stars': '2212', 'repo_language': 'C++', 'file_name': 'include_juce_data_structures.mm', 'mime_type': 'text/x-c', 'hash': -6539254570590503296, 'source_dataset': 'data'}
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="refresh" content="0;URL=../../../libc/fn.globfree64.html"> </head> <body> <p>Redirecting to <a href="../../../libc/fn.globfree64.html">../../../libc/fn.globfree64.html</a>...</p> <script>location.replace("../../../libc/fn.globfree64.html" + location.search + location.hash);</script> </body> </html>
{'repo_name': 'rust-lang-ja/the-rust-programming-language-ja', 'stars': '349', 'repo_language': 'HTML', 'file_name': 'main.css', 'mime_type': 'text/plain', 'hash': -5628367143394835967, 'source_dataset': 'data'}
rows = {[1.981281e+002 2.420731e+002 2.610494e+002 2.710369e+002 2.930094e+002 3.039956e+002 3.139831e+002 3.249694e+002 3.439456e+002 3.609244e+002 3.679156e+002 3.749069e+002 3.799006e+002 3.868919e+002 3.888894e+002 3.908869e+002 3.918856e+002 3.918856e+002 3.908869e+002 3.898881e+002 3.858931e+002 3.828969e+002 3.799006e+002 3.759056e+002 3.729094e+002 3.689144e+002 3.659181e+002 3.619231e+002 3.589269e+002 3.539331e+002 3.509369e+002 ]; [3.299631e+002 2.980031e+002 2.940081e+002 2.900131e+002 2.850194e+002 2.810244e+002 2.760306e+002 2.680406e+002 2.650444e+002 2.610494e+002 2.590519e+002 ]; [2.450694e+002 1.991269e+002 1.951319e+002 1.911369e+002 1.881406e+002 1.851444e+002 1.831469e+002 1.801506e+002 1.791519e+002 1.781531e+002 ]; }; cols = {[3.520606e+002 3.450694e+002 3.440706e+002 3.430719e+002 3.410744e+002 3.410744e+002 3.410744e+002 3.410744e+002 3.430719e+002 3.460681e+002 3.490644e+002 3.520606e+002 3.560556e+002 3.650444e+002 3.700381e+002 3.760306e+002 3.810244e+002 3.870169e+002 3.920106e+002 3.980031e+002 4.079906e+002 4.119856e+002 4.159806e+002 4.199756e+002 4.219731e+002 4.249694e+002 4.259681e+002 4.259681e+002 4.259681e+002 4.239706e+002 4.219731e+002 ]; [3.450694e+002 3.800256e+002 3.840206e+002 3.870169e+002 3.900131e+002 3.920106e+002 3.940081e+002 3.950069e+002 3.940081e+002 3.930094e+002 3.910119e+002 ]; [3.500631e+002 3.850194e+002 3.900131e+002 3.940081e+002 3.970044e+002 4.000006e+002 4.019981e+002 4.059931e+002 4.069919e+002 4.079906e+002 ]; };
{'repo_name': 'FraPochetti/ImageTextRecognition', 'stars': '124', 'repo_language': 'Matlab', 'file_name': 'img044_042.m', 'mime_type': 'text/plain', 'hash': 6486540179744921347, 'source_dataset': 'data'}
fileFormatVersion: 2 guid: 4a3df287aaa282d4f86a7649a125b7aa timeCreated: 1464338620 licenseType: Pro TextureImporter: fileIDToRecycleName: {} serializedVersion: 2 mipmaps: mipMapMode: 0 enableMipMap: 0 linearTexture: 0 correctGamma: 0 fadeOut: 0 borderMipMap: 0 mipMapFadeDistanceStart: 1 mipMapFadeDistanceEnd: 3 bumpmap: convertToNormalMap: 0 externalNormalMap: 0 heightScale: 0.25 normalMapFilter: 0 isReadable: 0 grayScaleToAlpha: 0 generateCubemap: 0 cubemapConvolution: 0 cubemapConvolutionSteps: 7 cubemapConvolutionExponent: 1.5 seamlessCubemap: 0 textureFormat: -1 maxTextureSize: 256 textureSettings: filterMode: -1 aniso: 0 mipBias: -1 wrapMode: -1 nPOTScale: 1 lightmap: 0 rGBM: 0 compressionQuality: 50 allowsAlphaSplitting: 0 spriteMode: 0 spriteExtrude: 1 spriteMeshType: 1 alignment: 0 spritePivot: {x: 0.5, y: 0.5} spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 alphaIsTransparency: 0 textureType: 5 buildTargetSettings: - buildTarget: Android maxTextureSize: 256 textureFormat: 34 compressionQuality: 50 allowsAlphaSplitting: 0 spriteSheet: sprites: [] outline: [] spritePackingTag: userData: assetBundleName: assetBundleVariant:
{'repo_name': 'Acgmart/ET-MultiplyDemos', 'stars': '110', 'repo_language': 'C#', 'file_name': 'ImmutableTypeClassMapConvention.cs.meta', 'mime_type': 'text/plain', 'hash': -4056751214682332942, 'source_dataset': 'data'}
<?xml version="1.0" encoding="utf-8"?> <root> <!-- Microsoft ResX Schema Version 2.0 The primary goals of this format is to allow a simple XML format that is mostly human readable. The generation and parsing of the various data types are done through the TypeConverter classes associated with the data types. Example: ... ado.net/XML headers & schema ... <resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="version">2.0</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <value>[base64 mime encoded serialized .NET Framework object]</value> </data> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <comment>This is a comment</comment> </data> There are any number of "resheader" rows that contain simple name/value pairs. Each data row contains a name, and value. The row also contains a type or mimetype. Type corresponds to a .NET class that support text/value conversion through the TypeConverter architecture. Classes that don't support this are serialized and stored with the mimetype set. The mimetype is used for serialized objects, and tells the ResXResourceReader how to depersist the object. This is currently not extensible. For a given mimetype the value must be set accordingly: Note - application/x-microsoft.net.object.binary.base64 is the format that the ResXResourceWriter will generate, however the reader can read any of the formats listed below. mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Soap.SoapFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.bytearray.base64 value : The object must be serialized into a byte array : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="metadata"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" /> </xsd:sequence> <xsd:attribute name="name" use="required" type="xsd:string" /> <xsd:attribute name="type" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="assembly"> <xsd:complexType> <xsd:attribute name="alias" type="xsd:string" /> <xsd:attribute name="name" type="xsd:string" /> </xsd:complexType> </xsd:element> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute ref="xml:space" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="resmimetype"> <value>text/microsoft-resx</value> </resheader> <resheader name="version"> <value>2.0</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <data name="CurrentLocale" xml:space="preserve"> <value>Nuværende kultur: {0}</value> </data> <data name="HowToChange" xml:space="preserve"> <value>For at ændre denne, skift system instillinger og genstart eksemplet</value> </data> <data name="Welcome" xml:space="preserve"> <value>Velkommen til lokaliserings eksemplet!</value> </data> </root>
{'repo_name': 'SimonDarksideJ/XNAGameStudio', 'stars': '220', 'repo_language': 'C#', 'file_name': 'FUNDING.yml', 'mime_type': 'text/plain', 'hash': 9111139088076565997, 'source_dataset': 'data'}
<!-- $PostgreSQL$ PostgreSQL documentation --> <refentry id="SQL-CREATELANGUAGE"> <refmeta> <refentrytitle>CREATE LANGUAGE</refentrytitle> <manvolnum>7</manvolnum> <refmiscinfo>SQL - Language Statements</refmiscinfo> </refmeta> <refnamediv> <refname>CREATE LANGUAGE</refname> <refpurpose>define a new procedural language</refpurpose> </refnamediv> <indexterm zone="sql-createlanguage"> <primary>CREATE LANGUAGE</primary> </indexterm> <refsynopsisdiv> <synopsis> CREATE [ OR REPLACE ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">name</replaceable> CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">name</replaceable> HANDLER <replaceable class="parameter">call_handler</replaceable> [ INLINE <replaceable class="parameter">inline_handler</replaceable> ] [ VALIDATOR <replaceable>valfunction</replaceable> ] </synopsis> </refsynopsisdiv> <refsect1 id="sql-createlanguage-description"> <title>Description</title> <para> <command>CREATE LANGUAGE</command> registers a new procedural language with a <productname>PostgreSQL</productname> database. Subsequently, functions and trigger procedures can be defined in this new language. </para> <para> <command>CREATE LANGUAGE</command> effectively associates the language name with handler function(s) that are responsible for executing functions written in the language. Refer to <xref linkend="plhandler"> for more information about language handlers. </para> <para> There are two forms of the <command>CREATE LANGUAGE</command> command. In the first form, the user supplies just the name of the desired language, and the <productname>PostgreSQL</productname> server consults the <link linkend="catalog-pg-pltemplate"><structname>pg_pltemplate</structname></link> system catalog to determine the correct parameters. In the second form, the user supplies the language parameters along with the language name. The second form can be used to create a language that is not defined in <structname>pg_pltemplate</>, but this approach is considered obsolescent. </para> <para> When the server finds an entry in the <structname>pg_pltemplate</> catalog for the given language name, it will use the catalog data even if the command includes language parameters. This behavior simplifies loading of old dump files, which are likely to contain out-of-date information about language support functions. </para> <para> Ordinarily, the user must have the <productname>PostgreSQL</productname> superuser privilege to register a new language. However, the owner of a database can register a new language within that database if the language is listed in the <structname>pg_pltemplate</structname> catalog and is marked as allowed to be created by database owners (<structfield>tmpldbacreate</> is true). The default is that trusted languages can be created by database owners, but this can be adjusted by superusers by modifying the contents of <structname>pg_pltemplate</structname>. The creator of a language becomes its owner and can later drop it, rename it, or assign it to a new owner. </para> <para> <command>CREATE OR REPLACE LANGUAGE</command> will either create a new language, or replace an existing definition. If the language already exists, its parameters are updated according to the values specified or taken from <structname>pg_pltemplate</structname>, but the language's ownership and permissions settings do not change, and any existing functions written in the language are assumed to still be valid. In addition to the normal privilege requirements for creating a language, the user must be superuser or owner of the existing language. The <literal>REPLACE</> case is mainly meant to be used to ensure that the language exists. If the language has a <structname>pg_pltemplate</structname> entry then <literal>REPLACE</> will not actually change anything about an existing definition, except in the unusual case where the <structname>pg_pltemplate</structname> entry has been modified since the language was created. </para> </refsect1> <refsect1 id="sql-createlanguage-parameters"> <title>Parameters</title> <variablelist> <varlistentry> <term><literal>TRUSTED</literal></term> <listitem> <para> <literal>TRUSTED</literal> specifies that the language does not grant access to data that the user would not otherwise have. If this key word is omitted when registering the language, only users with the <productname>PostgreSQL</productname> superuser privilege can use this language to create new functions. </para> </listitem> </varlistentry> <varlistentry> <term><literal>PROCEDURAL</literal></term> <listitem> <para> This is a noise word. </para> </listitem> </varlistentry> <varlistentry> <term><replaceable class="parameter">name</replaceable></term> <listitem> <para> The name of the new procedural language. The language name is case insensitive. The name must be unique among the languages in the database. </para> <para> For backward compatibility, the name can be enclosed by single quotes. </para> </listitem> </varlistentry> <varlistentry> <term><literal>HANDLER</literal> <replaceable class="parameter">call_handler</replaceable></term> <listitem> <para> <replaceable class="parameter">call_handler</replaceable> is the name of a previously registered function that will be called to execute the procedural language's functions. The call handler for a procedural language must be written in a compiled language such as C with version 1 call convention and registered with <productname>PostgreSQL</productname> as a function taking no arguments and returning the <type>language_handler</type> type, a placeholder type that is simply used to identify the function as a call handler. </para> </listitem> </varlistentry> <varlistentry> <term><literal>INLINE</literal> <replaceable class="parameter">inline_handler</replaceable></term> <listitem> <para> <replaceable class="parameter">inline_handler</replaceable> is the name of a previously registered function that will be called to execute an anonymous code block (<xref linkend="sql-do"> command) in this language. If no <replaceable class="parameter">inline_handler</replaceable> function is specified, the language does not support anonymous code blocks. The handler function must take one argument of type <type>internal</type>, which will be the <command>DO</> command's internal representation, and it will typically return <type>void</>. The return value of the handler is ignored. </para> </listitem> </varlistentry> <varlistentry> <term><literal>VALIDATOR</literal> <replaceable class="parameter">valfunction</replaceable></term> <listitem> <para> <replaceable class="parameter">valfunction</replaceable> is the name of a previously registered function that will be called when a new function in the language is created, to validate the new function. If no validator function is specified, then a new function will not be checked when it is created. The validator function must take one argument of type <type>oid</type>, which will be the OID of the to-be-created function, and will typically return <type>void</>. </para> <para> A validator function would typically inspect the function body for syntactical correctness, but it can also look at other properties of the function, for example if the language cannot handle certain argument types. To signal an error, the validator function should use the <function>ereport()</function> function. The return value of the function is ignored. </para> </listitem> </varlistentry> </variablelist> <para> The <literal>TRUSTED</> option and the support function name(s) are ignored if the server has an entry for the specified language name in <structname>pg_pltemplate</>. </para> </refsect1> <refsect1 id="sql-createlanguage-notes"> <title>Notes</title> <para> The <xref linkend="app-createlang"> program is a simple wrapper around the <command>CREATE LANGUAGE</> command. It eases installation of procedural languages from the shell command line. </para> <para> Use <xref linkend="sql-droplanguage">, or better yet the <xref linkend="app-droplang"> program, to drop procedural languages. </para> <para> The system catalog <classname>pg_language</classname> (see <xref linkend="catalog-pg-language">) records information about the currently installed languages. Also, <command>createlang</command> has an option to list the installed languages. </para> <para> To create functions in a procedural language, a user must have the <literal>USAGE</literal> privilege for the language. By default, <literal>USAGE</> is granted to <literal>PUBLIC</> (i.e., everyone) for trusted languages. This can be revoked if desired. </para> <para> Procedural languages are local to individual databases. However, a language can be installed into the <literal>template1</literal> database, which will cause it to be available automatically in all subsequently-created databases. </para> <para> The call handler function, the inline handler function (if any), and the validator function (if any) must already exist if the server does not have an entry for the language in <structname>pg_pltemplate</>. But when there is an entry, the functions need not already exist; they will be automatically defined if not present in the database. (This might result in <command>CREATE LANGUAGE</> failing, if the shared library that implements the language is not available in the installation.) </para> <para> In <productname>PostgreSQL</productname> versions before 7.3, it was necessary to declare handler functions as returning the placeholder type <type>opaque</>, rather than <type>language_handler</>. To support loading of old dump files, <command>CREATE LANGUAGE</> will accept a function declared as returning <type>opaque</>, but it will issue a notice and change the function's declared return type to <type>language_handler</>. </para> </refsect1> <refsect1 id="sql-createlanguage-examples"> <title>Examples</title> <para> The preferred way of creating any of the standard procedural languages is just: <programlisting> CREATE LANGUAGE plperl; </programlisting> </para> <para> For a language not known in the <structname>pg_pltemplate</> catalog, a sequence such as this is needed: <programlisting> CREATE FUNCTION plsample_call_handler() RETURNS language_handler AS '$libdir/plsample' LANGUAGE C; CREATE LANGUAGE plsample HANDLER plsample_call_handler; </programlisting> </para> </refsect1> <refsect1 id="sql-createlanguage-compat"> <title>Compatibility</title> <para> <command>CREATE LANGUAGE</command> is a <productname>PostgreSQL</productname> extension. </para> </refsect1> <refsect1> <title>See Also</title> <simplelist type="inline"> <member><xref linkend="sql-alterlanguage"></member> <member><xref linkend="sql-createfunction"></member> <member><xref linkend="sql-droplanguage"></member> <member><xref linkend="sql-grant"></member> <member><xref linkend="sql-revoke"></member> <member><xref linkend="app-createlang"></member> <member><xref linkend="app-droplang"></member> </simplelist> </refsect1> </refentry>
{'repo_name': 'postgres/postgres-old-soon-decommissioned', 'stars': '135', 'repo_language': 'C', 'file_name': 'postmaster.sgml', 'mime_type': 'text/html', 'hash': 7544679084110370203, 'source_dataset': 'data'}
#!/usr/bin/env bash CUDA_VISIBLE_DEVICES=0 \ python main.py \ --data_dir ../data/FB15k/ \ --embedding_dim 100 \ --margin_value 1 \ --batch_size 10000 \ --learning_rate 0.003 \ --n_generator 24 \ --n_rank_calculator 24 \ --eval_freq 100 \ --max_epoch 5000
{'repo_name': 'ZichaoHuang/TransE', 'stars': '132', 'repo_language': 'Python', 'file_name': 'main.py', 'mime_type': 'text/x-python', 'hash': 2154557038221018184, 'source_dataset': 'data'}
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.components.external_intents; /** * Handles intercepting navigation requests for an external authenticator application. */ public interface AuthenticatorNavigationInterceptor { /** * To be called by a Tab to check whether the passed in URL, which is about to be loaded, * should be processed by an external Authenticator application. * * @param url the URL about to be loaded in the tab * @return True if the URL has been handled by the Authenticator, false if it hasn't and * should be processed normally by the Tab. */ boolean handleAuthenticatorUrl(String url); }
{'repo_name': 'nwjs/chromium.src', 'stars': '111', 'repo_language': 'None', 'file_name': 'AndroidManifest.xml', 'mime_type': 'text/xml', 'hash': -6332188982697770675, 'source_dataset': 'data'}
"use strict"; import * as qs from "querystring"; import { Logger } from "../logger"; import { CreateThirdPartyCardRequest, FetchThirdPartyBoardsRequest, FetchThirdPartyBoardsResponse, FetchThirdPartyCardsRequest, FetchThirdPartyCardsResponse, MoveThirdPartyCardRequest, MoveThirdPartyCardResponse, TrelloBoard, TrelloCard, TrelloCreateCardRequest, TrelloCreateCardResponse, TrelloMember } from "../protocol/agent.protocol"; import { CSTrelloProviderInfo } from "../protocol/api.protocol"; import { log, lspProvider } from "../system"; import { ApiResponse, ThirdPartyIssueProviderBase } from "./provider"; @lspProvider("trello") export class TrelloProvider extends ThirdPartyIssueProviderBase<CSTrelloProviderInfo> { private _trelloUserId: string | undefined; private _listNames: { [id: string]: string } = {}; get displayName() { return "Trello"; } get name() { return "trello"; } get headers() { return {}; } private get apiKey() { return this._providerInfo && this._providerInfo.apiKey; } async onConnected() { this._trelloUserId = await this.getMemberId(); } @log() async getBoards(request: FetchThirdPartyBoardsRequest): Promise<FetchThirdPartyBoardsResponse> { // have to force connection here because we need apiKey and accessToken to even create our request await this.ensureConnected(); const response = await this.get<TrelloBoard[]>( `/members/${this._trelloUserId}/boards?${qs.stringify({ filter: "open", fields: "id,name,desc,descData,closed,idOrganization,pinned,url,labelNames,starred", lists: "open", key: this.apiKey, token: this.accessToken })}` ); const boards = request.organizationId ? response.body.filter(b => b.idOrganization === request.organizationId) : response.body; boards.forEach(board => { board.lists.forEach(list => { this._listNames[list.id] = list.name; }); }); return { boards }; } async selfAssignCard(request: { cardId: string }) { await this.ensureConnected(); const response = await this.put<{}, any>( `/cards/${request.cardId}?${qs.stringify({ idMembers: this._trelloUserId, key: this.apiKey, token: this.accessToken })}`, {} ); return response.body; } @log() async getCards(request: FetchThirdPartyCardsRequest): Promise<FetchThirdPartyCardsResponse> { // have to force connection here because we need apiKey and accessToken to even create our request await this.ensureConnected(); let response: ApiResponse<TrelloCard[]>; if (true || request.data.assignedToMe) { response = await this.get<TrelloCard[]>( `/members/${this._trelloUserId}/cards?${qs.stringify({ cards: "open", filter: "open", fields: "id,name,desc,url,idList,idBoard,idOrganization,dateLastActivity,shortLink,idShort", key: this.apiKey, token: this.accessToken })}` ); } else if (request.data.assignedToAnyone) { response = await this.get<TrelloCard[]>( `/members/${this._trelloUserId}/cards?${qs.stringify({ cards: "open", filter: "open", fields: "id,name,desc,url,idList,idBoard,idOrganization,dateLastActivity,shortLink,idShort", key: this.apiKey, token: this.accessToken })}` ); response.body = []; const bodies = ( await Promise.all( // @ts-ignore request.filterBoards.map(boardId => { const innerResponse = this.get<TrelloCard[]>( `/boards/${boardId}/cards?${qs.stringify({ cards: "open", fields: "id,name,desc,url,idList,idBoard,idOrganization,dateLastActivity,shortLink,idShort", key: this.apiKey, token: this.accessToken })}` ); return innerResponse; }) ) ).forEach(resp => { // @ts-ignore if (!response) response = resp; // @ts-ignore else response.body = response.body.concat(resp.body); }); } else { response = await this.get<TrelloCard[]>( `/lists/${request.listId}/cards?${qs.stringify({ cards: "open", fields: "id,name,desc,url,idList,idBoard,idOrganization,dateLastActivity,shortLink,idShort", key: this.apiKey, token: this.accessToken })}` ); } const cards = (request.organizationId ? response.body.filter(c => c.idOrganization === request.organizationId) : response.body ).map(card => { return { id: card.id, title: card.name, body: card.desc, url: card.url, modifiedAt: new Date(card.dateLastActivity).getTime(), tokenId: card.shortLink, idList: card.idList, listName: this._listNames[card.idList], idBoard: card.idBoard }; }); return { cards }; } @log() async createCard(request: CreateThirdPartyCardRequest) { await this.ensureConnected(); const data = request.data as TrelloCreateCardRequest; const response = await this.post<{}, TrelloCreateCardResponse>( `/cards?${qs.stringify({ idList: data.listId, name: data.name, desc: data.description, key: this.apiKey, idMembers: (data.assignees! || []).map(a => a.id), token: this.accessToken })}`, {} ); return response.body; } @log() async moveCard(request: MoveThirdPartyCardRequest) { await this.ensureConnected(); const response = await this.put<{}, MoveThirdPartyCardResponse>( `/cards/${request.cardId}?${qs.stringify({ idList: request.listId, key: this.apiKey, token: this.accessToken })}`, {} ); return response.body; } @log() async getAssignableUsers(request: { boardId: string }) { await this.ensureConnected(); const { body } = await this.get<TrelloMember[]>( `/boards/${request.boardId}/members?${qs.stringify({ key: this.apiKey, token: this.accessToken, fields: "id,email,username,fullName" })}` ); return { users: body.map(u => ({ ...u, displayName: u.fullName })) }; } private async getMemberId() { const tokenResponse = await this.get<{ idMember: string; [key: string]: any }>( `/token/${this.accessToken}?${qs.stringify({ key: this.apiKey, token: this.accessToken })}` ); return tokenResponse.body.idMember; } }
{'repo_name': 'TeamCodeStream/codestream', 'stars': '232', 'repo_language': 'TypeScript', 'file_name': 'snapshot-sandbox', 'mime_type': 'text/x-shellscript', 'hash': -1731392780161043071, 'source_dataset': 'data'}
#include "f2c.h" #include "blaswrap.h" /* Table of constant values */ static integer c__1 = 1; /* Subroutine */ int zptcon_(integer *n, doublereal *d__, doublecomplex *e, doublereal *anorm, doublereal *rcond, doublereal *rwork, integer * info) { /* System generated locals */ integer i__1; doublereal d__1; /* Builtin functions */ double z_abs(doublecomplex *); /* Local variables */ integer i__, ix; extern integer idamax_(integer *, doublereal *, integer *); extern /* Subroutine */ int xerbla_(char *, integer *); doublereal ainvnm; /* -- LAPACK routine (version 3.1) -- */ /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ /* November 2006 */ /* .. Scalar Arguments .. */ /* .. */ /* .. Array Arguments .. */ /* .. */ /* Purpose */ /* ======= */ /* ZPTCON computes the reciprocal of the condition number (in the */ /* 1-norm) of a complex Hermitian positive definite tridiagonal matrix */ /* using the factorization A = L*D*L**H or A = U**H*D*U computed by */ /* ZPTTRF. */ /* Norm(inv(A)) is computed by a direct method, and the reciprocal of */ /* the condition number is computed as */ /* RCOND = 1 / (ANORM * norm(inv(A))). */ /* Arguments */ /* ========= */ /* N (input) INTEGER */ /* The order of the matrix A. N >= 0. */ /* D (input) DOUBLE PRECISION array, dimension (N) */ /* The n diagonal elements of the diagonal matrix D from the */ /* factorization of A, as computed by ZPTTRF. */ /* E (input) COMPLEX*16 array, dimension (N-1) */ /* The (n-1) off-diagonal elements of the unit bidiagonal factor */ /* U or L from the factorization of A, as computed by ZPTTRF. */ /* ANORM (input) DOUBLE PRECISION */ /* The 1-norm of the original matrix A. */ /* RCOND (output) DOUBLE PRECISION */ /* The reciprocal of the condition number of the matrix A, */ /* computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is the */ /* 1-norm of inv(A) computed in this routine. */ /* RWORK (workspace) DOUBLE PRECISION array, dimension (N) */ /* INFO (output) INTEGER */ /* = 0: successful exit */ /* < 0: if INFO = -i, the i-th argument had an illegal value */ /* Further Details */ /* =============== */ /* The method used is described in Nicholas J. Higham, "Efficient */ /* Algorithms for Computing the Condition Number of a Tridiagonal */ /* Matrix", SIAM J. Sci. Stat. Comput., Vol. 7, No. 1, January 1986. */ /* ===================================================================== */ /* .. Parameters .. */ /* .. */ /* .. Local Scalars .. */ /* .. */ /* .. External Functions .. */ /* .. */ /* .. External Subroutines .. */ /* .. */ /* .. Intrinsic Functions .. */ /* .. */ /* .. Executable Statements .. */ /* Test the input arguments. */ /* Parameter adjustments */ --rwork; --e; --d__; /* Function Body */ *info = 0; if (*n < 0) { *info = -1; } else if (*anorm < 0.) { *info = -4; } if (*info != 0) { i__1 = -(*info); xerbla_("ZPTCON", &i__1); return 0; } /* Quick return if possible */ *rcond = 0.; if (*n == 0) { *rcond = 1.; return 0; } else if (*anorm == 0.) { return 0; } /* Check that D(1:N) is positive. */ i__1 = *n; for (i__ = 1; i__ <= i__1; ++i__) { if (d__[i__] <= 0.) { return 0; } /* L10: */ } /* Solve M(A) * x = e, where M(A) = (m(i,j)) is given by */ /* m(i,j) = abs(A(i,j)), i = j, */ /* m(i,j) = -abs(A(i,j)), i .ne. j, */ /* and e = [ 1, 1, ..., 1 ]'. Note M(A) = M(L)*D*M(L)'. */ /* Solve M(L) * x = e. */ rwork[1] = 1.; i__1 = *n; for (i__ = 2; i__ <= i__1; ++i__) { rwork[i__] = rwork[i__ - 1] * z_abs(&e[i__ - 1]) + 1.; /* L20: */ } /* Solve D * M(L)' * x = b. */ rwork[*n] /= d__[*n]; for (i__ = *n - 1; i__ >= 1; --i__) { rwork[i__] = rwork[i__] / d__[i__] + rwork[i__ + 1] * z_abs(&e[i__]); /* L30: */ } /* Compute AINVNM = max(x(i)), 1<=i<=n. */ ix = idamax_(n, &rwork[1], &c__1); ainvnm = (d__1 = rwork[ix], abs(d__1)); /* Compute the reciprocal condition number. */ if (ainvnm != 0.) { *rcond = 1. / ainvnm / *anorm; } return 0; /* End of ZPTCON */ } /* zptcon_ */
{'repo_name': 'nya3jp/python-animeface', 'stars': '117', 'repo_language': 'C', 'file_name': 'Imaging.h', 'mime_type': 'text/x-c', 'hash': -4892089744798899375, 'source_dataset': 'data'}
/* * Copyright (c) 2015 Manojkumar Bhosale (Manojkumar.Bhosale@imgtec.com) * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "libavutil/mips/generic_macros_msa.h" #include "h263dsp_mips.h" static void h263_dct_unquantize_msa(int16_t *block, int16_t qmul, int16_t qadd, int8_t n_coeffs, uint8_t loop_start) { int16_t *block_dup = block; int32_t level, cnt; v8i16 block_vec, qmul_vec, qadd_vec, sub; v8i16 add, mask, mul, zero_mask; qmul_vec = __msa_fill_h(qmul); qadd_vec = __msa_fill_h(qadd); for (cnt = 0; cnt < (n_coeffs >> 3); cnt++) { block_vec = LD_SH(block_dup + loop_start); mask = __msa_clti_s_h(block_vec, 0); zero_mask = __msa_ceqi_h(block_vec, 0); mul = block_vec * qmul_vec; sub = mul - qadd_vec; add = mul + qadd_vec; add = (v8i16) __msa_bmnz_v((v16u8) add, (v16u8) sub, (v16u8) mask); block_vec = (v8i16) __msa_bmnz_v((v16u8) add, (v16u8) block_vec, (v16u8) zero_mask); ST_SH(block_vec, block_dup + loop_start); block_dup += 8; } cnt = ((n_coeffs >> 3) * 8) + loop_start; for (; cnt <= n_coeffs; cnt++) { level = block[cnt]; if (level) { if (level < 0) { level = level * qmul - qadd; } else { level = level * qmul + qadd; } block[cnt] = level; } } } static int32_t mpeg2_dct_unquantize_inter_msa(int16_t *block, int32_t qscale, const int16_t *quant_matrix) { int32_t cnt, sum_res = -1; v8i16 block_vec, block_neg, qscale_vec, mask; v8i16 block_org0, block_org1, block_org2, block_org3; v8i16 quant_m0, quant_m1, quant_m2, quant_m3; v8i16 sum, mul, zero_mask; v4i32 mul_vec, qscale_l, qscale_r, quant_m_r, quant_m_l; v4i32 block_l, block_r, sad; qscale_vec = __msa_fill_h(qscale); for (cnt = 0; cnt < 2; cnt++) { LD_SH4(block, 8, block_org0, block_org1, block_org2, block_org3); LD_SH4(quant_matrix, 8, quant_m0, quant_m1, quant_m2, quant_m3); mask = __msa_clti_s_h(block_org0, 0); zero_mask = __msa_ceqi_h(block_org0, 0); block_neg = -block_org0; block_vec = (v8i16) __msa_bmnz_v((v16u8) block_org0, (v16u8) block_neg, (v16u8) mask); block_vec <<= 1; block_vec += 1; UNPCK_SH_SW(block_vec, block_r, block_l); UNPCK_SH_SW(qscale_vec, qscale_r, qscale_l); UNPCK_SH_SW(quant_m0, quant_m_r, quant_m_l); mul_vec = block_l * qscale_l; mul_vec *= quant_m_l; block_l = mul_vec >> 4; mul_vec = block_r * qscale_r; mul_vec *= quant_m_r; block_r = mul_vec >> 4; mul = (v8i16) __msa_pckev_h((v8i16) block_l, (v8i16) block_r); block_neg = - mul; sum = (v8i16) __msa_bmnz_v((v16u8) mul, (v16u8) block_neg, (v16u8) mask); sum = (v8i16) __msa_bmnz_v((v16u8) sum, (v16u8) block_org0, (v16u8) zero_mask); ST_SH(sum, block); block += 8; quant_matrix += 8; sad = __msa_hadd_s_w(sum, sum); sum_res += HADD_SW_S32(sad); mask = __msa_clti_s_h(block_org1, 0); zero_mask = __msa_ceqi_h(block_org1, 0); block_neg = - block_org1; block_vec = (v8i16) __msa_bmnz_v((v16u8) block_org1, (v16u8) block_neg, (v16u8) mask); block_vec <<= 1; block_vec += 1; UNPCK_SH_SW(block_vec, block_r, block_l); UNPCK_SH_SW(qscale_vec, qscale_r, qscale_l); UNPCK_SH_SW(quant_m1, quant_m_r, quant_m_l); mul_vec = block_l * qscale_l; mul_vec *= quant_m_l; block_l = mul_vec >> 4; mul_vec = block_r * qscale_r; mul_vec *= quant_m_r; block_r = mul_vec >> 4; mul = __msa_pckev_h((v8i16) block_l, (v8i16) block_r); block_neg = - mul; sum = (v8i16) __msa_bmnz_v((v16u8) mul, (v16u8) block_neg, (v16u8) mask); sum = (v8i16) __msa_bmnz_v((v16u8) sum, (v16u8) block_org1, (v16u8) zero_mask); ST_SH(sum, block); block += 8; quant_matrix += 8; sad = __msa_hadd_s_w(sum, sum); sum_res += HADD_SW_S32(sad); mask = __msa_clti_s_h(block_org2, 0); zero_mask = __msa_ceqi_h(block_org2, 0); block_neg = - block_org2; block_vec = (v8i16) __msa_bmnz_v((v16u8) block_org2, (v16u8) block_neg, (v16u8) mask); block_vec <<= 1; block_vec += 1; UNPCK_SH_SW(block_vec, block_r, block_l); UNPCK_SH_SW(qscale_vec, qscale_r, qscale_l); UNPCK_SH_SW(quant_m2, quant_m_r, quant_m_l); mul_vec = block_l * qscale_l; mul_vec *= quant_m_l; block_l = mul_vec >> 4; mul_vec = block_r * qscale_r; mul_vec *= quant_m_r; block_r = mul_vec >> 4; mul = __msa_pckev_h((v8i16) block_l, (v8i16) block_r); block_neg = - mul; sum = (v8i16) __msa_bmnz_v((v16u8) mul, (v16u8) block_neg, (v16u8) mask); sum = (v8i16) __msa_bmnz_v((v16u8) sum, (v16u8) block_org2, (v16u8) zero_mask); ST_SH(sum, block); block += 8; quant_matrix += 8; sad = __msa_hadd_s_w(sum, sum); sum_res += HADD_SW_S32(sad); mask = __msa_clti_s_h(block_org3, 0); zero_mask = __msa_ceqi_h(block_org3, 0); block_neg = - block_org3; block_vec = (v8i16) __msa_bmnz_v((v16u8) block_org3, (v16u8) block_neg, (v16u8) mask); block_vec <<= 1; block_vec += 1; UNPCK_SH_SW(block_vec, block_r, block_l); UNPCK_SH_SW(qscale_vec, qscale_r, qscale_l); UNPCK_SH_SW(quant_m3, quant_m_r, quant_m_l); mul_vec = block_l * qscale_l; mul_vec *= quant_m_l; block_l = mul_vec >> 4; mul_vec = block_r * qscale_r; mul_vec *= quant_m_r; block_r = mul_vec >> 4; mul = __msa_pckev_h((v8i16) block_l, (v8i16) block_r); block_neg = - mul; sum = (v8i16) __msa_bmnz_v((v16u8) mul, (v16u8) block_neg, (v16u8) mask); sum = (v8i16) __msa_bmnz_v((v16u8) sum, (v16u8) block_org3, (v16u8) zero_mask); ST_SH(sum, block); block += 8; quant_matrix += 8; sad = __msa_hadd_s_w(sum, sum); sum_res += HADD_SW_S32(sad); } return sum_res; } void ff_dct_unquantize_h263_intra_msa(MpegEncContext *s, int16_t *block, int32_t index, int32_t qscale) { int32_t qmul, qadd; int32_t nCoeffs; av_assert2(s->block_last_index[index] >= 0 || s->h263_aic); qmul = qscale << 1; if (!s->h263_aic) { block[0] *= index < 4 ? s->y_dc_scale : s->c_dc_scale; qadd = (qscale - 1) | 1; } else { qadd = 0; } if (s->ac_pred) nCoeffs = 63; else nCoeffs = s->inter_scantable.raster_end[s->block_last_index[index]]; h263_dct_unquantize_msa(block, qmul, qadd, nCoeffs, 1); } void ff_dct_unquantize_h263_inter_msa(MpegEncContext *s, int16_t *block, int32_t index, int32_t qscale) { int32_t qmul, qadd; int32_t nCoeffs; av_assert2(s->block_last_index[index] >= 0); qadd = (qscale - 1) | 1; qmul = qscale << 1; nCoeffs = s->inter_scantable.raster_end[s->block_last_index[index]]; h263_dct_unquantize_msa(block, qmul, qadd, nCoeffs, 0); } void ff_dct_unquantize_mpeg2_inter_msa(MpegEncContext *s, int16_t *block, int32_t index, int32_t qscale) { const uint16_t *quant_matrix; int32_t sum = -1; quant_matrix = s->inter_matrix; sum = mpeg2_dct_unquantize_inter_msa(block, qscale, quant_matrix); block[63] ^= sum & 1; }
{'repo_name': 'mabeijianxi/small-video-record', 'stars': '3214', 'repo_language': 'C', 'file_name': '2.x_en_using_help.md', 'mime_type': 'text/plain', 'hash': -4852285857074603550, 'source_dataset': 'data'}
/*=========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * */ #ifndef BAM_LOAD_SEQUENCE_WRITER_H_ #define BAM_LOAD_SEQUENCE_WRITER_H_ 1 #include <vdb/manager.h> #include <vdb/database.h> #include <vdb/table.h> #include <vdb/cursor.h> #include <klib/text.h> #include <klib/data-buffer.h> struct TableWriterSeq; typedef struct s_sequence_record { char *seq; uint8_t *qual; uint32_t *readStart; uint32_t *readLen; uint8_t *orientation; uint8_t *is_bad; uint8_t *alignmentCount; char const *spotGroup; char const *linkageGroup; bool *aligned; char *cskey; uint64_t *ti; uint64_t keyId; unsigned spotGroupLen; unsigned linkageGroupLen; unsigned numreads; } SequenceRecord; typedef struct s_sequence_record_storage { uint64_t ti[2]; uint32_t readStart[2]; uint32_t readLen[2]; uint8_t orientation[2]; uint8_t is_bad[2]; uint8_t alignmentCount[2]; bool aligned[2]; char cskey[2]; } SequenceRecordStorage; typedef struct s_sequence { VDatabase *db; struct TableWriterSeq const *tbl; } Sequence; Sequence *SequenceInit(Sequence *self, VDatabase *db); rc_t SequenceWriteRecord(Sequence *self, SequenceRecord const *rec, bool color, bool isDup, INSDC_SRA_platform_id platform); rc_t SequenceDoneWriting(Sequence *self); rc_t SequenceReadKey(const Sequence *self, int64_t row, uint64_t *key); rc_t SequenceUpdateAlignData(Sequence *self, int64_t row, unsigned nreads, const int64_t primeId[/* nreads */], const uint8_t alignCount[/* nreads */]); void SequenceWhack(Sequence *self, bool commit); #endif /* ndef BAM_LOAD_SEQUENCE_WRITER_H_ */
{'repo_name': 'ncbi/sra-tools', 'stars': '436', 'repo_language': 'C', 'file_name': 'Makefile', 'mime_type': 'text/plain', 'hash': 9041216649757246292, 'source_dataset': 'data'}
package org.domeos.framework.api.consolemodel.monitor; import java.util.List; import java.util.Map; import java.util.TreeMap; /** * Created by baokangwang on 2016/3/7. */ public class MonitorResult { private String targetType; private int interval; private String dataSpec; private Map<String, List<Map<String, Double>>> counterResults; public MonitorResult() { counterResults = new TreeMap<>(); } public MonitorResult(String targetType, int interval, String dataSpec, Map<String, List<Map<String, Double>>> counterResults) { this.targetType = targetType; this.interval = interval; this.dataSpec = dataSpec; this.counterResults = counterResults; } public String getTargetType() { return targetType; } public void setTargetType(String targetType) { this.targetType = targetType; } public int getInterval() { return interval; } public void setInterval(int interval) { this.interval = interval; } public String getDataSpec() { return dataSpec; } public void setDataSpec(String dataSpec) { this.dataSpec = dataSpec; } public Map<String, List<Map<String, Double>>> getCounterResults() { return counterResults; } public void setCounterResults(Map<String, List<Map<String, Double>>> counterResults) { this.counterResults = counterResults; } }
{'repo_name': 'domeos/server', 'stars': '265', 'repo_language': 'Java', 'file_name': 'login.html', 'mime_type': 'text/html', 'hash': -4213777834917920597, 'source_dataset': 'data'}
/** * External Dependencies */ import 'url-polyfill'; import { isEqual, pick } from 'lodash'; import queryString from 'query-string'; /** * WordPress dependencies */ import { BlockControls, BlockIcon, InnerBlocks, InspectorControls } from '@wordpress/block-editor'; import { Button, ExternalLink, Notice, PanelBody, Placeholder, Spinner, ToggleControl, Toolbar, withNotices, } from '@wordpress/components'; import { useEffect, useState } from '@wordpress/element'; import { __, _x } from '@wordpress/i18n'; import { getBlockDefaultClassName } from '@wordpress/blocks'; import { select, dispatch } from '@wordpress/data'; /** * Internal dependencies */ import './editor.scss'; import './view.scss'; import icon from './icon'; import attributeDetails from './attributes'; import { getValidatedAttributes } from '../../shared/get-validated-attributes'; import { getAttributesFromEmbedCode } from './utils'; import BlockStylesSelector from '../../shared/components/block-styles-selector'; import { CALENDLY_EXAMPLE_URL, innerButtonBlock } from './'; import testEmbedUrl from '../../shared/test-embed-url'; function CalendlyEdit( props ) { const { attributes, className, clientId, name, noticeOperations, noticeUI, setAttributes, } = props; const defaultClassName = getBlockDefaultClassName( name ); const validatedAttributes = getValidatedAttributes( attributeDetails, attributes ); if ( ! isEqual( validatedAttributes, attributes ) ) { setAttributes( validatedAttributes ); } const { backgroundColor, submitButtonText, hideEventTypeDetails, primaryColor, textColor, style, url, } = validatedAttributes; const [ embedCode, setEmbedCode ] = useState( url ); const [ isEditingUrl, setIsEditingUrl ] = useState( false ); const [ isResolvingUrl, setIsResolvingUrl ] = useState( false ); const [ embedButtonAttributes, setEmbedButtonAttributes ] = useState( {} ); const setErrorNotice = () => { noticeOperations.removeAllNotices(); noticeOperations.createErrorNotice( __( "Your calendar couldn't be embedded. Please double check your URL or code.", 'jetpack' ) ); }; useEffect( () => { if ( ! url || CALENDLY_EXAMPLE_URL === url || 'link' === style ) { return; } testEmbedUrl( url, setIsResolvingUrl ).catch( () => { setAttributes( { url: undefined } ); setErrorNotice(); } ); }, [] ); const parseEmbedCode = event => { if ( ! event ) { setErrorNotice(); return; } event.preventDefault(); const newAttributes = getAttributesFromEmbedCode( embedCode ); if ( ! newAttributes ) { setErrorNotice(); return; } if ( newAttributes.buttonAttributes && 'link' === newAttributes.style ) { const innerButtons = select( 'core/editor' ).getBlocksByClientId( clientId ); if ( innerButtons.length ) { innerButtons[ 0 ].innerBlocks.forEach( block => { dispatch( 'core/editor' ).updateBlockAttributes( block.clientId, newAttributes.buttonAttributes ); } ); } setEmbedButtonAttributes( newAttributes.buttonAttributes ); } testEmbedUrl( newAttributes.url, setIsResolvingUrl ) .then( () => { const newValidatedAttributes = getValidatedAttributes( attributeDetails, newAttributes ); setAttributes( newValidatedAttributes ); setIsEditingUrl( false ); noticeOperations.removeAllNotices(); } ) .catch( () => { setAttributes( { url: undefined } ); setErrorNotice(); } ); }; const embedCodeForm = ( <> <form onSubmit={ parseEmbedCode }> <input type="text" id="embedCode" onChange={ event => setEmbedCode( event.target.value ) } placeholder={ __( 'Calendly web address or embed code…', 'jetpack' ) } value={ embedCode } className="components-placeholder__input" /> <div> <Button isSecondary isLarge type="submit"> { _x( 'Embed', 'button label', 'jetpack' ) } </Button> </div> </form> <div className={ `${ defaultClassName }-learn-more` }> <ExternalLink href="https://help.calendly.com/hc/en-us/articles/223147027-Embed-options-overview"> { __( 'Need help finding your embed code?', 'jetpack' ) } </ExternalLink> </div> </> ); const blockEmbedding = ( <div className="wp-block-embed is-loading"> <Spinner /> <p>{ __( 'Embedding…', 'jetpack' ) }</p> </div> ); const blockPlaceholder = ( <Placeholder label={ __( 'Calendly', 'jetpack' ) } instructions={ __( 'Enter your Calendly web address or embed code below.', 'jetpack' ) } icon={ <BlockIcon icon={ icon } /> } notices={ noticeUI } > { embedCodeForm } </Placeholder> ); const iframeSrc = () => { const query = queryString.stringify( { embed_domain: 'wordpress.com', embed_type: 'Inline', hide_event_type_details: hideEventTypeDetails ? 1 : 0, background_color: backgroundColor, primary_color: primaryColor, text_color: textColor, } ); return `${ url }?${ query }`; }; const inlinePreview = ( <> <div className={ `${ defaultClassName }-overlay` }></div> <iframe src={ iframeSrc() } width="100%" height="100%" frameBorder="0" data-origwidth="100%" data-origheight="100%" title="Calendly" ></iframe> </> ); const buttonPreview = ( <InnerBlocks template={ [ [ innerButtonBlock.name, { ...innerButtonBlock.attributes, ...embedButtonAttributes, passthroughAttributes: { url: 'url' }, }, ], ] } templateLock="all" /> ); const linkPreview = ( <> <a style={ { alignSelf: 'flex-start', border: 'none' } } className="wp-block-button__link"> { submitButtonText } </a> </> ); const blockPreview = ( previewStyle, disabled ) => { if ( previewStyle === 'inline' ) { return inlinePreview; } if ( disabled ) { return linkPreview; } return buttonPreview; }; const styleOptions = [ { value: 'inline', label: __( 'Inline', 'jetpack' ) }, { value: 'link', label: __( 'Link', 'jetpack' ) }, ]; const inspectorControls = ( <> { url && ! isEditingUrl && ( <BlockControls> <Toolbar> <Button onClick={ () => setIsEditingUrl( true ) }>{ __( 'Edit', 'jetpack' ) }</Button> </Toolbar> </BlockControls> ) } { url && ( <BlockStylesSelector clientId={ clientId } styleOptions={ styleOptions } onSelectStyle={ setAttributes } activeStyle={ style } attributes={ attributes } viewportWidth={ 500 } /> ) } <InspectorControls> <PanelBody title={ __( 'Calendar Settings', 'jetpack' ) } initialOpen={ false }> <form onSubmit={ parseEmbedCode } className={ `${ defaultClassName }-embed-form-sidebar` } > <input type="text" id="embedCode" onChange={ event => setEmbedCode( event.target.value ) } placeholder={ __( 'Calendly web address or embed code…', 'jetpack' ) } value={ embedCode } className="components-placeholder__input" /> <div> <Button isSecondary isLarge type="submit"> { _x( 'Embed', 'button label', 'jetpack' ) } </Button> </div> </form> <ToggleControl label={ __( 'Hide Event Type Details', 'jetpack' ) } checked={ hideEventTypeDetails } onChange={ () => setAttributes( { hideEventTypeDetails: ! hideEventTypeDetails } ) } /> </PanelBody> { url && ( <Notice className={ `${ defaultClassName }-color-notice` } isDismissible={ false }> <ExternalLink href="https://help.calendly.com/hc/en-us/community/posts/360033166114-Embed-Widget-Color-Customization-Available-Now-"> { __( 'Follow these instructions to change the colors in this block.', 'jetpack' ) } </ExternalLink> </Notice> ) } </InspectorControls> </> ); if ( isResolvingUrl ) { return blockEmbedding; } const classes = `${ className } calendly-style-${ style }`; return ( <div className={ classes }> { inspectorControls } { url && ! isEditingUrl ? blockPreview( style ) : blockPlaceholder } </div> ); } export default withNotices( CalendlyEdit );
{'repo_name': 'Automattic/jetpack', 'stars': '1211', 'repo_language': 'PHP', 'file_name': 'must-connect-main-blog.php', 'mime_type': 'text/html', 'hash': 4170176784632954668, 'source_dataset': 'data'}
/* * 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. */ /* * This code was generated by https://github.com/googleapis/google-api-java-client-services/ * Modify at your own risk. */ package com.google.api.services.vision.v1.model; /** * Logical element on the page. * * <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is * transmitted over HTTP when working with the Cloud Vision API. For a detailed explanation see: * <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a> * </p> * * @author Google, Inc. */ @SuppressWarnings("javadoc") public final class GoogleCloudVisionV1p1beta1Block extends com.google.api.client.json.GenericJson { /** * Detected block type (text, image etc) for this block. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.String blockType; /** * The bounding box for the block. The vertices are in the order of top-left, top-right, bottom- * right, bottom-left. When a rotation of the bounding box is detected the rotation is represented * as around the top-left corner as defined when the text is read in the 'natural' orientation. * For example: * * * when the text is horizontal it might look like: * * 0----1 | | 3----2 * * * when it's rotated 180 degrees around the top-left corner it becomes: * * 2----3 | | 1----0 * * and the vertex order will still be (0, 1, 2, 3). * The value may be {@code null}. */ @com.google.api.client.util.Key private GoogleCloudVisionV1p1beta1BoundingPoly boundingBox; /** * Confidence of the OCR results on the block. Range [0, 1]. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.Float confidence; /** * List of paragraphs in this block (if this blocks is of type text). * The value may be {@code null}. */ @com.google.api.client.util.Key private java.util.List<GoogleCloudVisionV1p1beta1Paragraph> paragraphs; /** * Additional information detected for the block. * The value may be {@code null}. */ @com.google.api.client.util.Key private GoogleCloudVisionV1p1beta1TextAnnotationTextProperty property; /** * Detected block type (text, image etc) for this block. * @return value or {@code null} for none */ public java.lang.String getBlockType() { return blockType; } /** * Detected block type (text, image etc) for this block. * @param blockType blockType or {@code null} for none */ public GoogleCloudVisionV1p1beta1Block setBlockType(java.lang.String blockType) { this.blockType = blockType; return this; } /** * The bounding box for the block. The vertices are in the order of top-left, top-right, bottom- * right, bottom-left. When a rotation of the bounding box is detected the rotation is represented * as around the top-left corner as defined when the text is read in the 'natural' orientation. * For example: * * * when the text is horizontal it might look like: * * 0----1 | | 3----2 * * * when it's rotated 180 degrees around the top-left corner it becomes: * * 2----3 | | 1----0 * * and the vertex order will still be (0, 1, 2, 3). * @return value or {@code null} for none */ public GoogleCloudVisionV1p1beta1BoundingPoly getBoundingBox() { return boundingBox; } /** * The bounding box for the block. The vertices are in the order of top-left, top-right, bottom- * right, bottom-left. When a rotation of the bounding box is detected the rotation is represented * as around the top-left corner as defined when the text is read in the 'natural' orientation. * For example: * * * when the text is horizontal it might look like: * * 0----1 | | 3----2 * * * when it's rotated 180 degrees around the top-left corner it becomes: * * 2----3 | | 1----0 * * and the vertex order will still be (0, 1, 2, 3). * @param boundingBox boundingBox or {@code null} for none */ public GoogleCloudVisionV1p1beta1Block setBoundingBox(GoogleCloudVisionV1p1beta1BoundingPoly boundingBox) { this.boundingBox = boundingBox; return this; } /** * Confidence of the OCR results on the block. Range [0, 1]. * @return value or {@code null} for none */ public java.lang.Float getConfidence() { return confidence; } /** * Confidence of the OCR results on the block. Range [0, 1]. * @param confidence confidence or {@code null} for none */ public GoogleCloudVisionV1p1beta1Block setConfidence(java.lang.Float confidence) { this.confidence = confidence; return this; } /** * List of paragraphs in this block (if this blocks is of type text). * @return value or {@code null} for none */ public java.util.List<GoogleCloudVisionV1p1beta1Paragraph> getParagraphs() { return paragraphs; } /** * List of paragraphs in this block (if this blocks is of type text). * @param paragraphs paragraphs or {@code null} for none */ public GoogleCloudVisionV1p1beta1Block setParagraphs(java.util.List<GoogleCloudVisionV1p1beta1Paragraph> paragraphs) { this.paragraphs = paragraphs; return this; } /** * Additional information detected for the block. * @return value or {@code null} for none */ public GoogleCloudVisionV1p1beta1TextAnnotationTextProperty getProperty() { return property; } /** * Additional information detected for the block. * @param property property or {@code null} for none */ public GoogleCloudVisionV1p1beta1Block setProperty(GoogleCloudVisionV1p1beta1TextAnnotationTextProperty property) { this.property = property; return this; } @Override public GoogleCloudVisionV1p1beta1Block set(String fieldName, Object value) { return (GoogleCloudVisionV1p1beta1Block) super.set(fieldName, value); } @Override public GoogleCloudVisionV1p1beta1Block clone() { return (GoogleCloudVisionV1p1beta1Block) super.clone(); } }
{'repo_name': 'googleapis/google-api-java-client-services', 'stars': '127', 'repo_language': 'Java', 'file_name': 'RemoteBuildExecution.java', 'mime_type': 'text/html', 'hash': -5940440509815258676, 'source_dataset': 'data'}
#include "driver.h" #include "cpuintrf.h" #include "state.h" #include "armnecintrf.h" #include "armnec.h" #define VEZ_MEM_SHIFT 11 #define VEZ_PAGE_COUNT (1 << (20 - VEZ_MEM_SHIFT)) /* structure definition */ typedef struct { struct ArmNec regs; /* ArmNec structure */ UINT32 int_vector; /* interrupt vector (not used) */ UINT32 pending_irq; /* pending irq */ UINT32 nmi_state; /* NMI state */ UINT32 irq_state; /* IRQ state */ int (*irq_callback)(int irqline); /* MAME IRQ callback */ unsigned char * ppMemRead[VEZ_PAGE_COUNT]; unsigned char * ppMemWrite[VEZ_PAGE_COUNT]; } armnec_regs; /* static structure */ static armnec_regs ARMNEC; /* cycles */ int *armnec_cycles=&ARMNEC.regs.cycles; /* interrupt types */ #define INT_IRQ 0x01 #define NMI_IRQ 0x02 /* ArmNec required functions */ static int armnec_UnrecognizedCallback(unsigned int a) { return 0; } static unsigned int armnec_read8(unsigned int Addr) { return ((cpu_readmem20(Addr))&0xff); } static unsigned int armnec_read16(unsigned int Addr) { return (((cpu_readmem20(Addr))&0xff)|((cpu_readmem20(Addr+1)&0xff)<<8)); } static void armnec_write8(unsigned int Addr,unsigned int Value) { cpu_writemem20(Addr,Value); } static void armnec_write16(unsigned int Addr,unsigned int Value) { cpu_writemem20(Addr,(unsigned char)Value&0xff); cpu_writemem20(Addr+1,((unsigned char)(Value>>8))&0xff); } static unsigned int armnec_in8(unsigned int Addr) { return ((cpu_readport(Addr))&0xff); } static void armnec_out8(unsigned int Addr, unsigned int Value) { cpu_writeport(Addr,Value); } static unsigned int armnec_checkpc(unsigned int ps, unsigned int ip) { change_pc20((ps << 4) + ip); ARMNEC.regs.mem_base=(unsigned int) OP_ROM; ARMNEC.regs.pc=ARMNEC.regs.mem_base + ((ps << 4) + ip); return (ARMNEC.regs.pc); } #define CHECK_PC armnec_checkpc(ARMNEC.regs.sreg[1], ARMNEC.regs.ip) /* NEC required functions */ void armnec_init(void) { } void armnec_set_irq_callback(int (*callback)(int irqline)) { ARMNEC.irq_callback = callback; } unsigned armnec_dasm(char *buffer, unsigned pc) { sprintf( buffer, "$%02X", cpu_readop(pc) ); return 1; } void armnec_exit(void) { } void armnec_reset(void *param) { memset(&ARMNEC,0,sizeof(armnec_regs)); ARMNEC.regs.read8 = armnec_read8; ARMNEC.regs.read16 = armnec_read16; ARMNEC.regs.write8 = armnec_write8; ARMNEC.regs.write16 = armnec_write16; ARMNEC.regs.in8 = armnec_in8; ARMNEC.regs.out8 = armnec_out8; ARMNEC.regs.checkpc = armnec_checkpc; ARMNEC.regs.UnrecognizedCallback = armnec_UnrecognizedCallback; ARMNEC.regs.ReadMemMap=ARMNEC.ppMemRead; ARMNEC.regs.WriteMemMap=ARMNEC.ppMemRead; ARMNEC.regs.sreg[1] = 0xffff; ARMNEC.regs.flags = 0x8000; // MF CHECK_PC; } unsigned armnec_get_context(void *dst) { if (dst) memcpy (dst,&ARMNEC,sizeof (armnec_regs)); return sizeof(armnec_regs); } void armnec_set_context(void *src) { if (src) memcpy (&ARMNEC, src, sizeof (armnec_regs)); CHECK_PC; } unsigned armnec_get_pc(void) { return ((ARMNEC.regs.sreg[1] << 4) + ARMNEC.regs.ip); } void armnec_set_pc(unsigned val) { if( val - (ARMNEC.regs.sreg[1]<<4) < 0x10000 ) { ARMNEC.regs.ip = val - (ARMNEC.regs.sreg[1]); } else { ARMNEC.regs.sreg[1] = val >> 4; ARMNEC.regs.ip = val & 0x0000f; } CHECK_PC; } unsigned armnec_get_sp(void) { unsigned short *regs=(unsigned short *)ARMNEC.regs.reg; return (ARMNEC.regs.sreg[2]<<4) + regs[4]; } void armnec_set_sp(unsigned val) { unsigned short *regs=(unsigned short *)ARMNEC.regs.reg; if( val - (ARMNEC.regs.sreg[2]<<4) < 0x10000 ) { regs[4] = val - (ARMNEC.regs.sreg[2]<<4); } else { ARMNEC.regs.sreg[2] = val >> 4; regs[4] = val & 0x0000f; } } unsigned armnec_get_reg(int regnum) { unsigned short *regs=(unsigned short *)ARMNEC.regs.reg; switch( regnum ) { case ARMNEC_IP: return ARMNEC.regs.ip; case ARMNEC_FLAGS: return ARMNEC.regs.flags; case ARMNEC_AW: return regs[0]; case ARMNEC_CW: return regs[1]; case ARMNEC_DW: return regs[2]; case ARMNEC_BW: return regs[3]; case ARMNEC_SP: return regs[4]; case ARMNEC_BP: return regs[5]; case ARMNEC_IX: return regs[6]; case ARMNEC_IY: return regs[7]; case ARMNEC_ES: return ARMNEC.regs.sreg[0]; case ARMNEC_CS: return ARMNEC.regs.sreg[1]; case ARMNEC_SS: return ARMNEC.regs.sreg[2]; case ARMNEC_DS: return ARMNEC.regs.sreg[3]; case ARMNEC_VECTOR: return ARMNEC.int_vector; case ARMNEC_PENDING: return ARMNEC.pending_irq; case ARMNEC_NMI_STATE: return ARMNEC.nmi_state; case ARMNEC_IRQ_STATE: return ARMNEC.irq_state; case REG_PREVIOUSPC: return 0; /* not supported */ default: if( regnum <= REG_SP_CONTENTS ) { unsigned offset = armnec_get_sp() + 2 * (REG_SP_CONTENTS - regnum); return cpu_readmem20( offset ) | ( cpu_readmem20( offset + 1) << 8 ); } } return 0; } void armnec_set_reg(int regnum, unsigned val) { unsigned short *regs=(unsigned short *)ARMNEC.regs.reg; switch( regnum ) { case ARMNEC_IP: ARMNEC.regs.ip = val; break; case ARMNEC_FLAGS: ARMNEC.regs.flags = val; break; case ARMNEC_AW: regs[0] = val; break; case ARMNEC_CW: regs[1] = val; break; case ARMNEC_DW: regs[2] = val; break; case ARMNEC_BW: regs[3] = val; break; case ARMNEC_SP: regs[4] = val; break; case ARMNEC_BP: regs[5] = val; break; case ARMNEC_IX: regs[6] = val; break; case ARMNEC_IY: regs[7] = val; break; case ARMNEC_ES: ARMNEC.regs.sreg[0] = val; break; case ARMNEC_CS: ARMNEC.regs.sreg[1] = val; break; case ARMNEC_SS: ARMNEC.regs.sreg[2] = val; break; case ARMNEC_DS: ARMNEC.regs.sreg[3] = val; break; case ARMNEC_VECTOR: ARMNEC.int_vector = val; break; case ARMNEC_PENDING: ARMNEC.pending_irq = val; break; case ARMNEC_NMI_STATE: armnec_set_nmi_line(val); break; case ARMNEC_IRQ_STATE: armnec_set_irq_line(0,val); break; default: if( regnum <= REG_SP_CONTENTS ) { unsigned offset = armnec_get_sp() + 2 * (REG_SP_CONTENTS - regnum); cpu_writemem20( offset, val & 0xff ); cpu_writemem20( offset+1, (val >> 8) & 0xff ); } } } void armnec_set_nmi_line(int state) { if( ARMNEC.nmi_state == state ) return; ARMNEC.nmi_state = state; if (state != CLEAR_LINE) { ARMNEC.pending_irq |= NMI_IRQ; } } void armnec_set_irq_line(int irqline, int state) { ARMNEC.irq_state = state; if (state == CLEAR_LINE) { if (!(ARMNEC.regs.flags & 0x0200)) ARMNEC.pending_irq &= ~INT_IRQ; } else { if (ARMNEC.regs.flags & 0x0200) ARMNEC.pending_irq |= INT_IRQ; } } static void armv30_interrupt(void) { if( ARMNEC.pending_irq & NMI_IRQ ) { ArmV30Irq(&ARMNEC.regs, ARMNEC_NMI_INT); CHECK_PC; ARMNEC.pending_irq &= ~NMI_IRQ; } else if( ARMNEC.pending_irq ) { ArmV30Irq(&ARMNEC.regs,(*ARMNEC.irq_callback)(0)); CHECK_PC; ARMNEC.irq_state = CLEAR_LINE; ARMNEC.pending_irq &= ~INT_IRQ; } } static void armv33_interrupt(void) { if( ARMNEC.pending_irq & NMI_IRQ ) { ArmV33Irq(&ARMNEC.regs, ARMNEC_NMI_INT); CHECK_PC; ARMNEC.pending_irq &= ~NMI_IRQ; } else if( ARMNEC.pending_irq ) { ArmV33Irq(&ARMNEC.regs,(*ARMNEC.irq_callback)(0)); CHECK_PC; ARMNEC.irq_state = CLEAR_LINE; ARMNEC.pending_irq &= ~INT_IRQ; } } int armv30_execute(int cycles) { int exec=0; ARMNEC.regs.cycles = cycles; if (ARMNEC.pending_irq) armv30_interrupt(); exec=ArmV30Run(&ARMNEC.regs); CHECK_PC; return (cycles-exec); } int armv33_execute(int cycles) { int exec=0; ARMNEC.regs.cycles = cycles; if (ARMNEC.pending_irq) armv33_interrupt(); exec=ArmV33Run(&ARMNEC.regs); CHECK_PC; return (cycles-exec); } const char *armv30_info(void *context, int regnum) { switch( regnum ) { case CPU_INFO_NAME: return "ArmNec V30"; case CPU_INFO_FAMILY: return "NEC V-Series"; case CPU_INFO_VERSION: return "1.0"; case CPU_INFO_FILE: return __FILE__; case CPU_INFO_CREDITS: return "ArmNec emulator by Oopsware"; } return ""; } const char *armv33_info(void *context, int regnum) { switch( regnum ) { case CPU_INFO_NAME: return "ArmNec V33"; case CPU_INFO_FAMILY: return "NEC V-Series"; case CPU_INFO_VERSION: return "1.0"; case CPU_INFO_FILE: return __FILE__; case CPU_INFO_CREDITS: return "ArmNec emulator by Oopsware"; } return ""; }
{'repo_name': 'kevsmithpublic/MameAppleTV', 'stars': '223', 'repo_language': 'C++', 'file_name': 'Main.storyboard', 'mime_type': 'text/xml', 'hash': 7880210461247502857, 'source_dataset': 'data'}
<!doctype html> <title>CodeMirror: Closure Stylesheets (GSS) mode</title> <meta charset="utf-8"/> <link rel=stylesheet href="../../doc/docs.css"> <link rel="stylesheet" href="../../lib/codemirror.css"> <link rel="stylesheet" href="../../addon/hint/show-hint.css"> <script src="../../lib/codemirror.js"></script> <script src="css.js"></script> <script src="../../addon/edit/matchbrackets.js"></script> <script src="../../addon/hint/show-hint.js"></script> <script src="../../addon/hint/css-hint.js"></script> <style>.CodeMirror {background: #f8f8f8;}</style> <div id=nav> <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> <ul> <li><a href="../../index.html">Home</a> <li><a href="../../doc/manual.html">Manual</a> <li><a href="https://github.com/codemirror/codemirror">Code</a> </ul> <ul> <li><a href="../index.html">Language modes</a> <li><a class=active href="#">Closure Stylesheets (GSS)</a> </ul> </div> <article> <h2>Closure Stylesheets (GSS) mode</h2> <form><textarea id="code" name="code"> /* Some example Closure Stylesheets */ @provide 'some.styles'; @require 'other.styles'; @component { @def FONT_FAMILY "Times New Roman", Georgia, Serif; @def FONT_SIZE_NORMAL 15px; @def FONT_NORMAL normal FONT_SIZE_NORMAL FONT_FAMILY; @def BG_COLOR rgb(235, 239, 249); @def DIALOG_BORDER_COLOR rgb(107, 144, 218); @def DIALOG_BG_COLOR BG_COLOR; @def LEFT_HAND_NAV_WIDTH 180px; @def LEFT_HAND_NAV_PADDING 3px; @defmixin size(WIDTH, HEIGHT) { width: WIDTH; height: HEIGHT; } body { background-color: BG_COLOR; margin: 0; padding: 3em 6em; font: FONT_NORMAL; color: #000; } #navigation a { font-weight: bold; text-decoration: none !important; } .dialog { background-color: DIALOG_BG_COLOR; border: 1px solid DIALOG_BORDER_COLOR; } .content { position: absolute; margin-left: add(LEFT_HAND_NAV_PADDING, /* padding left */ LEFT_HAND_NAV_WIDTH, LEFT_HAND_NAV_PADDING); /* padding right */ } .logo { @mixin size(150px, 55px); background-image: url('http://www.google.com/images/logo_sm.gif'); } } </textarea></form> <script> var editor = CodeMirror.fromTextArea(document.getElementById("code"), { extraKeys: {"Ctrl-Space": "autocomplete"}, lineNumbers: true, matchBrackets: true, mode: "text/x-gss" }); </script> <p>A mode for <a href="https://github.com/google/closure-stylesheets">Closure Stylesheets</a> (GSS).</p> <p><strong>MIME type defined:</strong> <code>text/x-gss</code>.</p> <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#gss_*">normal</a>, <a href="../../test/index.html#verbose,gss_*">verbose</a>.</p> </article>
{'repo_name': 'shi-yang/jnoj', 'stars': '118', 'repo_language': 'JavaScript', 'file_name': 'detail.php', 'mime_type': 'text/x-php', 'hash': -3625982877399163506, 'source_dataset': 'data'}
{ "emname": "i064109", "namespace": "company/myscenario/ems", "options": { "management": true, "messagingrest": true, "messaging": true }, "rules": { "queueRules": { "inboundFilter": [ "${namespace}/#" ], "outboundFilter": [ "${namespace}/#" ] }, "topicRules": { "inboundFilter": [ "${namespace}/#" ], "outboundFilter": [ "${namespace}/#" ] } } }
{'repo_name': 'SAPDocuments/Tutorials', 'stars': '319', 'repo_language': 'Jupyter Notebook', 'file_name': 'tags.json', 'mime_type': 'text/plain', 'hash': 742144978845583526, 'source_dataset': 'data'}
name: "VGG16" #precision default_forward_type: __FORWARD_TYPE___ #precision default_backward_type: __BACKWARD_TYPE___ #precision default_forward_math: __FORWARD_MATH___ #precision default_backward_math: __BACKWARD_MATH___ #synthetic layer { #synthetic name: "data" #synthetic type: "Input" #synthetic top: "data" #synthetic input_param { shape: { dim: __EXP_DEVICE_BATCH__ dim: 3 dim: 224 dim: 224 } } #synthetic } #synthetic layer { #synthetic name: "label" #synthetic type: "Input" #synthetic top: "label" #synthetic input_param { shape: { dim: __EXP_DEVICE_BATCH__ dim: 1 } } #synthetic } #data layer { #data name: "data" #data type: "Data" #data top: "data" #data top: "label" #data include { #data phase: TRAIN #data } #data transform_param { #data mirror: __CAFFE_MIRROR__ #data crop_size: 224 #data mean_file: "__CAFFE_DATA_MEAN_FILE__" #data } #data data_param { #data source: "__CAFFE_DATA_DIR__" #data batch_size: __EXP_DEVICE_BATCH__ #data backend: __CAFFE_DATA_BACKEND__ #data } #data } layer { name: "conv1_1" type: "Convolution" bottom: "data" top: "conv1_1" convolution_param { num_output: 64 pad: 1 kernel_size: 3 } } layer { name: "relu1_1" type: "ReLU" bottom: "conv1_1" top: "conv1_1" } layer { name: "conv1_2" type: "Convolution" bottom: "conv1_1" top: "conv1_2" convolution_param { num_output: 64 pad: 1 kernel_size: 3 } } layer { name: "relu1_2" type: "ReLU" bottom: "conv1_2" top: "conv1_2" } layer { name: "pool1" type: "Pooling" bottom: "conv1_2" top: "pool1" pooling_param { pool: MAX kernel_size: 2 stride: 2 } } layer { name: "conv2_1" type: "Convolution" bottom: "pool1" top: "conv2_1" convolution_param { num_output: 128 pad: 1 kernel_size: 3 } } layer { name: "relu2_1" type: "ReLU" bottom: "conv2_1" top: "conv2_1" } layer { name: "conv2_2" type: "Convolution" bottom: "conv2_1" top: "conv2_2" convolution_param { num_output: 128 pad: 1 kernel_size: 3 } } layer { name: "relu2_2" type: "ReLU" bottom: "conv2_2" top: "conv2_2" } layer { name: "pool2" type: "Pooling" bottom: "conv2_2" top: "pool2" pooling_param { pool: MAX kernel_size: 2 stride: 2 } } layer { name: "conv3_1" type: "Convolution" bottom: "pool2" top: "conv3_1" convolution_param { num_output: 256 pad: 1 kernel_size: 3 } } layer { name: "relu3_1" type: "ReLU" bottom: "conv3_1" top: "conv3_1" } layer { name: "conv3_2" type: "Convolution" bottom: "conv3_1" top: "conv3_2" convolution_param { num_output: 256 pad: 1 kernel_size: 3 } } layer { name: "relu3_2" type: "ReLU" bottom: "conv3_2" top: "conv3_2" } layer { name: "conv3_3" type: "Convolution" bottom: "conv3_2" top: "conv3_3" convolution_param { num_output: 256 pad: 1 kernel_size: 3 } } layer { name: "relu3_3" type: "ReLU" bottom: "conv3_3" top: "conv3_3" } layer { name: "pool3" type: "Pooling" bottom: "conv3_3" top: "pool3" pooling_param { pool: MAX kernel_size: 2 stride: 2 } } layer { name: "conv4_1" type: "Convolution" bottom: "pool3" top: "conv4_1" convolution_param { num_output: 512 pad: 1 kernel_size: 3 } } layer { name: "relu4_1" type: "ReLU" bottom: "conv4_1" top: "conv4_1" } layer { name: "conv4_2" type: "Convolution" bottom: "conv4_1" top: "conv4_2" convolution_param { num_output: 512 pad: 1 kernel_size: 3 } } layer { name: "relu4_2" type: "ReLU" bottom: "conv4_2" top: "conv4_2" } layer { name: "conv4_3" type: "Convolution" bottom: "conv4_2" top: "conv4_3" convolution_param { num_output: 512 pad: 1 kernel_size: 3 } } layer { name: "relu4_3" type: "ReLU" bottom: "conv4_3" top: "conv4_3" } layer { name: "pool4" type: "Pooling" bottom: "conv4_3" top: "pool4" pooling_param { pool: MAX kernel_size: 2 stride: 2 } } layer { name: "conv5_1" type: "Convolution" bottom: "pool4" top: "conv5_1" convolution_param { num_output: 512 pad: 1 kernel_size: 3 } } layer { name: "relu5_1" type: "ReLU" bottom: "conv5_1" top: "conv5_1" } layer { name: "conv5_2" type: "Convolution" bottom: "conv5_1" top: "conv5_2" convolution_param { num_output: 512 pad: 1 kernel_size: 3 } } layer { name: "relu5_2" type: "ReLU" bottom: "conv5_2" top: "conv5_2" } layer { name: "conv5_3" type: "Convolution" bottom: "conv5_2" top: "conv5_3" convolution_param { num_output: 512 pad: 1 kernel_size: 3 } } layer { name: "relu5_3" type: "ReLU" bottom: "conv5_3" top: "conv5_3" } layer { name: "pool5" type: "Pooling" bottom: "conv5_3" top: "pool5" pooling_param { pool: MAX kernel_size: 2 stride: 2 } } layer { name: "fc6" type: "InnerProduct" bottom: "pool5" top: "fc6" inner_product_param { num_output: 4096 } } layer { name: "relu6" type: "ReLU" bottom: "fc6" top: "fc6" } layer { name: "drop6" type: "Dropout" bottom: "fc6" top: "fc6" dropout_param { dropout_ratio: 0.5 } } layer { name: "fc7" type: "InnerProduct" bottom: "fc6" top: "fc7" inner_product_param { num_output: 4096 } } layer { name: "relu7" type: "ReLU" bottom: "fc7" top: "fc7" } layer { name: "drop7" type: "Dropout" bottom: "fc7" top: "fc7" dropout_param { dropout_ratio: 0.5 } } layer { name: "fc8" type: "InnerProduct" bottom: "fc7" top: "fc8" inner_product_param { num_output: 1000 } } layer { name: "loss" type: "SoftmaxWithLoss" bottom: "fc8" bottom: "label" top: "loss" }
{'repo_name': 'HewlettPackard/dlcookbook-dlbs', 'stars': '105', 'repo_language': 'Python', 'file_name': 'index.rst', 'mime_type': 'text/plain', 'hash': -1597965614194574847, 'source_dataset': 'data'}
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # 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. # ============================================================================== """Contains utilities for downloading and converting datasets.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import sys import tarfile from six.moves import urllib import tensorflow as tf LABELS_FILENAME = 'labels.txt' def int64_feature(values): """Returns a TF-Feature of int64s. Args: values: A scalar or list of values. Returns: a TF-Feature. """ if not isinstance(values, (tuple, list)): values = [values] return tf.train.Feature(int64_list=tf.train.Int64List(value=values)) def bytes_feature(values): """Returns a TF-Feature of bytes. Args: values: A string. Returns: a TF-Feature. """ return tf.train.Feature(bytes_list=tf.train.BytesList(value=[values])) def image_to_tfexample(image_data, image_format, height, width, class_id): return tf.train.Example(features=tf.train.Features(feature={ 'image/encoded': bytes_feature(image_data), 'image/format': bytes_feature(image_format), 'image/class/label': int64_feature(class_id), 'image/height': int64_feature(height), 'image/width': int64_feature(width), })) def download_and_uncompress_tarball(tarball_url, dataset_dir): """Downloads the `tarball_url` and uncompresses it locally. Args: tarball_url: The URL of a tarball file. dataset_dir: The directory where the temporary files are stored. """ filename = tarball_url.split('/')[-1] filepath = os.path.join(dataset_dir, filename) def _progress(count, block_size, total_size): sys.stdout.write('\r>> Downloading %s %.1f%%' % ( filename, float(count * block_size) / float(total_size) * 100.0)) sys.stdout.flush() filepath, _ = urllib.request.urlretrieve(tarball_url, filepath, _progress) print() statinfo = os.stat(filepath) print('Successfully downloaded', filename, statinfo.st_size, 'bytes.') tarfile.open(filepath, 'r:gz').extractall(dataset_dir) def write_label_file(labels_to_class_names, dataset_dir, filename=LABELS_FILENAME): """Writes a file with the list of class names. Args: labels_to_class_names: A map of (integer) labels to class names. dataset_dir: The directory in which the labels file should be written. filename: The filename where the class names are written. """ labels_filename = os.path.join(dataset_dir, filename) with tf.gfile.Open(labels_filename, 'w') as f: for label in labels_to_class_names: class_name = labels_to_class_names[label] f.write('%d:%s\n' % (label, class_name)) def has_labels(dataset_dir, filename=LABELS_FILENAME): """Specifies whether or not the dataset directory contains a label map file. Args: dataset_dir: The directory in which the labels file is found. filename: The filename where the class names are written. Returns: `True` if the labels file exists and `False` otherwise. """ return tf.gfile.Exists(os.path.join(dataset_dir, filename)) def read_label_file(dataset_dir, filename=LABELS_FILENAME): """Reads the labels file and returns a mapping from ID to class name. Args: dataset_dir: The directory in which the labels file is found. filename: The filename where the class names are written. Returns: A map from a label (integer) to class name. """ labels_filename = os.path.join(dataset_dir, filename) with tf.gfile.Open(labels_filename, 'r') as f: lines = f.read().decode() lines = lines.split('\n') lines = filter(None, lines) labels_to_class_names = {} for line in lines: index = line.index(':') labels_to_class_names[int(line[:index])] = line[index+1:] return labels_to_class_names
{'repo_name': 'rohitgirdhar/AttentionalPoolingAction', 'stars': '232', 'repo_language': 'Python', 'file_name': 'overfeat.py', 'mime_type': 'text/x-python', 'hash': -4901216690872030604, 'source_dataset': 'data'}
package cloudauth //Licensed under the Apache License, Version 2.0 (the "License"); //you may not use this file except in compliance with the License. //You may obtain a copy of the License at // //http://www.apache.org/licenses/LICENSE-2.0 // //Unless required by applicable law or agreed to in writing, software //distributed under the License is distributed on an "AS IS" BASIS, //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //See the License for the specific language governing permissions and //limitations under the License. // // Code generated by Alibaba Cloud SDK Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. // MaterialInVerifyMaterial is a nested struct in cloudauth response type MaterialInVerifyMaterial struct { FaceImageUrl string `json:"FaceImageUrl" xml:"FaceImageUrl"` IdCardName string `json:"IdCardName" xml:"IdCardName"` IdCardNumber string `json:"IdCardNumber" xml:"IdCardNumber"` FaceQuality string `json:"FaceQuality" xml:"FaceQuality"` FaceGlobalUrl string `json:"FaceGlobalUrl" xml:"FaceGlobalUrl"` FaceMask string `json:"FaceMask" xml:"FaceMask"` IdCardInfo IdCardInfo `json:"IdCardInfo" xml:"IdCardInfo"` }
{'repo_name': 'aliyun/alibaba-cloud-sdk-go', 'stars': '747', 'repo_language': 'Go', 'file_name': 'struct_cert_list.go', 'mime_type': 'text/plain', 'hash': -2627328217997497863, 'source_dataset': 'data'}
CMFCRibbonPanel* pPanel3 = pCategory->AddPanel(_T("Font")); CMFCRibbonFontComboBox::m_bDrawUsingFont = TRUE; CMFCRibbonFontComboBox* pBtn7 = new CMFCRibbonFontComboBox(ID_RIBBON_EBTN_7); pBtn7->SelectItem(_T("Arial")); pPanel3->Add(pBtn7);
{'repo_name': 'dotnet/docs', 'stars': '2342', 'repo_language': 'PowerShell', 'file_name': 'class1.vb', 'mime_type': 'text/plain', 'hash': 4152435423891778579, 'source_dataset': 'data'}
var mysql = require('../lib/mysql.js'); var Util = require('../lib/util.js'); /** * 查询文件 */ exports.queryFile = function(fileId, callback){ mysql.queryOne('select * from file where id = ?', [fileId], function(err, file) { callback(err, file); }); }; /** * 保存文件 */ exports.saveFile = function(fileName, userId, folderId, fileHashname, fileSize, fileMime, is_public, date ,description, callback){ mysql.update('insert into file(name, user_id, folder_id, hash, size, mime, is_public, create_at, description) values(?,?,?,?,?,?,?,?,?)', [ fileName, userId, folderId, fileHashname, fileSize, fileMime, is_public, date ,description ], function(err, info) { callback(err, info); }); }; /** * 查询用户文件夹下的所有文件 */ exports.queryFiles = function(folderId, userId, callback){ mysql.query('select * from file where folder_id = ? and user_id =? order by create_at desc', [ folderId, userId ], function(err, files) { callback(err, files); }); }; /** * 查询文件夹下的所有文件 */ exports.queryFilesOfFolder = function(folderId, callback){ mysql.query('select * from file where folder_id = ? order by create_at desc', [ folderId ], function(err, files) { callback(err, files); }); }; /** * 批量按文件夹id查询文件总数 */ exports.queryFilesCountOfFolders = function(folderIds, callback){ mysql.query('select count(id) as count, folder_id from file where folder_id in(' + folderIds.join(',') + ') group by folder_id', [], function(err, kvs) { callback(err, kvs); }); }; /** * 删除文件 */ exports.deleteFile = function(fileId, userId, callback){ mysql.update('delete from file where id = ? and user_id = ?', [fileId, userId], function(err, info){ callback(err, info); }); }; /** * 设置文件可见性:isPublic=1为可见,0为不可见 */ exports.updateFileVisibility = function(isPublic, fileId, userId, callback){ mysql.update('update file set is_public = ? where id = ? and user_id = ?', [isPublic, fileId, userId], function(err, info){ callback(err, info); }); }; /** * 设置文件下载量 */ exports.updateFileDownload = function(fileId, callback){ mysql.update('update file set down_count = down_count+1 where id = ?', [fileId], function(err,info){ callback(err, info); }); }; /** * 设置文件所属文件夹 */ exports.updateFileFolder = function(fileId, folderId, userId, callback){ mysql.update('update file set folder_id = ? where id = ? and user_id = ?', [ folderId, fileId, userId ], function(err,info){ callback(err, info); }); }; /** * 查询最新文件 */ exports.queryNewFiles = function(limit, callback){ mysql.query('select * from file where is_public = ? order by id desc limit ?', [ 1, limit ], function(err, files) { callback(err, files); }); }; /** * 查询下载量最多文件 */ exports.queryHotFiles = function(limit, callback){ mysql.query('select * from file where is_public = ? order by down_count desc limit ?', [ 1, limit ], function(err, files) { callback(err, files); }); }; /** * 查询用户的公开文件 */ exports.queryPublicFilesOfUser = function(userId, callback){ mysql.query('select * from file where user_id = ? and is_public = ?', [ userId, 1 ], function(err, files) { callback(err, files); }); };
{'repo_name': 'sumory/sumorio', 'stars': '137', 'repo_language': 'JavaScript', 'file_name': 'message.js', 'mime_type': 'text/plain', 'hash': 1646537586086330001, 'source_dataset': 'data'}
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package support.ui.utilities.time; import java.text.DateFormat; import java.text.FieldPosition; import java.text.Format; import java.text.ParseException; import java.text.ParsePosition; import java.util.Calendar; import java.util.Date; import java.util.Locale; import java.util.TimeZone; /** * <p>FastDateFormat is a fast and thread-safe version of * {@link java.text.SimpleDateFormat}.</p> * * <p>This class can be used as a direct replacement to * {@code SimpleDateFormat} in most formatting and parsing situations. * This class is especially useful in multi-threaded server environments. * {@code SimpleDateFormat} is not thread-safe in any JDK version, * nor will it be as Sun have closed the bug/RFE. * </p> * * <p>All patterns are compatible with * SimpleDateFormat (except time zones and some year patterns - see below).</p> * * <p>Since 3.2, FastDateFormat supports parsing as well as printing.</p> * * <p>Java 1.4 introduced a new pattern letter, {@code 'Z'}, to represent * time zones in RFC822 format (eg. {@code +0800} or {@code -1100}). * This pattern letter can be used here (on all JDK versions).</p> * * <p>In addition, the pattern {@code 'ZZ'} has been made to represent * ISO8601 full format time zones (eg. {@code +08:00} or {@code -11:00}). * This introduces a minor incompatibility with Java 1.4, but at a gain of * useful functionality.</p> * * <p>Javadoc cites for the year pattern: <i>For formatting, if the number of * pattern letters is 2, the year is truncated to 2 digits; otherwise it is * interpreted as a number.</i> Starting with Java 1.7 a pattern of 'Y' or * 'YYY' will be formatted as '2003', while it was '03' in former Java * versions. FastDateFormat implements the behavior of Java 7.</p> * * @since 2.0 * @version $Id: FastDateFormat.java 1572877 2014-02-28 08:42:25Z britter $ */ public class FastDateFormat extends Format implements DateParser, DatePrinter { /** * Required for serialization support. * * @see java.io.Serializable */ private static final long serialVersionUID = 2L; /** * FULL locale dependent date or time style. */ public static final int FULL = DateFormat.FULL; /** * LONG locale dependent date or time style. */ public static final int LONG = DateFormat.LONG; /** * MEDIUM locale dependent date or time style. */ public static final int MEDIUM = DateFormat.MEDIUM; /** * SHORT locale dependent date or time style. */ public static final int SHORT = DateFormat.SHORT; private static final FormatCache<FastDateFormat> cache = new FormatCache<FastDateFormat>() { @Override protected FastDateFormat createInstance(final String pattern, final TimeZone timeZone, final Locale locale) { return new FastDateFormat(pattern, timeZone, locale); } }; private final FastDatePrinter printer; private final FastDateParser parser; //----------------------------------------------------------------------- /** * <p>Gets a formatter instance using the default pattern in the * default locale.</p> * * @return a date/time formatter */ public static FastDateFormat getInstance() { return cache.getInstance(); } /** * <p>Gets a formatter instance using the specified pattern in the * default locale.</p> * * @param pattern {@link java.text.SimpleDateFormat} compatible * pattern * @return a pattern based date/time formatter * @throws IllegalArgumentException if pattern is invalid */ public static FastDateFormat getInstance(final String pattern) { return cache.getInstance(pattern, null, null); } /** * <p>Gets a formatter instance using the specified pattern and * time zone.</p> * * @param pattern {@link java.text.SimpleDateFormat} compatible * pattern * @param timeZone optional time zone, overrides time zone of * formatted date * @return a pattern based date/time formatter * @throws IllegalArgumentException if pattern is invalid */ public static FastDateFormat getInstance(final String pattern, final TimeZone timeZone) { return cache.getInstance(pattern, timeZone, null); } /** * <p>Gets a formatter instance using the specified pattern and * locale.</p> * * @param pattern {@link java.text.SimpleDateFormat} compatible * pattern * @param locale optional locale, overrides system locale * @return a pattern based date/time formatter * @throws IllegalArgumentException if pattern is invalid */ public static FastDateFormat getInstance(final String pattern, final Locale locale) { return cache.getInstance(pattern, null, locale); } /** * <p>Gets a formatter instance using the specified pattern, time zone * and locale.</p> * * @param pattern {@link java.text.SimpleDateFormat} compatible * pattern * @param timeZone optional time zone, overrides time zone of * formatted date * @param locale optional locale, overrides system locale * @return a pattern based date/time formatter * @throws IllegalArgumentException if pattern is invalid * or {@code null} */ public static FastDateFormat getInstance(final String pattern, final TimeZone timeZone, final Locale locale) { return cache.getInstance(pattern, timeZone, locale); } //----------------------------------------------------------------------- /** * <p>Gets a date formatter instance using the specified style in the * default time zone and locale.</p> * * @param style date style: FULL, LONG, MEDIUM, or SHORT * @return a localized standard date formatter * @throws IllegalArgumentException if the Locale has no date * pattern defined * @since 2.1 */ public static FastDateFormat getDateInstance(final int style) { return cache.getDateInstance(style, null, null); } /** * <p>Gets a date formatter instance using the specified style and * locale in the default time zone.</p> * * @param style date style: FULL, LONG, MEDIUM, or SHORT * @param locale optional locale, overrides system locale * @return a localized standard date formatter * @throws IllegalArgumentException if the Locale has no date * pattern defined * @since 2.1 */ public static FastDateFormat getDateInstance(final int style, final Locale locale) { return cache.getDateInstance(style, null, locale); } /** * <p>Gets a date formatter instance using the specified style and * time zone in the default locale.</p> * * @param style date style: FULL, LONG, MEDIUM, or SHORT * @param timeZone optional time zone, overrides time zone of * formatted date * @return a localized standard date formatter * @throws IllegalArgumentException if the Locale has no date * pattern defined * @since 2.1 */ public static FastDateFormat getDateInstance(final int style, final TimeZone timeZone) { return cache.getDateInstance(style, timeZone, null); } /** * <p>Gets a date formatter instance using the specified style, time * zone and locale.</p> * * @param style date style: FULL, LONG, MEDIUM, or SHORT * @param timeZone optional time zone, overrides time zone of * formatted date * @param locale optional locale, overrides system locale * @return a localized standard date formatter * @throws IllegalArgumentException if the Locale has no date * pattern defined */ public static FastDateFormat getDateInstance(final int style, final TimeZone timeZone, final Locale locale) { return cache.getDateInstance(style, timeZone, locale); } //----------------------------------------------------------------------- /** * <p>Gets a time formatter instance using the specified style in the * default time zone and locale.</p> * * @param style time style: FULL, LONG, MEDIUM, or SHORT * @return a localized standard time formatter * @throws IllegalArgumentException if the Locale has no time * pattern defined * @since 2.1 */ public static FastDateFormat getTimeInstance(final int style) { return cache.getTimeInstance(style, null, null); } /** * <p>Gets a time formatter instance using the specified style and * locale in the default time zone.</p> * * @param style time style: FULL, LONG, MEDIUM, or SHORT * @param locale optional locale, overrides system locale * @return a localized standard time formatter * @throws IllegalArgumentException if the Locale has no time * pattern defined * @since 2.1 */ public static FastDateFormat getTimeInstance(final int style, final Locale locale) { return cache.getTimeInstance(style, null, locale); } /** * <p>Gets a time formatter instance using the specified style and * time zone in the default locale.</p> * * @param style time style: FULL, LONG, MEDIUM, or SHORT * @param timeZone optional time zone, overrides time zone of * formatted time * @return a localized standard time formatter * @throws IllegalArgumentException if the Locale has no time * pattern defined * @since 2.1 */ public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone) { return cache.getTimeInstance(style, timeZone, null); } /** * <p>Gets a time formatter instance using the specified style, time * zone and locale.</p> * * @param style time style: FULL, LONG, MEDIUM, or SHORT * @param timeZone optional time zone, overrides time zone of * formatted time * @param locale optional locale, overrides system locale * @return a localized standard time formatter * @throws IllegalArgumentException if the Locale has no time * pattern defined */ public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone, final Locale locale) { return cache.getTimeInstance(style, timeZone, locale); } //----------------------------------------------------------------------- /** * <p>Gets a date/time formatter instance using the specified style * in the default time zone and locale.</p> * * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT * @return a localized standard date/time formatter * @throws IllegalArgumentException if the Locale has no date/time * pattern defined * @since 2.1 */ public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle) { return cache.getDateTimeInstance(dateStyle, timeStyle, null, null); } /** * <p>Gets a date/time formatter instance using the specified style and * locale in the default time zone.</p> * * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT * @param locale optional locale, overrides system locale * @return a localized standard date/time formatter * @throws IllegalArgumentException if the Locale has no date/time * pattern defined * @since 2.1 */ public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final Locale locale) { return cache.getDateTimeInstance(dateStyle, timeStyle, null, locale); } /** * <p>Gets a date/time formatter instance using the specified style and * time zone in the default locale.</p> * * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT * @param timeZone optional time zone, overrides time zone of * formatted date * @return a localized standard date/time formatter * @throws IllegalArgumentException if the Locale has no date/time * pattern defined * @since 2.1 */ public static FastDateFormat getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone) { return getDateTimeInstance(dateStyle, timeStyle, timeZone, null); } /** * <p>Gets a date/time formatter instance using the specified style, * time zone and locale.</p> * * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT * @param timeZone optional time zone, overrides time zone of * formatted date * @param locale optional locale, overrides system locale * @return a localized standard date/time formatter * @throws IllegalArgumentException if the Locale has no date/time * pattern defined */ public static FastDateFormat getDateTimeInstance( final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) { return cache.getDateTimeInstance(dateStyle, timeStyle, timeZone, locale); } // Constructor //----------------------------------------------------------------------- /** * <p>Constructs a new FastDateFormat.</p> * * @param pattern {@link java.text.SimpleDateFormat} compatible pattern * @param timeZone non-null time zone to use * @param locale non-null locale to use * @throws NullPointerException if pattern, timeZone, or locale is null. */ protected FastDateFormat(final String pattern, final TimeZone timeZone, final Locale locale) { this(pattern, timeZone, locale, null); } // Constructor //----------------------------------------------------------------------- /** * <p>Constructs a new FastDateFormat.</p> * * @param pattern {@link java.text.SimpleDateFormat} compatible pattern * @param timeZone non-null time zone to use * @param locale non-null locale to use * @param centuryStart The start of the 100 year period to use as the "default century" for 2 digit year parsing. If centuryStart is null, defaults to now - 80 years * @throws NullPointerException if pattern, timeZone, or locale is null. */ protected FastDateFormat(final String pattern, final TimeZone timeZone, final Locale locale, final Date centuryStart) { printer = new FastDatePrinter(pattern, timeZone, locale); parser = new FastDateParser(pattern, timeZone, locale, centuryStart); } // Format methods //----------------------------------------------------------------------- /** * <p>Formats a {@code Date}, {@code Calendar} or * {@code Long} (milliseconds) object.</p> * * @param obj the object to format * @param toAppendTo the buffer to append to * @param pos the position - ignored * @return the buffer passed in */ @Override public StringBuffer format(final Object obj, final StringBuffer toAppendTo, final FieldPosition pos) { return printer.format(obj, toAppendTo, pos); } /** * <p>Formats a millisecond {@code long} value.</p> * * @param millis the millisecond value to format * @return the formatted string * @since 2.1 */ @Override public String format(final long millis) { return printer.format(millis); } /** * <p>Formats a {@code Date} object using a {@code GregorianCalendar}.</p> * * @param date the date to format * @return the formatted string */ @Override public String format(final Date date) { return printer.format(date); } /** * <p>Formats a {@code Calendar} object.</p> * * @param calendar the calendar to format * @return the formatted string */ @Override public String format(final Calendar calendar) { return printer.format(calendar); } /** * <p>Formats a millisecond {@code long} value into the * supplied {@code StringBuffer}.</p> * * @param millis the millisecond value to format * @param buf the buffer to format into * @return the specified string buffer * @since 2.1 */ @Override public StringBuffer format(final long millis, final StringBuffer buf) { return printer.format(millis, buf); } /** * <p>Formats a {@code Date} object into the * supplied {@code StringBuffer} using a {@code GregorianCalendar}.</p> * * @param date the date to format * @param buf the buffer to format into * @return the specified string buffer */ @Override public StringBuffer format(final Date date, final StringBuffer buf) { return printer.format(date, buf); } /** * <p>Formats a {@code Calendar} object into the * supplied {@code StringBuffer}.</p> * * @param calendar the calendar to format * @param buf the buffer to format into * @return the specified string buffer */ @Override public StringBuffer format(final Calendar calendar, final StringBuffer buf) { return printer.format(calendar, buf); } // Parsing //----------------------------------------------------------------------- /* (non-Javadoc) * @see DateParser#parse(java.lang.String) */ @Override public Date parse(final String source) throws ParseException { return parser.parse(source); } /* (non-Javadoc) * @see DateParser#parse(java.lang.String, java.text.ParsePosition) */ @Override public Date parse(final String source, final ParsePosition pos) { return parser.parse(source, pos); } /* (non-Javadoc) * @see java.text.Format#parseObject(java.lang.String, java.text.ParsePosition) */ @Override public Object parseObject(final String source, final ParsePosition pos) { return parser.parseObject(source, pos); } // Accessors //----------------------------------------------------------------------- /** * <p>Gets the pattern used by this formatter.</p> * * @return the pattern, {@link java.text.SimpleDateFormat} compatible */ @Override public String getPattern() { return printer.getPattern(); } /** * <p>Gets the time zone used by this formatter.</p> * <p/> * <p>This zone is always used for {@code Date} formatting. </p> * * @return the time zone */ @Override public TimeZone getTimeZone() { return printer.getTimeZone(); } /** * <p>Gets the locale used by this formatter.</p> * * @return the locale */ @Override public Locale getLocale() { return printer.getLocale(); } /** * <p>Gets an estimate for the maximum string length that the * formatter will produce.</p> * <p/> * <p>The actual formatted length will almost always be less than or * equal to this amount.</p> * * @return the maximum formatted length */ public int getMaxLengthEstimate() { return printer.getMaxLengthEstimate(); } // Basics //----------------------------------------------------------------------- /** * <p>Compares two objects for equality.</p> * * @param obj the object to compare to * @return {@code true} if equal */ @Override public boolean equals(final Object obj) { if (!(obj instanceof FastDateFormat)) { return false; } final FastDateFormat other = (FastDateFormat) obj; // no need to check parser, as it has same invariants as printer return printer.equals(other.printer); } /** * <p>Returns a hashcode compatible with equals.</p> * * @return a hashcode compatible with equals */ @Override public int hashCode() { return printer.hashCode(); } /** * <p>Gets a debugging string version of this formatter.</p> * * @return a debugging string */ @Override public String toString() { return "FastDateFormat[" + printer.getPattern() + "," + printer.getLocale() + "," + printer.getTimeZone().getID() + "]"; } /** * <p>Performs the formatting by applying the rules to the * specified calendar.</p> * * @param calendar the calendar to format * @param buf the buffer to format into * @return the specified string buffer */ protected StringBuffer applyRules(final Calendar calendar, final StringBuffer buf) { return printer.applyRules(calendar, buf); } }
{'repo_name': 'CameloeAnthony/Ant', 'stars': '808', 'repo_language': 'Java', 'file_name': 'ExampleUnitTest.java', 'mime_type': 'text/html', 'hash': -7571631657821969841, 'source_dataset': 'data'}
// // AppDelegate.h // HJCarouselDemo // // Created by haijiao on 15/8/20. // Copyright (c) 2015年 olinone. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
{'repo_name': 'panghaijiao/HJCarouselDemo', 'stars': '434', 'repo_language': 'Objective-C', 'file_name': 'HJCarouselDemo.xccheckout', 'mime_type': 'text/xml', 'hash': -912502141018607508, 'source_dataset': 'data'}
var SINE_SUMMATION_INTERACTIVE = (function() { var canvasWidth = 550; var canvasHeight = 250; var MARGINS = { top: 0, right: 0, bottom: 0, left: 0 }; plotWidth = canvasWidth - MARGINS.left - MARGINS.right, plotHeight = canvasHeight - MARGINS.top - MARGINS.bottom; var subPlotHeight = plotHeight / 3; var xRangeCorr = d3.scale.linear().range([MARGINS.left, plotWidth]); var yRangeCorr = d3.scale.linear().range([subPlotHeight, MARGINS.top]); var yRangeCorr1 = d3.scale.linear().range([subPlotHeight * 2 + 20, subPlotHeight + 20]); var yRangeCorr2 = d3.scale.linear().range([subPlotHeight * 3 + 70, subPlotHeight * 2 + 70]); xRangeCorr.domain([0, 4 * Math.PI]); yRangeCorr.domain([-1.25, 1.25]); yRangeCorr1.domain([-1.25, 1.25]); yRangeCorr2.domain([-1.25, 1.25]); var signalPhase = 0; var signalFreq = 1; var signalAmp = 1.0; var xAxis = d3.svg.axis() .scale(xRangeCorr) .tickSize(0) .ticks(0) .tickSubdivide(true); var xAxis1 = d3.svg.axis() .scale(xRangeCorr) .tickSize(0) .ticks(0) .tickSubdivide(true); var xAxis2 = d3.svg.axis() .scale(xRangeCorr) .tickSize(0) .ticks(0) .tickSubdivide(true); var vis = d3.select('#sineSummationInteractive'); vis.append('svg:g') .attr('class', 'x axis') .attr('transform', 'translate(0,' + yRangeCorr(0) + ')') .style('opacity', 0.25) .call(xAxis); vis.append('svg:g') .attr('class', 'x axis') .attr('transform', 'translate(0,' + yRangeCorr1(0) + ')') .style('opacity', 0.25) .call(xAxis1); vis.append('svg:g') .attr('class', 'x axis') .attr('transform', 'translate(0,' + yRangeCorr2(0) + ')') .style('opacity', 0.25) .call(xAxis2); var color1 = "red"; var color2 = "steelblue"; var color3 = "purple"; var corrSigPath1 = vis.append('svg:path') .attr("stroke-width", 2.0) .attr("stroke", color1) .attr("fill", "none") .attr("opacity", 0.4); var corrSigPath2 = vis.append('svg:path') .attr("stroke-width", 2.0) .attr("stroke", color2) .attr("fill", "none") .attr("opacity", 0.5); var corrSigPath3 = vis.append('svg:path') .attr("stroke-width", 2.0) .attr("stroke", color3) .attr("fill", "none") .attr("fill-opacity", 0.20) .attr("opacity", 0.5); var corrSig1 = d3.svg.line() .x(function (d, i) { return xRangeCorr(d)}) .y(function (d, i) { return yRangeCorr(inputSignal(d)); }); var corrSig2 = d3.svg.line() .x(function (d, i) { return xRangeCorr(d)}) .y(function (d, i) { return yRangeCorr1(signalAmp * Math.sin(d + signalPhase)); }); var corrSig3 = d3.svg.line() .x(function (d, i) { return xRangeCorr(d)}) .y(function (d, i) { return yRangeCorr2(inputSignal(d) + signalAmp * Math.sin(d + signalPhase)); }); var corrSigData = d3.range(0, 4 * Math.PI + 0.1, 0.1); corrSigPath1.attr("d", corrSig1(corrSigData)); corrSigPath2.attr("d", corrSig2(corrSigData)); corrSigPath3.attr("d", corrSig3(corrSigData)); var corrSigSampleData = d3.range(0, 4 * Math.PI, 4 * Math.PI / 30); vis.append("text") .attr("text-anchor", "begin") .attr("x", xRangeCorr(0)) .attr("y", yRangeCorr(1)) .attr("stroke", "none") .style("font-size", "11px") .attr("fill", "#333") .text("Signal A"); vis.append("text") .attr("text-anchor", "begin") .attr("x", xRangeCorr(0)) .attr("y", yRangeCorr1(1.1)) .attr("stroke", "none") .style("font-size", "11px") .attr("fill", "#333") .text("Signal B"); vis.append("text") .attr("text-anchor", "begin") .attr("x", xRangeCorr(0)) .attr("y", yRangeCorr2(2.2)) .attr("stroke", "none") .style("font-size", "11px") .attr("fill", "#333") .text("Signal A + Signal B"); function inputSignal(d) { return Math.sin(d); } var samples1 = vis.selectAll(".point1") .data(corrSigSampleData) .enter().append("svg:circle") .attr("stroke", "none") .attr("fill", color1) .attr("cx", function(d, i) { return xRangeCorr(d); }) .attr("cy", function(d, i) { return yRangeCorr(inputSignal(d)); }) .attr("r", function(d, i) { return 2.0 }); var samples2 = vis.selectAll(".point2") .data(corrSigSampleData) .enter().append("svg:circle") .attr("stroke", "none") .attr("fill", color2) .attr("cx", function(d, i) { return xRangeCorr(d); }) .attr("cy", function(d, i) { return yRangeCorr1(Math.sin(d * signalFreq + signalPhase)); }) .attr("r", function(d, i) { return 2.0 }); var connectors = vis.selectAll(".connectors") .data(corrSigSampleData) .enter().append("line") .attr("x1", function(d, i) { return xRangeCorr(d); }) .attr("y1", function(d, i) { return yRangeCorr(inputSignal(d)); }) .attr("x2", function(d, i) { return xRangeCorr(d); }) .attr("y2", function(d, i) { return yRangeCorr2(inputSignal(d) + signalAmp * Math.sin(d + signalPhase)); }) .attr("stroke-width", 1.0) .attr("stroke", "grey") .style("opacity", 0.20) .style("stroke-dasharray", ("3, 3")) ; var samples3 = vis.selectAll(".point3") .data(corrSigSampleData) .enter().append("svg:circle") .attr("stroke", "none") .attr("fill", color3) .attr("cx", function(d, i) { return xRangeCorr(d); }) .attr("cy", function(d, i) { return yRangeCorr2(inputSignal(d) + Math.sin(d * signalFreq + signalPhase)); }) .attr("r", function(d, i) { return 2.0 }); function draw() { if (signalPhase === SIMPLE_CORRELATION_OFFSET && signalAmp === SIMPLE_CORRELATION_AMP) { return; } signalPhase = SIMPLE_CORRELATION_OFFSET; signalAmp = SIMPLE_CORRELATION_AMP; samples2.data(corrSigSampleData) .attr("cx", function(d, i) { return xRangeCorr(d); }) .attr("cy", function(d, i) { return yRangeCorr1(Math.sin(d * signalFreq + signalPhase) * signalAmp); }); samples3.data(corrSigSampleData) .attr("cx", function(d, i) { return xRangeCorr(d); }) .attr("cy", function(d, i) { return yRangeCorr2(inputSignal(d) + Math.sin(d * signalFreq + signalPhase) * signalAmp); }); connectors.data(corrSigSampleData) .attr("x1", function(d, i) { return xRangeCorr(d); }) .attr("y1", function(d, i) { return yRangeCorr(inputSignal(d)); }) .attr("x2", function(d, i) { return xRangeCorr(d); }) .attr("y2", function(d, i) { return yRangeCorr2(inputSignal(d) + signalAmp * Math.sin(d + signalPhase) * signalAmp); }); corrSigPath2.attr("d", corrSig2(corrSigData)); corrSigPath3.attr("d", corrSig3(corrSigData)); } d3.timer(draw, 100); }) ();
{'repo_name': 'jackschaedler/circles-sines-signals', 'stars': '820', 'repo_language': 'JavaScript', 'file_name': 'example.css', 'mime_type': 'text/plain', 'hash': -3719835529041299771, 'source_dataset': 'data'}
{ "_args": [ [ { "name": "ansi-regex", "raw": "ansi-regex@^0.2.0", "rawSpec": "^0.2.0", "scope": null, "spec": ">=0.2.0 <0.3.0", "type": "range" }, "/ws/silk-core/node_modules/download-status/node_modules/has-ansi" ] ], "_from": "ansi-regex@>=0.2.0 <0.3.0", "_id": "ansi-regex@0.2.1", "_inCache": true, "_installable": true, "_location": "/download-status/ansi-regex", "_npmUser": { "email": "sindresorhus@gmail.com", "name": "sindresorhus" }, "_npmVersion": "1.4.9", "_phantomChildren": {}, "_requested": { "name": "ansi-regex", "raw": "ansi-regex@^0.2.0", "rawSpec": "^0.2.0", "scope": null, "spec": ">=0.2.0 <0.3.0", "type": "range" }, "_requiredBy": [ "/download-status/has-ansi", "/download-status/strip-ansi" ], "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz", "_shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9", "_shrinkwrap": null, "_spec": "ansi-regex@^0.2.0", "_where": "/ws/silk-core/node_modules/download-status/node_modules/has-ansi", "author": { "email": "sindresorhus@gmail.com", "name": "Sindre Sorhus", "url": "http://sindresorhus.com" }, "bugs": { "url": "https://github.com/sindresorhus/ansi-regex/issues" }, "dependencies": {}, "description": "Regular expression for matching ANSI escape codes", "devDependencies": { "mocha": "*" }, "directories": {}, "dist": { "shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9", "tarball": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz" }, "engines": { "node": ">=0.10.0" }, "files": [ "index.js" ], "homepage": "https://github.com/sindresorhus/ansi-regex", "keywords": [ "ansi", "styles", "color", "colour", "colors", "terminal", "console", "cli", "string", "tty", "escape", "formatting", "rgb", "256", "shell", "xterm", "command-line", "text", "regex", "regexp", "re", "match", "test", "find", "pattern" ], "license": "MIT", "maintainers": [ { "email": "sindresorhus@gmail.com", "name": "sindresorhus" } ], "name": "ansi-regex", "optionalDependencies": {}, "readme": "ERROR: No README data found!", "repository": { "type": "git", "url": "git://github.com/sindresorhus/ansi-regex.git" }, "scripts": { "test": "mocha" }, "version": "0.2.1" }
{'repo_name': 'silklabs/silk', 'stars': '160', 'repo_language': 'JavaScript', 'file_name': 'silk-wifi.js.flow', 'mime_type': 'text/x-java', 'hash': 3067001624031434310, 'source_dataset': 'data'}
/* FAR Style (c) MajestiC <majestic2k@gmail.com> */ pre code { display: block; padding: 0.5em; background: #000080; } pre code, .ruby .subst { color: #0FF; } pre .string, pre .ruby .string, pre .haskell .type, pre .tag .value, pre .css .rules .value, pre .css .rules .value .number, pre .preprocessor, pre .ruby .symbol, pre .ruby .symbol .string, pre .ruby .symbol .keyword, pre .ruby .symbol .keymethods, pre .built_in, pre .sql .aggregate, pre .django .template_tag, pre .django .variable, pre .smalltalk .class, pre .addition, pre .apache .tag, pre .apache .cbracket, pre .tex .command { color: #FF0; } pre .keyword, pre .css .id, pre .title, pre .haskell .type, pre .vbscript .built_in, pre .sql .aggregate, pre .rsl .built_in, pre .smalltalk .class, pre .xml .tag .title, pre .winutils, pre .flow, pre .change, pre .envvar, pre .bash .variable, pre .tex .special { color: #FFF; } pre .comment, pre .phpdoc, pre .javadoc, pre .java .annotation, pre .template_comment, pre .deletion, pre .apache .sqbracket, pre .tex .formula { color: #888; } pre .number, pre .date, pre .regexp, pre .literal, pre .smalltalk .symbol, pre .smalltalk .char { color: #0F0; } pre .python .decorator, pre .django .filter .argument, pre .smalltalk .localvars, pre .smalltalk .array, pre .attr_selector, pre .pseudo, pre .xml .pi, pre .diff .header, pre .chunk, pre .shebang, pre .nginx .built_in, pre .input_number { color: #008080; } pre .keyword, pre .css .id, pre .title, pre .haskell .type, pre .vbscript .built_in, pre .sql .aggregate, pre .rsl .built_in, pre .smalltalk .class, pre .winutils, pre .flow, pre .apache .tag, pre .nginx .built_in, pre .tex .command, pre .tex .special, pre .request, pre .status { font-weight: bold; }
{'repo_name': 'jtleek/dataanalysis', 'stars': '702', 'repo_language': 'JavaScript', 'file_name': 'MathOperators.js', 'mime_type': 'text/plain', 'hash': 797176627916489888, 'source_dataset': 'data'}
'use strict'; module.exports = function (app) { class Bar extends app.Service { constructor(ctx) { super(ctx); } * get(name) { return { name: name, bar: 'bar1', }; } } return Bar; };
{'repo_name': 'eggjs/egg-core', 'stars': '182', 'repo_language': 'JavaScript', 'file_name': 'user.js', 'mime_type': 'text/plain', 'hash': -2926882200414140803, 'source_dataset': 'data'}
<body> <foo></foo> <foo bar="baz"></foo> <foo/> <foo bar="baz"/> <foo>/</foo> <foo bar="baz">/</foo><img/><img/> </body>
{'repo_name': 'neuland/jade4j', 'stars': '679', 'repo_language': 'Java', 'file_name': 'JadeExceptionTest.java', 'mime_type': 'text/html', 'hash': 4590493343536528531, 'source_dataset': 'data'}
namespace ClassLib037 { public class Class047 { public static string Property => "ClassLib037"; } }
{'repo_name': 'dotnet/performance', 'stars': '329', 'repo_language': 'C#', 'file_name': 'Class067.cs', 'mime_type': 'text/plain', 'hash': -1745256458764915318, 'source_dataset': 'data'}
/* Generated by RuntimeBrowser. */ @protocol SFMapRegion <NSObject> @required - (NSDictionary *)dictionaryRepresentation; - (double)eastLng; - (NSData *)jsonData; - (double)northLat; - (void)setEastLng:(double)arg1; - (void)setNorthLat:(double)arg1; - (void)setSouthLat:(double)arg1; - (void)setWestLng:(double)arg1; - (double)southLat; - (double)westLng; @end
{'repo_name': 'nst/iOS-Runtime-Headers', 'stars': '7551', 'repo_language': 'Objective-C', 'file_name': 'NPNameParser.h', 'mime_type': 'text/plain', 'hash': 8264231185335294129, 'source_dataset': 'data'}
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <meta name="description" content=""> <meta name="author" content=""> <link rel="icon" href="../../favicon.ico"> <title>Commercial Tools Scorecard</title> <!-- Bootstrap core CSS --> <link href="content/css/bootstrap.min.css" rel="stylesheet"> <!-- Custom styles for this template --> <link href="content/dashboard.css" rel="stylesheet"> <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> <script src="content/js/ie-emulation-modes-warning.js"></script> <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <nav class="navbar navbar-inverse navbar-fixed-top"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="OWASP_Benchmark_Home.html">OWASP Benchmark v1.1,1.2</a> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-right"> <li><a href="OWASP_Benchmark_Home.html">Home</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Tools<span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="Benchmark_v1.2_Scorecard_for_FBwFindSecBugs_v1.4.0.html">FBwFindSecBugs v1.4.0</a></li> <li><a href="Benchmark_v1.2_Scorecard_for_FBwFindSecBugs_v1.4.3.html">FBwFindSecBugs v1.4.3</a></li> <li><a href="Benchmark_v1.2_Scorecard_for_FBwFindSecBugs_v1.4.4.html">FBwFindSecBugs v1.4.4</a></li> <li><a href="Benchmark_v1.2_Scorecard_for_FBwFindSecBugs_v1.4.5.html">FBwFindSecBugs v1.4.5</a></li> <li><a href="Benchmark_v1.2_Scorecard_for_FBwFindSecBugs_v1.4.6.html">FBwFindSecBugs v1.4.6</a></li> <li><a href="Benchmark_v1.2_Scorecard_for_FindBugs_v3.0.1.html">FindBugs v3.0.1</a></li> <li><a href="Benchmark_v1.2_Scorecard_for_OWASP_ZAP_vD-2015-08-24.html">OWASP ZAP vD-2015-08-24</a></li> <li><a href="Benchmark_v1.2_Scorecard_for_OWASP_ZAP_vD-2016-09-05.html">OWASP ZAP vD-2016-09-05</a></li> <li><a href="Benchmark_v1.2_Scorecard_for_PMD_v5.2.3.html">PMD v5.2.3</a></li> <li><a href="Benchmark_v1.1_Scorecard_for_SAST-01.html">SAST-01</a></li> <li><a href="Benchmark_v1.1_Scorecard_for_SAST-02.html">SAST-02</a></li> <li><a href="Benchmark_v1.1_Scorecard_for_SAST-03.html">SAST-03</a></li> <li><a href="Benchmark_v1.1_Scorecard_for_SAST-04.html">SAST-04</a></li> <li><a href="Benchmark_v1.1_Scorecard_for_SAST-05.html">SAST-05</a></li> <li><a href="Benchmark_v1.1_Scorecard_for_SAST-06.html">SAST-06</a></li> <li><a href="Benchmark_v1.2_Scorecard_for_SonarQube_Java_Plugin_v3.14.html">SonarQube Java Plugin v3.14</a></li> <li><a href="Benchmark_v1.1,1.2_Scorecard_for_Commercial_Tools.html">Commercial Average</a></li> </ul> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Vulnerabilities<span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="Benchmark_v1.1,1.2_Scorecard_for_Command_Injection.html">Command Injection</a></li> <li><a href="Benchmark_v1.1,1.2_Scorecard_for_Cross-Site_Scripting.html">Cross-Site Scripting</a></li> <li><a href="Benchmark_v1.1,1.2_Scorecard_for_Insecure_Cookie.html">Insecure Cookie</a></li> <li><a href="Benchmark_v1.1,1.2_Scorecard_for_LDAP_Injection.html">LDAP Injection</a></li> <li><a href="Benchmark_v1.1,1.2_Scorecard_for_Path_Traversal.html">Path Traversal</a></li> <li><a href="Benchmark_v1.1,1.2_Scorecard_for_SQL_Injection.html">SQL Injection</a></li> <li><a href="Benchmark_v1.1,1.2_Scorecard_for_Trust_Boundary_Violation.html">Trust Boundary Violation</a></li> <li><a href="Benchmark_v1.1,1.2_Scorecard_for_Weak_Encryption_Algorithm.html">Weak Encryption Algorithm</a></li> <li><a href="Benchmark_v1.1,1.2_Scorecard_for_Weak_Hash_Algorithm.html">Weak Hash Algorithm</a></li> <li><a href="Benchmark_v1.1,1.2_Scorecard_for_Weak_Random_Number.html">Weak Random Number</a></li> <li><a href="Benchmark_v1.1,1.2_Scorecard_for_XPath_Injection.html">XPath Injection</a></li> </ul> </li> <li><a href="OWASP_Benchmark_Guide.html">Guide</a></li> </ul> </div> </div> </nav> <div class="container"> <div class="starter-template"> <div>empty</div> <div>empty</div> <h3>OWASP Benchmark Scorecard for Commercial Tools</h3> <p>The OWASP Benchmark is a test suite designed to evaluate the speed, coverage, and accuracy of automated vulnerability detection tools. Without the ability to measure these tools, it is difficult to understand their strengths and weaknesses, and compare them to each other. The Benchmark contains thousands of test cases that are fully runnable and exploitable. The following is the scorecard showing how well the commercial tools collectively performed against version 1.1,1.2 of the Benchmark. For each vulnerability it shows the lowest, average, and highest scores across all the commercial tools included in this scorecard calculation.</p> <p>For more information, please visit the <a href="https://www.owasp.org/index.php/Benchmark">OWASP Benchmark Project Site</a>. <p> <p> <h2>Average Scores Per Vulnerability for Commercial Tools</h2> <table class="table"> <tr><th>Vulnerability Category</th><th>Low Tool Type</th><th>Low Score</th><th>Ave Score</th><th>High Score</th><th>High Tool Type</th></tr> <tr><td>Command Injection</td><td>SAST</td><td class="danger">0</td><td>16</td><td class="danger">29</td><td>SAST</td></tr> <tr><td>Cross-Site Scripting</td><td>SAST</td><td class="danger">9</td><td>23</td><td class="danger">39</td><td>SAST</td></tr> <tr><td>Insecure Cookie</td><td>SAST</td><td class="danger">0</td><td>33</td><td class="success">100</td><td>SAST</td></tr> <tr><td>LDAP Injection</td><td>SAST</td><td class="danger">0</td><td>17</td><td class="success">54</td><td>SAST</td></tr> <tr><td>Path Traversal</td><td>SAST</td><td class="danger">1</td><td>19</td><td class="danger">35</td><td>SAST</td></tr> <tr><td>SQL Injection</td><td>SAST</td><td class="danger">9</td><td>24</td><td class="danger">34</td><td>SAST</td></tr> <tr><td>Trust Boundary Violation</td><td>SAST</td><td class="danger">0</td><td>8</td><td class="danger">16</td><td>SAST</td></tr> <tr><td>Weak Encryption Algorithm</td><td>SAST</td><td class="danger">0</td><td>39</td><td class="success">74</td><td>SAST</td></tr> <tr><td>Weak Hash Algorithm</td><td>SAST</td><td class="danger">0</td><td>38</td><td class="success">77</td><td>SAST</td></tr> <tr><td>Weak Random Number</td><td>SAST</td><td class="danger">0</td><td>36</td><td class="success">90</td><td>SAST</td></tr> <tr><td>XPath Injection</td><td>SAST</td><td class="danger">0</td><td>27</td><td class="success">59</td><td>SAST</td></tr> <tr><td>Average across all categories for 6 tools</td><td></td><td>1.7</td><td>25.5</td><td>55.2</td><td></td></tr> <p> <p> <h2>Key</h2> <table class="table"> <tr> <th>Tool Type</th> <td>SAST - Static Application Security Testing. DAST - Dynamic Application Security Testing. IAST - Interactive Application Security Testing. These terms were coined by Gartner.</td> </tr> <tr> <th>True Positive (TP)</th> <td>Tests with real vulnerabilities that were correctly reported as vulnerable by the tool.</td> </tr> <tr> <th>False Negative (FN)</th> <td>Tests with real vulnerabilities that were not correctly reported as vulnerable by the tool.</td> </tr> <tr> <th>True Negative (TN)</th> <td>Tests with fake vulnerabilities that were correctly not reported as vulnerable by the tool.</td> </tr> <tr> <th>False Positive (FP)</th> <td>Tests with fake vulnerabilities that were incorrectly reported as vulnerable by the tool.</td> </tr> <tr> <th>True Positive Rate (TPR) = TP / ( TP + FN )</th> <td>The rate at which the tool correctly reports real vulnerabilities. Also referred to as Recall, as defined at <a href="https://en.wikipedia.org/wiki/Precision_and_recall">Wikipedia</a>.</td> </tr> <tr> <th>False Positive Rate (FPR) = FP / ( FP + TN )</th> <td>The rate at which the tool incorrectly reports fake vulnerabilities as real.</td> </tr> <tr> <th>Score = TPR - FPR</th> <td>Normalized distance from the random guess line.</td> </tr> </table> </div> </div><!-- /.container --> <!-- Bootstrap core JavaScript ================================================== --> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="content/js/bootstrap.min.js"></script> </body> </html>
{'repo_name': 'OWASP/Benchmark', 'stars': '268', 'repo_language': 'Java', 'file_name': 'extensions.xml', 'mime_type': 'text/xml', 'hash': -1408230334676580680, 'source_dataset': 'data'}
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Geoworks 1995 -- All Rights Reserved PROJECT: Tiramisu MODULE: Preferences FILE: preffax2.def AUTHOR: Peter Trinh, Jan 16, 1995 MACROS: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- PT 1/16/95 Initial revision DESCRIPTION: Contains definitions of data-structure for the Fax Preferences module. $Id: preffax2.def,v 1.1 97/04/05 01:43:20 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ;----------------------------------------------------------------------------- ; Data types ;----------------------------------------------------------------------------- ELEMENT_NOT_IN_ARRAY enum FatalErrors ; Trying to index into the given array specified by ds:si with a bad ; index value, ax. CHUNK_ARRAY_ENUM_PREMATURE_TERMINATION enum FatalErrors ; Not expecting the enumeration to terminate prematurely (without ; having gone through all the items in the chunk arrays), ie. the ; callback routine terminated with the CARRY flag set. PREF_DIALING_CODE_LIST_ENUM_PREMATURE_TERMINATION enum FatalErrors ; Not expecting the enumeration to terminate prematurely, ie. the ; callback routine terminated with the CARRY flag set. PREF_ITEM_GROUP_SPECIAL_CATEGORY_ERROR enum FatalErrors ; The category string in the instance data field doesn't match that of ; the assertions. Make sure to have ; categoryOne = FAX_INI_FAXIN_CATEGORY ; categoryTwo = FAX_INI_FAXOUT_CATEGORY ; if you want to write the class information. ;----------------------------------------------------------------------------- ; CONSTANTS ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ; STRUCTURES ;----------------------------------------------------------------------------- PrefFaxMesgStruct struct PFMS_msgNumber word ; will be stored in reg ax PFMS_cx_data word ; passed in cx PFMS_dx_data word ; dx PFMS_bp_data word ; bp PrefFaxMesgStruct ends ;----------------------------------------------------------------------------- ; CLASSES ;----------------------------------------------------------------------------- PrefFaxDialogClass class PrefDialogClass MSG_PREF_FAX_DIALOG_SEND_MSG_TO_SELECTED_LIST message ; ; Will send the "encapsulated" message and parameters (given on the ; stack) to the list selected by the list selector. Eg. if the Access ; list is chosen, then the message and parameters on the passed ; structure will be sent to the Access list. ; ; For now, the list selector is hard-coded to be DialingCodeSelector, ; but can be expanded later on to support any various selectors. ; ; Context: Forwarding message mechanism. ; Source: Global ; Destination: PrefDialogClass ; Interception: not usually ; ; Pass: PrefFaxMesgStruct - on the stack ; ; Return: nothing ; nothing - destroyed ; MSG_PREF_FAX_DIALOG_SELECT_DIALING_CODE_LIST message ; ; Sent when the user clicks on one of the items of the ; DialingCodeSelector. Will determine which list is selected, and ; "ACTIVATE" that list while "DEACTIVATING" the other list(s) ; NOT_USABLE. ; ; Context: Mechanism to visually select PrefDialingCodeLists ; Source: PrefItemGroupClass ; Destination: PrefDialogClass ; Interception: not usually ; ; Pass: cx = current selection ; bp = number of selections ; dl = GenItemGroupStateFlags ; ; Return: nothing ; nothing - destroyed ; ;----------------------------------------------------------------------------- ; Instance data ;----------------------------------------------------------------------------- PrefFaxDialogClass endc PrefInteractionSpecialClass class PrefInteractionClass ;----------------------------------------------------------------------------- ; Instance data ;----------------------------------------------------------------------------- PrefInteractionSpecialClass endc PrefItemGroupSpecialClass class PrefItemGroupClass ; ; Allows saving the same option information to two different category. ; ; To do this, we're intercepting the MSG_GEN_SAVE_OPTION message and ; copying our own key string into the buffer and then call the super ; class to actually write it out. ; ; Note: Will ignore the category that is given in the vardata ; ATTR_GEN_INIT_FILE_CATEGORY when saving; however, you will still ; need to indicate the category and key using ; ATTR_GEN_INIT_FILE_CATEGORY/KEY for proper loading behavior. ; MSG_PREF_ITEM_GROUP_SPECIAL_CHECK_PORT message ; ; Checks the selected port to see if a viable faxmodem is connected. ; If not, then display a warning dialog box. ; ; Context: sent out when user selects a port number item ; Source: GenItemGroupClass object ; Destination: Any PrefItemGroupSpecialClass object ; Interception: not usually ; ; Pass: cx = current selection, or first selection in item group, ; if more than one selection, or GIGS_NONE if no ; selection (selection interpreted as port numbers) ; bp = number of selections ; dl = GenItemGroupStateFlags ; GIGSF_MODIFIED will be set if a user activation has ; just changed the status of the group. Will be clear ; if a redundant user activation has occurred, such as ; the re-selection of the singly selected exclusive ; item. If message is a result of ; MSG_GEN_ITEM_GROUP_SEND_STATUS_MSG being sent, then ; this bit will hold the value passed in that message. ; ; Return: nothing ; nothing - destroyed ; ;----------------------------------------------------------------------------- ; Data types ;----------------------------------------------------------------------------- PrefItemGroupSpecialFlags record PIGSF_FAX_CLASS:1 ; It's a fax class item selector, so ; need to write out the driver name ; and capabilities as well. :7 PrefItemGroupSpecialFlags end ;----------------------------------------------------------------------------- ; Instance data ;----------------------------------------------------------------------------- PIGSI_categoryOne lptr.char ; First category string PIGSI_categoryTwo lptr.char ; Second category string where saved information should be ; written to. PIGSI_itemGroupSpecialflags PrefItemGroupSpecialFlags ; To mark other things that needs to be written out to the ini ; file. PrefItemGroupSpecialClass endc PrefDialingCodeListClass class PrefDynamicListClass ; ; Adds on to the functionality of the PrefDynamicListClass by allowing ; the management of not only one "list" of items, but three "lists" of ; items that have their values stored in the ini file. It also sends ; the outputs of the selected list items to the "attached" text ; objects. ; ; Upon receiving MSG_PREF_DYNAMIC_LIST_BUILD_ARRAY, it will build out ; 1-3 chunk arrays depending on the number of ini keys that are ; initialized. ; ; Then upon receiving MSG_PREF_ITEM_GROUP_GET_ITEM_MONIKER, it will ; search the "notes" chunk array and return the appropriate text item. ; (THUS: the notesKey should be initialized or else the object will ; not be initialized at all.) ; ; Upon receiving MSG_PREF_DYNAMIC_LIST_FIND_ITEM, it will find the ; item in the "notes" chunk array given the item moniker. ; MSG_PREF_DIALING_CODE_LIST_SELECT_ITEM message ; ; When an item in the list is selected, this message will be sent to ; the PrefDialingCodeListClass. When this message is received, it ; will output the corresponding information in it's arrays to the ; attached text object. ; ; Context: When item in the list is selected ; Source: PrefDialingCodeListClass object ; Destination: PrefDialingCodeListClass object ; Interception: not usually ; ; Pass: cx -- current selection, or first selection in item ; group, if more than one selection, or GIGS_NONE ; of no selection ; bp -- number of selections ; dl -- GenItemGroupStateFlags ; Return: nothing ; ax, cx, dx, bp -- destroyed MSG_PREF_DIALING_CODE_LIST_DELETE_SELECTED_ITEM message ; ; Will delete the currently selected item. This is done by removing ; all the corresponding elements in the chunk arrays as well as ; removing the item from the list itself. When removing the elements ; from the arrays, we will free the allocated lptr. ; ; Side effect: will clear out all attached text objects. ; ; Context: Mechanism to change the list. ; Source: Global ; Destination: PrefDialingCodeListClass object ; Interception: not usually ; ; Pass: nothing ; Return: nothing ; nothing - destroyed ; MSG_PREF_DIALING_CODE_LIST_INSERT_ITEM message ; ; Will insert an item into the list. The item will be sorted by it's ; notes data string and will be inserted accordingly. The data ; strings will be grabbed from the attached text objects. ; ; Context: Mechanism to change the list. ; Source: Global ; Destination: PrefDialingCodeListClass object ; Interception: not usually ; ; Pass: nothing ; Return: nothing ; nothing - destroyed ; MSG_PREF_DIALING_CODE_LIST_MODIFY_SELECTED_ITEM message ; ; Will allow the modification of the selected item's information, ie. ; note string, dialing code, billing code, etc. ; ; Context: Mechanism to change the list. ; Source: Global ; Destination: PrefDialingCodeListClass object ; Interception: not usually ; ; Pass: nothing ; Return: nothing ; nothing - destroyed ; MSG_PREF_DIALING_CODE_LIST_DESTROY_ARRAYS message ; ; Will "destroy" the arrays, by freeing up memory that is associated ; to the chunk arrays and the arrays themselves. ; ; Context: Mechanism to clean up. ; Source: Global ; Destination: PrefDialingCodeListClass object ; Interception: not usually ; ; Pass: nothing ; Return: nothing ; nothing - destroyed ; MSG_PREF_DIALING_CODE_LIST_ACTIVATE message ; ; Make the list USABLE and all the linked text objects USABLE as well. ; ; Context: Mechanism to select between lists ; Source: Global ; Destination: PrefDialingCodeListClass object ; Interception: not usually ; ; Pass: nothing ; Return: nothing ; nothing - destroyed ; MSG_PREF_DIALING_CODE_LIST_DEACTIVATE message ; ; Make the list NOT_USABLE and all the linked text objects NOT_USABLE as ; well. ; ; Context: Mechanism to select between lists ; Source: Global ; Destination: PrefDialingCodeListClass object ; Interception: not usually ; ; Pass: nothing ; Return: nothing ; nothing - destroyed ; ;----------------------------------------------------------------------------- ; Data types ;----------------------------------------------------------------------------- ; ; Identifiers for the various ini keys ; PrefDialingCodeKey etype word PDCK_NOTE enum PrefDialingCodeKey ; Note ini-key PDCK_CODE1 enum PrefDialingCodeKey ; Code1 ini-key PDCK_CODE2 enum PrefDialingCodeKey ; Code2 ini-key ; ; Data-structure of the info stored in the array ; PrefDCLArrayInfo struct PDCLAI_length word ; Length of the stored string PDCLAI_strLptr lptr.char ; lptr to str chunk PrefDCLArrayInfo ends PrefDialingCodeListFlags record PDCLIF_ABORT:1 ; a transaction was aborted so don't ; commit to the ini file PDCLIF_INITIALIZED:1 ; the list has already been initialized PDCLIF_DIRTIED:1 ; the list has been modified so needs ; saving :5 PrefDialingCodeListFlags end ;----------------------------------------------------------------------------- ; Instance data ;----------------------------------------------------------------------------- PDCLI_category lptr.char ; Ini category where all of the following keys are located. ; PDCLI_notesKey lptr.char ; The ini key indicating where the "notes" are stored. (NOTE: ; these "notes" will also serve as the moniker of the items in ; the list.) ; PDCLI_codeOneKey lptr.char ; The ini key indicating where the first set of "code" are ; stored. ; PDCLI_codeTwoKey lptr.char ; The ini key indicating where the second set of "code" are ; stored. ; PDCLI_notesArray lptr.char ; Pointer to the chunk array that will store all the "notes" ; while the Dialing Code dialog box in on screen. ; PDCLI_codeOneArray lptr.char ; Pointer to the chunk array that will store all of the first ; set of "code" while the Dialing Code dialog box in on ; screen. ; PDCLI_codeTwoArray lptr.char ; Pointer to the chunk array that will store all of the second ; set of "code" while the Dialing Code dialog box in on ; screen. ; PDCLI_notesTextObj optr ; This text object will receive the output of the selected ; item from the "notes" list. ; PDCLI_codeOneTextObj optr ; This text object will receive the output of the selected ; item from the "codeOne" list. ; PDCLI_codeTwoTextObj optr ; This text object will receive the output of the selected ; item from the "codeTwo" list. ; PDCLI_statusFlags PrefDialingCodeListFlags ; Indicates errors and other warnings. ; PrefItemGroupSpecialClass endc COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DerefInstanceDataDSDI %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Gets the instance data from the given object by dereferencing the object and adding the appropriate offset. PASS: *ds:si - ObjectClass classOffset - eg. CwordBoard_offset RETURN: ds:di - ptr to intance data DESTROYED: Nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- PT 6/24/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DerefInstanceDataDSDI macro classOffset ifb <classOffset> ErrMessage < DerefInstanceDataDSDI expects the class offset as an argument. > endif mov di, ds:[si] add di, ds:[di].&classOffset endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DerefInstanceDataDSBX %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Gets the instance data from the given object by dereferencing the object and adding the appropriate offset. PASS: *ds:si - ObjectClass classOffset - eg. CwordBoard_offset RETURN: ds:bx - ptr to intance data DESTROYED: Nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: none REVISION HISTORY: Name Date Description ---- ---- ----------- PT 7/25/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DerefInstanceDataDSBX macro classOffset ifb <classOffset> ErrMessage < DerefInstanceDataDSBX expects the class offset as an argument. > endif mov bx, ds:[si] add bx, ds:[bx].&classOffset endm
{'repo_name': 'bluewaysw/pcgeos', 'stars': '316', 'repo_language': 'Assembly', 'file_name': 'marble.goh', 'mime_type': 'text/plain', 'hash': 2506610026707613675, 'source_dataset': 'data'}
/* * 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.operator.aggregation; import com.facebook.airlift.stats.QuantileDigest; import com.facebook.presto.common.Page; import com.facebook.presto.common.block.Block; import com.facebook.presto.common.type.SqlVarbinary; import com.facebook.presto.common.type.StandardTypes; import com.facebook.presto.common.type.Type; import com.facebook.presto.metadata.FunctionManager; import com.google.common.primitives.Doubles; import com.google.common.primitives.Floats; import org.testng.annotations.Test; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import java.util.stream.LongStream; import static com.facebook.presto.block.BlockAssertions.createBlockOfReals; import static com.facebook.presto.block.BlockAssertions.createLongSequenceBlock; import static com.facebook.presto.block.BlockAssertions.createLongsBlock; import static com.facebook.presto.block.BlockAssertions.createRLEBlock; import static com.facebook.presto.block.BlockAssertions.createSequenceBlockOfReal; import static com.facebook.presto.common.type.BigintType.BIGINT; import static com.facebook.presto.common.type.DoubleType.DOUBLE; import static com.facebook.presto.common.type.RealType.REAL; import static com.facebook.presto.common.type.StandardTypes.QDIGEST; import static com.facebook.presto.operator.aggregation.AggregationTestUtils.assertAggregation; import static com.facebook.presto.operator.aggregation.FloatingPointBitsConverterUtil.doubleToSortableLong; import static com.facebook.presto.operator.aggregation.FloatingPointBitsConverterUtil.floatToSortableInt; import static com.facebook.presto.operator.aggregation.TestMergeQuantileDigestFunction.QDIGEST_EQUALITY; import static com.facebook.presto.sql.analyzer.TypeSignatureProvider.fromTypes; import static com.google.common.collect.ImmutableList.toImmutableList; import static java.lang.Double.NaN; public class TestQuantileDigestAggregationFunction extends TestStatisticalDigestAggregationFunction { private static final double STANDARD_ERROR = 0.01; protected double getParameter() { return STANDARD_ERROR; } @Test public void testRealsWithWeights() { testAggregationReal( createBlockOfReals(1.0F, null, 2.0F, null, 3.0F, null, 4.0F, null, 5.0F, null), createRLEBlock(1, 10), 0.01, 1.0F, 2.0F, 3.0F, 4.0F, 5.0F); testAggregationReal( createBlockOfReals(null, null, null, null, null), createRLEBlock(1, 5), NaN); testAggregationReal( createBlockOfReals(-1.0F, -2.0F, -3.0F, -4.0F, -5.0F, -6.0F, -7.0F, -8.0F, -9.0F, -10.0F), createRLEBlock(1, 10), 0.01, -1.0F, -2.0F, -3.0F, -4.0F, -5.0F, -6.0F, -7.0F, -8.0F, -9.0F, -10.0F); testAggregationReal( createBlockOfReals(1.0F, 2.0F, 3.0F, 4.0F, 5.0F, 6.0F, 7.0F, 8.0F, 9.0F, 10.0F), createRLEBlock(1, 10), 0.01, 1.0F, 2.0F, 3.0F, 4.0F, 5.0F, 6.0F, 7.0F, 8.0F, 9.0F, 10.0F); testAggregationReal( createBlockOfReals(), createRLEBlock(1, 0), NaN); testAggregationReal( createBlockOfReals(1.0F), createRLEBlock(1, 1), 0.01, 1.0F); testAggregationReal( createSequenceBlockOfReal(-1000, 1000), createRLEBlock(1, 2000), 0.01, Floats.toArray(LongStream.range(-1000, 1000).mapToObj(Float::new).collect(toImmutableList()))); } @Test public void testBigintsWithWeight() { testAggregationBigint( createLongsBlock(1L, null, 2L, null, 3L, null, 4L, null, 5L, null), createRLEBlock(1, 10), 0.01, 1, 2, 3, 4, 5); testAggregationBigint( createLongsBlock(null, null, null, null, null), createRLEBlock(1, 5), NaN); testAggregationBigint( createLongsBlock(-1, -2, -3, -4, -5, -6, -7, -8, -9, -10), createRLEBlock(1, 10), 0.01, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10); testAggregationBigint( createLongsBlock(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), createRLEBlock(1, 10), 0.01, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); testAggregationBigint( createLongsBlock(new int[] {}), createRLEBlock(1, 0), NaN); testAggregationBigint( createLongsBlock(1), createRLEBlock(1, 1), 0.01, 1); testAggregationBigint( createLongSequenceBlock(-1000, 1000), createRLEBlock(1, 2000), 0.01, LongStream.range(-1000, 1000).toArray()); } @Override protected InternalAggregationFunction getAggregationFunction(Type... type) { FunctionManager functionManager = METADATA.getFunctionManager(); return functionManager.getAggregateFunctionImplementation( functionManager.lookupFunction("qdigest_agg", fromTypes(type))); } private void testAggregationBigint(Block inputBlock, Block weightsBlock, double maxError, long... inputs) { // Test without weights and accuracy testAggregationBigints( getAggregationFunction(BIGINT), new Page(inputBlock), maxError, inputs); // Test with weights and without accuracy testAggregationBigints( getAggregationFunction(BIGINT, BIGINT), new Page(inputBlock, weightsBlock), maxError, inputs); // Test with weights and accuracy testAggregationBigints( getAggregationFunction(BIGINT, BIGINT, DOUBLE), new Page(inputBlock, weightsBlock, createRLEBlock(maxError, inputBlock.getPositionCount())), maxError, inputs); } private void testAggregationReal(Block longsBlock, Block weightsBlock, double maxError, float... inputs) { // Test without weights and accuracy testAggregationReal( getAggregationFunction(REAL), new Page(longsBlock), maxError, inputs); // Test with weights and without accuracy testAggregationReal( getAggregationFunction(REAL, BIGINT), new Page(longsBlock, weightsBlock), maxError, inputs); // Test with weights and accuracy testAggregationReal( getAggregationFunction(REAL, BIGINT, DOUBLE), new Page(longsBlock, weightsBlock, createRLEBlock(maxError, longsBlock.getPositionCount())), maxError, inputs); } private void testAggregationBigints(InternalAggregationFunction function, Page page, double maxError, long... inputs) { // aggregate level assertAggregation(function, QDIGEST_EQUALITY, "test multiple positions", page, getExpectedValueLongs(maxError, inputs)); // test scalars List<Long> rows = Arrays.stream(inputs).sorted().boxed().collect(Collectors.toList()); SqlVarbinary returned = (SqlVarbinary) AggregationTestUtils.aggregation(function, page); assertPercentileWithinError(QDIGEST, StandardTypes.BIGINT, returned, maxError, rows, 0.1, 0.5, 0.9, 0.99); } private void testAggregationReal(InternalAggregationFunction function, Page page, double maxError, float... inputs) { assertAggregation(function, QDIGEST_EQUALITY, "test multiple positions", page, getExpectedValuesFloats(maxError, inputs)); // test scalars List<Double> rows = Floats.asList(inputs).stream().sorted().map(Float::doubleValue).collect(Collectors.toList()); SqlVarbinary returned = (SqlVarbinary) AggregationTestUtils.aggregation(function, page); assertPercentileWithinError(QDIGEST, StandardTypes.REAL, returned, maxError, rows, 0.1, 0.5, 0.9, 0.99); } @Override protected void testAggregationDoubles(InternalAggregationFunction function, Page page, double maxError, double... inputs) { assertAggregation(function, QDIGEST_EQUALITY, "test multiple positions", page, getExpectedValueDoubles(maxError, inputs)); // test scalars List<Double> rows = Doubles.asList(inputs).stream().sorted().collect(Collectors.toList()); SqlVarbinary returned = (SqlVarbinary) AggregationTestUtils.aggregation(function, page); assertPercentileWithinError(QDIGEST, StandardTypes.DOUBLE, returned, maxError, rows, 0.1, 0.5, 0.9, 0.99); } private Object getExpectedValueLongs(double maxError, long... values) { if (values.length == 0) { return null; } QuantileDigest qdigest = new QuantileDigest(maxError); Arrays.stream(values).forEach(qdigest::add); return new SqlVarbinary(qdigest.serialize().getBytes()); } @Override protected Object getExpectedValueDoubles(double maxError, double... values) { if (values.length == 0) { return null; } QuantileDigest qdigest = new QuantileDigest(maxError); Arrays.stream(values).forEach(value -> qdigest.add(doubleToSortableLong(value))); return new SqlVarbinary(qdigest.serialize().getBytes()); } private Object getExpectedValuesFloats(double maxError, float... values) { if (values.length == 0) { return null; } QuantileDigest qdigest = new QuantileDigest(maxError); Floats.asList(values).forEach(value -> qdigest.add(floatToSortableInt(value))); return new SqlVarbinary(qdigest.serialize().getBytes()); } }
{'repo_name': 'prestodb/presto', 'stars': '10854', 'repo_language': 'Java', 'file_name': 'TestAlluxioCachingFileSystem.java', 'mime_type': 'text/x-java', 'hash': -6783834814836409007, 'source_dataset': 'data'}
require "pakyow/support/configurable" require "pakyow/support/deep_freeze" RSpec.shared_examples "configurable" do it "provides access to a setting defined without a default value" do object.setting :foo object.configure! expect(object.config.foo).to be_nil end it "provides access to a setting defined with a default value" do object.setting :foo, :bar object.configure! expect(object.config.foo).to be(:bar) end it "provides access to a setting defined with a block" do object.setting :foo do :bar end object.configure! expect(object.config.foo).to be(:bar) end it "provides access to the object being configured" do object.setting :name do self.name end object.configure! expect(object.config.name).to eq(:configurable) end it "fails when accessing an unknown setting" do object.configure! expect { object.config.foo }.to raise_error(NoMethodError) end it "converts to a hash" do object.setting :foo do :bar end object.configure! expect(object.config.to_h).to eq({:foo => :bar}) end it "responds to missing" do object.configurable :foo do setting :bar, :baz end object.configure! expect(object.config.respond_to?(:foo)).to be(true) expect(object.config.respond_to?(:bar)).to be(false) expect(object.config.foo.respond_to?(:bar)).to be(true) expect(object.config.foo.respond_to?(:baz)).to be(false) end describe "configuring for an environment" do before do object.setting :foo object.setting :bar object.setting :baz object.configure do config.foo = :global_foo config.baz = :global_baz end object.configure :specific do config.bar = :bar config.baz = :baz end object.configure :other do config.foo = :other_foo config.bar = :other_bar config.baz = :other_baz end object.configure!(environment) end let(:environment) { :specific } it "configures globally" do expect(object.config.foo).to eq(:global_foo) end it "configures for the environment" do expect(object.config.bar).to eq(:bar) end it "gives precedence to the environment" do expect(object.config.baz).to eq(:baz) end context "environment is not a symbol" do let(:environment) { "specific" } it "still configures" do expect(object.config.foo).to eq(:global_foo) expect(object.config.bar).to eq(:bar) expect(object.config.baz).to eq(:baz) end end end describe "memoization" do it "memoizes default values" do object.setting :foo, [] object.configure! object.config.foo << :bar object.config.foo << :baz expect(object.config.foo).to eq([:bar, :baz]) end it "memoizes values provided by blocks" do object.setting :foo do [] end object.configure! object.config.foo << :bar object.config.foo << :baz expect(object.config.foo).to eq([:bar, :baz]) end end describe "freezing" do using Pakyow::Support::DeepFreeze it "builds each value" do object.setting :foo, :bar object.configure! object.deep_freeze expect(object.config.foo).to eq(:bar) end end end RSpec.describe "configuring a class" do let :object do Class.new do include Pakyow::Support::Configurable def self.name :configurable end end end include_examples "configurable" end RSpec.describe "configuring a module" do let :object do Module.new do include Pakyow::Support::Configurable def self.name :configurable end end end include_examples "configurable" end
{'repo_name': 'pakyow/pakyow', 'stars': '831', 'repo_language': 'Ruby', 'file_name': 'xhr.js', 'mime_type': 'text/plain', 'hash': -8866362820176408699, 'source_dataset': 'data'}
# GENERATED FROM XML -- DO NOT EDIT URI: core.html.de Content-Language: de Content-type: text/html; charset=ISO-8859-1 URI: core.html.en.utf8 Content-Language: en Content-type: text/html; charset=UTF-8 URI: core.html.es.utf8 Content-Language: es Content-type: text/html; charset=UTF-8 URI: core.html.fr.utf8 Content-Language: fr Content-type: text/html; charset=UTF-8 URI: core.html.ja.utf8 Content-Language: ja Content-type: text/html; charset=UTF-8 URI: core.html.tr.utf8 Content-Language: tr Content-type: text/html; charset=UTF-8
{'repo_name': 'apache/httpd', 'stars': '2466', 'repo_language': 'C', 'file_name': 'worker.c', 'mime_type': 'text/x-c', 'hash': 6639933238604143509, 'source_dataset': 'data'}
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" version="1.0" exclude-result-prefixes="exsl"> <!-- ******************************************************************** $Id: profile-chunk.xsl 6910 2007-06-28 23:23:30Z xmldoc $ ******************************************************************** This file is part of the XSL DocBook Stylesheet distribution. See ../README or http://docbook.sf.net/release/xsl/current/ for copyright and other information. ******************************************************************** --> <!-- ==================================================================== --> <!-- First import the non-chunking templates that format elements within each chunk file. In a customization, you should create a separate non-chunking customization layer such as mydocbook.xsl that imports the original docbook.xsl and customizes any presentation templates. Then your chunking customization should import mydocbook.xsl instead of docbook.xsl. --> <xsl:import href="docbook.xsl"/> <!-- chunk-common.xsl contains all the named templates for chunking. In a customization file, you import chunk-common.xsl, then add any customized chunking templates of the same name. They will have import precedence over the original chunking templates in chunk-common.xsl. --> <xsl:import href="chunk-common.xsl"/> <!-- The manifest.xsl module is no longer imported because its templates were moved into chunk-common and chunk-code --> <!-- chunk-code.xsl contains all the chunking templates that use a match attribute. In a customization it should be referenced using <xsl:include> instead of <xsl:import>, and then add any customized chunking templates with match attributes. But be sure to add a priority="1" to such customized templates to resolve its conflict with the original, since they have the same import precedence. Using xsl:include prevents adding another layer of import precedence, which would cause any customizations that use xsl:apply-imports to wrongly apply the chunking version instead of the original non-chunking version to format an element. --> <xsl:include href="profile-chunk-code.xsl"/> </xsl:stylesheet>
{'repo_name': 'LCTT/LFS-BOOK', 'stars': '482', 'repo_language': 'XSLT', 'file_name': 'changelog.xml', 'mime_type': 'text/xml', 'hash': 3613756542293839963, 'source_dataset': 'data'}
// Copyright 2019 Yunion // // 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 shellutils // import "yunion.io/x/onecloud/pkg/util/shellutils"
{'repo_name': 'yunionio/onecloud', 'stars': '224', 'repo_language': 'Go', 'file_name': 'main.go', 'mime_type': 'text/x-c', 'hash': 7862836919974429563, 'source_dataset': 'data'}
/* * Copyright 2020 the original author or authors. * * 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 org.gradle.api.internal.changedetection.state import com.google.common.collect.ImmutableSet import org.gradle.api.internal.file.archive.ZipEntry import spock.lang.Specification class PropertiesFileZipEntryHasherTest extends Specification { ResourceEntryFilter propertyResourceFilter = new IgnoringResourceEntryFilter(ImmutableSet.copyOf("created-by", "पशुपतिरपि")) ZipEntryHasher filteredHasher = new PropertiesFileZipEntryHasher(propertyResourceFilter) ZipEntryHasher unfilteredHasher = new PropertiesFileZipEntryHasher(ResourceEntryFilter.FILTER_NOTHING) def "properties are case sensitive"() { given: def propertiesEntry1 = zipEntry(["Created-By": "1.8.0_232-b18 (Azul Systems, Inc.)"]) def propertiesEntry2 = zipEntry(["created-by": "1.8.0_232-b18 (Azul Systems, Inc.)"]) def hash1 = unfilteredHasher.hash(propertiesEntry1) def hash2 = unfilteredHasher.hash(propertiesEntry2) def hash3 = filteredHasher.hash(propertiesEntry1) def hash4 = filteredHasher.hash(propertiesEntry2) expect: hash1 != hash2 hash2 != hash4 hash3 != hash4 and: hash1 == hash3 } def "properties are normalized and filtered out"() { given: def propertiesEntry1 = zipEntry(["created-by": "1.8.0_232-b18 (Azul Systems, Inc.)", "foo": "true"]) def propertiesEntry2 = zipEntry(["created-by": "1.8.0_232-b15 (Azul Systems, Inc.)", "foo": "true"]) def hash1 = unfilteredHasher.hash(propertiesEntry1) def hash2 = unfilteredHasher.hash(propertiesEntry2) def hash3 = filteredHasher.hash(propertiesEntry1) def hash4 = filteredHasher.hash(propertiesEntry2) expect: hash1 != hash2 hash1 != hash3 hash2 != hash4 and: hash3 == hash4 } def "properties can have UTF-8 encoding"() { def propertiesEntry1 = zipEntry(["Created-By": "1.8.0_232-b18 (Azul Systems, Inc.)", "पशुपतिरपि": "some sanskrit", "तान्यहानि": "more sanskrit"]) def propertiesEntry2 = zipEntry(["Created-By": "1.8.0_232-b18 (Azul Systems, Inc.)", "पशुपतिरपि": "changed sanskrit", "तान्यहानि": "more sanskrit"]) def hash1 = unfilteredHasher.hash(propertiesEntry1) def hash2 = unfilteredHasher.hash(propertiesEntry2) def hash3 = filteredHasher.hash(propertiesEntry1) def hash4 = filteredHasher.hash(propertiesEntry2) expect: hash1 != hash2 hash1 != hash3 hash2 != hash4 and: hash3 == hash4 } def "properties are order insensitive"() { given: def propertiesEntry1 = zipEntry(["created-by": "1.8.0_232-b18 (Azul Systems, Inc.)", "foo": "true"]) def propertiesEntry2 = zipEntry(["foo": "true", "created-by": "1.8.0_232-b15 (Azul Systems, Inc.)"]) def hash1 = unfilteredHasher.hash(propertiesEntry1) def hash2 = unfilteredHasher.hash(propertiesEntry2) def hash3 = filteredHasher.hash(propertiesEntry1) def hash4 = filteredHasher.hash(propertiesEntry2) expect: hash1 != hash2 hash1 != hash3 hash2 != hash4 and: hash3 == hash4 } def "comments are always filtered out"() { def propertiesEntry1 = zipEntry(["foo": "true"], "Build information 1.0") def propertiesEntry2 = zipEntry(["foo": "true"], "Build information 1.1") def hash1 = unfilteredHasher.hash(propertiesEntry1) def hash2 = unfilteredHasher.hash(propertiesEntry2) def hash3 = filteredHasher.hash(propertiesEntry1) def hash4 = filteredHasher.hash(propertiesEntry2) expect: hash1 == hash2 hash1 == hash3 hash3 == hash4 } ZipEntryContext zipEntry(Map<String, String> attributes, String comments = "") { Properties properties = new Properties() properties.putAll(attributes) ByteArrayOutputStream bos = new ByteArrayOutputStream() properties.store(bos, comments) def zipEntry = new ZipEntry() { @Override boolean isDirectory() { return false } @Override String getName() { return "META-INF/build-info.properties" } @Override byte[] getContent() throws IOException { return bos.toByteArray() } @Override InputStream getInputStream() { return new ByteArrayInputStream(bos.toByteArray()) } @Override int size() { return bos.size() } } return new ZipEntryContext(zipEntry, "META-INF/build-info.properties", "foo.zip") } }
{'repo_name': 'gradle/gradle', 'stars': '10712', 'repo_language': 'Groovy', 'file_name': 'DefaultRuleActionAdapterTest.groovy', 'mime_type': 'text/plain', 'hash': -156827121724274425, 'source_dataset': 'data'}
export default function (babel) { const {types: t} = babel; /** * t.isFunctionExpression() || t.isArrowFunctionExpression() */ function isAnyFunctionExpression() { return t.isFunctionExpression.apply(t, arguments) || t.isArrowFunctionExpression.apply(t, arguments); } function isAction(node, actionIdentifier, mobxNamespaceIdentifier) { return (actionIdentifier && t.isIdentifier(node, {name: actionIdentifier})) || ( t.isMemberExpression(node) && t.isIdentifier(node.object, {name: 'action'}) && t.isIdentifier(node.property, {name: "bound"}) ) || ( mobxNamespaceIdentifier && t.isMemberExpression(node) && t.isIdentifier(node.object, {name: mobxNamespaceIdentifier}) && t.isIdentifier(node.property, {name: "action"}) ) } const traverseActionBody = { ["FunctionExpression|ArrowFunctionExpression"](path) { const actionIdentifier = this.actionIdentifier; const mobxNamespaceIdentifier = this.mobxNamespaceIdentifier; path.traverse(traverseActionBody, {actionIdentifier, mobxNamespaceIdentifier}) path.skip() // if current node parent is call expression and this call is action call, skip wrapping if (t.isCallExpression(path.parentPath.node) && isAction(path.parentPath.node.callee, actionIdentifier, mobxNamespaceIdentifier)) { return; } path.replaceWith(t.CallExpression( this.actionIdentifier ? t.Identifier(this.actionIdentifier) : t.MemberExpression(t.Identifier(this.mobxNamespaceIdentifier), t.Identifier("action")) , [path.node] )); } }; const traverseSibling = { CallExpression(path) { const node = path.node; const actionIdentifier = this.actionIdentifier; const mobxNamespaceIdentifier = this.mobxNamespaceIdentifier; if (isAction(node.callee, actionIdentifier, mobxNamespaceIdentifier)) { if (node.arguments.length === 1) { path.get('arguments.0').traverse(traverseActionBody, {actionIdentifier, mobxNamespaceIdentifier}) path.skip(); } else if (node.arguments.length === 2) { path.get('arguments.1').traverse(traverseActionBody, {actionIdentifier, mobxNamespaceIdentifier}) path.skip(); } } }, ["ClassMethod|ClassProperty"](path) { const actionIdentifier = this.actionIdentifier; const mobxNamespaceIdentifier = this.mobxNamespaceIdentifier; const explicitClasses = this.classes; const classDeclaration = path.findParent(p => p.isClassDeclaration()) // If there is an explicit classes with actions, handle them separately if ( explicitClasses && t.isIdentifier(classDeclaration.node.id) && void 0 !== explicitClasses[classDeclaration.node.id.name] && t.isClassMethod(path.node) && t.isIdentifier(path.node.key) && ( // all code inside constructor should be handled as action too, because it could contain other action creations path.node.key.name === "constructor" || void 0 !== explicitClasses[classDeclaration.node.id.name][path.node.key.name] ) ) { if (path.node.key.name === "constructor") { path.get('body').get('body').forEach(cPath => { if (cPath.isExpressionStatement()) { const exprPath = cPath.get('expression') if (exprPath.isAssignmentExpression() && exprPath.get('operator').node === '=') { const leftPath = exprPath.get('left') const rightPath = exprPath.get('right') if ( leftPath.isMemberExpression() && leftPath.get('object').isThisExpression() && leftPath.get('property').isIdentifier() && leftPath.get('property').node.name in explicitClasses[classDeclaration.node.id.name] && (rightPath.isArrowFunctionExpression() || rightPath.isFunctionExpression()) ) { rightPath.get('body').traverse(traverseActionBody, {actionIdentifier, mobxNamespaceIdentifier}) } } } }) } else { path.get('body').traverse(traverseActionBody, {actionIdentifier, mobxNamespaceIdentifier}) } path.skip(); } else if (path.node.decorators) { for (const {expression} of path.node.decorators) { if ( isAction(expression, actionIdentifier, mobxNamespaceIdentifier) || (t.isCallExpression(expression) && isAction(expression.callee, actionIdentifier, mobxNamespaceIdentifier)) ) { if (t.isClassMethod(path.node)) { path.get('body').traverse(traverseActionBody, {actionIdentifier, mobxNamespaceIdentifier}) path.skip(); } else if (t.isClassProperty(path.node)) { path.get('value').traverse(traverseActionBody, {actionIdentifier, mobxNamespaceIdentifier}) path.skip(); } } } } }, }; return { name: "mobx-deep-action-transform", visitor: { Program(path, state) { let actionIdentifier; let mobxNamespaceIdentifier; let tslibNamespaceIdentifier; const mobxPackage = state.opts && state.opts["mobx-package"] || "mobx" path.traverse({ ImportDeclaration(path) { if (path.node.source.value === mobxPackage) { for (const specifier of path.node.specifiers) { if (t.isImportNamespaceSpecifier(specifier) || (specifier.imported.name === "action")) { if (t.isImportNamespaceSpecifier(specifier)) { mobxNamespaceIdentifier = specifier.local.name; } else if (specifier.imported.name === "action") { actionIdentifier = specifier.local.name; } } } } if (path.node.source.value === "tslib") { for (const specifier of path.node.specifiers) { if (t.isImportNamespaceSpecifier(specifier)) { tslibNamespaceIdentifier = specifier.local.name } } } } }) const context = {actionIdentifier, mobxNamespaceIdentifier} path.traverse(traverseSibling, context) const toTraverse = []; /** * Lookup for typescript decorators, and handle them separately */ path.traverse({ CallExpression(path) { const node = path.node if ( t.isMemberExpression(node.callee) && t.isIdentifier(node.callee.object, {name: tslibNamespaceIdentifier}) && t.isIdentifier(node.callee.property, {name: "__decorate"}) && node.arguments.length === 4 && t.isArrayExpression(node.arguments[0]) && ( node.arguments[0].elements.some(e => ( t.isIdentifier(e, {name: actionIdentifier}) ) || ( t.isMemberExpression(e) && t.isIdentifier(e.object, {name: mobxNamespaceIdentifier}) && t.isIdentifier(e.property, {name: "action"}) ) || ( t.isCallExpression(e) && t.isIdentifier(e.callee, {name: actionIdentifier}) ) || ( t.isCallExpression(e) && t.isMemberExpression(e.callee) && t.isIdentifier(e.callee.object, {name: mobxNamespaceIdentifier}) && t.isIdentifier(e.callee.property, {name: "action"}) ) ) ) && t.isMemberExpression(node.arguments[1]) && t.isIdentifier(node.arguments[1].property, {name: "prototype"}) && t.isStringLiteral(node.arguments[2]) ) { const className = node.arguments[1].object.name const methodName = node.arguments[2].value const traversePath = path.getStatementParent().parentPath const existsTraverseRequest = toTraverse.find(e => e.path === traversePath) if (!existsTraverseRequest) { toTraverse.push({ path: traversePath, classes: { [className]: {[methodName]: methodName} } }) } else { const existsClassRequest = existsTraverseRequest.classes[className] if (!existsClassRequest) { existsTraverseRequest.classes[className] = {[methodName]: methodName} } else { existsTraverseRequest.classes[className][methodName] = methodName } } } } }) toTraverse.forEach(({path, classes}) => path.traverse(traverseSibling, {...context, classes})) }, } }; }
{'repo_name': 'mobxjs/babel-plugin-mobx-deep-action', 'stars': '108', 'repo_language': 'JavaScript', 'file_name': 'settings.json', 'mime_type': 'text/plain', 'hash': -602949387617636694, 'source_dataset': 'data'}
<?xml version='1.0' encoding='utf-8'?> <section xmlns="https://code.dccouncil.us/schemas/dc-library" xmlns:codified="https://code.dccouncil.us/schemas/codified" xmlns:codify="https://code.dccouncil.us/schemas/codify" xmlns:xi="http://www.w3.org/2001/XInclude" containing-doc="D.C. Code"> <num>29-202.05</num> <heading>Statement of merger; effective date.</heading> <para> <num>(a)</num> <text>A statement of merger shall be signed on behalf of each merging entity and delivered to the Mayor for filing.</text> </para> <para> <num>(b)</num> <text>A statement of merger shall contain:</text> <para> <num>(1)</num> <text>The name, jurisdiction of formation, and type of entity of each merging entity that is not the surviving entity;</text> </para> <para> <num>(2)</num> <text>The name, jurisdiction of formation, and type of entity of the surviving entity;</text> </para> <para> <num>(3)</num> <text>If the statement of merger is not to be effective upon filing, the later date and time on which it will become effective, which may not be more than 90 days after the date of filing;</text> </para> <para> <num>(4)</num> <text>A statement that the merger was approved by each domestic merging entity, if any, in accordance with this subchapter and by each foreign merging entity, if any, in accordance with the law of its jurisdiction of formation;</text> </para> <para> <num>(5)</num> <text>If the surviving entity exists before the merger and is a domestic filing entity, any amendment to its public organic record approved as part of the plan of merger;</text> </para> <para> <num>(6)</num> <text>If the surviving entity is created by the merger and is a domestic filing entity, its public organic document as an attachment;</text> </para> <para> <num>(7)</num> <text>If the surviving entity is created by the merger and is a domestic limited liability partnership, its statement of qualification as an attachment; and</text> </para> <para> <num>(8)</num> <text>If the surviving entity is a foreign entity that is not a registered foreign entity, a mailing address to which process may be served pursuant to <cite path="§29-202.06|(e)">§ 29-202.06(e)</cite>.</text> </para> </para> <para> <num>(c)</num> <text>In addition to the requirements of subsection (b) of this section, a statement of merger may contain any other provision not prohibited by law.</text> </para> <para> <num>(d)</num> <text>If the surviving entity is a domestic entity, its public organic record, if any, shall satisfy the requirements of the law of the District, except that it does not need to be signed and may omit any provision that is not required to be included in a restatement of the public organic record.</text> </para> <para> <num>(e)</num> <text>A plan of merger that is signed on behalf of all of the merging entities and meets all of the requirements of subsection (b) of this section may be delivered to the Mayor for filing instead of a statement of merger and, upon filing by the Mayor, shall have the same effect. If a plan of merger is filed as provided in this subsection, references in this chapter to a statement of merger refer to the plan of merger filed under this subsection.</text> </para> <para> <num>(f)</num> <text>A statement of merger shall be effective upon the date and time of filing or the later date and time specified in the statement of merger.</text> </para> <annotations> <annotation doc="D.C. Law 18-378" type="History">July 2, 2011, D.C. Law 18-378, § 2, 58 DCR 1720</annotation> <annotation doc="D.C. Law 19-210" type="History">Mar. 5, 2013, D.C. Law 19-210, § 2(b)(9), 59 DCR 13171</annotation> <annotation type="Editor's Notes">Application of Law 19-210: Section 7 of <cite doc="D.C. Law 19-210">D.C. Law 19-210</cite> provided that the act shall apply as of January 1, 2012.</annotation> <annotation type="Effect of Amendments">The 2013 amendment by <cite doc="D.C. Law 19-210">D.C. Law 19-210</cite> substituted “delivered to the Mayor for filing” for “filed with the Mayor” in (a) and (e); substituted “formation” for “organization” and “and type of entity” for “type” throughout (b); substituted “record” for “document” in (b)(5) and throughout (d); substituted “registered” for “qualified” in (b)(8); and added “by the Mayor” after “filing” in (e).</annotation> <annotation type="Section References">This section is referenced in <cite path="§29-201.02">§ 29-201.02</cite>.</annotation> </annotations> </section>
{'repo_name': 'DCCouncil/dc-law-xml', 'stars': '270', 'repo_language': 'None', 'file_name': 'codify_street_designation_anno.xml', 'mime_type': 'text/plain', 'hash': 799065248438417393, 'source_dataset': 'data'}
HtmlFile:test.html PsiElement(HTML_DOCUMENT) PsiElement(XML_PROLOG) <empty list> HtmlTag:a XmlToken:XML_START_TAG_START('<') XmlToken:XML_NAME('a') XmlToken:XML_EMPTY_ELEMENT_END('/>')
{'repo_name': 'JetBrains/intellij-plugins', 'stars': '1534', 'repo_language': 'Java', 'file_name': 'index.js', 'mime_type': 'text/plain', 'hash': 788382345716830821, 'source_dataset': 'data'}
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Finder; use Symfony\Component\Finder\Comparator\DateComparator; use Symfony\Component\Finder\Comparator\NumberComparator; use Symfony\Component\Finder\Iterator\CustomFilterIterator; use Symfony\Component\Finder\Iterator\DateRangeFilterIterator; use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator; use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator; use Symfony\Component\Finder\Iterator\FilecontentFilterIterator; use Symfony\Component\Finder\Iterator\FilenameFilterIterator; use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator; use Symfony\Component\Finder\Iterator\SortableIterator; /** * Finder allows to build rules to find files and directories. * * It is a thin wrapper around several specialized iterator classes. * * All rules may be invoked several times. * * All methods return the current Finder object to allow easy chaining: * * $finder = Finder::create()->files()->name('*.php')->in(__DIR__); * * @author Fabien Potencier <fabien@symfony.com> */ class Finder implements \IteratorAggregate, \Countable { const IGNORE_VCS_FILES = 1; const IGNORE_DOT_FILES = 2; private $mode = 0; private $names = array(); private $notNames = array(); private $exclude = array(); private $filters = array(); private $depths = array(); private $sizes = array(); private $followLinks = false; private $reverseSorting = false; private $sort = false; private $ignore = 0; private $dirs = array(); private $dates = array(); private $iterators = array(); private $contains = array(); private $notContains = array(); private $paths = array(); private $notPaths = array(); private $ignoreUnreadableDirs = false; private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg'); public function __construct() { $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES; } /** * Creates a new Finder. * * @return static */ public static function create() { return new static(); } /** * Restricts the matching to directories only. * * @return $this */ public function directories() { $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES; return $this; } /** * Restricts the matching to files only. * * @return $this */ public function files() { $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES; return $this; } /** * Adds tests for the directory depth. * * Usage: * * $finder->depth('> 1') // the Finder will start matching at level 1. * $finder->depth('< 3') // the Finder will descend at most 3 levels of directories below the starting point. * $finder->depth(['>= 1', '< 3']) * * @param string|int|string[]|int[] $levels The depth level expression or an array of depth levels * * @return $this * * @see DepthRangeFilterIterator * @see NumberComparator */ public function depth($levels) { foreach ((array) $levels as $level) { $this->depths[] = new Comparator\NumberComparator($level); } return $this; } /** * Adds tests for file dates (last modified). * * The date must be something that strtotime() is able to parse: * * $finder->date('since yesterday'); * $finder->date('until 2 days ago'); * $finder->date('> now - 2 hours'); * $finder->date('>= 2005-10-15'); * $finder->date(['>= 2005-10-15', '<= 2006-05-27']); * * @param string|string[] $dates A date range string or an array of date ranges * * @return $this * * @see strtotime * @see DateRangeFilterIterator * @see DateComparator */ public function date($dates) { foreach ((array) $dates as $date) { $this->dates[] = new Comparator\DateComparator($date); } return $this; } /** * Adds rules that files must match. * * You can use patterns (delimited with / sign), globs or simple strings. * * $finder->name('*.php') * $finder->name('/\.php$/') // same as above * $finder->name('test.php') * $finder->name(['test.py', 'test.php']) * * @param string|string[] $patterns A pattern (a regexp, a glob, or a string) or an array of patterns * * @return $this * * @see FilenameFilterIterator */ public function name($patterns) { $this->names = \array_merge($this->names, (array) $patterns); return $this; } /** * Adds rules that files must not match. * * @param string|string[] $patterns A pattern (a regexp, a glob, or a string) or an array of patterns * * @return $this * * @see FilenameFilterIterator */ public function notName($patterns) { $this->notNames = \array_merge($this->notNames, (array) $patterns); return $this; } /** * Adds tests that file contents must match. * * Strings or PCRE patterns can be used: * * $finder->contains('Lorem ipsum') * $finder->contains('/Lorem ipsum/i') * $finder->contains(['dolor', '/ipsum/i']) * * @param string|string[] $patterns A pattern (string or regexp) or an array of patterns * * @return $this * * @see FilecontentFilterIterator */ public function contains($patterns) { $this->contains = \array_merge($this->contains, (array) $patterns); return $this; } /** * Adds tests that file contents must not match. * * Strings or PCRE patterns can be used: * * $finder->notContains('Lorem ipsum') * $finder->notContains('/Lorem ipsum/i') * $finder->notContains(['lorem', '/dolor/i']) * * @param string|string[] $patterns A pattern (string or regexp) or an array of patterns * * @return $this * * @see FilecontentFilterIterator */ public function notContains($patterns) { $this->notContains = \array_merge($this->notContains, (array) $patterns); return $this; } /** * Adds rules that filenames must match. * * You can use patterns (delimited with / sign) or simple strings. * * $finder->path('some/special/dir') * $finder->path('/some\/special\/dir/') // same as above * $finder->path(['some dir', 'another/dir']) * * Use only / as dirname separator. * * @param string|string[] $patterns A pattern (a regexp or a string) or an array of patterns * * @return $this * * @see FilenameFilterIterator */ public function path($patterns) { $this->paths = \array_merge($this->paths, (array) $patterns); return $this; } /** * Adds rules that filenames must not match. * * You can use patterns (delimited with / sign) or simple strings. * * $finder->notPath('some/special/dir') * $finder->notPath('/some\/special\/dir/') // same as above * $finder->notPath(['some/file.txt', 'another/file.log']) * * Use only / as dirname separator. * * @param string|string[] $patterns A pattern (a regexp or a string) or an array of patterns * * @return $this * * @see FilenameFilterIterator */ public function notPath($patterns) { $this->notPaths = \array_merge($this->notPaths, (array) $patterns); return $this; } /** * Adds tests for file sizes. * * $finder->size('> 10K'); * $finder->size('<= 1Ki'); * $finder->size(4); * $finder->size(['> 10K', '< 20K']) * * @param string|int|string[]|int[] $sizes A size range string or an integer or an array of size ranges * * @return $this * * @see SizeRangeFilterIterator * @see NumberComparator */ public function size($sizes) { foreach ((array) $sizes as $size) { $this->sizes[] = new Comparator\NumberComparator($size); } return $this; } /** * Excludes directories. * * Directories passed as argument must be relative to the ones defined with the `in()` method. For example: * * $finder->in(__DIR__)->exclude('ruby'); * * @param string|array $dirs A directory path or an array of directories * * @return $this * * @see ExcludeDirectoryFilterIterator */ public function exclude($dirs) { $this->exclude = array_merge($this->exclude, (array) $dirs); return $this; } /** * Excludes "hidden" directories and files (starting with a dot). * * This option is enabled by default. * * @param bool $ignoreDotFiles Whether to exclude "hidden" files or not * * @return $this * * @see ExcludeDirectoryFilterIterator */ public function ignoreDotFiles($ignoreDotFiles) { if ($ignoreDotFiles) { $this->ignore |= static::IGNORE_DOT_FILES; } else { $this->ignore &= ~static::IGNORE_DOT_FILES; } return $this; } /** * Forces the finder to ignore version control directories. * * This option is enabled by default. * * @param bool $ignoreVCS Whether to exclude VCS files or not * * @return $this * * @see ExcludeDirectoryFilterIterator */ public function ignoreVCS($ignoreVCS) { if ($ignoreVCS) { $this->ignore |= static::IGNORE_VCS_FILES; } else { $this->ignore &= ~static::IGNORE_VCS_FILES; } return $this; } /** * Adds VCS patterns. * * @see ignoreVCS() * * @param string|string[] $pattern VCS patterns to ignore */ public static function addVCSPattern($pattern) { foreach ((array) $pattern as $p) { self::$vcsPatterns[] = $p; } self::$vcsPatterns = array_unique(self::$vcsPatterns); } /** * Sorts files and directories by an anonymous function. * * The anonymous function receives two \SplFileInfo instances to compare. * * This can be slow as all the matching files and directories must be retrieved for comparison. * * @return $this * * @see SortableIterator */ public function sort(\Closure $closure) { $this->sort = $closure; return $this; } /** * Sorts files and directories by name. * * This can be slow as all the matching files and directories must be retrieved for comparison. * * @param bool $useNaturalSort Whether to use natural sort or not, disabled by default * * @return $this * * @see SortableIterator */ public function sortByName(/* bool $useNaturalSort = false */) { if (\func_num_args() < 1 && __CLASS__ !== \get_class($this) && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface) { @trigger_error(sprintf('The "%s()" method will have a new "bool $useNaturalSort = false" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); } $useNaturalSort = 0 < \func_num_args() && func_get_arg(0); $this->sort = $useNaturalSort ? Iterator\SortableIterator::SORT_BY_NAME_NATURAL : Iterator\SortableIterator::SORT_BY_NAME; return $this; } /** * Sorts files and directories by type (directories before files), then by name. * * This can be slow as all the matching files and directories must be retrieved for comparison. * * @return $this * * @see SortableIterator */ public function sortByType() { $this->sort = Iterator\SortableIterator::SORT_BY_TYPE; return $this; } /** * Sorts files and directories by the last accessed time. * * This is the time that the file was last accessed, read or written to. * * This can be slow as all the matching files and directories must be retrieved for comparison. * * @return $this * * @see SortableIterator */ public function sortByAccessedTime() { $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME; return $this; } /** * Reverses the sorting. * * @return $this */ public function reverseSorting() { $this->reverseSorting = true; return $this; } /** * Sorts files and directories by the last inode changed time. * * This is the time that the inode information was last modified (permissions, owner, group or other metadata). * * On Windows, since inode is not available, changed time is actually the file creation time. * * This can be slow as all the matching files and directories must be retrieved for comparison. * * @return $this * * @see SortableIterator */ public function sortByChangedTime() { $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME; return $this; } /** * Sorts files and directories by the last modified time. * * This is the last time the actual contents of the file were last modified. * * This can be slow as all the matching files and directories must be retrieved for comparison. * * @return $this * * @see SortableIterator */ public function sortByModifiedTime() { $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME; return $this; } /** * Filters the iterator with an anonymous function. * * The anonymous function receives a \SplFileInfo and must return false * to remove files. * * @return $this * * @see CustomFilterIterator */ public function filter(\Closure $closure) { $this->filters[] = $closure; return $this; } /** * Forces the following of symlinks. * * @return $this */ public function followLinks() { $this->followLinks = true; return $this; } /** * Tells finder to ignore unreadable directories. * * By default, scanning unreadable directories content throws an AccessDeniedException. * * @param bool $ignore * * @return $this */ public function ignoreUnreadableDirs($ignore = true) { $this->ignoreUnreadableDirs = (bool) $ignore; return $this; } /** * Searches files and directories which match defined rules. * * @param string|array $dirs A directory path or an array of directories * * @return $this * * @throws \InvalidArgumentException if one of the directories does not exist */ public function in($dirs) { $resolvedDirs = array(); foreach ((array) $dirs as $dir) { if (is_dir($dir)) { $resolvedDirs[] = $this->normalizeDir($dir); } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) { $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob)); } else { throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir)); } } $this->dirs = array_merge($this->dirs, $resolvedDirs); return $this; } /** * Returns an Iterator for the current Finder configuration. * * This method implements the IteratorAggregate interface. * * @return \Iterator|SplFileInfo[] An iterator * * @throws \LogicException if the in() method has not been called */ public function getIterator() { if (0 === \count($this->dirs) && 0 === \count($this->iterators)) { throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.'); } if (1 === \count($this->dirs) && 0 === \count($this->iterators)) { return $this->searchInDirectory($this->dirs[0]); } $iterator = new \AppendIterator(); foreach ($this->dirs as $dir) { $iterator->append($this->searchInDirectory($dir)); } foreach ($this->iterators as $it) { $iterator->append($it); } return $iterator; } /** * Appends an existing set of files/directories to the finder. * * The set can be another Finder, an Iterator, an IteratorAggregate, or even a plain array. * * @param iterable $iterator * * @return $this * * @throws \InvalidArgumentException when the given argument is not iterable */ public function append($iterator) { if ($iterator instanceof \IteratorAggregate) { $this->iterators[] = $iterator->getIterator(); } elseif ($iterator instanceof \Iterator) { $this->iterators[] = $iterator; } elseif ($iterator instanceof \Traversable || \is_array($iterator)) { $it = new \ArrayIterator(); foreach ($iterator as $file) { $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file)); } $this->iterators[] = $it; } else { throw new \InvalidArgumentException('Finder::append() method wrong argument type.'); } return $this; } /** * Check if the any results were found. * * @return bool */ public function hasResults() { foreach ($this->getIterator() as $_) { return true; } return false; } /** * Counts all the results collected by the iterators. * * @return int */ public function count() { return iterator_count($this->getIterator()); } private function searchInDirectory(string $dir): \Iterator { if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) { $this->exclude = array_merge($this->exclude, self::$vcsPatterns); } if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) { $this->notPaths[] = '#(^|/)\..+(/|$)#'; } $minDepth = 0; $maxDepth = PHP_INT_MAX; foreach ($this->depths as $comparator) { switch ($comparator->getOperator()) { case '>': $minDepth = $comparator->getTarget() + 1; break; case '>=': $minDepth = $comparator->getTarget(); break; case '<': $maxDepth = $comparator->getTarget() - 1; break; case '<=': $maxDepth = $comparator->getTarget(); break; default: $minDepth = $maxDepth = $comparator->getTarget(); } } $flags = \RecursiveDirectoryIterator::SKIP_DOTS; if ($this->followLinks) { $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS; } $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs); if ($this->exclude) { $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude); } $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST); if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) { $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth); } if ($this->mode) { $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode); } if ($this->names || $this->notNames) { $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames); } if ($this->contains || $this->notContains) { $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains); } if ($this->sizes) { $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes); } if ($this->dates) { $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates); } if ($this->filters) { $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters); } if ($this->paths || $this->notPaths) { $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths); } if ($this->sort || $this->reverseSorting) { $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting); $iterator = $iteratorAggregate->getIterator(); } return $iterator; } /** * Normalizes given directory names by removing trailing slashes. * * Excluding: (s)ftp:// wrapper * * @param string $dir * * @return string */ private function normalizeDir($dir) { $dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR); if (preg_match('#^s?ftp://#', $dir)) { $dir .= '/'; } return $dir; } }
{'repo_name': 'woann/chat', 'stars': '208', 'repo_language': 'PHP', 'file_name': 'demo-1.js', 'mime_type': 'text/plain', 'hash': 8988814944044646015, 'source_dataset': 'data'}
{ stdenv, fetchurl, nixosTests }: stdenv.mkDerivation rec { pname = "wordpress"; version = "5.4.2"; src = fetchurl { url = "https://wordpress.org/${pname}-${version}.tar.gz"; sha256 = "1pnl11yws2r2d5dfq0z85zcy5ilvm298bfs7h9z1sjakkwkh5sph"; }; installPhase = '' mkdir -p $out/share/wordpress cp -r . $out/share/wordpress ''; passthru.tests = { inherit (nixosTests) wordpress; }; meta = with stdenv.lib; { homepage = "https://wordpress.org"; description = "WordPress is open source software you can use to create a beautiful website, blog, or app"; license = [ licenses.gpl2 ]; maintainers = [ maintainers.basvandijk ]; platforms = platforms.all; }; }
{'repo_name': 'NixOS/nixpkgs', 'stars': '5317', 'repo_language': 'Nix', 'file_name': 'default.nix', 'mime_type': 'text/plain', 'hash': -8440326741828802564, 'source_dataset': 'data'}
<?xml version="1.0" encoding="ISO-8859-1"?> <!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, ~ software distributed under the License is distributed on an ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~ KIND, either express or implied. See the License for the ~ specific language governing permissions and limitations ~ under the License. --> <configuration> <version>2</version> <managedRepositories> <managedRepository> <id>internal</id> <name>Archiva Managed Internal Repository</name> <location>${appserver.base}/repositories/internal</location> <indexDir>${appserver.base}/repositories/internal/.indexer</indexDir> <layout>default</layout> <releases>true</releases> <snapshots>false</snapshots> <blockRedeployments>false</blockRedeployments> <scanned>true</scanned> <refreshCronExpression>0 0 * * * ?</refreshCronExpression> <daysOlder>30</daysOlder> </managedRepository> <managedRepository> <id>snapshots</id> <name>Archiva Managed Snapshot Repository</name> <location>${appserver.base}/repositories/snapshots</location> <indexDir>${appserver.base}/repositories/snapshots/.indexer</indexDir> <layout>default</layout> <releases>false</releases> <snapshots>true</snapshots> <blockRedeployments>false</blockRedeployments> <scanned>true</scanned> <refreshCronExpression>0 0\,30 * * * ?</refreshCronExpression> <daysOlder>30</daysOlder> </managedRepository> </managedRepositories> <repositoryScanning> <fileTypes> <fileType> <id>artifacts</id> <patterns> <pattern>**/*.pom</pattern> <pattern>**/*.jar</pattern> <pattern>**/*.ear</pattern> <pattern>**/*.war</pattern> <pattern>**/*.car</pattern> <pattern>**/*.sar</pattern> <pattern>**/*.mar</pattern> <pattern>**/*.rar</pattern> <pattern>**/*.dtd</pattern> <pattern>**/*.tld</pattern> <pattern>**/*.tar.gz</pattern> <pattern>**/*.tar.bz2</pattern> <pattern>**/*.zip</pattern> </patterns> </fileType> <fileType> <id>indexable-content</id> <patterns> <pattern>**/*.txt</pattern> <pattern>**/*.TXT</pattern> <pattern>**/*.block</pattern> <pattern>**/*.config</pattern> <pattern>**/*.pom</pattern> <pattern>**/*.xml</pattern> <pattern>**/*.xsd</pattern> <pattern>**/*.dtd</pattern> <pattern>**/*.tld</pattern> </patterns> </fileType> <fileType> <id>auto-remove</id> <patterns> <pattern>**/*.bak</pattern> <pattern>**/*~</pattern> <pattern>**/*-</pattern> </patterns> </fileType> <fileType> <id>ignored</id> <patterns> <pattern>**/.htaccess</pattern> <pattern>**/KEYS</pattern> <pattern>**/*.rb</pattern> <pattern>**/*.sh</pattern> <pattern>**/.svn/**</pattern> <pattern>**/.DAV/**</pattern> </patterns> </fileType> </fileTypes> <knownContentConsumers> <knownContentConsumer>update-db-artifact</knownContentConsumer> <knownContentConsumer>create-missing-checksums</knownContentConsumer> <knownContentConsumer>update-db-repository-metadata</knownContentConsumer> <knownContentConsumer>validate-checksum</knownContentConsumer> <knownContentConsumer>validate-signature</knownContentConsumer> <knownContentConsumer>index-content</knownContentConsumer> <knownContentConsumer>auto-remove</knownContentConsumer> <knownContentConsumer>auto-rename</knownContentConsumer> </knownContentConsumers> <invalidContentConsumers> <invalidContentConsumer>update-db-bad-content</invalidContentConsumer> </invalidContentConsumers> </repositoryScanning> <databaseScanning> <cronExpression>0 0 * * * ?</cronExpression> <unprocessedConsumers> <unprocessedConsumer>index-artifact</unprocessedConsumer> <unprocessedConsumer>update-db-project</unprocessedConsumer> <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer> <unprocessedConsumer>index-archive-toc</unprocessedConsumer> <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer> <unprocessedConsumer>index-public-methods</unprocessedConsumer> </unprocessedConsumers> <cleanupConsumers> <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer> <cleanupConsumer>not-present-remove-db-project</cleanupConsumer> <cleanupConsumer>not-present-remove-indexed</cleanupConsumer> </cleanupConsumers> </databaseScanning> </configuration>
{'repo_name': 'apache/archiva', 'stars': '262', 'repo_language': 'Java', 'file_name': 'index.xml', 'mime_type': 'text/xml', 'hash': -8440921332888815305, 'source_dataset': 'data'}
commit 4bae615022cb5a5da79ccda83cc6c9ba9f2d479c Author: Joseph Myers <joseph@codesourcery.com> Date: Wed Nov 22 18:44:23 2017 +0000 Avoid use of strlen in getlogin_r (bug 22447). Building glibc with current mainline GCC fails, among other reasons, because of an error for use of strlen on the nonstring ut_user field. This patch changes the problem code in getlogin_r to use __strnlen instead. It also needs to set the trailing NUL byte of the result explicitly, because of the case where ut_user does not have such a trailing NUL byte (but the result should always have one). Tested for x86_64. Also tested that, in conjunction with <https://sourceware.org/ml/libc-alpha/2017-11/msg00797.html>, it fixes the build for arm with mainline GCC. [BZ #22447] * sysdeps/unix/getlogin_r.c (__getlogin_r): Use __strnlen not strlen to compute length of ut_user and set trailing NUL byte of result explicitly. --- sysdeps/unix/getlogin_r.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/sysdeps/unix/getlogin_r.c +++ b/sysdeps/unix/getlogin_r.c @@ -82,7 +82,7 @@ if (result == 0) { - size_t needed = strlen (ut->ut_user) + 1; + size_t needed = __strnlen (ut->ut_user, UT_NAMESIZE) + 1; if (needed > name_len) { @@ -91,7 +91,8 @@ } else { - memcpy (name, ut->ut_user, needed); + memcpy (name, ut->ut_user, needed - 1); + name[needed - 1] = 0; result = 0; } }
{'repo_name': 'hanwckf/rt-n56u', 'stars': '1587', 'repo_language': 'C', 'file_name': 'ak4396.h', 'mime_type': 'text/x-c', 'hash': -8847686544809907383, 'source_dataset': 'data'}
{ "images" : [ { "idiom" : "universal", "filename" : "crop_1_1.png", "scale" : "1x" }, { "idiom" : "universal", "scale" : "2x" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } }
{'repo_name': '3tinkers/TKImageView', 'stars': '341', 'repo_language': 'Objective-C', 'file_name': 'contents.xcworkspacedata', 'mime_type': 'text/xml', 'hash': 3672061855928708392, 'source_dataset': 'data'}
package com.vogella.android.firebaseexample; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; public class MainActivity extends Activity { // Firebase instance variables private FirebaseAuth firebaseAuthentication; private FirebaseUser firebaseUser; private String username; private String photoUrl; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); firebaseAuthentication = FirebaseAuth.getInstance(); firebaseUser = firebaseAuthentication.getCurrentUser(); if (firebaseUser == null) { // Not signed in, launch the Sign In activity startActivity(new Intent(this, SignInActivity.class)); finish(); return; } else { username = firebaseUser.getDisplayName(); if (firebaseUser.getPhotoUrl() != null) { photoUrl = firebaseUser.getPhotoUrl().toString(); } } } }
{'repo_name': 'vogellacompany/codeexamples-android', 'stars': '486', 'repo_language': 'Java', 'file_name': 'org.eclipse.jdt.core.prefs', 'mime_type': 'text/plain', 'hash': 181425419506976138, 'source_dataset': 'data'}
{ "5f075ae3e1f9d0382bb8c4632991f96f": "Go", "b66367e07d66d23c7b374944048a48fd": "https://github.com/godaddy-wordpress/go", "45a0bfab2afddc3488bc5271244f2706": "Το Go είναι ένα πρωτοποριακό θέμα για το WordPress με προτεραιότητα στο Gutenberg, με ιδιαίτερη έμφαση στο να δίνει τη δυνατότητα στους σχεδιαστές να κατασκευάζουν πανέμορφες και πλούσιες σελίδες με το WordPress.", "ab0a2ad2de4a8df6663bbcb8fd532f46": "GoDaddy", "14f0fd22288f6490c67087be904ab544": "https://www.godaddy.com", "2b63489305859743e2a0ff1f1fc3d44e": "Your installation of the Go theme is incomplete. If you installed the Go theme from GitHub, please refer to this document to set up your development environment: %1$s", "eb6248e0e51d886d0a025adb479163e9": "Your installation of the Go theme is incomplete. If you installed the Go theme from GitHub, please refer to <a href=\"%1$s\" target=\"_blank\" rel=\"noopener noreferrer\">this document</a> to set up your development environment.", "074de7e7c226d5c60f8af14c20725352": "Κύριο", "7aaf0c93c9323c3379ede972e0950896": "Μενού υποσέλιδου αρ. 1", "be18b79db515eef9e3b22ff01a0af98e": "Μενού υποσέλιδου αρ. 2", "c3349428ccc248d1af8335f5851adfcd": "Μενού υποσέλιδου αρ. 3", "5bf57e0fcef61ba61afc7a88a17b1f71": "Μια σκέψη για το &ldquo;%s&rdquo;", "f22ad85909b230935593b8d269b2b86b": "%1$s σκέψη για το &ldquo;%2$s&rdquo;", "221b94a7f866d10d0b85b7886cea5d18": "Πλοήγηση στα σχόλια", "2379d290e577d6407518769a6a2cad3a": "&larr; Παλιότερα σχόλια", "4c42ccb4e8de473e402d55dc5c21a5c6": "Νεότερα σχόλια &rarr;", "496c558a09bbbcfc869aa80b2f037261": "Τα σχόλια είναι απενεργοποιημένα.", "9974c35dfcc9e4f36d959eb0b93ea83b": "Brutalist", "f5a9b6ae4126df72b50eb6118c8af6d9": "Millennial", "d6adc10909c4132ba3ffea033e777e44": "Φούξια", "b58273f254c2c7fb86624e9d41c35651": "Μετάβαση απευθείας στο περιεχόμενο", "c1b5fa03ecdb95d4a45dd1c40b02527f": "Οριζόντια", "106aecf314c1888e3d36a4edc6f5de01": "collapse child menu", "c6bbcc7f5459e2a48fa1be3c32bb25af": "expand child menu", "8d496fe225b423ae91cafb2913fe60fc": "Εγκατάσταση απαιτούμενων προσθέτων", "4eff3a34f0ddf963f7d0610d3cb79354": "Εγκατάσταση προσθέτων", "07867e5fd7b858b877323ffd402ac38e": "Γίνεται εγκατάσταση προσθέτου: %s", "6775d2cf31e189555413105bc4de5e63": "Γίνεται ενημέρωση προσθέτου: %s", "a5971f89797a3dc6d0b203dc73e74aeb": "Κάτι πήγε στραβά με το API του προσθέτου.", "6129ae156fb09631943bd7abda907f53": "Για αυτό το θέμα απαιτείται το παρακάτω πρόσθετο: %1$s.", "540aa63f32b7c02925ac675a0c5192c0": "Για αυτό το θέμα προτείνεται το παρακάτω πρόσθετο: %1$s.", "01097764834f55dcdc69d5599a779949": "Το παρακάτω πρόσθετο πρέπει να ενημερωθεί στην τελευταία του έκδοση ώστε να εξασφαλιστεί μέγιστη συμβατότητα με αυτό το θέμα: %1$s.", "0f8e41124b9bda740786e48fd248440d": "Υπάρχει μια διαθέσιμη ενημέρωση για το: %1$s.", "2c4f12eb0f240287f07622f045ce1054": "Το παρακάτω απαιτούμενο πρόσθετο είναι προς το παρόν ανενεργό: %1$s.", "483561eadcfc9dbd24f28ecab12436c7": "Το παρακάτω προτεινόμενο πρόσθετο είναι προς το παρόν ανενεργό: %1$s.", "412f5c3aedb4cf643dc16e46d7bbe32d": "Έναρξη εγκατάστασης προσθέτου", "ba68c40ac159a5acad0d184df058ac97": "Έναρξη ενημέρωσης προσθέτου", "621f65f745c1eaaf2535b3e55319259f": "Έναρξη ενεργοποίησης προσθέτου", "bb885c3eedde441b8398dbc9586e09b5": "Επιστροφή στον εγκαταστάτη απαιτούμενων προσθέτων", "5ab741fb6675b5c6bb34dc16996a53bd": "Επιστροφή στη διαχείριση", "37829e778cf85fe234ef2d80be24527a": "Το πρόσθετο ενεργοποιήθηκε με επιτυχία.", "5a088d527373890f64540c7e47a89df5": "Το παρακάτω πρόσθετο ενεργοποιήθηκε με επιτυχία:", "8b22c7f3c16ad269acd401fb7d9db35a": "Δεν έγινε καμία ενέργεια. Το πρόσθετο %1$s ήταν ήδη ενεργό.", "b4100ea853d762a3924ca18fa8680ba2": "Το πρόσθετο δεν ενεργοποιήθηκε. Χρειάζεται νεότερη έκδοση του προσθέτου %s για αυτό το θέμα. Ενημερώστε το πρόσθετο.", "3c48d813eb0b1f244fa131cc5de6be0e": "Όλα τα πρόσθετα εγκαταστάθηκαν και ενεργοποιήθηκαν με επιτυχία. %1$s", "3146b03cfc1c9f2fc7110fb73f7307de": "Κλείσιμο αυτού του μηνύματος", "d364fb426c947babf1d67df9e36523e1": "Υπάρχουν ένα ή περισσότερα απαιτούμενα ή προτεινόμενα πρόσθετα για εγκατάσταση, ενημέρωση ή ενεργοποίηση.", "d5a441c680bd89a8c32768c2caa4fe77": "Επικοινωνήστε με τον διαχειριστή αυτού του ιστότοπου για βοήθεια.", "657b74f6fd4ba4f8f694b30c05009c16": "Αυτό το πρόσθετο πρέπει να ενημερωθεί για να είναι συμβατό με το θέμα σας.", "aaf83959b5747c06b5cd53fc22f63390": "Απαιτείται ενημέρωση", "fca4795f2c2f8a8b496ca5e7419bb54a": "Το πακέτο του απομακρυσμένου προσθέτου δεν περιέχει φάκελο με το επιθυμητό σύντομο όνομα και η μετονομασία δεν είχε αποτέλεσμα.", "bb29545b68b66e79e7a5c3573a0fdc7f": "Επικοινωνήστε με τον πάροχο του προσθέτου και ζητήστε του να δημιουργήσει πακέτο του προσθέτου σύμφωνα με τις κατευθυντήριες γραμμές του WordPress.", "58d5fd7cdf545224a930d7b9d059fad3": "Το πακέτο του απομακρυσμένου προσθέτου αποτελείται από περισσότερα από ένα αρχεία, αλλά τα αρχεία δεν είναι συσκευασμένα μέσα σε φάκελο.", "be5d5d37542d75f93a87094459f76678": "και", "93a14746fccf11d84b17b66d8ede812c": "TGMPA v%s", "b651efdb98a5d6bd2b3935d0c3f4a5e2": "Απαιτείται", "654866693fd91ce8e9764a218f569918": "Προτείνεται", "1f595cbbf20d9305968ef706e97d3105": "Αποθετήριο WordPress", "df6d8ea725c83d85194e03ee5d86cd6c": "Εξωτερική πηγή", "0b75c554830973695016efb11cdf1504": "Προ-συσκευασμένο", "ddd8eef6f86868a07f62b0e3810711f0": "Μη εγκατεστημένο", "5996488c02e895d82c39733547ede973": "Εγκατεστημένο αλλά όχι ενεργοποιημένο", "4d3d769b812b6faa6b76e1a8abaece2d": "Ενεργό", "56f86712ba4f8686c8c5dfe1c8609649": "Απαιτείται μη διαθέσιμη ενημέρωση", "50541f6698d7220ddb930ccbb050e4ec": "Απαιτεί ενημέρωση", "4aeef8c1b1367ceeabafca62ef3ddaf5": "Προτείνεται ενημέρωση", "b024db677e7a3544f4024465dd1b5081": "%1$s, %2$s", "0bc4a1fa03e297756bfd365acb035200": "Και τα <span class=\"count\">(%s)</span>", "9c8500a6e682bf2ebb0b374d6e90f08b": "Προς εγκατάσταση <span class=\"count\">(%s)</span>", "d62b8e9701342bcb5e7025210bbe4775": "Διαθέσιμη ενημέρωση <span class=\"count\">(%s)</span>", "7390d724ef0335d8c41749667f334177": "Προς ενεργοποίηση <span class=\"count\">(%s)</span>", "ad921d60486366258809553a3db49a4a": "άγνωστο", "416faa92dbbbc3b74be0dcb5d6314052": "Εγκατεστημένη έκδοση:", "ef4198d0c49b3b1cc787d79d69e5a8bc": "Ελάχιστη απαιτούμενη έκδοση:", "d122edb5d91c246aba401b99c20683e2": "Διαθέσιμη έκδοση:", "6d147e1e4adafa6bf0882450d48e9fec": "Δεν υπάρχουν πρόσθετα για εγκατάσταση, ενημέρωση ή ενεργοποίηση.", "409c1892b68cb394799262ac57f6d4f1": "Ενημερώσεις προσθέτων", "f31bbdd1b3e85bccd652680e16935819": "Προέλευση", "a1fa27779242b4902f7ae3bdd5c6d508": "Τύπος", "34b6cd75171affba6957e308dcbd92be": "Έκδοση", "ec53a8c4f07baed5d8825072c89799be": "Κατάσταση", "63e2bc8d23f826ac7a87f9c63aaa9cd0": "Εγκατάσταση του %2$s", "30a47c48bc396796ee5f6d5521b71dda": "Ενημέρωση του %2$s", "3d2b3af061f0ad743561232ea9fe1ad2": "Ενεργοποίηση του %2$s", "fe14a1a82858d426bd698bfd336d3d49": "Μήνυμα αναβάθμισης από τον συντάκτη του προσθέτου:", "349838fb1d851d3e2014b9fe39203275": "Εγκατάσταση", "06933067aafd48425d67bcb01bba5cb6": "Ενημέρωση", "a13367a8e2a3f3bf4f3409079e3fdf87": "Ενεργοποίηση", "92dd49659bcab42087fd5ca92ff478c6": "Δεν έχουν επιλεγεί πρόσθετα για εγκατάσταση. Δεν έγινε καμία ενέργεια.", "b8a5a076175d4a807e0bed3caedc2a4b": "Δεν έχουν επιλεγεί πρόσθετα για ενημέρωση. Δεν έγινε καμία ενέργεια.", "31892b3c81fc5642c8080b4a25f429ee": "Δεν υπάρχουν διαθέσιμα πρόσθετα για εγκατάσταση προς το παρόν.", "c3fa68f1a18fe25ac48b7b0b3242ddcc": "Δεν υπάρχουν διαθέσιμα πρόσθετα για ενημέρωση προς το παρόν.", "03b30c31d71dd6e0f601169e5051ce01": "Δεν έχουν επιλεγεί πρόσθετα για ενεργοποίηση. Δεν έγινε καμία ενέργεια.", "1646015930dff0c9b9af0f7132d25376": "Δεν υπάρχουν διαθέσιμα πρόσθετα για ενεργοποίηση προς το παρόν.", "edc3d85dac34a37710b4a9c2e24b8b75": "Η ενεργοποίηση του προσθέτου απέτυχε.", "0efdbbd67a26af3f2097acaa0b9a21e9": "Γίνεται ενημέρωση του προσθέτου %1$s (%2$d/%3$d)", "2ef4da25e6e03ae8e862d7689b2ba554": "Προέκυψε σφάλμα κατά την εγκατάσταση του προσθέτου %1$s: <strong>%2$s</strong>.", "630ad046884e381655ca1fccd0667601": "Η εγκατάσταση του προσθέτου %1$s απέτυχε.", "370eb8fcb15bff522689322a97ab88f7": "Η διαδικασία εγκατάστασης και ενεργοποίησης ξεκινά. Σε ορισμένες περιπτώσεις, αυτή η διαδικασία ίσως διαρκέσει αρκετά, για αυτό κάντε λίγο υπομονή.", "b2c308c165b8f7aa1e51da66dab37826": "Το πρόσθετο %1$s εγκαταστάθηκε και ενεργοποιήθηκε με επιτυχία.", "06c883a79771ecda24de1687ed7915ba": "Προβολή λεπτομερειών", "7c5fb72b2ab0d57476a8b930a59f0650": "Απόκρυψη λεπτομερειών", "a612d8f63518b69a843a62347bef74f4": "Όλες οι εγκαταστάσεις και ενεργοποιήσεις ολοκληρώθηκαν.", "de6d25fb7d974d4e615b386367ff986f": "Γίνεται εγκατάσταση και ενεργοποίηση του προσθέτου %1$s (%2$d/%3$d)", "071037479108e80816f433d094a06632": "Η διαδικασία εγκατάστασης ξεκινά. Σε ορισμένες περιπτώσεις, αυτή η διαδικασία ίσως διαρκέσει αρκετά, για αυτό κάντε λίγο υπομονή.", "0b8c1d6179d1c4a20f002d67dc49bc0c": "Το πρόσθετο %1$s εγκαταστάθηκε με επιτυχία.", "003b8672b471e60c83cb28552f948625": "Όλες οι εγκαταστάσεις ολοκληρώθηκαν.", "4cee13af8289e47431d5b934e6ecd69f": "Γίνεται εγκατάσταση του προσθέτου %1$s: (%2$d/%3$d)", "2660064e68655415da2628c2ae2f7592": "Μικρό", "5dbc98dcc983a70728bd082d1a47546e": "S", "87f8a6ab85c9ced3702b4ea641ad4bb5": "Μεσαίο", "69691c7bdcc3ce6d5d8a1361f22d04ac": "M", "3a69b34ce86dacb205936a8094f6c743": "Μεγάλο", "d20caec3b48a1eef164cb4ca81ba2587": "L", "a2ad65f28a717b0fd2be860a0d8e5c3e": "Τεράστιο", "a7a4ccc5e1a068d87f4965e014329201": "XL", "0c7d6cf19426e01dcfa32434828ed266": "Δεύτερου επιπέδου", "0521727bc2cea17905e963461d5a0f19": "Τρίτου επιπέδου", "c217982fe63eec047710cfffdebe2218": "Τετάρτου επιπέδου", "965c66786344ce30cf8f3e657910594b": "Primary to Secondary", "de7c6c0f0a18e7e09c42d5faf8f945f0": "Primary to Tertiary", "1041bbc7db334295048208656a73b2cf": "Primary to Background", "84b7fbbc9302c08b150354eb19429a75": "Secondary to Tertiary", "1bfbcce75c3c9a52a464d4cb0984488a": "Παραδοσιακά", "f055923cf23e41b26df5fe1b28c40d1c": "Βερίκοκο", "0b6e98d660e2901c33333347da37ad36": "Σμαράγδι", "1ff97d8cde3a648c648fd044b54916b9": "Τούβλο", "a0df72576daf9a1137d39f7553d36e82": "Χάλκινο", "ad1c9cd3e7b07e2c364c985f73188054": "Σύγχρονη", "1c749862591cbbc9e4609d7a10288f49": "Σκιά", "8b7b9806e715b01b9021912e0f86935f": "Λουλακί", "501a92c9b793cb44dfbfe0ca9ffee563": "Ειρηνικός", "ed5d1978bec6557ee1fb56ea04c82e47": "Μοδάτο", "93df2c41a9abe4a797371f5c761adbfe": "Δαμασκηνί", "4668112d7c5f80a73a826dd8150989df": "Χάλυβας", "42ae2d145ddd8555e9c2a7a1da9c8d0f": "Αβοκάντο", "89b49e95b5604105c04f218f3e560380": "Σαμπάνια", "70841bb9368ce1e5ce312a8fa7e47e10": "Καλωσόρισμα", "ac12ee4aedb176eb73ce3f6c0d1e9036": "Δάσος", "0d5079b088aebbde820dfa1e3790cc89": "Έλατο", "6d309d764aefcda1d279eb3a32d3e7f7": "Mocha", "e346c232ce72c429ea0995de9f63f551": "Λεβάντα", "7eaa58547a5f7ca615c75491124e8929": "Παιχνιδιάρικο", "c17bc04e709e07381e1b991cb4e9d29d": "Παιχνίδισμα", "61db47dac8aefe03fc67ee1b65ecd8f6": "Κοραλί", "7b291551dc64b95a2c0e172d009384fc": "Οργανικό", "d9d40472f2eed7b7d72bac108c1ef57b": "Μούρο", "4fbedaa7aa52043452fc4adba2488729": "Κεφαλίδα 1", "23cc3182eb650e18fd0c817a1304ae56": "Κεφαλίδα 2", "0e0dccf4aa1c53321c361193d696fafc": "Κεφαλίδα 3", "24210ed27bc371a9070b8e970fc343c5": "Κεφαλίδα 4", "b960eb3519790d13a33348f60a95000f": "Υποσέλιδο 1", "77b01c45cf16f7b6d627fea6bf8f5d17": "Υποσέλιδο 2", "9a916bca2f53405524c5467058f78fde": "Υποσέλιδο 3", "cf64efb396b872a492aff56944cf469b": "Υποσέλιδο 4", "d85544fce402c7a2a96a48078edaf203": "Facebook", "2491bc9c7d8731e1ae33124093bc7026": "Twitter", "55f015a0c5605702f913536afe70cfb0": "Instagram", "e884c507c5198a4578a84498f7a323e2": "LinkedIn", "86709a608bd914b28221164e6680ebf7": "Pinterest", "8dd1bae8da2e2408210d0656fbe6b7d1": "YouTube", "d3b7c913cd04ebfec0e9ec32cb6fd58c": "GitHub", "e27721c74d54c8f57cc581c680a0143b": "Δεν είναι δυνατή η εύρεση αυτής της σελίδας", "04cc2ca3a963a638a60162312fa1bb72": "Αναζήτηση για: %s", "795d59a96adcde416d31c5b1b6fae364": "Δεν βρέθηκε τίποτα", "fc54c47b449b067575842a9d49bcf71a": "Αντιστοιχίστε ένα μενού στη θέση μενού %s", "32954654ac8fe66a1d09be19001de2d4": "Πλάτος", "320b8c4699152b882bbf171e0bf567f0": "Πλάτος για κινητά", "225e92a29a578d4ab13cebc9d40e4c1e": "Ρυθμίσεις ιστότοπου", "0788de47c0f48f512564f551a796f888": "Τίτλοι σελίδας", "bb74fb7d72a4cb101f0fbdc48057a279": "Display page titles on individual pages that are not individually opted-out.", "72dfcaa2598cb5deaf61b8042148d07d": "Blog Excerpt", "3bbbf17425375547eda0d048450d3253": "Use post excerpts on the blog page.", "847bc3bdd70d4f17eb04bac2b378455d": "Κείμενο copyright", "c551fef0bdcf0fd755100caafe7f93c7": "Στυλ σχεδίασης", "31029597bb352af3508cd607cc741a08": "Επιλέξτε ένα στυλ, επιλέξτε έναν συνδυασμό χρωμάτων και προσαρμόστε τα χρώματα για να εξατομικεύσετε τον ιστότοπό σας.", "d8c42b8bd0d94b14ac75ca433526e5d1": "Color scheme", "053ead99b35b6193a2e4e14a373b6a91": "Header Colors", "82ec577cdd6fdebc0f444d83d7624df1": "Customize colors within the site header.", "a9ded1e5ce5d75814730bb4caaf49419": "Background", "45bd1d5b32931106efbf1a82fe6a732f": "Foreground", "0a361a92f0beae69f82ea87c625128ba": "Footer Colors", "4fb6d9220ab42e54bc559ed7bb3cae61": "Customize colors within the site footer.", "0101316665d4f82adaa26d86fbbb2d6e": "Heading", "bda2db21792487966664a4de3519e223": "Social Icon", "8d1554ae8e848f4f565925d93644d32d": "Additional Design Controls", "f3acc5beb7e21a795b1570325cdaf3da": "Customize additional design settings.", "211bd1a9ea45b24f911f086d2b662ce8": "Site Spacing", "bf50d5e661106d0abe925af3c2e6f7e7": "Κεφαλίδα", "37b1bf60e553008bcedd478e67593137": "Επιλέξτε μια κεφαλίδα για κάθε σελίδα στον ιστότοπό σας και προσαρμόστε το στυλ της με τις παρακάτω διαθέσιμες επιλογές.", "ded40f2a77c30efc6062db0cbd857746": "Υποσέλιδο", "6a5ab4488121720fbf5f2d78ed020d29": "Επιλέξτε ένα υποσέλιδο για κάθε σελίδα στον ιστότοπό σας και προσαρμόστε το στυλ του με τις παρακάτω διαθέσιμες επιλογές.", "f431e17ea0081a3c9e51fc240221ee21": "Κοινωνικά δίκτυα", "6ae6cf1e7822e72032ead26ee64fd57c": "Add social media account links to apply social icons on the site footer.", "0532a578e0729366b9e83865968a772e": "Social icon", "88cc3e49eec1f0e371bc7279ecb2cc19": "Menu Behavior", "cf5399c516989ddb623b83ade29d9cdb": "Show sub menus on hover.", "e4c85852ac4dc9e9533185ec9a7790bb": "Show sub menu items on hover.", "c4747322a3ed87e45d90ceb23b7ea641": "Σχεδίαση ιστότοπου", "13644746d31d36d1b0ac4daf2bd9f814": "Παράθεμα:", "a4a149c62d8238973112920f8d30034b": "(Τροποποίηση)", "ba5f41bc2f6e3a6edf594d1878426799": "Συντάκτης άρθρου", "5862ba6b9399ea36ab7d486f299754c8": "%1$s στις %2$s", "6954378552054e698cfff1a52b0eca9d": "Το σχόλιό σας πρόκειται να υποβληθεί σε έλεγχο.", "7dce122004969d56ae2e0245cb754d35": "Επεξεργασία", "25d8df6e580905091a0d5ef5b9e05bf0": "Απάντηση", "29503bd4f9fd280f19f44ddd7331ef28": "Συντάκτης: %s", "bec60391604287aee5be8e970f2486a6": "Ημερομηνία άρθρου", "af1b98adf7f686b84cd0b443e022b7a0": "Κατηγορίες", "efeb369cccbd560588a756610865664c": "Σε", "189f63f277cd73395561651753563065": "Ετικέτες", "15422d54ec0d47000dc86a9820a5237e": "Προβεβλημένα", "b61541208db7fa7dba42c85224405911": "Μενού", "2b81f8f425c6f22b8d869ee405833e25": "Εναλλαγή αναζήτησης", "1f522a2fa180c6b03a80139148f74f13": "Hide Page Title.", "57c1fee9db05c07a96c99d9260d38d6d": "Προβολή καλαθιού αγορών", "8af832276de7faddcccbe98e59eee754": "Κλείσιμο πλευρικής στήλης", "a85eba4c6c699122b2bb1387ea4813ad": "Καλάθι αγορών", "ebf652dcbefde665f0a2d85ba6e4abac": "%s προϊόν στο καλάθι αγορών σας", "877300276a72c788dc01d357238b515b": "Το καλάθι αγορών σας είναι προς το παρόν άδειο.", "5fc420fd34e997fe8e43852cf7ff7af0": "Προηγούμενο άρθρο: ", "dd1f775e443ff3b9a89270713580a51b": "Προηγούμενο", "3f9f291d150226d28162f044ec8f28b9": "Επόμενο άρθρο:", "10ac3d04253ef7e1ddc73e6091c0cd55": "Επόμενο", "0557fa923dcee4d0f86b1409f5c2167f": "Επιστροφή", "d2254f8d50d0aa681adb55adc343772c": "Επαναφορά επιλογών", "b3a76772ac3c36c9e9900f8461982e07": "Είστε έτοιμοι για να δημοσιεύσετε το πρώτο σας άρθρο; <a href=\"%1$s\">Ξεκινήστε εδώ.</a>", "5c3bca668b5bc916ab17f331d87eb746": "Λυπούμαστε, αλλά τίποτα δεν ταιριάζει με τους όρους αναζήτησης. Δοκιμάστε ξανά την αναζήτηση με διαφορετικές λέξεις-κλειδιά.", "ed1c0bdc3bfe37ae24499e6fb8e379d4": "Μάλλον δεν μπορούμε να βρούμε αυτό που ψάχνετε. Ίσως μπορεί να σας βοηθήσει η αναζήτηση.", "193cfc9be3b995831c6af2fea6650e60": "Σελίδα", "0974d2c2f4c6420089275c2a41c4b41c": "Σελίδες:", "a9f45e0f2d55afaf3c89b67ddb6156f9": "Μενού υποσέλιδου", "4e99885f27345ffcbe9f7d55255b9a3f": "Μενού κύριου υποσέλιδου", "06174e793e1ad39e9027fabbf7e2cc02": "Μενού υποσέλιδου δευτέρου επιπέδου", "9e04d3b3a7ef4141df9ef5c2400cc00a": "Μενού υποσέλιδου τρίτου επιπέδου", "8f7f4c1ce7a4f933663d10543562b096": "About", "a57649eeff67bdd590971ecd52424979": "Hi, I’m Everett", "596d0fc2bdc960f87d99d09fe2e0b4c9": "A tenacious, loving and energetic photographer who enjoys grabbing her camera and running out to take some photos.", "73c24767740c6f31cf730b57b65e65e8": "Work With Me", "18f2ae2bda9a34f06975d5c124643168": "Image description", "bd26ebabe55bf88f39a776528dcb7d47": "Early on", "c265536d7d6b3d1e9528f3b86a38e4bb": "I am so fascinated by photography and it’s capability to bring your imagination to amazing places. Early on, I fell in love with the idea of filming my own productions, so I set out to learn everything I could.", "222a267cc5778206b253be35ee3ddab5": "Current", "d7a35651572926e86e3323ff6bec92f5": "I have been teaching myself filmmaking for the past four and a half years and I’m still learning every day. I am building my business as a freelance filmmaker, as well as working on my own photo shoots.", "ad53a688bc13a3ceee6e3c26ce3a478c": "Protecting yourself", "4e564a84d78ef7209ba6fb5bee8eb85c": "Miller &amp; Cole is tremendously proud of the impact that we have made in helping our clients by providing quality legal services and exceptional service.", "97fcd908b61f462e5209f68fee8084a7": "Quality Results", "a9c6e89226308bf67e1c6d37d916c1b0": "Our goal is to create assets from our clients’ innovations through patent, trademark and copyright law.&nbsp; We take great pride in providing quality trademark legal services and exceptional customer service every single day.", "9d80c25533b671d3d7acc6077886e524": "Experienced", "e5edd86c3876699e4effe5f3b1a5810a": "The attorneys at Miller &amp; Cole work as a team to exceed each of our clients’ expectations. We have 30+ years of high-level experience helping businesses protecting the time, money and resources spent developing ideas and inventions.", "bbaff12800505b22a853e8b7f4eb6a22": "Contact", "77786d69049cec1be313bb63e0cd090c": "Office => (555) 555-5555<br>email@example.com", "ce5bf551379459c1c61d2a204061c455": "Location", "6bee6a3145035f6a394b23fec45bc39e": "123 Example Rd<br>Scottsdale, AZ 85260", "49ab28040dfa07f53544970c6d147e1e": "Connect", "d800c82567c9c825b3ce6d32765822d8": "<a href=\"https://twitter.com\">Twitter</a><br><a href=\"https://www.facebook.com\">Facebook</a><br>", "343c3f326d92f78853023f3cd3b4133c": "Let's get in touch", "516f29c39dd15c961a74414e4a9369d5": "Well hello there, wonderful, fabulous&nbsp;you!&nbsp;If you’d like to get in touch with me, please feel free to give me a call at (555) 555-5555, or send a message with the form down below. Either way, I'll be in touch shortly!", "9cfc9b74983d504ec71db33967591249": "Contact Us", "c2caf9df3a874dbaa2b004e4c3a148d9": "\"I appreciate Everett's ability to compose visually stunning photos, brining my memories to live every time I look at them.\"", "3065e1d546f612e5e0bee8df4a1faf13": "- Larina H.", "578641f6a254ada6b06ec7f0d0de004a": "\"Everett should be nominated for photographer of the year. I am so pleased with her photography at my wedding.\"", "04c543f32baa142e5fd6d73eaa9d441d": "- Kam V.", "dbcb8d317443aef2cb5e21301c4524c0": "\"Everett knew exactly how to pull the best of me out, and into a beautiful portrait. I'm so glad I met Everett!\"", "bd62a1c08d8b9dcd780e5fcd12b426d5": "- Jerri S.", "28d46b023f9c1c9548ffdd6acd9dd0c5": "Studio Gym<br>123 Example Rd, Scottsdale, AZ 85260<br>(555) 555-5555", "6a7e73161603d87b26a8eac49dab0a9c": "Hours", "ff6289679621e379af4cb205e162f1a5": "Mon-Fri => 8:00 - 21:00<br>Sat => 8:00 - 20:00<br>Sun => 10:00 - 14:00", "339f7a2e087a159e6a31501649027a77": "Homepage", "9deb79aa2673c64c4dd6e6f448429119": "Where the hustle slows, the rhythm is heard, and the beans are fantastic", "7b2c53095062da3a730b09c296f2de4d": "Enjoy Live Music + the Best Coffee You've Ever Had", "2fd2dd1c7bb86dbac0679c5e7571be6e": "Connecting audience + artist in our lush, speakeasy-style listening room. Only 50 seats available for this sought-after scene.", "4a8684386afc20eb3c7ed0b46e862012": "A social house", "60e196bdf560a116729f36f5a4a75da1": "With our guides' experience, we will not only get you to where the fish are - but we'll get you hooked on them too. Our crew is knowledgeable and friendly - ready to take you on the trip of your dreams.", "bb72e2e99f86c7f636b7cd149e09d4e8": "A listening room", "9a9630f7f40ab8888c35b9e51e32347f": "Folks have fought some monster bluefin tuna on standup gear with our offshore fishing packager, which is an incredible challenge for sure! Stick to the shoreline and test your strength pulling in some biggies!", "5dfc0b434585f95130b93667f7e7c470": "Our approach reflects the people we serve. We are diverse, yet the same.", "f5395c9793af8a11b406ca7c1ac70da9": "Learn More", "4ccaeda10d46b8eddf024bf70f0ecbda": "When we set up shop with an espresso machine up front and a roaster in the back, we hoped to some day be a part of New York's rich tradition of service and culinary achievement. Everyday this aspiration drives us.", "f1355c42c67a64e5c4464127e0c3ff5d": "The city's energy binds us together. It drives us to be the best.", "d1d2aa8a612cfd9d5c6cbc345ce0c76b": "This fairly new coffee shop, conveniently located in downtown Scottsdale, is one of the best coffee shops I've ever been to, and trust me when I say, I've been to many. The owners and the staff will make you feel like an old friend or even family.", "c17148c365ce0aa304a6857c4dac4f32": "Grab a cup", "387abe8697b2407a76ea0c604a338656": "Bringing the finest culinary food from the heart of Asia directly to you", "67a23ea99550e4b0a811fbd382ee4f2b": "View our Menu", "3d9547265b255a0bea1358358cdd2842": "<strong>Sushi Nakazawa</strong>&nbsp;serves the&nbsp;<em>omakase</em>&nbsp;of&nbsp;<strong>Chef Daisuke Nakazawa</strong>. Within the twenty-course meal lies Chef Nakazawa’s passion for sushi. With ingredients sourced both domestically and internationally, the chef crafts a very special tasting menu within the style of Edomae sushi. Chef Nakazawa is a strong believer in the food he serves representing the waters he is surrounded by, so only the best and freshest find its way to your plate.", "63fbc969213eadbe5377b4adc53ac975": "The relaxed dining experience at Sushi Nakazawa is chic nonetheless. High back leather chairs at the sushi bar coddle you while each course is explained in detail, and every nuance is revealed. Whether an Edomae novice or self-proclaimed sushi foodie, you will leave with a feeling of euphoria.", "f481ae7362d0b466e1ae5e03527e7091": "Authentic", "5a3f3b41bc6ef56ef4cbf5b47e272bd8": "The relaxed dining experience at Bento is chic and airy. High back chairs at the sushi bar coddle you for each course.", "1df940294e43cce1f43fe5cd4e103b94": "Historical", "ce37a88f0568f6b43c239f9cf014d16c": "Write title...", "f8177095183f19f9a738784d3f891324": "Housed in the original Yami House, the history behind Bento is amazing. Learn more as you dine in our historical dining room.", "95a8a3926d15d1252641bd1de9eb9f7f": "Best-rated", "ce8ca30d569641ad1f0a0bc603071a3b": "Bento is one of the best-rated restaurants in the region. With glamourous food and delicious drinks - you won't want to miss out!", "0b3efd337c6f97f0f40775eb97cde29e": "Bento, Steak &amp; Sushi", "adaa50211c1cb392a63d15a41f75dc4a": "123 Example Rd", "b192b122b18558c7abba8f72bc42e872": "Scottsdale, AZ 85260", "88497539356974df1c84efccd78c4cbb": "Reservations", "ec2f9d0d8833ed595922ea3a6fc0fd03": "Hello! We're a", "e08ac4c4e111ba6183a717d2019df79c": "Branding &amp; Digital Design<br>Studio in Tokyo", "6d734835896854e25a2e022f63c61efa": "Let's Talk", "4967fde615084bca557d71783b0bb361": "Need our help?", "34e9868d69870363e0e57acd76002911": "We Create Brands and Inspire Experiences", "55e6e4b1b55445fe47dce6f99efa479e": "Welcome to Salt", "1d4d94d9f9869c85a3b81fd280c2005d": "For over forty years Salt has been known for its luxury lobster, steamed clams, barbecued chicken and homemade clam chowder. Stop on by and grab some of the most incredible seafood you'll ever taste.", "7972c6da1562a8e1d378715503eb73b3": "Food &amp; Hours", "8d7c6b2603a1bd484f077645b232f0c3": "Ocean to Plate", "57c3beb6d502f602fa21ff4e8e6d9b1e": "Add feature title...", "f1b19e05d4ef9fb2f9d72dcf3d4948f9": "Cajun &amp; creole seafood cuisine, never frozen - delish", "e86688f48b710fe6ed8e199c3d3cf0d0": "See Menu", "78f1edacc65ec1b0c1bb29c462bce0e7": "Dine with Us", "3a843c5503127774f76f2e6a211ca7cc": "Mon - Thurs => 5pm - 11pm<br> Fri-Sat => 5pm - Midnight", "ff96ef62c5a8977b2c139155d89c372a": "Dine in", "e5f6696fe35a80686e78bd72bd59ca17": "Catering", "f9253199f38be604b4a4b0eb9fb4e7d5": "We cater all events from family reunions, to weddings", "ba98f96f5bef5b86050a6e809ffbd7bc": "Add feature content", "d4f859a96c13f551a2771b7fc3a78d38": "Portfolio", "5c93310dd0291e121181e830cdda892e": "Gallery", "6e4edd3015a0cfae1b0a481aaddbc28f": "Νεότερα <span class=\"nav-short\">άρθρα</span>", "60fedf85a70d0e6151a988c7d207b457": "Παλαιότερα <span class=\"nav-short\">άρθρα</span>", "75ecaaafd1f677d07360709be6528768": "Αναζήτηση για:", "29042a31d997c996f52c1d2fd4ad813d": "Αναζήτηση &hellip;", "a4d3b161ce1309df1c4e25df28694b7b": "Υποβολή", "0e979c88b3a83cc4da445e3dc2a06213": "Hide page title" }
{'repo_name': 'godaddy-wordpress/go', 'stars': '152', 'repo_language': 'PHP', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': 8446653701511556066, 'source_dataset': 'data'}
#include "pch.h" #include "rthsTypes.h" namespace rths { void GlobalSettings::enableDebugFlag(DebugFlag v) { debug_flags = debug_flags | (uint32_t)v; } void GlobalSettings::disableDebugFlag(DebugFlag v) { debug_flags = debug_flags & (~(uint32_t)v); } bool GlobalSettings::hasDebugFlag(DebugFlag v) const { return (debug_flags & (uint32_t)v) != 0; } bool GlobalSettings::hasFlag(GlobalFlag v) const { return (flags & (uint32_t)v) != 0; } GlobalSettings& GetGlobals() { static GlobalSettings s_globals; return s_globals; } static std::vector<std::function<void()>> g_deferred_commands, g_deferred_commands_tmp; static std::mutex g_mutex_deferred_commands; template<class Body> inline void DeferredCommandsLock(const Body& body) { std::unique_lock<std::mutex> l(g_mutex_deferred_commands); body(); } void AddDeferredCommand(const std::function<void()>& v) { DeferredCommandsLock([&v]() { g_deferred_commands.push_back(v); }); } void FlushDeferredCommands() { DeferredCommandsLock([]() { g_deferred_commands.swap(g_deferred_commands_tmp); }); for (auto& f : g_deferred_commands_tmp) f(); g_deferred_commands_tmp.clear(); } bool SkinData::valid() const { return !bindposes.empty() && !bone_counts.empty() && !weights.empty(); } void CallOnMeshDelete(MeshData *mesh); void CallOnMeshInstanceDelete(MeshInstanceData *inst); void CallOnRenderTargetDelete(RenderTargetData *rt); MeshData::MeshData() { } MeshData::~MeshData() { CallOnMeshDelete(this); } void MeshData::release() { ExternalRelease(this); } bool MeshData::valid() const { return this && ( (gpu_vertex_buffer != nullptr && gpu_index_buffer != nullptr) || (cpu_vertex_buffer != nullptr && cpu_index_buffer != nullptr) ); } bool MeshData::isRelocated() const { return device_data && device_data->isRelocated(); } MeshInstanceData::MeshInstanceData() { } MeshInstanceData::~MeshInstanceData() { CallOnMeshInstanceDelete(this); } void MeshInstanceData::release() { ExternalRelease(this); } bool MeshInstanceData::valid() const { return this && mesh->valid(); } bool MeshInstanceData::isUpdated(UpdateFlag v) const { return (update_flags & uint32_t(v)) != 0; } void MeshInstanceData::clearUpdateFlags() { update_flags = 0; } void MeshInstanceData::markUpdated(UpdateFlag v) { update_flags |= (uint32_t)v; } void MeshInstanceData::markUpdated() { if (mesh) { markUpdated(UpdateFlag::Transform); if (mesh->skin.valid()) markUpdated(UpdateFlag::Bones); if (!mesh->blendshapes.empty()) markUpdated(UpdateFlag::Blendshape); } } bool MeshInstanceData::hasFlag(InstanceFlag v) const { return (instance_flags & uint32_t(v)) != 0; } void MeshInstanceData::setTransform(const float4x4 &v) { if (transform != v) { transform = v; markUpdated(UpdateFlag::Transform); } } void MeshInstanceData::setBones(const float4x4 *v, size_t n) { if (bones.size() != n) markUpdated(UpdateFlag::Bones); if (n == 0) { bones.clear(); } else { if (bones.size() == n && !std::equal(v, v + n, bones.data())) markUpdated(UpdateFlag::Bones); bones.assign(v, v + n); } } void MeshInstanceData::setBlendshapeWeights(const float *v, size_t n) { if (blendshape_weights.size() != n) markUpdated(UpdateFlag::Blendshape); if (n == 0) { blendshape_weights.clear(); } else { if (blendshape_weights.size() == n && !std::equal(v, v + n, blendshape_weights.data())) markUpdated(UpdateFlag::Blendshape); blendshape_weights.assign(v, v + n); } } void MeshInstanceData::setFlags(uint32_t v) { if (instance_flags != v) { markUpdated(UpdateFlag::Flags); instance_flags = v; } } void MeshInstanceData::setLayer(uint32_t v) { if (layer != v) { markUpdated(UpdateFlag::Flags); layer = v; } } RenderTargetData::RenderTargetData() { } RenderTargetData::~RenderTargetData() { CallOnRenderTargetDelete(this); } void RenderTargetData::release() { ExternalRelease(this); } bool RenderTargetData::isRelocated() const { return device_data && device_data->isRelocated(); } } // namespace rths
{'repo_name': 'unity3d-jp/RaytracedHardShadow', 'stars': '150', 'repo_language': 'C++', 'file_name': 'AudioManager.asset', 'mime_type': 'text/plain', 'hash': -3918812674368768775, 'source_dataset': 'data'}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html><head><title></title> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta name="generator" content="Doxygen 1.8.10"/> <link rel="stylesheet" type="text/css" href="search.css"/> <script type="text/javascript" src="enums_4.js"></script> <script type="text/javascript" src="search.js"></script> </head> <body class="SRPage"> <div id="SRIndex"> <div class="SRStatus" id="Loading">Loading...</div> <div id="SRResults"></div> <script type="text/javascript"><!-- createResults(); --></script> <div class="SRStatus" id="Searching">Searching...</div> <div class="SRStatus" id="NoMatches">No Matches</div> <script type="text/javascript"><!-- document.getElementById("Loading").style.display="none"; document.getElementById("NoMatches").style.display="none"; var searchResults = new SearchResults("searchResults"); searchResults.Search(); --></script> </div> </body> </html>
{'repo_name': 'xuhongv/StudyInEsp8266', 'stars': '444', 'repo_language': 'Assembly', 'file_name': 'eagle.S', 'mime_type': 'text/plain', 'hash': 2303146082387255186, 'source_dataset': 'data'}
/******************************************************************************* * MIT License * * Copyright (c) 2020 Raymond Buckley * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. ******************************************************************************/ package com.ray3k.skincomposer; import com.badlogic.gdx.Graphics; import com.badlogic.gdx.files.FileHandle; import com.badlogic.gdx.graphics.g2d.PixmapPacker; import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeBitmapFontData; import com.badlogic.gdx.utils.Array; import java.io.File; import java.util.List; public interface DesktopWorker { void texturePack(Array<FileHandle> handles, FileHandle localFile, FileHandle targetFile, FileHandle settingsFile); void packFontImages(Array<FileHandle> files, FileHandle saveFile); void sizeWindowToFit(int maxWidth, int maxHeight, int displayBorder, Graphics graphics); void centerWindow(Graphics graphics); void addFilesDroppedListener(FilesDroppedListener filesDroppedListener); void removeFilesDroppedListener(FilesDroppedListener filesDroppedListener); void setCloseListener(CloseListener closeListener); void attachLogListener(); List<File> openMultipleDialog(String title, String defaultPath, String[] filterPatterns, String filterDescription); File openDialog(String title, String defaultPath, String[] filterPatterns, String filterDescription); File saveDialog(String title, String defaultPath, String[] filterPatterns, String filterDescription); char getKeyName(int keyCode); void writeFont(FreeTypeBitmapFontData data, Array<PixmapPacker.Page> pages, FileHandle target); }
{'repo_name': 'raeleus/skin-composer', 'stars': '220', 'repo_language': 'Java', 'file_name': 'skin-composer-installer-ui.json', 'mime_type': 'text/plain', 'hash': -1277240176687593542, 'source_dataset': 'data'}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta content="Apache Forrest" name="Generator"> <meta name="Forrest-version" content="0.10-dev"> <meta name="Forrest-skin-name" content="pelt"> <title>Running Apache&trade; FOP</title> <link type="text/css" href="../skin/basic.css" rel="stylesheet"> <link media="screen" type="text/css" href="../skin/screen.css" rel="stylesheet"> <link media="print" type="text/css" href="../skin/print.css" rel="stylesheet"> <link type="text/css" href="../skin/profile.css" rel="stylesheet"> <script src="../skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="../skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="../skin/fontsize.js" language="javascript" type="text/javascript"></script> <link rel="shortcut icon" href="../favicon.ico"> </head> <body onload="init()"> <script type="text/javascript">ndeSetTextSize();</script> <div id="top"> <!--+ |header +--> <div class="header"> <!--+ |start group logo +--> <div class="grouplogo"> <a href="http://xmlgraphics.apache.org/"><img class="logoImage" alt="Apache XML Graphics" src="../images/group-logo.gif" title="Apache XML Graphics is responsible for the creation and maintenance of software for managing the conversion of XML formats to graphical output, and the creation and maintenance of related software components, based on software licensed to the Foundation"></a> </div> <!--+ |end group logo +--> <!--+ |start Project Logo +--> <div class="projectlogo"> <a href="http://xmlgraphics.apache.org/fop/"><img class="logoImage" alt="Apache FOP" src="../images/logo.jpg" title="Apache FOP (Formatting Objects Processor) is the world's first output independent formatter. Output formats currently supported include PDF, PCL, PS, SVG, XML (area tree representation), Print, AWT, MIF and TXT. The primary output target is PDF."></a> </div> <!--+ |end Project Logo +--> <!--+ |start Search +--> <div class="searchbox"> <form action="http://www.google.com/search" method="get" class="roundtopsmall"> <input value="xmlgraphics.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">&nbsp; <input name="Search" value="Search" type="submit"> </form> </div> <!--+ |end search +--> <!--+ |start Tabs +--> <ul id="tabs"> <li> <a class="unselected" href="../index.html">Home</a> </li> <li> <a class="unselected" href="../1.0/index.html">Version 1.0</a> </li> <li> <a class="unselected" href="../1.1/index.html">Version 1.1</a> </li> <li class="current"> <a class="selected" href="../trunk/index.html">FOP Trunk</a> </li> <li> <a class="unselected" href="../dev/index.html">Development</a> </li> </ul> <!--+ |end Tabs +--> </div> </div> <div id="main"> <div id="publishedStrip"> <!--+ |start Subtabs +--> <div id="level2tabs"></div> <!--+ |end Endtabs +--> <script type="text/javascript"><!-- document.write("Last Published: " + document.lastModified); // --></script> </div> <!--+ |breadtrail +--> <div class="breadtrail"> <a href="http://www.apache.org/">The Apache Software Foundation</a> &gt; <a href="http://xmlgraphics.apache.org/">Apache XML Graphics Project</a><script src="../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script> </div> <!--+ |start Menu, mainarea +--> <!--+ |start Menu +--> <div id="menu"> <div onclick="SwitchMenu('menu_selected_1.1', '../skin/')" id="menu_selected_1.1Title" class="menutitle" style="background-image: url('../skin/images/chapter_open.gif');">Apache&trade; FOP Trunk (dev)</div> <div id="menu_selected_1.1" class="selectedmenuitemgroup" style="display: block;"> <div class="menuitem"> <a href="../trunk/index.html">About</a> </div> <div class="menuitem"> <a href="../trunk/upgrading.html">Upgrading</a> </div> <div onclick="SwitchMenu('menu_selected_1.1.3', '../skin/')" id="menu_selected_1.1.3Title" class="menutitle" style="background-image: url('../skin/images/chapter_open.gif');">Using Apache&trade; FOP</div> <div id="menu_selected_1.1.3" class="selectedmenuitemgroup" style="display: block;"> <div class="menuitem"> <a href="../trunk/anttask.html">Ant Task</a> </div> <div class="menuitem"> <a href="../trunk/compiling.html">Build</a> </div> <div class="menuitem"> <a href="../trunk/configuration.html">Configure</a> </div> <div class="menuitem"> <a href="../trunk/embedding.html">Embed</a> </div> <div class="menupage"> <div class="menupagetitle">Run</div> </div> <div class="menuitem"> <a href="../trunk/servlets.html">Servlets</a> </div> </div> <div onclick="SwitchMenu('menu_1.1.4', '../skin/')" id="menu_1.1.4Title" class="menutitle">Features</div> <div id="menu_1.1.4" class="menuitemgroup"> <div class="menuitem"> <a href="../trunk/accessibility.html">Accessibility</a> </div> <div class="menuitem"> <a href="../trunk/complexscripts.html">Complex Scripts</a> </div> <div class="menuitem"> <a href="../trunk/events.html">Events</a> </div> <div class="menuitem"> <a href="../trunk/extensions.html">Extensions</a> </div> <div class="menuitem"> <a href="../trunk/fonts.html">Fonts</a> </div> <div class="menuitem"> <a href="../trunk/graphics.html">Graphics</a> </div> <div class="menuitem"> <a href="../trunk/hyphenation.html">Hyphenation</a> </div> <div class="menuitem"> <a href="../trunk/intermediate.html">Intermediate Format</a> </div> <div class="menuitem"> <a href="../trunk/metadata.html">Metadata</a> </div> <div class="menuitem"> <a href="../trunk/output.html">Output Targets</a> </div> <div class="menuitem"> <a href="../trunk/pdfa.html">PDF/A</a> </div> <div class="menuitem"> <a href="../trunk/pdfx.html">PDF/X</a> </div> <div class="menuitem"> <a href="../trunk/pdfencryption.html">PDF Encryption</a> </div> </div> </div> <div id="credit"></div> <div id="roundbottom"> <img style="display: none" class="corner" height="15" width="15" alt="" src="../skin/images/rc-b-l-15-1body-2menu-3menu.png"></div> <!--+ |alternative credits +--> <div id="credit2"></div> </div> <!--+ |end Menu +--> <!--+ |start content +--> <div id="content"> <div title="raw XML" class="xmllink"> <a class="dida" href="running.xml"><img alt="XML - icon" src="../skin/images/xmldoc.gif" class="skin"><br> XML</a> </div> <div title="Portable Document Format" class="pdflink"> <a class="dida" href="running.pdf"><img alt="PDF -icon" src="../skin/images/pdfdoc.gif" class="skin"><br> PDF</a> </div> <div class="trail">Font size: &nbsp;<input value="Reset" class="resetfont" title="Reset text" onclick="ndeSetTextSize('reset'); return false;" type="button"> &nbsp;<input value="-a" class="smallerfont" title="Shrink text" onclick="ndeSetTextSize('decr'); return false;" type="button"> &nbsp;<input value="+a" class="biggerfont" title="Enlarge text" onclick="ndeSetTextSize('incr'); return false;" type="button"> </div> <h1>Running Apache&trade; FOP</h1> <div id="front-matter"> <div id="minitoc-area"> <ul class="minitoc"> <li> <a href="#require">System Requirements</a> </li> <li> <a href="#install">Installation</a> <ul class="minitoc"> <li> <a href="#install-instruct">Instructions</a> </li> <li> <a href="#install-problems">Problems</a> </li> </ul> </li> <li> <a href="#standalone-start">Starting FOP as a Standalone Application</a> <ul class="minitoc"> <li> <a href="#fop-script">Using the fop script or batch file</a> </li> <li> <a href="#your-own-script">Writing your own script</a> </li> <li> <a href="#jar-option">Running with java's -jar option</a> </li> <li> <a href="#dynamical-classpath">FOP's dynamical classpath construction</a> </li> </ul> </li> <li> <a href="#check-input">Using Xalan to Check XSL-FO Input</a> </li> <li> <a href="#memory">Memory Usage</a> </li> <li> <a href="#problems">Problems</a> </li> </ul> </div> </div> <a name="require"></a> <h2 class="underlined_10">System Requirements</h2> <div class="section"> <p>The following software must be installed:</p> <ul> <li> Java 1.4.x or later Runtime Environment. <ul> <li> Many JREs &gt;=1.4 contain older JAXP implementations (which often contain bugs). It's usually a good idea to replace them with a current implementation. </li> </ul> </li> <li> Apache&trade; FOP. The <a href="../download.html">FOP distribution</a> includes all libraries that you will need to run a basic FOP installation. These can be found in the [fop-root]/lib directory. These libraries include the following: <ul> <li> <a target="_blank" class="fork" href="http://xmlgraphics.apache.org/commons/">Apache XML Graphics Commons</a>, an shared library for Batik and FOP.</li> <li> <a target="_blank" class="fork" href="http://xmlgraphics.apache.org/batik/">Apache Batik</a>, an SVG library.</li> <li> <a class="external" href="http://commons.apache.org/logging/">Apache Commons Logging</a>, a logger abstraction kit.</li> <li> <a class="external" href="http://commons.apache.org/io/">Apache Commons IO</a>, a library with I/O utilities.</li> <li> <a class="external" href="http://excalibur.apache.org/framework/">Apache Excalibur/Avalon Framework</a>, for XML configuration handling.</li> </ul> </li> </ul> <p>The following software is optional, depending on your needs:</p> <ul> <li> Graphics libraries. Generally, FOP contains direct support for the most important bitmap image formats (including PNG, JPEG and GIF). See <a href="graphics.html">FOP: Graphics Formats</a> for details. </li> <li> PDF encryption. See <a href="pdfencryption.html">FOP: PDF Encryption</a> for details. </li> </ul> <p>In addition, the following system requirements apply:</p> <ul> <li> If you will be using FOP to process SVG, you must do so in a graphical environment. See <a href="graphics.html#batik">FOP: Graphics (Batik)</a> for details. </li> </ul> </div> <a name="install"></a> <h2 class="underlined_10">Installation</h2> <div class="section"> <a name="install-instruct"></a> <h3 class="underlined_5">Instructions</h3> <p> Basic FOP installation consists of first unzipping the <span class="codefrag">.gz</span> file that is the distribution medium, then unarchiving the resulting <span class="codefrag">.tar</span> file in a directory/folder that is convenient on your system. Please consult your operating system documentation or Zip application software documentation for instructions specific to your site. </p> <a name="install-problems"></a> <h3 class="underlined_5">Problems</h3> <p> Some Mac OSX users have experienced filename truncation problems using Stuffit to unzip and unarchive their distribution media. This is a legacy of older Mac operating systems, which had a 31-character pathname limit. Several Mac OSX users have recommended that Mac OSX users use the shell command <span class="codefrag">tar -xzf</span> instead. </p> </div> <a name="standalone-start"></a> <h2 class="underlined_10">Starting FOP as a Standalone Application</h2> <div class="section"> <a name="fop-script"></a> <h3 class="underlined_5">Using the fop script or batch file</h3> <p> The usual and recommended practice for starting FOP from the command line is to run the batch file fop.bat (Windows) or the shell script fop (Unix/Linux). These scripts require that the environment variable JAVA_HOME be set to a path pointing to the appropriate Java installation on your system. Macintosh OSX includes a Java environment as part of its distribution. We are told by Mac OSX users that the path to use in this case is <span class="codefrag">/Library/Java/Home</span>. <strong>Caveat:</strong> We suspect that, as Apple releases new Java environments and as FOP upgrades the minimum Java requirements, the two will inevitably not match on some systems. Please see <a class="external" href="http://developer.apple.com/java/faq">Java on Mac OSX FAQ</a> for information as it becomes available. </p> <pre class="code"> USAGE Fop [options] [-fo|-xml] infile [-xsl file] [-awt|-pdf|-mif|-rtf|-tiff|-png|-pcl|-ps|-txt|-at [mime]|-print] &lt;outfile&gt; [OPTIONS] -version print FOP version and exit -d debug mode -x dump configuration settings -q quiet mode -c cfg.xml use additional configuration file cfg.xml -l lang the language to use for user information -nocs disable complex script features -r relaxed/less strict validation (where available) -dpi xxx target resolution in dots per inch (dpi) where xxx is a number -s for area tree XML, down to block areas only -v run in verbose mode (currently simply print FOP version and continue) -o [password] PDF file will be encrypted with option owner password -u [password] PDF file will be encrypted with option user password -noprint PDF file will be encrypted without printing permission -nocopy PDF file will be encrypted without copy content permission -noedit PDF file will be encrypted without edit content permission -noannotations PDF file will be encrypted without edit annotation permission -nofillinforms PDF file will be encrypted without fill in forms permission -noaccesscontent PDF file will be encrypted without extract text and graphics permission -noassembledoc PDF file will be encrypted without assemble the document permission -noprinthq PDF file will be encrypted without print high quality permission -a enables accessibility features (Tagged PDF etc., default off) -pdfprofile prof PDF file will be generated with the specified profile (Examples for prof: PDF/A-1b or PDF/X-3:2003) -conserve enable memory-conservation policy (trades memory-consumption for disk I/O) (Note: currently only influences whether the area tree is serialized.) -cache specifies a file/directory path location -flush flushes the current font cache file [INPUT] infile xsl:fo input file (the same as the next) (use '-' for infile to pipe input from stdin) -fo infile xsl:fo input file -xml infile xml input file, must be used together with -xsl -atin infile area tree input file -ifin infile intermediate format input file -imagein infile image input file (piping through stdin not supported) -xsl stylesheet xslt stylesheet -param name value &lt;value&gt; to use for parameter &lt;name&gt; in xslt stylesheet (repeat '-param name value' for each parameter) -catalog use catalog resolver for input XML and XSLT files [OUTPUT] outfile input will be rendered as PDF into outfile (use '-' for outfile to pipe output to stdout) -pdf outfile input will be rendered as PDF (outfile req'd) -pdfa1b outfile input will be rendered as PDF/A-1b compliant PDF (outfile req'd, same as "-pdf outfile -pdfprofile PDF/A-1b") -awt input will be displayed on screen -rtf outfile input will be rendered as RTF (outfile req'd) -pcl outfile input will be rendered as PCL (outfile req'd) -ps outfile input will be rendered as PostScript (outfile req'd) -afp outfile input will be rendered as AFP (outfile req'd) -tiff outfile input will be rendered as TIFF (outfile req'd) -png outfile input will be rendered as PNG (outfile req'd) -txt outfile input will be rendered as plain text (outfile req'd) -at [mime] out representation of area tree as XML (outfile req'd) specify optional mime output to allow the AT to be converted to final format later -if [mime] out representation of document in intermediate format XML (outfile req'd) specify optional mime output to allow the IF to be converted to final format later -print input file will be rendered and sent to the printer see options with "-print help" -out mime outfile input will be rendered using the given MIME type (outfile req'd) Example: "-out application/pdf D:\out.pdf" (Tip: "-out list" prints the list of supported MIME types) -svg outfile input will be rendered as an SVG slides file (outfile req'd) Experimental feature - requires additional fop-sandbox.jar. -foout outfile input will only be XSL transformed. The intermediate XSL-FO file is saved and no rendering is performed. (Only available if you use -xml and -xsl parameters) [Examples] fop foo.fo foo.pdf fop -fo foo.fo -pdf foo.pdf (does the same as the previous line) fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf fop -xml foo.xml -xsl foo.xsl -foout foo.fo fop -xml - -xsl foo.xsl -pdf - fop foo.fo -mif foo.mif fop foo.fo -rtf foo.rtf fop foo.fo -print fop foo.fo -awt</pre> <p> PDF encryption is only available if FOP was compiled with encryption support <strong>and</strong> if compatible encryption support is available at run time. Currently, only the JCE is supported. Check the <a href="pdfencryption.html">Details</a>. </p> <a name="your-own-script"></a> <h3 class="underlined_5">Writing your own script</h3> <p>FOP's entry point for your own scripts is the class <span class="codefrag">org.apache.fop.cli.Main</span>. The general pattern for the command line is: <span class="codefrag">java -classpath &lt;CLASSPATH&gt; org.apache.fop.cli.Main &lt;arguments&gt;</span>. The arguments consist of the options and infile and outfile specifications as shown above for the standard scripts. You may wish to review the standard scripts to make sure that you get your environment properly configured. </p> <a name="jar-option"></a> <h3 class="underlined_5">Running with java's -jar option</h3> <p> As an alternative to the start scripts you can run <span class="codefrag">java -jar path/to/build/fop.jar &lt;arguments&gt;</span>, relying on FOP to build the classpath for running FOP dynamically, see <a href="#dynamical-classpath">below</a>. If you use hyphenation, you must put <span class="codefrag">fop-hyph.jar</span> in the <span class="codefrag">lib</span> directory. </p> <p>You can also run <span class="codefrag">java -jar path/to/fop.jar &lt;arguments&gt;</span>, relying on the <span class="codefrag">Class-Path</span> entry in the manifest file. This works if you put <span class="codefrag">fop.jar</span> and all jar files from the <span class="codefrag">lib</span> directory in a single directory. If you use hyphenation, you must also put <span class="codefrag">fop-hyph.jar</span> in that directory.</p> <p>In both cases the arguments consist of the options and infile and outfile specifications as shown above for the standard scripts.</p> <a name="dynamical-classpath"></a> <h3 class="underlined_5">FOP's dynamical classpath construction</h3> <p>If FOP is started without a proper classpath, it tries to add its dependencies dynamically. If the system property <span class="codefrag">fop.home</span> contains the name of a directory, then FOP uses that directory as the base directory for its search. Otherwise the current working directory is the base directory. If the base directory is called <span class="codefrag">build</span>, then its parent directory becomes the base directory.</p> <p>FOP expects to find <span class="codefrag">fop.jar</span> in the <span class="codefrag">build</span> subdirectory of the base directory, and adds it to the classpath. Subsequently FOP adds all <span class="codefrag">jar</span> files in the lib directory to the classpath. The lib directory is either the <span class="codefrag">lib</span> subdirectory of the base directory, or, if that does not exist, the base directory itself.</p> <p>If the system property <span class="codefrag">fop.optional.lib</span> contains the name of a directory, then all <span class="codefrag">jar</span> files in that directory are also added to the classpath. See the methods <span class="codefrag">getJARList</span> and <span class="codefrag">checkDependencies</span> in <span class="codefrag">org.apache.fop.cli.Main</span>.</p> </div> <a name="check-input"></a> <h2 class="underlined_10">Using Xalan to Check XSL-FO Input</h2> <div class="section"> <p> FOP sessions that use -xml and -xsl input instead of -fo input are actually controlling two distinct conversions: Tranforming XML to XSL-FO, then formatting the XSL-FO to PDF (or another FOP output format). Although FOP controls both of these processes, the first is included merely as a convenience and for performance reasons. Only the second is part of FOP's core processing. If a user has a problem running FOP, it is important to determine which of these two processes is causing the problem. If the problem is in the first process, the user's stylesheet is likely the cause. The FOP development team does not have resources to help with stylesheet issues, although we have included links to some useful <a href="../resources.html#specs">Specifications</a> and <a href="../resources.html#articles">Books/Articles</a>. If the problem is in the second process, FOP may have a bug or an unimplemented feature that does require attention from the FOP development team. </p> <div class="note"> <div class="label">Note</div> <div class="content">The user is always responsible to provide correct XSL-FO code to FOP.</div> </div> <p> In the case of using -xml and -xsl input, although the user is responsible for the XSL-FO code that is FOP's input, it is not visible to the user. To make the intermediate FO file visible, the FOP distribution includes the "-foout" option which causes FOP to run only the first (transformation) step, and write the results to a file. (See also the Xalan command-line below) </p> <div class="note"> <div class="label">Note</div> <div class="content"> When asking for help on the FOP mailing lists, <em>never</em> attach XML and XSL to illustrate the issue. Always run the XSLT step (-foout) and send the resulting XSL-FO file instead. Of course, be sure that the XSL-FO file is correct before sending it. </div> </div> <p> The -foout option works the same way as if you would call the <a class="external" href="http://xml.apache.org/xalan-j/commandline.html">Xalan command-line</a>: </p> <p> <span class="codefrag">java org.apache.xalan.xslt.Process -IN xmlfile -XSL file -OUT outfile</span> </p> <p> Note that there are some subtle differences between the FOP and Xalan command-lines. </p> </div> <a name="memory"></a> <h2 class="underlined_10">Memory Usage</h2> <div class="section"> <p> FOP can consume quite a bit of memory, even though this has been continually improved. This is partly inherent to the formatting process and partly caused by implementation choices. All FO processors currently on the market have memory problems with certain layouts. </p> <p> If you are running out of memory when using FOP, here are some ideas that may help: </p> <ul> <li> Increase memory available to the JVM. See <a class="external" href="http://java.sun.com/j2se/1.4/docs/tooldocs/solaris/java.html">the -Xmx option</a> for more information. <div class="warning"> <div class="label">Warning</div> <div class="content"> It is usually unwise to increase the memory allocated to the JVM beyond the amount of physical RAM, as this will generally cause significantly slower performance. </div> </div> </li> <li> Avoid forward references. Forward references are references to some later part of a document. Examples include page number citations which refer to pages which follow the citation, tables of contents at the beginning of a document, and page numbering schemes that include the total number of pages in the document (<a href="../faq.html#pagenum">"page N of TOTAL"</a>). Forward references cause all subsequent pages to be held in memory until the reference can be resolved, i.e. until the page with the referenced element is encountered. Forward references may be required by the task, but if you are getting a memory overflow, at least consider the possibility of eliminating them. A table of contents could be replaced by PDF bookmarks instead or moved to the end of the document (reshuffle the paper could after printing). </li> <li> Avoid large images, especially if they are scaled down. If they need to be scaled, scale them in another application upstream from FOP. For many image formats, memory consumption is driven mainly by the size of the image file itself, not its dimensions (width*height), so increasing the compression rate may help. </li> <li> Use multiple page sequences. FOP starts rendering after the end of a page sequence is encountered. While the actual rendering is done page-by-page, some additional memory is freed after the page sequence has been rendered. This can be substantial if the page sequence contains lots of FO elements. </li> </ul> </div> <a name="problems"></a> <h2 class="underlined_10">Problems</h2> <div class="section"> <p>If you have problems running FOP, please see the <a href="../gethelp.html">"How to get Help" page</a>.</p> </div> <span class="version"> version 1308679</span> </div> <!--+ |end content +--> <div class="clearboth">&nbsp;</div> </div> <div id="footer"> <!--+ |start bottomstrip +--> <div class="lastmodified"> <script type="text/javascript"><!-- document.write("Last Published: " + document.lastModified); // --></script> </div> <div class="copyright"> Copyright &copy; 1999-2012 <a href="http://www.apache.org/licenses/">The Apache Software Foundation. Licensed under Apache License 2.0</a> <br> Apache, Apache FOP, the Apache feather logo, and the Apache FOP logos are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners. </div> <!--+ |end bottomstrip +--> </div> </body> </html>
{'repo_name': 'sebastianbergmann/phpunit-documentation', 'stars': '187', 'repo_language': 'HTML', 'file_name': 'index.html', 'mime_type': 'text/html', 'hash': -7050312436039541453, 'source_dataset': 'data'}
// Copyright 2009 the Sputnik authors. All rights reserved. /** * The "this" token can not be used as identifier * * @path ch07/7.6/7.6.1/7.6.1.1/S7.6.1.1_A1.18.js * @description Checking if execution of "this=1" fails * @negative */ this = 1;
{'repo_name': 'nilproject/NiL.JS', 'stars': '210', 'repo_language': 'JavaScript', 'file_name': 'generators.js', 'mime_type': 'text/plain', 'hash': 3109673093772176166, 'source_dataset': 'data'}
fileFormatVersion: 2 guid: f0a89c940320ca917a00a59645a1e7db folderAsset: yes DefaultImporter: externalObjects: {} userData: assetBundleName: assetBundleVariant:
{'repo_name': 'sebastianstarke/AI4Animation', 'stars': '3141', 'repo_language': 'C++', 'file_name': 'ProjectVersion.txt', 'mime_type': 'text/plain', 'hash': -6991114588474735215, 'source_dataset': 'data'}
@file:JvmName("Events") package org.frice.event import java.awt.event.MouseEvent import javafx.scene.input.MouseEvent as JfxMouseEvent const val MOUSE_CLICKED = 0x00 const val MOUSE_RELEASED = 0x01 const val MOUSE_MOVED = 0x02 const val MOUSE_PRESSED = 0x03 /** * Created by ice1000 on 2016/8/13. * @author ice1000 * @since v0.1 */ data class OnMouseEvent( val x: Double, val y: Double, val screenX: Double, val screenY: Double, val isAltDown: Boolean, val isCtrlDown: Boolean, val isShiftDown: Boolean, val isMetaDown: Boolean, val type: Int) fun swingMouse(e: MouseEvent, type: Int) = OnMouseEvent( e.x.toDouble(), e.y.toDouble(), e.xOnScreen.toDouble(), e.yOnScreen.toDouble(), e.isAltDown, e.isControlDown, e.isShiftDown, e.isMetaDown, type) fun fxMouse(it: JfxMouseEvent, type: Int) = OnMouseEvent( it.x, it.y, it.screenX, it.screenY, it.isAltDown, it.isControlDown, it.isShiftDown, it.isMetaDown, type)
{'repo_name': 'icela/FriceEngine', 'stars': '316', 'repo_language': 'Kotlin', 'file_name': 'config.yml', 'mime_type': 'text/plain', 'hash': -8807761534590196716, 'source_dataset': 'data'}
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace DeviceMonitor.Properties { using System; /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DeviceMonitor.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
{'repo_name': 'rstropek/Samples', 'stars': '216', 'repo_language': 'JavaScript', 'file_name': 'AssemblyInfo.cs', 'mime_type': 'text/plain', 'hash': -1203528793547875199, 'source_dataset': 'data'}
//===-- MachineSink.cpp - Sinking for machine instructions ----------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This pass moves instructions into successor blocks when possible, so that // they aren't executed on paths where their results aren't needed. // // This pass is not intended to be a replacement or a complete alternative // for an LLVM-IR-level sinking pass. It is only designed to sink simple // constructs that are not exposed before lowering and instruction selection. // //===----------------------------------------------------------------------===// #include "llvm/CodeGen/Passes.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/Statistic.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/CodeGen/MachineBlockFrequencyInfo.h" #include "llvm/CodeGen/MachineDominators.h" #include "llvm/CodeGen/MachineLoopInfo.h" #include "llvm/CodeGen/MachinePostDominators.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetSubtargetInfo.h" using namespace llvm; #define DEBUG_TYPE "machine-sink" static cl::opt<bool> SplitEdges("machine-sink-split", cl::desc("Split critical edges during machine sinking"), cl::init(true), cl::Hidden); static cl::opt<bool> UseBlockFreqInfo("machine-sink-bfi", cl::desc("Use block frequency info to find successors to sink"), cl::init(true), cl::Hidden); STATISTIC(NumSunk, "Number of machine instructions sunk"); STATISTIC(NumSplit, "Number of critical edges split"); STATISTIC(NumCoalesces, "Number of copies coalesced"); namespace { class MachineSinking : public MachineFunctionPass { const TargetInstrInfo *TII; const TargetRegisterInfo *TRI; MachineRegisterInfo *MRI; // Machine register information MachineDominatorTree *DT; // Machine dominator tree MachinePostDominatorTree *PDT; // Machine post dominator tree MachineLoopInfo *LI; const MachineBlockFrequencyInfo *MBFI; AliasAnalysis *AA; // Remember which edges have been considered for breaking. SmallSet<std::pair<MachineBasicBlock*,MachineBasicBlock*>, 8> CEBCandidates; // Remember which edges we are about to split. // This is different from CEBCandidates since those edges // will be split. SetVector<std::pair<MachineBasicBlock*,MachineBasicBlock*> > ToSplit; public: static char ID; // Pass identification MachineSinking() : MachineFunctionPass(ID) { initializeMachineSinkingPass(*PassRegistry::getPassRegistry()); } bool runOnMachineFunction(MachineFunction &MF) override; void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesCFG(); MachineFunctionPass::getAnalysisUsage(AU); AU.addRequired<AliasAnalysis>(); AU.addRequired<MachineDominatorTree>(); AU.addRequired<MachinePostDominatorTree>(); AU.addRequired<MachineLoopInfo>(); AU.addPreserved<MachineDominatorTree>(); AU.addPreserved<MachinePostDominatorTree>(); AU.addPreserved<MachineLoopInfo>(); if (UseBlockFreqInfo) AU.addRequired<MachineBlockFrequencyInfo>(); } void releaseMemory() override { CEBCandidates.clear(); } private: bool ProcessBlock(MachineBasicBlock &MBB); bool isWorthBreakingCriticalEdge(MachineInstr *MI, MachineBasicBlock *From, MachineBasicBlock *To); /// \brief Postpone the splitting of the given critical /// edge (\p From, \p To). /// /// We do not split the edges on the fly. Indeed, this invalidates /// the dominance information and thus triggers a lot of updates /// of that information underneath. /// Instead, we postpone all the splits after each iteration of /// the main loop. That way, the information is at least valid /// for the lifetime of an iteration. /// /// \return True if the edge is marked as toSplit, false otherwise. /// False can be returned if, for instance, this is not profitable. bool PostponeSplitCriticalEdge(MachineInstr *MI, MachineBasicBlock *From, MachineBasicBlock *To, bool BreakPHIEdge); bool SinkInstruction(MachineInstr *MI, bool &SawStore); bool AllUsesDominatedByBlock(unsigned Reg, MachineBasicBlock *MBB, MachineBasicBlock *DefMBB, bool &BreakPHIEdge, bool &LocalUse) const; MachineBasicBlock *FindSuccToSinkTo(MachineInstr *MI, MachineBasicBlock *MBB, bool &BreakPHIEdge); bool isProfitableToSinkTo(unsigned Reg, MachineInstr *MI, MachineBasicBlock *MBB, MachineBasicBlock *SuccToSinkTo); bool PerformTrivialForwardCoalescing(MachineInstr *MI, MachineBasicBlock *MBB); }; } // end anonymous namespace char MachineSinking::ID = 0; char &llvm::MachineSinkingID = MachineSinking::ID; INITIALIZE_PASS_BEGIN(MachineSinking, "machine-sink", "Machine code sinking", false, false) INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree) INITIALIZE_PASS_DEPENDENCY(MachineLoopInfo) INITIALIZE_AG_DEPENDENCY(AliasAnalysis) INITIALIZE_PASS_END(MachineSinking, "machine-sink", "Machine code sinking", false, false) bool MachineSinking::PerformTrivialForwardCoalescing(MachineInstr *MI, MachineBasicBlock *MBB) { if (!MI->isCopy()) return false; unsigned SrcReg = MI->getOperand(1).getReg(); unsigned DstReg = MI->getOperand(0).getReg(); if (!TargetRegisterInfo::isVirtualRegister(SrcReg) || !TargetRegisterInfo::isVirtualRegister(DstReg) || !MRI->hasOneNonDBGUse(SrcReg)) return false; const TargetRegisterClass *SRC = MRI->getRegClass(SrcReg); const TargetRegisterClass *DRC = MRI->getRegClass(DstReg); if (SRC != DRC) return false; MachineInstr *DefMI = MRI->getVRegDef(SrcReg); if (DefMI->isCopyLike()) return false; DEBUG(dbgs() << "Coalescing: " << *DefMI); DEBUG(dbgs() << "*** to: " << *MI); MRI->replaceRegWith(DstReg, SrcReg); MI->eraseFromParent(); // Conservatively, clear any kill flags, since it's possible that they are no // longer correct. MRI->clearKillFlags(SrcReg); ++NumCoalesces; return true; } /// AllUsesDominatedByBlock - Return true if all uses of the specified register /// occur in blocks dominated by the specified block. If any use is in the /// definition block, then return false since it is never legal to move def /// after uses. bool MachineSinking::AllUsesDominatedByBlock(unsigned Reg, MachineBasicBlock *MBB, MachineBasicBlock *DefMBB, bool &BreakPHIEdge, bool &LocalUse) const { assert(TargetRegisterInfo::isVirtualRegister(Reg) && "Only makes sense for vregs"); // Ignore debug uses because debug info doesn't affect the code. if (MRI->use_nodbg_empty(Reg)) return true; // BreakPHIEdge is true if all the uses are in the successor MBB being sunken // into and they are all PHI nodes. In this case, machine-sink must break // the critical edge first. e.g. // // BB#1: derived from LLVM BB %bb4.preheader // Predecessors according to CFG: BB#0 // ... // %reg16385<def> = DEC64_32r %reg16437, %EFLAGS<imp-def,dead> // ... // JE_4 <BB#37>, %EFLAGS<imp-use> // Successors according to CFG: BB#37 BB#2 // // BB#2: derived from LLVM BB %bb.nph // Predecessors according to CFG: BB#0 BB#1 // %reg16386<def> = PHI %reg16434, <BB#0>, %reg16385, <BB#1> BreakPHIEdge = true; for (MachineOperand &MO : MRI->use_nodbg_operands(Reg)) { MachineInstr *UseInst = MO.getParent(); unsigned OpNo = &MO - &UseInst->getOperand(0); MachineBasicBlock *UseBlock = UseInst->getParent(); if (!(UseBlock == MBB && UseInst->isPHI() && UseInst->getOperand(OpNo+1).getMBB() == DefMBB)) { BreakPHIEdge = false; break; } } if (BreakPHIEdge) return true; for (MachineOperand &MO : MRI->use_nodbg_operands(Reg)) { // Determine the block of the use. MachineInstr *UseInst = MO.getParent(); unsigned OpNo = &MO - &UseInst->getOperand(0); MachineBasicBlock *UseBlock = UseInst->getParent(); if (UseInst->isPHI()) { // PHI nodes use the operand in the predecessor block, not the block with // the PHI. UseBlock = UseInst->getOperand(OpNo+1).getMBB(); } else if (UseBlock == DefMBB) { LocalUse = true; return false; } // Check that it dominates. if (!DT->dominates(MBB, UseBlock)) return false; } return true; } bool MachineSinking::runOnMachineFunction(MachineFunction &MF) { if (skipOptnoneFunction(*MF.getFunction())) return false; DEBUG(dbgs() << "******** Machine Sinking ********\n"); TII = MF.getSubtarget().getInstrInfo(); TRI = MF.getSubtarget().getRegisterInfo(); MRI = &MF.getRegInfo(); DT = &getAnalysis<MachineDominatorTree>(); PDT = &getAnalysis<MachinePostDominatorTree>(); LI = &getAnalysis<MachineLoopInfo>(); MBFI = UseBlockFreqInfo ? &getAnalysis<MachineBlockFrequencyInfo>() : nullptr; AA = &getAnalysis<AliasAnalysis>(); bool EverMadeChange = false; while (1) { bool MadeChange = false; // Process all basic blocks. CEBCandidates.clear(); ToSplit.clear(); for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) MadeChange |= ProcessBlock(*I); // If we have anything we marked as toSplit, split it now. for (auto &Pair : ToSplit) { auto NewSucc = Pair.first->SplitCriticalEdge(Pair.second, this); if (NewSucc != nullptr) { DEBUG(dbgs() << " *** Splitting critical edge:" " BB#" << Pair.first->getNumber() << " -- BB#" << NewSucc->getNumber() << " -- BB#" << Pair.second->getNumber() << '\n'); MadeChange = true; ++NumSplit; } else DEBUG(dbgs() << " *** Not legal to break critical edge\n"); } // If this iteration over the code changed anything, keep iterating. if (!MadeChange) break; EverMadeChange = true; } return EverMadeChange; } bool MachineSinking::ProcessBlock(MachineBasicBlock &MBB) { // Can't sink anything out of a block that has less than two successors. if (MBB.succ_size() <= 1 || MBB.empty()) return false; // Don't bother sinking code out of unreachable blocks. In addition to being // unprofitable, it can also lead to infinite looping, because in an // unreachable loop there may be nowhere to stop. if (!DT->isReachableFromEntry(&MBB)) return false; bool MadeChange = false; // Walk the basic block bottom-up. Remember if we saw a store. MachineBasicBlock::iterator I = MBB.end(); --I; bool ProcessedBegin, SawStore = false; do { MachineInstr *MI = I; // The instruction to sink. // Predecrement I (if it's not begin) so that it isn't invalidated by // sinking. ProcessedBegin = I == MBB.begin(); if (!ProcessedBegin) --I; if (MI->isDebugValue()) continue; bool Joined = PerformTrivialForwardCoalescing(MI, &MBB); if (Joined) { MadeChange = true; continue; } if (SinkInstruction(MI, SawStore)) ++NumSunk, MadeChange = true; // If we just processed the first instruction in the block, we're done. } while (!ProcessedBegin); return MadeChange; } bool MachineSinking::isWorthBreakingCriticalEdge(MachineInstr *MI, MachineBasicBlock *From, MachineBasicBlock *To) { // FIXME: Need much better heuristics. // If the pass has already considered breaking this edge (during this pass // through the function), then let's go ahead and break it. This means // sinking multiple "cheap" instructions into the same block. if (!CEBCandidates.insert(std::make_pair(From, To)).second) return true; if (!MI->isCopy() && !TII->isAsCheapAsAMove(MI)) return true; // MI is cheap, we probably don't want to break the critical edge for it. // However, if this would allow some definitions of its source operands // to be sunk then it's probably worth it. for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); if (!MO.isReg() || !MO.isUse()) continue; unsigned Reg = MO.getReg(); if (Reg == 0) continue; // We don't move live definitions of physical registers, // so sinking their uses won't enable any opportunities. if (TargetRegisterInfo::isPhysicalRegister(Reg)) continue; // If this instruction is the only user of a virtual register, // check if breaking the edge will enable sinking // both this instruction and the defining instruction. if (MRI->hasOneNonDBGUse(Reg)) { // If the definition resides in same MBB, // claim it's likely we can sink these together. // If definition resides elsewhere, we aren't // blocking it from being sunk so don't break the edge. MachineInstr *DefMI = MRI->getVRegDef(Reg); if (DefMI->getParent() == MI->getParent()) return true; } } return false; } bool MachineSinking::PostponeSplitCriticalEdge(MachineInstr *MI, MachineBasicBlock *FromBB, MachineBasicBlock *ToBB, bool BreakPHIEdge) { if (!isWorthBreakingCriticalEdge(MI, FromBB, ToBB)) return false; // Avoid breaking back edge. From == To means backedge for single BB loop. if (!SplitEdges || FromBB == ToBB) return false; // Check for backedges of more "complex" loops. if (LI->getLoopFor(FromBB) == LI->getLoopFor(ToBB) && LI->isLoopHeader(ToBB)) return false; // It's not always legal to break critical edges and sink the computation // to the edge. // // BB#1: // v1024 // Beq BB#3 // <fallthrough> // BB#2: // ... no uses of v1024 // <fallthrough> // BB#3: // ... // = v1024 // // If BB#1 -> BB#3 edge is broken and computation of v1024 is inserted: // // BB#1: // ... // Bne BB#2 // BB#4: // v1024 = // B BB#3 // BB#2: // ... no uses of v1024 // <fallthrough> // BB#3: // ... // = v1024 // // This is incorrect since v1024 is not computed along the BB#1->BB#2->BB#3 // flow. We need to ensure the new basic block where the computation is // sunk to dominates all the uses. // It's only legal to break critical edge and sink the computation to the // new block if all the predecessors of "To", except for "From", are // not dominated by "From". Given SSA property, this means these // predecessors are dominated by "To". // // There is no need to do this check if all the uses are PHI nodes. PHI // sources are only defined on the specific predecessor edges. if (!BreakPHIEdge) { for (MachineBasicBlock::pred_iterator PI = ToBB->pred_begin(), E = ToBB->pred_end(); PI != E; ++PI) { if (*PI == FromBB) continue; if (!DT->dominates(ToBB, *PI)) return false; } } ToSplit.insert(std::make_pair(FromBB, ToBB)); return true; } static bool AvoidsSinking(MachineInstr *MI, MachineRegisterInfo *MRI) { return MI->isInsertSubreg() || MI->isSubregToReg() || MI->isRegSequence(); } /// collectDebgValues - Scan instructions following MI and collect any /// matching DBG_VALUEs. static void collectDebugValues(MachineInstr *MI, SmallVectorImpl<MachineInstr *> &DbgValues) { DbgValues.clear(); if (!MI->getOperand(0).isReg()) return; MachineBasicBlock::iterator DI = MI; ++DI; for (MachineBasicBlock::iterator DE = MI->getParent()->end(); DI != DE; ++DI) { if (!DI->isDebugValue()) return; if (DI->getOperand(0).isReg() && DI->getOperand(0).getReg() == MI->getOperand(0).getReg()) DbgValues.push_back(DI); } } /// isProfitableToSinkTo - Return true if it is profitable to sink MI. bool MachineSinking::isProfitableToSinkTo(unsigned Reg, MachineInstr *MI, MachineBasicBlock *MBB, MachineBasicBlock *SuccToSinkTo) { assert (MI && "Invalid MachineInstr!"); assert (SuccToSinkTo && "Invalid SinkTo Candidate BB"); if (MBB == SuccToSinkTo) return false; // It is profitable if SuccToSinkTo does not post dominate current block. if (!PDT->dominates(SuccToSinkTo, MBB)) return true; // It is profitable to sink an instruction from a deeper loop to a shallower // loop, even if the latter post-dominates the former (PR21115). if (LI->getLoopDepth(MBB) > LI->getLoopDepth(SuccToSinkTo)) return true; // Check if only use in post dominated block is PHI instruction. bool NonPHIUse = false; for (MachineInstr &UseInst : MRI->use_nodbg_instructions(Reg)) { MachineBasicBlock *UseBlock = UseInst.getParent(); if (UseBlock == SuccToSinkTo && !UseInst.isPHI()) NonPHIUse = true; } if (!NonPHIUse) return true; // If SuccToSinkTo post dominates then also it may be profitable if MI // can further profitably sinked into another block in next round. bool BreakPHIEdge = false; // FIXME - If finding successor is compile time expensive then cache results. if (MachineBasicBlock *MBB2 = FindSuccToSinkTo(MI, SuccToSinkTo, BreakPHIEdge)) return isProfitableToSinkTo(Reg, MI, SuccToSinkTo, MBB2); // If SuccToSinkTo is final destination and it is a post dominator of current // block then it is not profitable to sink MI into SuccToSinkTo block. return false; } /// FindSuccToSinkTo - Find a successor to sink this instruction to. MachineBasicBlock *MachineSinking::FindSuccToSinkTo(MachineInstr *MI, MachineBasicBlock *MBB, bool &BreakPHIEdge) { assert (MI && "Invalid MachineInstr!"); assert (MBB && "Invalid MachineBasicBlock!"); // Loop over all the operands of the specified instruction. If there is // anything we can't handle, bail out. // SuccToSinkTo - This is the successor to sink this instruction to, once we // decide. MachineBasicBlock *SuccToSinkTo = nullptr; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); if (!MO.isReg()) continue; // Ignore non-register operands. unsigned Reg = MO.getReg(); if (Reg == 0) continue; if (TargetRegisterInfo::isPhysicalRegister(Reg)) { if (MO.isUse()) { // If the physreg has no defs anywhere, it's just an ambient register // and we can freely move its uses. Alternatively, if it's allocatable, // it could get allocated to something with a def during allocation. if (!MRI->isConstantPhysReg(Reg, *MBB->getParent())) return nullptr; } else if (!MO.isDead()) { // A def that isn't dead. We can't move it. return nullptr; } } else { // Virtual register uses are always safe to sink. if (MO.isUse()) continue; // If it's not safe to move defs of the register class, then abort. if (!TII->isSafeToMoveRegClassDefs(MRI->getRegClass(Reg))) return nullptr; // Virtual register defs can only be sunk if all their uses are in blocks // dominated by one of the successors. if (SuccToSinkTo) { // If a previous operand picked a block to sink to, then this operand // must be sinkable to the same block. bool LocalUse = false; if (!AllUsesDominatedByBlock(Reg, SuccToSinkTo, MBB, BreakPHIEdge, LocalUse)) return nullptr; continue; } // Otherwise, we should look at all the successors and decide which one // we should sink to. If we have reliable block frequency information // (frequency != 0) available, give successors with smaller frequencies // higher priority, otherwise prioritize smaller loop depths. SmallVector<MachineBasicBlock*, 4> Succs(MBB->succ_begin(), MBB->succ_end()); // Handle cases where sinking can happen but where the sink point isn't a // successor. For example: // // x = computation // if () {} else {} // use x // const std::vector<MachineDomTreeNode *> &Children = DT->getNode(MBB)->getChildren(); for (const auto &DTChild : Children) // DomTree children of MBB that have MBB as immediate dominator are added. if (DTChild->getIDom()->getBlock() == MI->getParent() && // Skip MBBs already added to the Succs vector above. !MBB->isSuccessor(DTChild->getBlock())) Succs.push_back(DTChild->getBlock()); // Sort Successors according to their loop depth or block frequency info. std::stable_sort( Succs.begin(), Succs.end(), [this](const MachineBasicBlock *L, const MachineBasicBlock *R) { uint64_t LHSFreq = MBFI ? MBFI->getBlockFreq(L).getFrequency() : 0; uint64_t RHSFreq = MBFI ? MBFI->getBlockFreq(R).getFrequency() : 0; bool HasBlockFreq = LHSFreq != 0 && RHSFreq != 0; return HasBlockFreq ? LHSFreq < RHSFreq : LI->getLoopDepth(L) < LI->getLoopDepth(R); }); for (SmallVectorImpl<MachineBasicBlock *>::iterator SI = Succs.begin(), E = Succs.end(); SI != E; ++SI) { MachineBasicBlock *SuccBlock = *SI; bool LocalUse = false; if (AllUsesDominatedByBlock(Reg, SuccBlock, MBB, BreakPHIEdge, LocalUse)) { SuccToSinkTo = SuccBlock; break; } if (LocalUse) // Def is used locally, it's never safe to move this def. return nullptr; } // If we couldn't find a block to sink to, ignore this instruction. if (!SuccToSinkTo) return nullptr; if (!isProfitableToSinkTo(Reg, MI, MBB, SuccToSinkTo)) return nullptr; } } // It is not possible to sink an instruction into its own block. This can // happen with loops. if (MBB == SuccToSinkTo) return nullptr; // It's not safe to sink instructions to EH landing pad. Control flow into // landing pad is implicitly defined. if (SuccToSinkTo && SuccToSinkTo->isLandingPad()) return nullptr; return SuccToSinkTo; } /// SinkInstruction - Determine whether it is safe to sink the specified machine /// instruction out of its current block into a successor. bool MachineSinking::SinkInstruction(MachineInstr *MI, bool &SawStore) { // Don't sink insert_subreg, subreg_to_reg, reg_sequence. These are meant to // be close to the source to make it easier to coalesce. if (AvoidsSinking(MI, MRI)) return false; // Check if it's safe to move the instruction. if (!MI->isSafeToMove(TII, AA, SawStore)) return false; // FIXME: This should include support for sinking instructions within the // block they are currently in to shorten the live ranges. We often get // instructions sunk into the top of a large block, but it would be better to // also sink them down before their first use in the block. This xform has to // be careful not to *increase* register pressure though, e.g. sinking // "x = y + z" down if it kills y and z would increase the live ranges of y // and z and only shrink the live range of x. bool BreakPHIEdge = false; MachineBasicBlock *ParentBlock = MI->getParent(); MachineBasicBlock *SuccToSinkTo = FindSuccToSinkTo(MI, ParentBlock, BreakPHIEdge); // If there are no outputs, it must have side-effects. if (!SuccToSinkTo) return false; // If the instruction to move defines a dead physical register which is live // when leaving the basic block, don't move it because it could turn into a // "zombie" define of that preg. E.g., EFLAGS. (<rdar://problem/8030636>) for (unsigned I = 0, E = MI->getNumOperands(); I != E; ++I) { const MachineOperand &MO = MI->getOperand(I); if (!MO.isReg()) continue; unsigned Reg = MO.getReg(); if (Reg == 0 || !TargetRegisterInfo::isPhysicalRegister(Reg)) continue; if (SuccToSinkTo->isLiveIn(Reg)) return false; } DEBUG(dbgs() << "Sink instr " << *MI << "\tinto block " << *SuccToSinkTo); // If the block has multiple predecessors, this is a critical edge. // Decide if we can sink along it or need to break the edge. if (SuccToSinkTo->pred_size() > 1) { // We cannot sink a load across a critical edge - there may be stores in // other code paths. bool TryBreak = false; bool store = true; if (!MI->isSafeToMove(TII, AA, store)) { DEBUG(dbgs() << " *** NOTE: Won't sink load along critical edge.\n"); TryBreak = true; } // We don't want to sink across a critical edge if we don't dominate the // successor. We could be introducing calculations to new code paths. if (!TryBreak && !DT->dominates(ParentBlock, SuccToSinkTo)) { DEBUG(dbgs() << " *** NOTE: Critical edge found\n"); TryBreak = true; } // Don't sink instructions into a loop. if (!TryBreak && LI->isLoopHeader(SuccToSinkTo)) { DEBUG(dbgs() << " *** NOTE: Loop header found\n"); TryBreak = true; } // Otherwise we are OK with sinking along a critical edge. if (!TryBreak) DEBUG(dbgs() << "Sinking along critical edge.\n"); else { // Mark this edge as to be split. // If the edge can actually be split, the next iteration of the main loop // will sink MI in the newly created block. bool Status = PostponeSplitCriticalEdge(MI, ParentBlock, SuccToSinkTo, BreakPHIEdge); if (!Status) DEBUG(dbgs() << " *** PUNTING: Not legal or profitable to " "break critical edge\n"); // The instruction will not be sunk this time. return false; } } if (BreakPHIEdge) { // BreakPHIEdge is true if all the uses are in the successor MBB being // sunken into and they are all PHI nodes. In this case, machine-sink must // break the critical edge first. bool Status = PostponeSplitCriticalEdge(MI, ParentBlock, SuccToSinkTo, BreakPHIEdge); if (!Status) DEBUG(dbgs() << " *** PUNTING: Not legal or profitable to " "break critical edge\n"); // The instruction will not be sunk this time. return false; } // Determine where to insert into. Skip phi nodes. MachineBasicBlock::iterator InsertPos = SuccToSinkTo->begin(); while (InsertPos != SuccToSinkTo->end() && InsertPos->isPHI()) ++InsertPos; // collect matching debug values. SmallVector<MachineInstr *, 2> DbgValuesToSink; collectDebugValues(MI, DbgValuesToSink); // Move the instruction. SuccToSinkTo->splice(InsertPos, ParentBlock, MI, ++MachineBasicBlock::iterator(MI)); // Move debug values. for (SmallVectorImpl<MachineInstr *>::iterator DBI = DbgValuesToSink.begin(), DBE = DbgValuesToSink.end(); DBI != DBE; ++DBI) { MachineInstr *DbgMI = *DBI; SuccToSinkTo->splice(InsertPos, ParentBlock, DbgMI, ++MachineBasicBlock::iterator(DbgMI)); } // Conservatively, clear any kill flags, since it's possible that they are no // longer correct. MI->clearKillInfo(); return true; }
{'repo_name': 'KhronosGroup/SPIRV-LLVM', 'stars': '264', 'repo_language': 'C++', 'file_name': 'CMakeLists.txt', 'mime_type': 'text/plain', 'hash': -1629086128409527998, 'source_dataset': 'data'}
from django.conf.urls import url from .views import (home, add_search, add ,single_show, episode_swt, season_swt, search, update_show, update_show_rating, recommended, update_all_continuing, delete_show) urlpatterns = [ url(r'^(?P<view_type>|all||)$', home), url(r'^update_all_shows', update_all_continuing), url(r'^update_show', update_show), url(r'^delete_show', delete_show), url(r'^update_rating', update_show_rating), url(r'^recommended', recommended), url(r'^add_search', add_search), url(r'^add', add), url(r'^search', search, name='search'), url(r'^show/(?P<show_slug>[a-zA-Z0-9-]*$)', single_show), url(r'^episode_swt', episode_swt), url(r'^season_swt', season_swt), ]
{'repo_name': 'guptachetan1997/Episodes', 'stars': '147', 'repo_language': 'Python', 'file_name': 'settings.py', 'mime_type': 'text/plain', 'hash': 4040168339707639033, 'source_dataset': 'data'}
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:m="http://www.w3.org/1998/Math/MathML"> <body> <m:ms><m:mfenced/></m:ms> </body> </html>
{'repo_name': 'ricardoquesada/Spidermonkey', 'stars': '201', 'repo_language': 'C++', 'file_name': 'panelUI.css', 'mime_type': 'text/plain', 'hash': 5071477463713564474, 'source_dataset': 'data'}
/* Copyright The containerd Authors. 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 cgroups // Hierarchy enables both unified and split hierarchy for cgroups type Hierarchy func() ([]Subsystem, error)
{'repo_name': 'containerd/cgroups', 'stars': '461', 'repo_language': 'Go', 'file_name': 'main.go', 'mime_type': 'text/x-c', 'hash': 58616966887607351, 'source_dataset': 'data'}
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/waf-regional/WAFRegional_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/core/utils/memory/stl/AWSVector.h> #include <aws/waf-regional/model/SubscribedRuleGroupSummary.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace WAFRegional { namespace Model { class AWS_WAFREGIONAL_API ListSubscribedRuleGroupsResult { public: ListSubscribedRuleGroupsResult(); ListSubscribedRuleGroupsResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); ListSubscribedRuleGroupsResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result); /** * <p>If you have more objects than the number that you specified for * <code>Limit</code> in the request, the response includes a * <code>NextMarker</code> value. To list more objects, submit another * <code>ListSubscribedRuleGroups</code> request, and specify the * <code>NextMarker</code> value from the response in the <code>NextMarker</code> * value in the next request.</p> */ inline const Aws::String& GetNextMarker() const{ return m_nextMarker; } /** * <p>If you have more objects than the number that you specified for * <code>Limit</code> in the request, the response includes a * <code>NextMarker</code> value. To list more objects, submit another * <code>ListSubscribedRuleGroups</code> request, and specify the * <code>NextMarker</code> value from the response in the <code>NextMarker</code> * value in the next request.</p> */ inline void SetNextMarker(const Aws::String& value) { m_nextMarker = value; } /** * <p>If you have more objects than the number that you specified for * <code>Limit</code> in the request, the response includes a * <code>NextMarker</code> value. To list more objects, submit another * <code>ListSubscribedRuleGroups</code> request, and specify the * <code>NextMarker</code> value from the response in the <code>NextMarker</code> * value in the next request.</p> */ inline void SetNextMarker(Aws::String&& value) { m_nextMarker = std::move(value); } /** * <p>If you have more objects than the number that you specified for * <code>Limit</code> in the request, the response includes a * <code>NextMarker</code> value. To list more objects, submit another * <code>ListSubscribedRuleGroups</code> request, and specify the * <code>NextMarker</code> value from the response in the <code>NextMarker</code> * value in the next request.</p> */ inline void SetNextMarker(const char* value) { m_nextMarker.assign(value); } /** * <p>If you have more objects than the number that you specified for * <code>Limit</code> in the request, the response includes a * <code>NextMarker</code> value. To list more objects, submit another * <code>ListSubscribedRuleGroups</code> request, and specify the * <code>NextMarker</code> value from the response in the <code>NextMarker</code> * value in the next request.</p> */ inline ListSubscribedRuleGroupsResult& WithNextMarker(const Aws::String& value) { SetNextMarker(value); return *this;} /** * <p>If you have more objects than the number that you specified for * <code>Limit</code> in the request, the response includes a * <code>NextMarker</code> value. To list more objects, submit another * <code>ListSubscribedRuleGroups</code> request, and specify the * <code>NextMarker</code> value from the response in the <code>NextMarker</code> * value in the next request.</p> */ inline ListSubscribedRuleGroupsResult& WithNextMarker(Aws::String&& value) { SetNextMarker(std::move(value)); return *this;} /** * <p>If you have more objects than the number that you specified for * <code>Limit</code> in the request, the response includes a * <code>NextMarker</code> value. To list more objects, submit another * <code>ListSubscribedRuleGroups</code> request, and specify the * <code>NextMarker</code> value from the response in the <code>NextMarker</code> * value in the next request.</p> */ inline ListSubscribedRuleGroupsResult& WithNextMarker(const char* value) { SetNextMarker(value); return *this;} /** * <p>An array of <a>RuleGroup</a> objects.</p> */ inline const Aws::Vector<SubscribedRuleGroupSummary>& GetRuleGroups() const{ return m_ruleGroups; } /** * <p>An array of <a>RuleGroup</a> objects.</p> */ inline void SetRuleGroups(const Aws::Vector<SubscribedRuleGroupSummary>& value) { m_ruleGroups = value; } /** * <p>An array of <a>RuleGroup</a> objects.</p> */ inline void SetRuleGroups(Aws::Vector<SubscribedRuleGroupSummary>&& value) { m_ruleGroups = std::move(value); } /** * <p>An array of <a>RuleGroup</a> objects.</p> */ inline ListSubscribedRuleGroupsResult& WithRuleGroups(const Aws::Vector<SubscribedRuleGroupSummary>& value) { SetRuleGroups(value); return *this;} /** * <p>An array of <a>RuleGroup</a> objects.</p> */ inline ListSubscribedRuleGroupsResult& WithRuleGroups(Aws::Vector<SubscribedRuleGroupSummary>&& value) { SetRuleGroups(std::move(value)); return *this;} /** * <p>An array of <a>RuleGroup</a> objects.</p> */ inline ListSubscribedRuleGroupsResult& AddRuleGroups(const SubscribedRuleGroupSummary& value) { m_ruleGroups.push_back(value); return *this; } /** * <p>An array of <a>RuleGroup</a> objects.</p> */ inline ListSubscribedRuleGroupsResult& AddRuleGroups(SubscribedRuleGroupSummary&& value) { m_ruleGroups.push_back(std::move(value)); return *this; } private: Aws::String m_nextMarker; Aws::Vector<SubscribedRuleGroupSummary> m_ruleGroups; }; } // namespace Model } // namespace WAFRegional } // namespace Aws
{'repo_name': 'aws/aws-sdk-cpp', 'stars': '1060', 'repo_language': 'C++', 'file_name': 'RunTests.cpp', 'mime_type': 'text/x-c', 'hash': 4919439826012897482, 'source_dataset': 'data'}
/* * Copyright (c) 2014 Glen Fernandes * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_UTILITY_ENABLE_IF_HPP #define BOOST_UTILITY_ENABLE_IF_HPP // The header file at this path is deprecated; // use boost/core/enable_if.hpp instead. #include <boost/core/enable_if.hpp> #endif
{'repo_name': 'sunlight3d/react_native_v0.49', 'stars': '218', 'repo_language': 'Objective-C', 'file_name': 'profiles_settings.xml', 'mime_type': 'text/plain', 'hash': 966271255551782212, 'source_dataset': 'data'}
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_MUS_WS_TEST_CHANGE_TRACKER_H_ #define COMPONENTS_MUS_WS_TEST_CHANGE_TRACKER_H_ #include <stdint.h> #include <string> #include <vector> #include "base/macros.h" #include "components/mus/common/types.h" #include "components/mus/public/interfaces/window_tree.mojom.h" #include "mojo/public/cpp/bindings/array.h" #include "ui/gfx/geometry/mojo/geometry.mojom.h" namespace mus { namespace ws { enum ChangeType { CHANGE_TYPE_EMBED, CHANGE_TYPE_EMBEDDED_APP_DISCONNECTED, CHANGE_TYPE_UNEMBED, CHANGE_TYPE_LOST_CAPTURE, // TODO(sky): nuke NODE. CHANGE_TYPE_NODE_ADD_TRANSIENT_WINDOW, CHANGE_TYPE_NODE_BOUNDS_CHANGED, CHANGE_TYPE_NODE_HIERARCHY_CHANGED, CHANGE_TYPE_NODE_REMOVE_TRANSIENT_WINDOW_FROM_PARENT, CHANGE_TYPE_NODE_REORDERED, CHANGE_TYPE_NODE_VISIBILITY_CHANGED, CHANGE_TYPE_NODE_DRAWN_STATE_CHANGED, CHANGE_TYPE_NODE_DELETED, CHANGE_TYPE_INPUT_EVENT, CHANGE_TYPE_EVENT_OBSERVED, CHANGE_TYPE_PROPERTY_CHANGED, CHANGE_TYPE_FOCUSED, CHANGE_TYPE_CURSOR_CHANGED, CHANGE_TYPE_ON_CHANGE_COMPLETED, CHANGE_TYPE_ON_TOP_LEVEL_CREATED, CHANGE_TYPE_OPACITY, }; // TODO(sky): consider nuking and converting directly to WindowData. struct TestWindow { TestWindow(); TestWindow(const TestWindow& other); ~TestWindow(); // Returns a string description of this. std::string ToString() const; // Returns a string description that includes visible and drawn. std::string ToString2() const; Id parent_id; Id window_id; bool visible; std::map<std::string, std::vector<uint8_t>> properties; }; // Tracks a call to WindowTreeClient. See the individual functions for the // fields that are used. struct Change { Change(); Change(const Change& other); ~Change(); ChangeType type; ClientSpecificId client_id; std::vector<TestWindow> windows; Id window_id; Id window_id2; Id window_id3; gfx::Rect bounds; gfx::Rect bounds2; int32_t event_action; uint32_t event_observer_id; mojo::String embed_url; mojom::OrderDirection direction; bool bool_value; float float_value; std::string property_key; std::string property_value; int32_t cursor_id; uint32_t change_id; }; // Converts Changes to string descriptions. std::vector<std::string> ChangesToDescription1( const std::vector<Change>& changes); // Convenience for returning the description of the first item in |changes|. // Returns an empty string if |changes| has something other than one entry. std::string SingleChangeToDescription(const std::vector<Change>& changes); std::string SingleChangeToDescription2(const std::vector<Change>& changes); // Convenience for returning the description of the first item in |windows|. // Returns an empty string if |windows| has something other than one entry. std::string SingleWindowDescription(const std::vector<TestWindow>& windows); // Returns a string description of |changes[0].windows|. Returns an empty string // if change.size() != 1. std::string ChangeWindowDescription(const std::vector<Change>& changes); // Converts WindowDatas to TestWindows. void WindowDatasToTestWindows(const mojo::Array<mojom::WindowDataPtr>& data, std::vector<TestWindow>* test_windows); // TestChangeTracker is used to record WindowTreeClient functions. It notifies // a delegate any time a change is added. class TestChangeTracker { public: // Used to notify the delegate when a change is added. A change corresponds to // a single WindowTreeClient function. class Delegate { public: virtual void OnChangeAdded() = 0; protected: virtual ~Delegate() {} }; TestChangeTracker(); ~TestChangeTracker(); void set_delegate(Delegate* delegate) { delegate_ = delegate; } std::vector<Change>* changes() { return &changes_; } // Each of these functions generate a Change. There is one per // WindowTreeClient function. void OnEmbed(ClientSpecificId client_id, mojom::WindowDataPtr root, bool drawn); void OnEmbeddedAppDisconnected(Id window_id); void OnUnembed(Id window_id); void OnLostCapture(Id window_id); void OnTransientWindowAdded(Id window_id, Id transient_window_id); void OnTransientWindowRemoved(Id window_id, Id transient_window_id); void OnWindowBoundsChanged(Id window_id, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds); void OnWindowHierarchyChanged(Id window_id, Id old_parent_id, Id new_parent_id, mojo::Array<mojom::WindowDataPtr> windows); void OnWindowReordered(Id window_id, Id relative_window_id, mojom::OrderDirection direction); void OnWindowDeleted(Id window_id); void OnWindowVisibilityChanged(Id window_id, bool visible); void OnWindowOpacityChanged(Id window_id, float opacity); void OnWindowParentDrawnStateChanged(Id window_id, bool drawn); void OnWindowInputEvent(Id window_id, const ui::Event& event, uint32_t event_observer_id); void OnEventObserved(const ui::Event& event, uint32_t event_observer_id); void OnWindowSharedPropertyChanged(Id window_id, mojo::String name, mojo::Array<uint8_t> data); void OnWindowFocused(Id window_id); void OnWindowPredefinedCursorChanged(Id window_id, mojom::Cursor cursor_id); void OnChangeCompleted(uint32_t change_id, bool success); void OnTopLevelCreated(uint32_t change_id, mojom::WindowDataPtr window_data, bool drawn); private: void AddChange(const Change& change); Delegate* delegate_; std::vector<Change> changes_; DISALLOW_COPY_AND_ASSIGN(TestChangeTracker); }; } // namespace ws } // namespace mus #endif // COMPONENTS_MUS_WS_TEST_CHANGE_TRACKER_H_
{'repo_name': 'crosswalk-project/chromium-crosswalk', 'stars': '146', 'repo_language': 'None', 'file_name': 'keyboard_utils.js', 'mime_type': 'text/plain', 'hash': 6240331817002426442, 'source_dataset': 'data'}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>OrangeHRM Quick Start Guide</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style type="text/css"> a { color: #009900; text-decoration: underline; } #logo { background-image : url('logo.png'); background-repeat: no-repeat; text-align: center; height: 127px; width: 500px; margin-bottom: 24px; } h1 { text-align:center; font-size:24px; } h2 { text-align:left; font-size:16px; } body { font-family: Arial, Helvetica, sans-serif; margin-top: 5px; margin-bottom: 0; margin-left: 150px; margin-right: 150px; } li { padding-bottom: 5px; padding-top: 5px; } #content { margin-left:50px; margin-right:50px; } .version{ text-decoration: none; } .play-store-img { height: 54px; margin-bottom: -20px; } .app-store-img { height: 41px; padding: 9px; margin-bottom: -24px; } </style> </head> <body> <div align="center"><div id="logo"></div></div> <h1>Welcome to OrangeHRM Quick Start Guide!</h1> <p> Below you can find links to our web site where installation prerequisites and installation process are explained. Make sure you are connected to the Internet to follow these links. If you find any problem, feel free to post it at our <a href="http://www.orangehrm.com/forum/" target="_blank">forum</a>. </p> <h2>Installing OrangeHRM <ins class="version"></ins> in Windows</h2> <ul> <li><a href="https://github.com/orangehrm/orangehrm/wiki/Getting-started#pre-requisites" target="_blank">Prerequisites for installing in Windows</a></li> <li><a href="https://github.com/orangehrm/orangehrm/wiki/Installation-Guide--EXE" target="_blank">Installing steps for Windows (Using EXE)</a></li> <li><a href="https://github.com/orangehrm/orangehrm/wiki/Installation-Guide-(Web)" target="_blank">Installing steps for Windows (Using Web installer)</a></li> </ul> <h2>Installing OrangeHRM <ins class="version"></ins> in Linux</h2> <ul> <li><a href="https://github.com/orangehrm/orangehrm/wiki/Getting-started#pre-requisites" target="_blank">Prerequisites for installing in Linux</a></li> <li><a href="https://github.com/orangehrm/orangehrm/wiki/Installation-Guide-(Web)" target="_blank">Installing steps for Linux</a></li> </ul> <h2>OrangeHRM Mobile App</h2> <ul> <li><a href="https://play.google.com/store/apps/details?id=com.orangehrm.opensource" target="_blank"> <img class="play-store-img" alt='Get it on Google Play' src='https://raw.githubusercontent.com/wiki/orangehrm/orangehrm/mobile/play_store_en_US.png'/> </a></li> <li><a href="https://apps.apple.com/us/app/orangehrm/id1527247547" target="_blank"> <img class="app-store-img" alt='Download on the App Store' src='https://raw.githubusercontent.com/wiki/orangehrm/orangehrm/mobile/app_store_en_US.svg'/> </a></li> </ul> </body> <script type="text/javascript" src="installer/guide/index.js"></script> </html>
{'repo_name': 'orangehrm/orangehrm', 'stars': '216', 'repo_language': 'PHP', 'file_name': 'AttendanceDao.yml', 'mime_type': 'text/plain', 'hash': 3212332287554026883, 'source_dataset': 'data'}
package mapper import ( "errors" "fmt" "github.com/sirupsen/logrus" "k8s.io/apimachinery/pkg/util/sets" "sigs.k8s.io/aws-iam-authenticator/pkg/config" ) const ( // Deprecated: use ModeMountedFile instead ModeFile string = "File" // Deprecated: use ModeEKSConfigMap instead ModeConfigMap string = "ConfigMap" ModeMountedFile string = "MountedFile" ModeEKSConfigMap string = "EKSConfigMap" ModeCRD string = "CRD" ) var ( ValidBackendModeChoices = []string{ModeFile, ModeConfigMap, ModeMountedFile, ModeEKSConfigMap, ModeCRD} DeprecatedBackendModeChoices = map[string]string{ ModeFile: ModeMountedFile, ModeConfigMap: ModeEKSConfigMap, } BackendModeChoices = []string{ModeMountedFile, ModeEKSConfigMap, ModeCRD} ) var ErrNotMapped = errors.New("ARN is not mapped") type Mapper interface { Name() string // Start must be non-blocking Start(stopCh <-chan struct{}) error Map(canonicalARN string) (*config.IdentityMapping, error) IsAccountAllowed(accountID string) bool } func ValidateBackendMode(modes []string) []error { var errs []error validModes := sets.NewString(ValidBackendModeChoices...) for _, mode := range modes { if !validModes.Has(mode) { errs = append(errs, fmt.Errorf("backend-mode %q is not a valid mode", mode)) } } for _, mode := range modes { if replacementMode, ok := DeprecatedBackendModeChoices[mode]; ok { logrus.Warningf("warning: backend-mode %q is deprecated, use %q instead", mode, replacementMode) } } if len(modes) != sets.NewString(modes...).Len() { errs = append(errs, fmt.Errorf("backend-mode %q has duplicates", modes)) } if len(modes) == 0 { errs = append(errs, fmt.Errorf("at least one backend-mode must be specified")) } return errs }
{'repo_name': 'kubernetes-sigs/aws-iam-authenticator', 'stars': '1446', 'repo_language': 'Go', 'file_name': 'server.go', 'mime_type': 'text/plain', 'hash': 6564114226601147929, 'source_dataset': 'data'}
# Copyright (C) 2010 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following disclaimer # in the documentation and/or other materials provided with the # distribution. # * Neither the name of Google Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import unittest from webkitpy.layout_tests.models.test_results import TestResult class TestResultsTest(unittest.TestCase): def test_defaults(self): result = TestResult("foo") self.assertEqual(result.test_name, 'foo') self.assertEqual(result.failures, []) self.assertEqual(result.test_run_time, 0) def test_loads(self): result = TestResult(test_name='foo', failures=[], test_run_time=1.1) s = result.dumps() new_result = TestResult.loads(s) self.assertIsInstance(new_result, TestResult) self.assertEqual(new_result, result) # Also check that != is implemented. self.assertFalse(new_result != result)
{'repo_name': 'mceSystems/node-jsc', 'stars': '178', 'repo_language': 'JavaScript', 'file_name': 'dnt_helper.js', 'mime_type': 'text/plain', 'hash': -2374623783158141844, 'source_dataset': 'data'}
<!DOCTYPE html> <html> <head> <title>{{ title }}</title> </head> <body> {{ customVariable }} </body> </html>
{'repo_name': 'CouscousPHP/Couscous', 'stars': '779', 'repo_language': 'PHP', 'file_name': 'README.md', 'mime_type': 'text/plain', 'hash': -6616677458892505507, 'source_dataset': 'data'}
{-# LANGUAGE MultiParamTypeClasses #-} module Reflex.Dom.Class ( module Reflex.Dom.Class , module Foreign.JavaScript.TH , module Web.KeyCode ) where import Control.Lens import Reflex.Class import Web.KeyCode import Foreign.JavaScript.TH import Reflex.PerformEvent.Class import Reflex.PostBuild.Class -- | Previously an alias for 'Data.Map.singleton', but now generalised to 'At' (=:) :: (At m, Monoid m) => Index m -> IxValue m -> m k =: a = at k ?~ a $ mempty infixr 7 =: -- Ought to bind tighter than <>, which is infixr 6 {-# DEPRECATED keycodeEnter "Instead of `x == keycodeEnter`, use `keyCodeLookup x == Enter`" #-} keycodeEnter :: Int keycodeEnter = 13 {-# DEPRECATED keycodeEscape "Instead of `x == keycodeEscape`, use `keyCodeLookup x == Escape`" #-} keycodeEscape :: Int keycodeEscape = 27 {-# INLINABLE holdOnStartup #-} holdOnStartup :: (PostBuild t m, PerformEvent t m, MonadHold t m) => a -> Performable m a -> m (Behavior t a) holdOnStartup a0 ma = do hold a0 =<< performEvent . (ma <$) =<< getPostBuild
{'repo_name': 'reflex-frp/reflex-dom', 'stars': '284', 'repo_language': 'Haskell', 'file_name': 'default.nix', 'mime_type': 'text/plain', 'hash': 913653890206456294, 'source_dataset': 'data'}
using Sandbox.Game.Entities.Cube; using Sandbox.Game.Gui; using Sandbox.Graphics.GUI; using System; using System.Collections.Generic; using System.Linq; using System.Text; using VRage; using VRage.Utils; using Sandbox.ModAPI; using Sandbox.ModAPI.Interfaces.Terminal; namespace Sandbox.Game.Screens.Terminal.Controls { public class MyTerminalControlLabel<TBlock> : MyTerminalControl<TBlock>, IMyTerminalControlLabel where TBlock : MyTerminalBlock { public MyStringId Label; MyGuiControlLabel m_label; public MyTerminalControlLabel(MyStringId label) : base("Label") { Label = label; } protected override MyGuiControlBase CreateGui() { m_label = new MyGuiControlLabel(); return new MyGuiControlBlockProperty(MyTexts.GetString(Label), null, m_label, MyGuiControlBlockPropertyLayoutEnum.Horizontal); } /// <summary> /// Implement IMyTerminalControlLabel for Mods /// </summary> MyStringId IMyTerminalControlLabel.Label { get { return Label; } set { Label = value; } } } }
{'repo_name': 'KeenSoftwareHouse/SpaceEngineers', 'stars': '2743', 'repo_language': 'C#', 'file_name': 'System.Data.SQLite.xml', 'mime_type': 'text/xml', 'hash': 6010592641444198040, 'source_dataset': 'data'}
/****************************************************************************** * bipartition.h * * * Source of KaHIP -- Karlsruhe High Quality Partitioning. * Christian Schulz <christian.schulz.phone@gmail.com> *****************************************************************************/ #ifndef BIPARTITION_7I4IR31Y #define BIPARTITION_7I4IR31Y #include "initial_partitioner.h" class bipartition : public initial_partitioner { public: bipartition(); virtual ~bipartition(); void initial_partition( const PartitionConfig & config, const unsigned int seed, graph_access & G, int* partition_map); void initial_partition( const PartitionConfig & config, const unsigned int seed, graph_access & G, int* xadj, int* adjncy, int* vwgt, int* adjwgt, int* partition_map); private: void grow_regions_bfs(const PartitionConfig & config, graph_access & G); void grow_regions_fm(const PartitionConfig & config, graph_access & G); NodeID find_start_node( const PartitionConfig & config, graph_access & G); void post_fm(const PartitionConfig & config, graph_access & G); inline Gain compute_gain( graph_access & G, NodeID node, PartitionID targeting_partition); }; inline Gain bipartition::compute_gain( graph_access & G, NodeID node, PartitionID targeting_partition) { //compute how connected is the target to the current partition Gain gain = 0; forall_out_edges(G, e, node) { NodeID target = G.getEdgeTarget(e); if( G.getPartitionIndex(target) == targeting_partition) { gain += G.getEdgeWeight(e); } else { gain -= G.getEdgeWeight(e); } } endfor return gain; } #endif /* end of include guard: BIPARTITION_7I4IR31Y */
{'repo_name': 'KaHIP/KaHIP', 'stars': '133', 'repo_language': 'C++', 'file_name': 'FindGurobi.cmake', 'mime_type': 'text/plain', 'hash': 4829588503517211202, 'source_dataset': 'data'}
// // IQKeyboardManager.m // https://github.com/hackiftekhar/IQKeyboardManager // Copyright (c) 2013-16 Iftekhar Qurashi. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #import "IQKeyboardManager.h" #import "IQUIView+Hierarchy.h" #import "IQUIView+IQKeyboardToolbar.h" #import "IQNSArray+Sort.h" #import "IQKeyboardManagerConstantsInternal.h" #import "IQUIScrollView+Additions.h" #import "IQUITextFieldView+Additions.h" #import "IQUIViewController+Additions.h" #import "IQPreviousNextView.h" #import <QuartzCore/CABase.h> #import <objc/runtime.h> #import <UIKit/UIAlertController.h> #import <UIKit/UISearchBar.h> #import <UIKit/UIScreen.h> #import <UIKit/UINavigationBar.h> #import <UIKit/UITapGestureRecognizer.h> #import <UIKit/UITextField.h> #import <UIKit/UITextView.h> #import <UIKit/UITableViewController.h> #import <UIKit/UICollectionViewController.h> #import <UIKit/UICollectionViewCell.h> #import <UIKit/UICollectionViewLayout.h> #import <UIKit/UINavigationController.h> #import <UIKit/UITouch.h> #import <UIKit/UIWindow.h> #import <UIKit/NSLayoutConstraint.h> #import <UIKit/UIStackView.h> NSInteger const kIQDoneButtonToolbarTag = -1002; NSInteger const kIQPreviousNextButtonToolbarTag = -1005; #define kIQCGPointInvalid CGPointMake(CGFLOAT_MAX, CGFLOAT_MAX) @interface IQKeyboardManager()<UIGestureRecognizerDelegate> /*******************************************/ /** used to adjust contentInset of UITextView. */ @property(nonatomic, assign) UIEdgeInsets startingTextViewContentInsets; /** used to adjust scrollIndicatorInsets of UITextView. */ @property(nonatomic, assign) UIEdgeInsets startingTextViewScrollIndicatorInsets; /** used with textView to detect a textFieldView contentInset is changed or not. (Bug ID: #92)*/ @property(nonatomic, assign) BOOL isTextViewContentInsetChanged; /*******************************************/ /** To save UITextField/UITextView object voa textField/textView notifications. */ @property(nullable, nonatomic, weak) UIView *textFieldView; /** To save rootViewController.view.frame.origin. */ @property(nonatomic, assign) CGPoint topViewBeginOrigin; /** To save rootViewController */ @property(nullable, nonatomic, weak) UIViewController *rootViewController; /** To overcome with popGestureRecognizer issue Bug ID: #1361 */ @property(nullable, nonatomic, weak) UIViewController *rootViewControllerWhilePopGestureRecognizerActive; @property(nonatomic, assign) CGPoint topViewBeginOriginWhilePopGestureRecognizerActive; /** To know if we have any pending request to adjust view position. */ @property(nonatomic, assign) BOOL hasPendingAdjustRequest; /*******************************************/ /** Variable to save lastScrollView that was scrolled. */ @property(nullable, nonatomic, weak) UIScrollView *lastScrollView; /** LastScrollView's initial contentInsets. */ @property(nonatomic, assign) UIEdgeInsets startingContentInsets; /** LastScrollView's initial scrollIndicatorInsets. */ @property(nonatomic, assign) UIEdgeInsets startingScrollIndicatorInsets; /** LastScrollView's initial contentOffset. */ @property(nonatomic, assign) CGPoint startingContentOffset; /*******************************************/ /** To save keyboard animation duration. */ @property(nonatomic, assign) CGFloat animationDuration; /** To mimic the keyboard animation */ @property(nonatomic, assign) NSInteger animationCurve; /*******************************************/ /** TapGesture to resign keyboard on view's touch. It's a readonly property and exposed only for adding/removing dependencies if your added gesture does have collision with this one */ @property(nonnull, nonatomic, strong, readwrite) UITapGestureRecognizer *resignFirstResponderGesture; /** moved distance to the top used to maintain distance between keyboard and textField. Most of the time this will be a positive value. */ @property(nonatomic, assign, readwrite) CGFloat movedDistance; /*******************************************/ @property(nonatomic, strong, nonnull, readwrite) NSMutableSet<Class> *registeredClasses; @property(nonatomic, strong, nonnull, readwrite) NSMutableSet<Class> *disabledDistanceHandlingClasses; @property(nonatomic, strong, nonnull, readwrite) NSMutableSet<Class> *enabledDistanceHandlingClasses; @property(nonatomic, strong, nonnull, readwrite) NSMutableSet<Class> *disabledToolbarClasses; @property(nonatomic, strong, nonnull, readwrite) NSMutableSet<Class> *enabledToolbarClasses; @property(nonatomic, strong, nonnull, readwrite) NSMutableSet<Class> *toolbarPreviousNextAllowedClasses; @property(nonatomic, strong, nonnull, readwrite) NSMutableSet<Class> *disabledTouchResignedClasses; @property(nonatomic, strong, nonnull, readwrite) NSMutableSet<Class> *enabledTouchResignedClasses; @property(nonatomic, strong, nonnull, readwrite) NSMutableSet<Class> *touchResignedGestureIgnoreClasses; /*******************************************/ @end @implementation IQKeyboardManager { @package /*******************************************/ /** To save keyboardWillShowNotification. Needed for enable keyboard functionality. */ NSNotification *_kbShowNotification; /** To save keyboard size. */ CGRect _kbFrame; /*******************************************/ } //UIKeyboard handling @synthesize enable = _enable; @synthesize keyboardDistanceFromTextField = _keyboardDistanceFromTextField; //Keyboard Appearance handling @synthesize overrideKeyboardAppearance = _overrideKeyboardAppearance; @synthesize keyboardAppearance = _keyboardAppearance; //IQToolbar handling @synthesize enableAutoToolbar = _enableAutoToolbar; @synthesize toolbarManageBehaviour = _toolbarManageBehaviour; @synthesize shouldToolbarUsesTextFieldTintColor = _shouldToolbarUsesTextFieldTintColor; @synthesize toolbarTintColor = _toolbarTintColor; @synthesize toolbarBarTintColor = _toolbarBarTintColor; @synthesize shouldShowToolbarPlaceholder = _shouldShowToolbarPlaceholder; @synthesize placeholderFont = _placeholderFont; @synthesize placeholderColor = _placeholderColor; @synthesize placeholderButtonColor = _placeholderButtonColor; //Resign handling @synthesize shouldResignOnTouchOutside = _shouldResignOnTouchOutside; @synthesize resignFirstResponderGesture = _resignFirstResponderGesture; //Sound handling @synthesize shouldPlayInputClicks = _shouldPlayInputClicks; //Animation handling @synthesize layoutIfNeededOnUpdate = _layoutIfNeededOnUpdate; #pragma mark - Initializing functions /** Override +load method to enable KeyboardManager when class loader load IQKeyboardManager. Enabling when app starts (No need to write any code) */ +(void)load { //Enabling IQKeyboardManager. Loading asynchronous on main thread [self performSelectorOnMainThread:@selector(sharedManager) withObject:nil waitUntilDone:NO]; } /* Singleton Object Initialization. */ -(instancetype)init { if (self = [super init]) { __weak typeof(self) weakSelf = self; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ __strong typeof(self) strongSelf = weakSelf; strongSelf.registeredClasses = [[NSMutableSet alloc] init]; [strongSelf registerAllNotifications]; //Creating gesture for @shouldResignOnTouchOutside. (Enhancement ID: #14) strongSelf.resignFirstResponderGesture = [[UITapGestureRecognizer alloc] initWithTarget:strongSelf action:@selector(tapRecognized:)]; strongSelf.resignFirstResponderGesture.cancelsTouchesInView = NO; [strongSelf.resignFirstResponderGesture setDelegate:strongSelf]; strongSelf.resignFirstResponderGesture.enabled = strongSelf.shouldResignOnTouchOutside; strongSelf.topViewBeginOrigin = kIQCGPointInvalid; strongSelf.topViewBeginOriginWhilePopGestureRecognizerActive = kIQCGPointInvalid; //Setting it's initial values strongSelf.animationDuration = 0.25; strongSelf.animationCurve = UIViewAnimationCurveEaseInOut; [strongSelf setEnable:YES]; [strongSelf setKeyboardDistanceFromTextField:10.0]; [strongSelf setShouldPlayInputClicks:YES]; [strongSelf setShouldResignOnTouchOutside:NO]; [strongSelf setOverrideKeyboardAppearance:NO]; [strongSelf setKeyboardAppearance:UIKeyboardAppearanceDefault]; [strongSelf setEnableAutoToolbar:YES]; [strongSelf setShouldShowToolbarPlaceholder:YES]; [strongSelf setToolbarManageBehaviour:IQAutoToolbarBySubviews]; [strongSelf setLayoutIfNeededOnUpdate:NO]; [strongSelf setShouldToolbarUsesTextFieldTintColor:NO]; //Loading IQToolbar, IQTitleBarButtonItem, IQBarButtonItem to fix first time keyboard appearance delay (Bug ID: #550) { //If you experience exception breakpoint issue at below line then try these solutions https://stackoverflow.com/questions/27375640/all-exception-break-point-is-stopping-for-no-reason-on-simulator UITextField *view = [[UITextField alloc] init]; [view addDoneOnKeyboardWithTarget:nil action:nil]; [view addPreviousNextDoneOnKeyboardWithTarget:nil previousAction:nil nextAction:nil doneAction:nil]; } //Initializing disabled classes Set. strongSelf.disabledDistanceHandlingClasses = [[NSMutableSet alloc] initWithObjects:[UITableViewController class],[UIAlertController class], nil]; strongSelf.enabledDistanceHandlingClasses = [[NSMutableSet alloc] init]; strongSelf.disabledToolbarClasses = [[NSMutableSet alloc] initWithObjects:[UIAlertController class], nil]; strongSelf.enabledToolbarClasses = [[NSMutableSet alloc] init]; strongSelf.toolbarPreviousNextAllowedClasses = [[NSMutableSet alloc] initWithObjects:[UITableView class],[UICollectionView class],[IQPreviousNextView class], nil]; strongSelf.disabledTouchResignedClasses = [[NSMutableSet alloc] initWithObjects:[UIAlertController class], nil]; strongSelf.enabledTouchResignedClasses = [[NSMutableSet alloc] init]; strongSelf.touchResignedGestureIgnoreClasses = [[NSMutableSet alloc] initWithObjects:[UIControl class],[UINavigationBar class], nil]; }); } return self; } /* Automatically called from the `+(void)load` method. */ + (IQKeyboardManager*)sharedManager { //Singleton instance static IQKeyboardManager *kbManager; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ kbManager = [[self alloc] init]; }); return kbManager; } #pragma mark - Dealloc -(void)dealloc { // Disable the keyboard manager. [self setEnable:NO]; //Removing notification observers on dealloc. [[NSNotificationCenter defaultCenter] removeObserver:self]; } #pragma mark - Property functions -(void)setEnable:(BOOL)enable { // If not enabled, enable it. if (enable == YES && _enable == NO) { //Setting YES to _enable. _enable = enable; //If keyboard is currently showing. Sending a fake notification for keyboardWillShow to adjust view according to keyboard. if (_kbShowNotification) [self keyboardWillShow:_kbShowNotification]; [self showLog:@"Enabled"]; } //If not disable, desable it. else if (enable == NO && _enable == YES) { //Sending a fake notification for keyboardWillHide to retain view's original position. [self keyboardWillHide:nil]; //Setting NO to _enable. _enable = enable; [self showLog:@"Disabled"]; } //If already disabled. else if (enable == NO && _enable == NO) { [self showLog:@"Already Disabled"]; } //If already enabled. else if (enable == YES && _enable == YES) { [self showLog:@"Already Enabled"]; } } -(BOOL)privateIsEnabled { BOOL enable = _enable; // IQEnableMode enableMode = _textFieldView.enableMode; // // if (enableMode == IQEnableModeEnabled) // { // enable = YES; // } // else if (enableMode == IQEnableModeDisabled) // { // enable = NO; // } // else { UIViewController *textFieldViewController = [_textFieldView viewContainingController]; if (textFieldViewController) { if (enable == NO) { //If viewController is kind of enable viewController class, then assuming it's enabled. for (Class enabledClass in _enabledDistanceHandlingClasses) { if ([textFieldViewController isKindOfClass:enabledClass]) { enable = YES; break; } } } if (enable) { //If viewController is kind of disable viewController class, then assuming it's disable. for (Class disabledClass in _disabledDistanceHandlingClasses) { if ([textFieldViewController isKindOfClass:disabledClass]) { enable = NO; break; } } //Special Controllers if (enable == YES) { NSString *classNameString = NSStringFromClass([textFieldViewController class]); //_UIAlertControllerTextFieldViewController if ([classNameString containsString:@"UIAlertController"] && [classNameString hasSuffix:@"TextFieldViewController"]) { enable = NO; } } } } } return enable; } // Setting keyboard distance from text field. -(void)setKeyboardDistanceFromTextField:(CGFloat)keyboardDistanceFromTextField { //Can't be less than zero. Minimum is zero. _keyboardDistanceFromTextField = MAX(keyboardDistanceFromTextField, 0); [self showLog:[NSString stringWithFormat:@"keyboardDistanceFromTextField: %.2f",_keyboardDistanceFromTextField]]; } /** Enabling/disable gesture on touching. */ -(void)setShouldResignOnTouchOutside:(BOOL)shouldResignOnTouchOutside { [self showLog:[NSString stringWithFormat:@"shouldResignOnTouchOutside: %@",shouldResignOnTouchOutside?@"Yes":@"No"]]; _shouldResignOnTouchOutside = shouldResignOnTouchOutside; //Enable/Disable gesture recognizer (Enhancement ID: #14) [_resignFirstResponderGesture setEnabled:[self privateShouldResignOnTouchOutside]]; } -(BOOL)privateShouldResignOnTouchOutside { BOOL shouldResignOnTouchOutside = _shouldResignOnTouchOutside; UIView *textFieldView = _textFieldView; IQEnableMode enableMode = textFieldView.shouldResignOnTouchOutsideMode; if (enableMode == IQEnableModeEnabled) { shouldResignOnTouchOutside = YES; } else if (enableMode == IQEnableModeDisabled) { shouldResignOnTouchOutside = NO; } else { UIViewController *textFieldViewController = [textFieldView viewContainingController]; if (textFieldViewController) { if (shouldResignOnTouchOutside == NO) { //If viewController is kind of enable viewController class, then assuming shouldResignOnTouchOutside is enabled. for (Class enabledClass in _enabledTouchResignedClasses) { if ([textFieldViewController isKindOfClass:enabledClass]) { shouldResignOnTouchOutside = YES; break; } } } if (shouldResignOnTouchOutside) { //If viewController is kind of disable viewController class, then assuming shouldResignOnTouchOutside is disable. for (Class disabledClass in _disabledTouchResignedClasses) { if ([textFieldViewController isKindOfClass:disabledClass]) { shouldResignOnTouchOutside = NO; break; } } //Special Controllers if (shouldResignOnTouchOutside == YES) { NSString *classNameString = NSStringFromClass([textFieldViewController class]); //_UIAlertControllerTextFieldViewController if ([classNameString containsString:@"UIAlertController"] && [classNameString hasSuffix:@"TextFieldViewController"]) { shouldResignOnTouchOutside = NO; } } } } } return shouldResignOnTouchOutside; } /** Enable/disable autotoolbar. Adding and removing toolbar if required. */ -(void)setEnableAutoToolbar:(BOOL)enableAutoToolbar { _enableAutoToolbar = enableAutoToolbar; [self showLog:[NSString stringWithFormat:@"enableAutoToolbar: %@",enableAutoToolbar?@"Yes":@"No"]]; //If enabled then adding toolbar. if ([self privateIsEnableAutoToolbar] == YES) { [self addToolbarIfRequired]; } //Else removing toolbar. else { [self removeToolbarIfRequired]; } } -(BOOL)privateIsEnableAutoToolbar { BOOL enableAutoToolbar = _enableAutoToolbar; UIViewController *textFieldViewController = [_textFieldView viewContainingController]; if (textFieldViewController) { if (enableAutoToolbar == NO) { //If found any toolbar enabled classes then return. for (Class enabledToolbarClass in _enabledToolbarClasses) { if ([textFieldViewController isKindOfClass:enabledToolbarClass]) { enableAutoToolbar = YES; break; } } } if (enableAutoToolbar) { //If found any toolbar disabled classes then return. for (Class disabledToolbarClass in _disabledToolbarClasses) { if ([textFieldViewController isKindOfClass:disabledToolbarClass]) { enableAutoToolbar = NO; break; } } //Special Controllers if (enableAutoToolbar == YES) { NSString *classNameString = NSStringFromClass([textFieldViewController class]); //_UIAlertControllerTextFieldViewController if ([classNameString containsString:@"UIAlertController"] && [classNameString hasSuffix:@"TextFieldViewController"]) { enableAutoToolbar = NO; } } } } return enableAutoToolbar; } #pragma mark - Private Methods /** Getting keyWindow. */ -(UIWindow *)keyWindow { UIView *textFieldView = _textFieldView; if (textFieldView.window) { return textFieldView.window; } else { static __weak UIWindow *_keyWindow = nil; /* (Bug ID: #23, #25, #73) */ UIWindow *originalKeyWindow = [[UIApplication sharedApplication] keyWindow]; UIWindow *strongKeyWindow = _keyWindow; //If original key window is not nil and the cached keywindow is also not original keywindow then changing keywindow. if (originalKeyWindow && strongKeyWindow != originalKeyWindow) { strongKeyWindow = _keyWindow = originalKeyWindow; } return strongKeyWindow; } } -(void)optimizedAdjustPosition { if (_hasPendingAdjustRequest == NO) { _hasPendingAdjustRequest = YES; __weak typeof(self) weakSelf = self; [[NSOperationQueue mainQueue] addOperationWithBlock:^{ __strong typeof(self) strongSelf = weakSelf; [strongSelf adjustPosition]; strongSelf.hasPendingAdjustRequest = NO; }]; } } /* Adjusting RootViewController's frame according to interface orientation. */ -(void)adjustPosition { UIView *textFieldView = _textFieldView; // Getting RootViewController. (Bug ID: #1, #4) UIViewController *rootController = _rootViewController; // Getting KeyWindow object. UIWindow *keyWindow = [self keyWindow]; // We are unable to get textField object while keyboard showing on UIWebView's textField. (Bug ID: #11) if (_hasPendingAdjustRequest == NO || textFieldView == nil || rootController == nil || keyWindow == nil) return; CFTimeInterval startTime = CACurrentMediaTime(); [self showLog:[NSString stringWithFormat:@"****** %@ started ******",NSStringFromSelector(_cmd)] indentation:1]; // Converting Rectangle according to window bounds. CGRect textFieldViewRectInWindow = [[textFieldView superview] convertRect:textFieldView.frame toView:keyWindow]; CGRect textFieldViewRectInRootSuperview = [[textFieldView superview] convertRect:textFieldView.frame toView:rootController.view.superview]; // Getting RootView origin. CGPoint rootViewOrigin = rootController.view.frame.origin; //Maintain keyboardDistanceFromTextField CGFloat specialKeyboardDistanceFromTextField = textFieldView.keyboardDistanceFromTextField; { UISearchBar *searchBar = textFieldView.textFieldSearchBar; if (searchBar) { specialKeyboardDistanceFromTextField = searchBar.keyboardDistanceFromTextField; } } CGFloat keyboardDistanceFromTextField = (specialKeyboardDistanceFromTextField == kIQUseDefaultKeyboardDistance)?_keyboardDistanceFromTextField:specialKeyboardDistanceFromTextField; CGSize kbSize; { CGRect kbFrame = _kbFrame; kbFrame.origin.y -= keyboardDistanceFromTextField; kbFrame.size.height += keyboardDistanceFromTextField; //Calculating actual keyboard displayed size, keyboard frame may be different when hardware keyboard is attached (Bug ID: #469) (Bug ID: #381) (Bug ID: #1506) CGRect intersectRect = CGRectIntersection(kbFrame, keyWindow.frame); if (CGRectIsNull(intersectRect)) { kbSize = CGSizeMake(kbFrame.size.width, 0); } else { kbSize = intersectRect.size; } } CGFloat navigationBarAreaHeight = [[UIApplication sharedApplication] statusBarFrame].size.height + rootController.navigationController.navigationBar.frame.size.height; CGFloat layoutAreaHeight = rootController.view.layoutMargins.top; CGFloat topLayoutGuide = MAX(navigationBarAreaHeight, layoutAreaHeight) + 5; CGFloat bottomLayoutGuide = [textFieldView isKindOfClass:[UITextView class]] ? 0 : rootController.view.layoutMargins.bottom; //Validation of textView for case where there is a tab bar at the bottom or running on iPhone X and textView is at the bottom. // +Move positive = textField is hidden. // -Move negative = textField is showing. // Calculating move position. Common for both normal and special cases. CGFloat move = MIN(CGRectGetMinY(textFieldViewRectInRootSuperview)-topLayoutGuide, CGRectGetMaxY(textFieldViewRectInWindow)-(CGRectGetHeight(keyWindow.frame)-kbSize.height)+bottomLayoutGuide); [self showLog:[NSString stringWithFormat:@"Need to move: %.2f",move]]; UIScrollView *superScrollView = nil; UIScrollView *superView = (UIScrollView*)[textFieldView superviewOfClassType:[UIScrollView class]]; //Getting UIScrollView whose scrolling is enabled. // (Bug ID: #285) while (superView) { if (superView.isScrollEnabled && superView.shouldIgnoreScrollingAdjustment == NO) { superScrollView = superView; break; } else { // Getting it's superScrollView. // (Enhancement ID: #21, #24) superView = (UIScrollView*)[superView superviewOfClassType:[UIScrollView class]]; } } __strong typeof(UIScrollView) *strongLastScrollView = _lastScrollView; //If there was a lastScrollView. // (Bug ID: #34) if (strongLastScrollView) { //If we can't find current superScrollView, then setting lastScrollView to it's original form. if (superScrollView == nil) { if (UIEdgeInsetsEqualToEdgeInsets(strongLastScrollView.contentInset, _startingContentInsets) == NO) { [self showLog:[NSString stringWithFormat:@"Restoring ScrollView contentInset to : %@",NSStringFromUIEdgeInsets(_startingContentInsets)]]; __weak typeof(self) weakSelf = self; [UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{ __strong typeof(self) strongSelf = weakSelf; [strongLastScrollView setContentInset:strongSelf.startingContentInsets]; strongLastScrollView.scrollIndicatorInsets = strongSelf.startingScrollIndicatorInsets; } completion:NULL]; } if (strongLastScrollView.shouldRestoreScrollViewContentOffset && CGPointEqualToPoint(strongLastScrollView.contentOffset, _startingContentOffset) == NO) { [self showLog:[NSString stringWithFormat:@"Restoring ScrollView contentOffset to : %@",NSStringFromCGPoint(_startingContentOffset)]]; BOOL animatedContentOffset = NO; // (Bug ID: #1365, #1508, #1541) #ifdef __IPHONE_11_0 if (@available(iOS 9.0, *)) #else if (IQ_IS_IOS9_OR_GREATER) #endif { animatedContentOffset = ([textFieldView superviewOfClassType:[UIStackView class] belowView:strongLastScrollView] != nil); } if (animatedContentOffset) { [strongLastScrollView setContentOffset:_startingContentOffset animated:UIView.areAnimationsEnabled]; } else { strongLastScrollView.contentOffset = _startingContentOffset; } } _startingContentInsets = UIEdgeInsetsZero; _startingScrollIndicatorInsets = UIEdgeInsetsZero; _startingContentOffset = CGPointZero; _lastScrollView = nil; strongLastScrollView = _lastScrollView; } //If both scrollView's are different, then reset lastScrollView to it's original frame and setting current scrollView as last scrollView. else if (superScrollView != strongLastScrollView) { if (UIEdgeInsetsEqualToEdgeInsets(strongLastScrollView.contentInset, _startingContentInsets) == NO) { [self showLog:[NSString stringWithFormat:@"Restoring ScrollView contentInset to : %@",NSStringFromUIEdgeInsets(_startingContentInsets)]]; __weak typeof(self) weakSelf = self; [UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{ __strong typeof(self) strongSelf = weakSelf; [strongLastScrollView setContentInset:strongSelf.startingContentInsets]; strongLastScrollView.scrollIndicatorInsets = strongSelf.startingScrollIndicatorInsets; } completion:NULL]; } if (strongLastScrollView.shouldRestoreScrollViewContentOffset && CGPointEqualToPoint(strongLastScrollView.contentOffset, _startingContentOffset) == NO) { [self showLog:[NSString stringWithFormat:@"Restoring ScrollView contentOffset to : %@",NSStringFromCGPoint(_startingContentOffset)]]; BOOL animatedContentOffset = NO; // (Bug ID: #1365, #1508, #1541) #ifdef __IPHONE_11_0 if (@available(iOS 9.0, *)) #else if (IQ_IS_IOS9_OR_GREATER) #endif { animatedContentOffset = ([textFieldView superviewOfClassType:[UIStackView class] belowView:strongLastScrollView] != nil); } if (animatedContentOffset) { [strongLastScrollView setContentOffset:_startingContentOffset animated:UIView.areAnimationsEnabled]; } else { strongLastScrollView.contentOffset = _startingContentOffset; } } _lastScrollView = superScrollView; strongLastScrollView = _lastScrollView; _startingContentInsets = superScrollView.contentInset; _startingScrollIndicatorInsets = superScrollView.scrollIndicatorInsets; _startingContentOffset = superScrollView.contentOffset; [self showLog:[NSString stringWithFormat:@"Saving New contentInset: %@ and contentOffset : %@",NSStringFromUIEdgeInsets(_startingContentInsets),NSStringFromCGPoint(_startingContentOffset)]]; } //Else the case where superScrollView == lastScrollView means we are on same scrollView after switching to different textField. So doing nothing } //If there was no lastScrollView and we found a current scrollView. then setting it as lastScrollView. else if(superScrollView) { _lastScrollView = superScrollView; strongLastScrollView = _lastScrollView; _startingContentInsets = superScrollView.contentInset; _startingContentOffset = superScrollView.contentOffset; _startingScrollIndicatorInsets = superScrollView.scrollIndicatorInsets; [self showLog:[NSString stringWithFormat:@"Saving contentInset: %@ and contentOffset : %@",NSStringFromUIEdgeInsets(_startingContentInsets),NSStringFromCGPoint(_startingContentOffset)]]; } // Special case for ScrollView. { // If we found lastScrollView then setting it's contentOffset to show textField. if (strongLastScrollView) { //Saving UIView *lastView = textFieldView; superScrollView = strongLastScrollView; //Looping in upper hierarchy until we don't found any scrollView in it's upper hirarchy till UIWindow object. while (superScrollView) { BOOL shouldContinue = NO; if (move > 0) { shouldContinue = move > (-superScrollView.contentOffset.y-superScrollView.contentInset.top); } else { //Special treatment for UITableView due to their cell reusing logic if ([superScrollView isKindOfClass:[UITableView class]]) { shouldContinue = superScrollView.contentOffset.y>0; UITableView *tableView = (UITableView*)superScrollView; UITableViewCell *tableCell = nil; NSIndexPath *indexPath = nil; NSIndexPath *previousIndexPath = nil; if (shouldContinue && (tableCell = (UITableViewCell*)[textFieldView superviewOfClassType:[UITableViewCell class]]) && (indexPath = [tableView indexPathForCell:tableCell]) && (previousIndexPath = [tableView previousIndexPathOfIndexPath:indexPath])) { CGRect previousCellRect = [tableView rectForRowAtIndexPath:previousIndexPath]; if (CGRectIsEmpty(previousCellRect) == NO) { CGRect previousCellRectInRootSuperview = [tableView convertRect:previousCellRect toView:rootController.view.superview]; move = MIN(0, CGRectGetMaxY(previousCellRectInRootSuperview) - topLayoutGuide); } } } //Special treatment for UICollectionView due to their cell reusing logic else if ([superScrollView isKindOfClass:[UICollectionView class]]) { shouldContinue = superScrollView.contentOffset.y>0; UICollectionView *collectionView = (UICollectionView*)superScrollView; UICollectionViewCell *collectionCell = nil; NSIndexPath *indexPath = nil; NSIndexPath *previousIndexPath = nil; if (shouldContinue && (collectionCell = (UICollectionViewCell*)[textFieldView superviewOfClassType:[UICollectionViewCell class]]) && (indexPath = [collectionView indexPathForCell:collectionCell]) && (previousIndexPath = [collectionView previousIndexPathOfIndexPath:indexPath])) { UICollectionViewLayoutAttributes *attributes = [collectionView layoutAttributesForItemAtIndexPath:previousIndexPath]; CGRect previousCellRect = attributes.frame; if (CGRectIsEmpty(previousCellRect) == NO) { CGRect previousCellRectInRootSuperview = [collectionView convertRect:previousCellRect toView:rootController.view.superview]; move = MIN(0, CGRectGetMaxY(previousCellRectInRootSuperview) - topLayoutGuide); } } } else { //If the textField is hidden at the top shouldContinue = textFieldViewRectInRootSuperview.origin.y < topLayoutGuide; if (shouldContinue) { move = MIN(0, textFieldViewRectInRootSuperview.origin.y - topLayoutGuide); } } } if (shouldContinue == NO) { move = 0; break; } UIScrollView *nextScrollView = nil; UIScrollView *tempScrollView = (UIScrollView*)[superScrollView superviewOfClassType:[UIScrollView class]]; //Getting UIScrollView whose scrolling is enabled. // (Bug ID: #285) while (tempScrollView) { if (tempScrollView.isScrollEnabled && tempScrollView.shouldIgnoreScrollingAdjustment == NO) { nextScrollView = tempScrollView; break; } else { // Getting it's superScrollView. // (Enhancement ID: #21, #24) tempScrollView = (UIScrollView*)[tempScrollView superviewOfClassType:[UIScrollView class]]; } } //Getting lastViewRect. CGRect lastViewRect = [[lastView superview] convertRect:lastView.frame toView:superScrollView]; //Calculating the expected Y offset from move and scrollView's contentOffset. CGFloat shouldOffsetY = superScrollView.contentOffset.y - MIN(superScrollView.contentOffset.y,-move); //Rearranging the expected Y offset according to the view. shouldOffsetY = MIN(shouldOffsetY, lastViewRect.origin.y); //[textFieldView isKindOfClass:[UITextView class]] If is a UITextView type //[superScrollView superviewOfClassType:[UIScrollView class]] == nil If processing scrollView is last scrollView in upper hierarchy (there is no other scrollView upper hierarchy.) //shouldOffsetY >= 0 shouldOffsetY must be greater than in order to keep distance from navigationBar (Bug ID: #92) if ([textFieldView isKindOfClass:[UITextView class]] && nextScrollView == nil && (shouldOffsetY >= 0)) { // Converting Rectangle according to window bounds. CGRect currentTextFieldViewRect = [[textFieldView superview] convertRect:textFieldView.frame toView:keyWindow]; //Calculating expected fix distance which needs to be managed from navigation bar CGFloat expectedFixDistance = CGRectGetMinY(currentTextFieldViewRect) - topLayoutGuide; //Now if expectedOffsetY (superScrollView.contentOffset.y + expectedFixDistance) is lower than current shouldOffsetY, which means we're in a position where navigationBar up and hide, then reducing shouldOffsetY with expectedOffsetY (superScrollView.contentOffset.y + expectedFixDistance) shouldOffsetY = MIN(shouldOffsetY, superScrollView.contentOffset.y + expectedFixDistance); //Setting move to 0 because now we don't want to move any view anymore (All will be managed by our contentInset logic. move = 0; } else { //Subtracting the Y offset from the move variable, because we are going to change scrollView's contentOffset.y to shouldOffsetY. move -= (shouldOffsetY-superScrollView.contentOffset.y); } CGPoint newContentOffset = CGPointMake(superScrollView.contentOffset.x, shouldOffsetY); if (CGPointEqualToPoint(superScrollView.contentOffset, newContentOffset) == NO) { __weak typeof(self) weakSelf = self; //Getting problem while using `setContentOffset:animated:`, So I used animation API. [UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{ __strong typeof(self) strongSelf = weakSelf; [strongSelf showLog:[NSString stringWithFormat:@"Adjusting %.2f to %@ ContentOffset",(superScrollView.contentOffset.y-shouldOffsetY),[superScrollView _IQDescription]]]; [strongSelf showLog:[NSString stringWithFormat:@"Remaining Move: %.2f",move]]; BOOL animatedContentOffset = NO; // (Bug ID: #1365, #1508, #1541) #ifdef __IPHONE_11_0 if (@available(iOS 9.0, *)) #else if (IQ_IS_IOS9_OR_GREATER) #endif { animatedContentOffset = ([textFieldView superviewOfClassType:[UIStackView class] belowView:superScrollView] != nil); } if (animatedContentOffset) { [superScrollView setContentOffset:newContentOffset animated:UIView.areAnimationsEnabled]; } else { superScrollView.contentOffset = newContentOffset; } } completion:^(BOOL finished){ __strong typeof(self) strongSelf = weakSelf; if ([superScrollView isKindOfClass:[UITableView class]] || [superScrollView isKindOfClass:[UICollectionView class]]) { //This will update the next/previous states [strongSelf addToolbarIfRequired]; } }]; } // Getting next lastView & superScrollView. lastView = superScrollView; superScrollView = nextScrollView; } //Updating contentInset { CGRect lastScrollViewRect = [[strongLastScrollView superview] convertRect:strongLastScrollView.frame toView:keyWindow]; CGFloat bottom = (kbSize.height-keyboardDistanceFromTextField)-(CGRectGetHeight(keyWindow.frame)-CGRectGetMaxY(lastScrollViewRect)); // Update the insets so that the scroll vew doesn't shift incorrectly when the offset is near the bottom of the scroll view. UIEdgeInsets movedInsets = strongLastScrollView.contentInset; movedInsets.bottom = MAX(_startingContentInsets.bottom, bottom); if (UIEdgeInsetsEqualToEdgeInsets(strongLastScrollView.contentInset, movedInsets) == NO) { [self showLog:[NSString stringWithFormat:@"old ContentInset : %@ new ContentInset : %@", NSStringFromUIEdgeInsets(strongLastScrollView.contentInset), NSStringFromUIEdgeInsets(movedInsets)]]; [UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{ strongLastScrollView.contentInset = movedInsets; UIEdgeInsets newInset = strongLastScrollView.scrollIndicatorInsets; newInset.bottom = movedInsets.bottom; strongLastScrollView.scrollIndicatorInsets = newInset; } completion:NULL]; } } } //Going ahead. No else if. } { //Special case for UITextView(Readjusting textView.contentInset when textView hight is too big to fit on screen) //_lastScrollView If not having inside any scrollView, (now contentInset manages the full screen textView. //[textFieldView isKindOfClass:[UITextView class]] If is a UITextView type if ([textFieldView isKindOfClass:[UITextView class]]) { UITextView *textView = (UITextView*)textFieldView; CGFloat keyboardYPosition = CGRectGetHeight(keyWindow.frame)-(kbSize.height-keyboardDistanceFromTextField); CGRect rootSuperViewFrameInWindow = [rootController.view.superview convertRect:rootController.view.superview.bounds toView:keyWindow]; CGFloat keyboardOverlapping = CGRectGetMaxY(rootSuperViewFrameInWindow) - keyboardYPosition; CGFloat textViewHeight = MIN(CGRectGetHeight(textFieldView.frame), (CGRectGetHeight(rootSuperViewFrameInWindow)-topLayoutGuide-keyboardOverlapping)); if (textFieldView.frame.size.height-textView.contentInset.bottom>textViewHeight) { //_isTextViewContentInsetChanged, If frame is not change by library in past, then saving user textView properties (Bug ID: #92) if (self.isTextViewContentInsetChanged == NO) { self.startingTextViewContentInsets = textView.contentInset; self.startingTextViewScrollIndicatorInsets = textView.scrollIndicatorInsets; } UIEdgeInsets newContentInset = textView.contentInset; newContentInset.bottom = self.textFieldView.frame.size.height-textViewHeight; self.isTextViewContentInsetChanged = YES; if (UIEdgeInsetsEqualToEdgeInsets(textView.contentInset, newContentInset) == NO) { __weak typeof(self) weakSelf = self; [UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{ __strong typeof(self) strongSelf = weakSelf; [strongSelf showLog:[NSString stringWithFormat:@"Old UITextView.contentInset : %@ New UITextView.contentInset : %@", NSStringFromUIEdgeInsets(textView.contentInset), NSStringFromUIEdgeInsets(textView.contentInset)]]; textView.contentInset = newContentInset; textView.scrollIndicatorInsets = newContentInset; } completion:NULL]; } } } { __weak typeof(self) weakSelf = self; // +Positive or zero. if (move>=0) { rootViewOrigin.y -= move; // From now prevent keyboard manager to slide up the rootView to more than keyboard height. (Bug ID: #93) rootViewOrigin.y = MAX(rootViewOrigin.y, MIN(0, -(kbSize.height-keyboardDistanceFromTextField))); [self showLog:@"Moving Upward"]; // Setting adjusted rootViewOrigin.ty //Used UIViewAnimationOptionBeginFromCurrentState to minimize strange animations. [UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{ __strong typeof(self) strongSelf = weakSelf; // Setting it's new frame CGRect rect = rootController.view.frame; rect.origin = rootViewOrigin; rootController.view.frame = rect; //Animating content if needed (Bug ID: #204) if (strongSelf.layoutIfNeededOnUpdate) { //Animating content (Bug ID: #160) [rootController.view setNeedsLayout]; [rootController.view layoutIfNeeded]; } [strongSelf showLog:[NSString stringWithFormat:@"Set %@ origin to : %@",rootController,NSStringFromCGPoint(rootViewOrigin)]]; } completion:NULL]; _movedDistance = (_topViewBeginOrigin.y-rootViewOrigin.y); } // -Negative else { CGFloat disturbDistance = rootController.view.frame.origin.y-_topViewBeginOrigin.y; // disturbDistance Negative = frame disturbed. Pull Request #3 // disturbDistance positive = frame not disturbed. if(disturbDistance<=0) { rootViewOrigin.y -= MAX(move, disturbDistance); [self showLog:@"Moving Downward"]; // Setting adjusted rootViewRect //Used UIViewAnimationOptionBeginFromCurrentState to minimize strange animations. [UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{ __strong typeof(self) strongSelf = weakSelf; // Setting it's new frame CGRect rect = rootController.view.frame; rect.origin = rootViewOrigin; rootController.view.frame = rect; //Animating content if needed (Bug ID: #204) if (strongSelf.layoutIfNeededOnUpdate) { //Animating content (Bug ID: #160) [rootController.view setNeedsLayout]; [rootController.view layoutIfNeeded]; } [strongSelf showLog:[NSString stringWithFormat:@"Set %@ origin to : %@",rootController,NSStringFromCGPoint(rootViewOrigin)]]; } completion:NULL]; _movedDistance = (_topViewBeginOrigin.y-rootController.view.frame.origin.y); } } } } CFTimeInterval elapsedTime = CACurrentMediaTime() - startTime; [self showLog:[NSString stringWithFormat:@"****** %@ ended: %g seconds ******",NSStringFromSelector(_cmd),elapsedTime] indentation:-1]; } -(void)restorePosition { _hasPendingAdjustRequest = NO; // Setting rootViewController frame to it's original position. // (Bug ID: #18) if (_rootViewController && CGPointEqualToPoint(_topViewBeginOrigin, kIQCGPointInvalid) == false) { __weak typeof(self) weakSelf = self; //Used UIViewAnimationOptionBeginFromCurrentState to minimize strange animations. [UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{ __strong typeof(self) strongSelf = weakSelf; UIViewController *strongRootController = strongSelf.rootViewController; { [strongSelf showLog:[NSString stringWithFormat:@"Restoring %@ origin to : %@",strongRootController,NSStringFromCGPoint(strongSelf.topViewBeginOrigin)]]; //Restoring CGRect rect = strongRootController.view.frame; rect.origin = strongSelf.topViewBeginOrigin; strongRootController.view.frame = rect; strongSelf.movedDistance = 0; if (strongRootController.navigationController.interactivePopGestureRecognizer.state == UIGestureRecognizerStateBegan) { strongSelf.rootViewControllerWhilePopGestureRecognizerActive = strongRootController; strongSelf.topViewBeginOriginWhilePopGestureRecognizerActive = strongSelf.topViewBeginOrigin; } //Animating content if needed (Bug ID: #204) if (strongSelf.layoutIfNeededOnUpdate) { //Animating content (Bug ID: #160) [strongRootController.view setNeedsLayout]; [strongRootController.view layoutIfNeeded]; } } } completion:NULL]; _rootViewController = nil; } } #pragma mark - Public Methods /* Refreshes textField/textView position if any external changes is explicitly made by user. */ - (void)reloadLayoutIfNeeded { if ([self privateIsEnabled] == YES) { UIView *textFieldView = _textFieldView; if (textFieldView && _keyboardShowing == YES && CGPointEqualToPoint(_topViewBeginOrigin, kIQCGPointInvalid) == false && [textFieldView isAlertViewTextField] == NO) { [self optimizedAdjustPosition]; } } } #pragma mark - UIKeyboad Notification methods /* UIKeyboardWillShowNotification. */ -(void)keyboardWillShow:(NSNotification*)aNotification { _kbShowNotification = aNotification; // Boolean to know keyboard is showing/hiding _keyboardShowing = YES; // Getting keyboard animation. NSInteger curve = [[aNotification userInfo][UIKeyboardAnimationCurveUserInfoKey] integerValue]; _animationCurve = curve<<16; // Getting keyboard animation duration CGFloat duration = [[aNotification userInfo][UIKeyboardAnimationDurationUserInfoKey] floatValue]; //Saving animation duration if (duration != 0.0) _animationDuration = duration; CGRect oldKBFrame = _kbFrame; // Getting UIKeyboardSize. _kbFrame = [[aNotification userInfo][UIKeyboardFrameEndUserInfoKey] CGRectValue]; if ([self privateIsEnabled] == NO) return; CFTimeInterval startTime = CACurrentMediaTime(); [self showLog:[NSString stringWithFormat:@"****** %@ started ******",NSStringFromSelector(_cmd)] indentation:1]; UIView *textFieldView = _textFieldView; if (textFieldView && CGPointEqualToPoint(_topViewBeginOrigin, kIQCGPointInvalid)) // (Bug ID: #5) { // keyboard is not showing(At the beginning only). We should save rootViewRect. UIViewController *rootController = [textFieldView parentContainerViewController]; _rootViewController = rootController; if (_rootViewControllerWhilePopGestureRecognizerActive == rootController) { _topViewBeginOrigin = _topViewBeginOriginWhilePopGestureRecognizerActive; } else { _topViewBeginOrigin = rootController.view.frame.origin; } _rootViewControllerWhilePopGestureRecognizerActive = nil; _topViewBeginOriginWhilePopGestureRecognizerActive = kIQCGPointInvalid; [self showLog:[NSString stringWithFormat:@"Saving %@ beginning origin: %@",rootController,NSStringFromCGPoint(_topViewBeginOrigin)]]; } //If last restored keyboard size is different(any orientation accure), then refresh. otherwise not. if (!CGRectEqualToRect(_kbFrame, oldKBFrame)) { //If _textFieldView is inside UIAlertView then do nothing. (Bug ID: #37, #74, #76) //See notes:- https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html If it is UIAlertView textField then do not affect anything (Bug ID: #70). if (_keyboardShowing == YES && textFieldView && [textFieldView isAlertViewTextField] == NO) { [self optimizedAdjustPosition]; } } CFTimeInterval elapsedTime = CACurrentMediaTime() - startTime; [self showLog:[NSString stringWithFormat:@"****** %@ ended: %g seconds ******",NSStringFromSelector(_cmd),elapsedTime] indentation:-1]; } /* UIKeyboardDidShowNotification. */ - (void)keyboardDidShow:(NSNotification*)aNotification { if ([self privateIsEnabled] == NO) return; CFTimeInterval startTime = CACurrentMediaTime(); [self showLog:[NSString stringWithFormat:@"****** %@ started ******",NSStringFromSelector(_cmd)] indentation:1]; UIView *textFieldView = _textFieldView; // Getting topMost ViewController. UIViewController *controller = [textFieldView topMostController]; //If _textFieldView viewController is presented as formSheet, then adjustPosition again because iOS internally update formSheet frame on keyboardShown. (Bug ID: #37, #74, #76) if (_keyboardShowing == YES && textFieldView && (controller.modalPresentationStyle == UIModalPresentationFormSheet || controller.modalPresentationStyle == UIModalPresentationPageSheet) && [textFieldView isAlertViewTextField] == NO) { [self optimizedAdjustPosition]; } CFTimeInterval elapsedTime = CACurrentMediaTime() - startTime; [self showLog:[NSString stringWithFormat:@"****** %@ ended: %g seconds ******",NSStringFromSelector(_cmd),elapsedTime] indentation:-1]; } /* UIKeyboardWillHideNotification. So setting rootViewController to it's default frame. */ - (void)keyboardWillHide:(NSNotification*)aNotification { //If it's not a fake notification generated by [self setEnable:NO]. if (aNotification) _kbShowNotification = nil; // Boolean to know keyboard is showing/hiding _keyboardShowing = NO; // Getting keyboard animation duration CGFloat aDuration = [[aNotification userInfo][UIKeyboardAnimationDurationUserInfoKey] floatValue]; if (aDuration!= 0.0f) { _animationDuration = aDuration; } //If not enabled then do nothing. if ([self privateIsEnabled] == NO) return; CFTimeInterval startTime = CACurrentMediaTime(); [self showLog:[NSString stringWithFormat:@"****** %@ started ******",NSStringFromSelector(_cmd)] indentation:1]; //Commented due to #56. Added all the conditions below to handle UIWebView's textFields. (Bug ID: #56) // We are unable to get textField object while keyboard showing on UIWebView's textField. (Bug ID: #11) // if (_textFieldView == nil) return; //Restoring the contentOffset of the lastScrollView __strong typeof(UIScrollView) *strongLastScrollView = _lastScrollView; if (strongLastScrollView) { __weak typeof(self) weakSelf = self; __weak typeof(UIView) *weakTextFieldView = self.textFieldView; [UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{ __strong typeof(self) strongSelf = weakSelf; __strong typeof(UIView) *strongTextFieldView = weakTextFieldView; if (UIEdgeInsetsEqualToEdgeInsets(strongLastScrollView.contentInset, strongSelf.startingContentInsets) == NO) { [strongSelf showLog:[NSString stringWithFormat:@"Restoring ScrollView contentInset to : %@",NSStringFromUIEdgeInsets(strongSelf.startingContentInsets)]]; strongLastScrollView.contentInset = strongSelf.startingContentInsets; strongLastScrollView.scrollIndicatorInsets = strongSelf.startingScrollIndicatorInsets; } if (strongLastScrollView.shouldRestoreScrollViewContentOffset && CGPointEqualToPoint(strongLastScrollView.contentOffset, strongSelf.startingContentOffset) == NO) { [strongSelf showLog:[NSString stringWithFormat:@"Restoring ScrollView contentOffset to : %@",NSStringFromCGPoint(strongSelf.startingContentOffset)]]; BOOL animatedContentOffset = NO; // (Bug ID: #1365, #1508, #1541) #ifdef __IPHONE_11_0 if (@available(iOS 9.0, *)) #else if (IQ_IS_IOS9_OR_GREATER) #endif { animatedContentOffset = ([strongTextFieldView superviewOfClassType:[UIStackView class] belowView:strongLastScrollView] != nil); } if (animatedContentOffset) { [strongLastScrollView setContentOffset:strongSelf.startingContentOffset animated:UIView.areAnimationsEnabled]; } else { strongLastScrollView.contentOffset = strongSelf.startingContentOffset; } } // TODO: restore scrollView state // This is temporary solution. Have to implement the save and restore scrollView state UIScrollView *superscrollView = strongLastScrollView; do { CGSize contentSize = CGSizeMake(MAX(superscrollView.contentSize.width, CGRectGetWidth(superscrollView.frame)), MAX(superscrollView.contentSize.height, CGRectGetHeight(superscrollView.frame))); CGFloat minimumY = contentSize.height-CGRectGetHeight(superscrollView.frame); if (minimumY<superscrollView.contentOffset.y) { CGPoint newContentOffset = CGPointMake(superscrollView.contentOffset.x, minimumY); if (CGPointEqualToPoint(superscrollView.contentOffset, newContentOffset) == NO) { [self showLog:[NSString stringWithFormat:@"Restoring contentOffset to : %@",NSStringFromCGPoint(newContentOffset)]]; BOOL animatedContentOffset = NO; // (Bug ID: #1365, #1508, #1541) #ifdef __IPHONE_11_0 if (@available(iOS 9.0, *)) #else if (IQ_IS_IOS9_OR_GREATER) #endif { animatedContentOffset = ([strongSelf.textFieldView superviewOfClassType:[UIStackView class] belowView:superscrollView] != nil); } if (animatedContentOffset) { [superscrollView setContentOffset:newContentOffset animated:UIView.areAnimationsEnabled]; } else { superscrollView.contentOffset = newContentOffset; } } } } while ((superscrollView = (UIScrollView*)[superscrollView superviewOfClassType:[UIScrollView class]])); } completion:NULL]; } [self restorePosition]; //Reset all values _lastScrollView = nil; _kbFrame = CGRectZero; _startingContentInsets = UIEdgeInsetsZero; _startingScrollIndicatorInsets = UIEdgeInsetsZero; _startingContentOffset = CGPointZero; CFTimeInterval elapsedTime = CACurrentMediaTime() - startTime; [self showLog:[NSString stringWithFormat:@"****** %@ ended: %g seconds ******",NSStringFromSelector(_cmd),elapsedTime] indentation:-1]; } /* UIKeyboardDidHideNotification. So topViewBeginRect can be set to CGRectZero. */ - (void)keyboardDidHide:(NSNotification*)aNotification { CFTimeInterval startTime = CACurrentMediaTime(); [self showLog:[NSString stringWithFormat:@"****** %@ started ******",NSStringFromSelector(_cmd)] indentation:1]; _topViewBeginOrigin = kIQCGPointInvalid; _kbFrame = CGRectZero; CFTimeInterval elapsedTime = CACurrentMediaTime() - startTime; [self showLog:[NSString stringWithFormat:@"****** %@ ended: %g seconds ******",NSStringFromSelector(_cmd),elapsedTime] indentation:-1]; } #pragma mark - UITextFieldView Delegate methods /** UITextFieldTextDidBeginEditingNotification, UITextViewTextDidBeginEditingNotification. Fetching UITextFieldView object. */ -(void)textFieldViewDidBeginEditing:(NSNotification*)notification { CFTimeInterval startTime = CACurrentMediaTime(); [self showLog:[NSString stringWithFormat:@"****** %@ started ******",NSStringFromSelector(_cmd)] indentation:1]; // Getting object _textFieldView = notification.object; UIView *textFieldView = _textFieldView; if (_overrideKeyboardAppearance == YES) { UITextField *textField = (UITextField*)textFieldView; if ([textField respondsToSelector:@selector(keyboardAppearance)]) { //If keyboard appearance is not like the provided appearance if (textField.keyboardAppearance != _keyboardAppearance) { //Setting textField keyboard appearance and reloading inputViews. textField.keyboardAppearance = _keyboardAppearance; [textField reloadInputViews]; } } } //If autoToolbar enable, then add toolbar on all the UITextField/UITextView's if required. if ([self privateIsEnableAutoToolbar]) { //UITextView special case. Keyboard Notification is firing before textView notification so we need to reload it's inputViews. if ([textFieldView isKindOfClass:[UITextView class]] && textFieldView.inputAccessoryView == nil) { __weak typeof(self) weakSelf = self; [UIView animateWithDuration:0.00001 delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{ __strong typeof(self) strongSelf = weakSelf; [strongSelf addToolbarIfRequired]; } completion:^(BOOL finished) { __strong typeof(self) strongSelf = weakSelf; //On textView toolbar didn't appear on first time, so forcing textView to reload it's inputViews. [strongSelf.textFieldView reloadInputViews]; }]; } //Else adding toolbar else { [self addToolbarIfRequired]; } } else { [self removeToolbarIfRequired]; } //Adding Geture recognizer to window (Enhancement ID: #14) [_resignFirstResponderGesture setEnabled:[self privateShouldResignOnTouchOutside]]; [textFieldView.window addGestureRecognizer:_resignFirstResponderGesture]; if ([self privateIsEnabled] == YES) { if (CGPointEqualToPoint(_topViewBeginOrigin, kIQCGPointInvalid)) // (Bug ID: #5) { // keyboard is not showing(At the beginning only). UIViewController *rootController = [textFieldView parentContainerViewController]; _rootViewController = rootController; if (_rootViewControllerWhilePopGestureRecognizerActive == rootController) { _topViewBeginOrigin = _topViewBeginOriginWhilePopGestureRecognizerActive; } else { _topViewBeginOrigin = rootController.view.frame.origin; } _rootViewControllerWhilePopGestureRecognizerActive = nil; _topViewBeginOriginWhilePopGestureRecognizerActive = kIQCGPointInvalid; [self showLog:[NSString stringWithFormat:@"Saving %@ beginning origin: %@",rootController, NSStringFromCGPoint(_topViewBeginOrigin)]]; } //If textFieldView is inside UIAlertView then do nothing. (Bug ID: #37, #74, #76) //See notes:- https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html If it is UIAlertView textField then do not affect anything (Bug ID: #70). if (_keyboardShowing == YES && textFieldView && [textFieldView isAlertViewTextField] == NO) { // keyboard is already showing. adjust frame. [self optimizedAdjustPosition]; } } // if ([textFieldView isKindOfClass:[UITextField class]]) // { // [(UITextField*)textFieldView addTarget:self action:@selector(editingDidEndOnExit:) forControlEvents:UIControlEventEditingDidEndOnExit]; // } CFTimeInterval elapsedTime = CACurrentMediaTime() - startTime; [self showLog:[NSString stringWithFormat:@"****** %@ ended: %g seconds ******",NSStringFromSelector(_cmd),elapsedTime] indentation:-1]; } /** UITextFieldTextDidEndEditingNotification, UITextViewTextDidEndEditingNotification. Removing fetched object. */ -(void)textFieldViewDidEndEditing:(NSNotification*)notification { CFTimeInterval startTime = CACurrentMediaTime(); [self showLog:[NSString stringWithFormat:@"****** %@ started ******",NSStringFromSelector(_cmd)] indentation:1]; UIView *textFieldView = _textFieldView; //Removing gesture recognizer (Enhancement ID: #14) [textFieldView.window removeGestureRecognizer:_resignFirstResponderGesture]; // if ([textFieldView isKindOfClass:[UITextField class]]) // { // [(UITextField*)textFieldView removeTarget:self action:@selector(editingDidEndOnExit:) forControlEvents:UIControlEventEditingDidEndOnExit]; // } // We check if there's a change in original frame or not. if(_isTextViewContentInsetChanged == YES && [textFieldView isKindOfClass:[UITextView class]]) { UITextView *textView = (UITextView*)textFieldView; self.isTextViewContentInsetChanged = NO; if (UIEdgeInsetsEqualToEdgeInsets(textView.contentInset, self.startingTextViewContentInsets) == NO) { __weak typeof(self) weakSelf = self; [UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{ __strong typeof(self) strongSelf = weakSelf; [strongSelf showLog:[NSString stringWithFormat:@"Restoring textView.contentInset to : %@",NSStringFromUIEdgeInsets(strongSelf.startingTextViewContentInsets)]]; //Setting textField to it's initial contentInset textView.contentInset = strongSelf.startingTextViewContentInsets; textView.scrollIndicatorInsets = strongSelf.startingTextViewScrollIndicatorInsets; } completion:NULL]; } } //Setting object to nil _textFieldView = nil; CFTimeInterval elapsedTime = CACurrentMediaTime() - startTime; [self showLog:[NSString stringWithFormat:@"****** %@ ended: %g seconds ******",NSStringFromSelector(_cmd),elapsedTime] indentation:-1]; } //-(void)editingDidEndOnExit:(UITextField*)textField //{ // [self showLog:[NSString stringWithFormat:@"ReturnKey %@",NSStringFromSelector(_cmd)]]; //} #pragma mark - UIStatusBar Notification methods /** UIApplicationWillChangeStatusBarOrientationNotification. Need to set the textView to it's original position. If any frame changes made. (Bug ID: #92)*/ - (void)willChangeStatusBarOrientation:(NSNotification*)aNotification { CFTimeInterval startTime = CACurrentMediaTime(); [self showLog:[NSString stringWithFormat:@"****** %@ started ******",NSStringFromSelector(_cmd)] indentation:1]; //If textViewContentInsetChanged is changed then restore it. if (_isTextViewContentInsetChanged == YES && [_textFieldView isKindOfClass:[UITextView class]]) { UITextView *textView = (UITextView*)_textFieldView; self.isTextViewContentInsetChanged = NO; if (UIEdgeInsetsEqualToEdgeInsets(textView.contentInset, self.startingTextViewContentInsets) == NO) { __weak typeof(self) weakSelf = self; //Due to orientation callback we need to set it's original position. [UIView animateWithDuration:_animationDuration delay:0 options:(_animationCurve|UIViewAnimationOptionBeginFromCurrentState) animations:^{ __strong typeof(self) strongSelf = weakSelf; [strongSelf showLog:[NSString stringWithFormat:@"Restoring textView.contentInset to : %@",NSStringFromUIEdgeInsets(strongSelf.startingTextViewContentInsets)]]; //Setting textField to it's initial contentInset textView.contentInset = strongSelf.startingTextViewContentInsets; textView.scrollIndicatorInsets = strongSelf.startingTextViewScrollIndicatorInsets; } completion:NULL]; } } [self restorePosition]; CFTimeInterval elapsedTime = CACurrentMediaTime() - startTime; [self showLog:[NSString stringWithFormat:@"****** %@ ended: %g seconds ******",NSStringFromSelector(_cmd),elapsedTime] indentation:-1]; } #pragma mark AutoResign methods /** Resigning on tap gesture. */ - (void)tapRecognized:(UITapGestureRecognizer*)gesture // (Enhancement ID: #14) { if (gesture.state == UIGestureRecognizerStateEnded) { //Resigning currently responder textField. [self resignFirstResponder]; } } /** Note: returning YES is guaranteed to allow simultaneous recognition. returning NO is not guaranteed to prevent simultaneous recognition, as the other gesture's delegate may return YES. */ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { return NO; } /** To not detect touch events in a subclass of UIControl, these may have added their own selector for specific work */ -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { // Should not recognize gesture if the clicked view is either UIControl or UINavigationBar(<Back button etc...) (Bug ID: #145) for (Class aClass in self.touchResignedGestureIgnoreClasses) { if ([[touch view] isKindOfClass:aClass]) { return NO; } } return YES; } /** Resigning textField. */ - (BOOL)resignFirstResponder { UIView *textFieldView = _textFieldView; if (textFieldView) { // Retaining textFieldView UIView *textFieldRetain = textFieldView; //Resigning first responder BOOL isResignFirstResponder = [textFieldView resignFirstResponder]; // If it refuses then becoming it as first responder again. (Bug ID: #96) if (isResignFirstResponder == NO) { //If it refuses to resign then becoming it first responder again for getting notifications callback. [textFieldRetain becomeFirstResponder]; [self showLog:[NSString stringWithFormat:@"Refuses to Resign first responder: %@",textFieldView]]; } return isResignFirstResponder; } else { return NO; } } /** Returns YES if can navigate to previous responder textField/textView, otherwise NO. */ -(BOOL)canGoPrevious { //Getting all responder view's. NSArray<UIView*> *textFields = [self responderViews]; //Getting index of current textField. NSUInteger index = [textFields indexOfObject:_textFieldView]; //If it is not first textField. then it's previous object can becomeFirstResponder. if (index != NSNotFound && index > 0) { return YES; } else { return NO; } } /** Returns YES if can navigate to next responder textField/textView, otherwise NO. */ -(BOOL)canGoNext { //Getting all responder view's. NSArray<UIView*> *textFields = [self responderViews]; //Getting index of current textField. NSUInteger index = [textFields indexOfObject:_textFieldView]; //If it is not last textField. then it's next object becomeFirstResponder. if (index != NSNotFound && index < textFields.count-1) { return YES; } else { return NO; } } /** Navigate to previous responder textField/textView. */ -(BOOL)goPrevious { //Getting all responder view's. NSArray<__kindof UIView*> *textFields = [self responderViews]; //Getting index of current textField. NSUInteger index = [textFields indexOfObject:_textFieldView]; //If it is not first textField. then it's previous object becomeFirstResponder. if (index != NSNotFound && index > 0) { UITextField *nextTextField = textFields[index-1]; // Retaining textFieldView UIView *textFieldRetain = _textFieldView; BOOL isAcceptAsFirstResponder = [nextTextField becomeFirstResponder]; // If it refuses then becoming previous textFieldView as first responder again. (Bug ID: #96) if (isAcceptAsFirstResponder == NO) { //If next field refuses to become first responder then restoring old textField as first responder. [textFieldRetain becomeFirstResponder]; [self showLog:[NSString stringWithFormat:@"Refuses to become first responder: %@",nextTextField]]; } return isAcceptAsFirstResponder; } else { return NO; } } /** Navigate to next responder textField/textView. */ -(BOOL)goNext { //Getting all responder view's. NSArray<__kindof UIView*> *textFields = [self responderViews]; //Getting index of current textField. NSUInteger index = [textFields indexOfObject:_textFieldView]; //If it is not last textField. then it's next object becomeFirstResponder. if (index != NSNotFound && index < textFields.count-1) { UITextField *nextTextField = textFields[index+1]; // Retaining textFieldView UIView *textFieldRetain = _textFieldView; BOOL isAcceptAsFirstResponder = [nextTextField becomeFirstResponder]; // If it refuses then becoming previous textFieldView as first responder again. (Bug ID: #96) if (isAcceptAsFirstResponder == NO) { //If next field refuses to become first responder then restoring old textField as first responder. [textFieldRetain becomeFirstResponder]; [self showLog:[NSString stringWithFormat:@"Refuses to become first responder: %@",nextTextField]]; } return isAcceptAsFirstResponder; } else { return NO; } } #pragma mark AutoToolbar methods /** Get all UITextField/UITextView siblings of textFieldView. */ -(NSArray<__kindof UIView*>*)responderViews { UIView *superConsideredView; UIView *textFieldView = _textFieldView; //If find any consider responderView in it's upper hierarchy then will get deepResponderView. for (Class consideredClass in _toolbarPreviousNextAllowedClasses) { superConsideredView = [textFieldView superviewOfClassType:consideredClass]; if (superConsideredView) break; } //If there is a superConsideredView in view's hierarchy, then fetching all it's subview that responds. No sorting for superConsideredView, it's by subView position. (Enhancement ID: #22) if (superConsideredView) { return [superConsideredView deepResponderViews]; } //Otherwise fetching all the siblings else { NSArray<UIView*> *textFields = [textFieldView responderSiblings]; //Sorting textFields according to behaviour switch (_toolbarManageBehaviour) { //If autoToolbar behaviour is bySubviews, then returning it. case IQAutoToolbarBySubviews: return textFields; break; //If autoToolbar behaviour is by tag, then sorting it according to tag property. case IQAutoToolbarByTag: return [textFields sortedArrayByTag]; break; //If autoToolbar behaviour is by tag, then sorting it according to tag property. case IQAutoToolbarByPosition: return [textFields sortedArrayByPosition]; break; default: return nil; break; } } } /** Add toolbar if it is required to add on textFields and it's siblings. */ -(void)addToolbarIfRequired { CFTimeInterval startTime = CACurrentMediaTime(); [self showLog:[NSString stringWithFormat:@"****** %@ started ******",NSStringFromSelector(_cmd)] indentation:1]; // Getting all the sibling textFields. NSArray<UIView*> *siblings = [self responderViews]; [self showLog:[NSString stringWithFormat:@"Found %lu responder sibling(s)",(unsigned long)siblings.count]]; UIView *textFieldView = _textFieldView; //Either there is no inputAccessoryView or if accessoryView is not appropriate for current situation(There is Previous/Next/Done toolbar). //setInputAccessoryView: check (Bug ID: #307) if ([textFieldView respondsToSelector:@selector(setInputAccessoryView:)]) { if ([textFieldView inputAccessoryView] == nil || [[textFieldView inputAccessoryView] tag] == kIQPreviousNextButtonToolbarTag || [[textFieldView inputAccessoryView] tag] == kIQDoneButtonToolbarTag) { UITextField *textField = (UITextField*)textFieldView; IQBarButtonItemConfiguration *rightConfiguration = nil; //Supporting Custom Done button image (Enhancement ID: #366) if (_toolbarDoneBarButtonItemImage) { rightConfiguration = [[IQBarButtonItemConfiguration alloc] initWithImage:_toolbarDoneBarButtonItemImage action:@selector(doneAction:)]; } //Supporting Custom Done button text (Enhancement ID: #209, #411, Bug ID: #376) else if (_toolbarDoneBarButtonItemText) { rightConfiguration = [[IQBarButtonItemConfiguration alloc] initWithTitle:_toolbarDoneBarButtonItemText action:@selector(doneAction:)]; } else { rightConfiguration = [[IQBarButtonItemConfiguration alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone action:@selector(doneAction:)]; } // If only one object is found, then adding only Done button. if ((siblings.count==1 && self.previousNextDisplayMode == IQPreviousNextDisplayModeDefault) || self.previousNextDisplayMode == IQPreviousNextDisplayModeAlwaysHide) { [textField addKeyboardToolbarWithTarget:self titleText:(_shouldShowToolbarPlaceholder ? textField.drawingToolbarPlaceholder : nil) rightBarButtonConfiguration:rightConfiguration previousBarButtonConfiguration:nil nextBarButtonConfiguration:nil]; textField.inputAccessoryView.tag = kIQDoneButtonToolbarTag; // (Bug ID: #78) } //If there is multiple siblings of textField else if ((siblings.count && self.previousNextDisplayMode == IQPreviousNextDisplayModeDefault) || self.previousNextDisplayMode == IQPreviousNextDisplayModeAlwaysShow) { IQBarButtonItemConfiguration *prevConfiguration = nil; //Supporting Custom Done button image (Enhancement ID: #366) if (_toolbarPreviousBarButtonItemImage) { prevConfiguration = [[IQBarButtonItemConfiguration alloc] initWithImage:_toolbarPreviousBarButtonItemImage action:@selector(previousAction:)]; } //Supporting Custom Done button text (Enhancement ID: #209, #411, Bug ID: #376) else if (_toolbarPreviousBarButtonItemText) { prevConfiguration = [[IQBarButtonItemConfiguration alloc] initWithTitle:_toolbarPreviousBarButtonItemText action:@selector(previousAction:)]; } else { prevConfiguration = [[IQBarButtonItemConfiguration alloc] initWithImage:[UIImage keyboardPreviousImage] action:@selector(previousAction:)]; } IQBarButtonItemConfiguration *nextConfiguration = nil; //Supporting Custom Done button image (Enhancement ID: #366) if (_toolbarNextBarButtonItemImage) { nextConfiguration = [[IQBarButtonItemConfiguration alloc] initWithImage:_toolbarNextBarButtonItemImage action:@selector(nextAction:)]; } //Supporting Custom Done button text (Enhancement ID: #209, #411, Bug ID: #376) else if (_toolbarNextBarButtonItemText) { nextConfiguration = [[IQBarButtonItemConfiguration alloc] initWithTitle:_toolbarNextBarButtonItemText action:@selector(nextAction:)]; } else { nextConfiguration = [[IQBarButtonItemConfiguration alloc] initWithImage:[UIImage keyboardNextImage] action:@selector(nextAction:)]; } [textField addKeyboardToolbarWithTarget:self titleText:(_shouldShowToolbarPlaceholder ? textField.drawingToolbarPlaceholder : nil) rightBarButtonConfiguration:rightConfiguration previousBarButtonConfiguration:prevConfiguration nextBarButtonConfiguration:nextConfiguration]; textField.inputAccessoryView.tag = kIQPreviousNextButtonToolbarTag; // (Bug ID: #78) } IQToolbar *toolbar = textField.keyboardToolbar; //Bar style according to keyboard appearance if ([textField respondsToSelector:@selector(keyboardAppearance)]) { switch ([textField keyboardAppearance]) { case UIKeyboardAppearanceDark: { toolbar.barStyle = UIBarStyleBlack; [toolbar setTintColor:[UIColor whiteColor]]; [toolbar setBarTintColor:nil]; } break; default: { toolbar.barStyle = UIBarStyleDefault; toolbar.barTintColor = _toolbarBarTintColor; //Setting toolbar tintColor // (Enhancement ID: #30) if (_shouldToolbarUsesTextFieldTintColor) { toolbar.tintColor = [textField tintColor]; } else if (_toolbarTintColor) { toolbar.tintColor = _toolbarTintColor; } else { toolbar.tintColor = [UIColor blackColor]; } } break; } //If need to show placeholder if (_shouldShowToolbarPlaceholder && textField.shouldHideToolbarPlaceholder == NO) { //Updating placeholder //(Bug ID: #148, #272) if (toolbar.titleBarButton.title == nil || [toolbar.titleBarButton.title isEqualToString:textField.drawingToolbarPlaceholder] == NO) { [toolbar.titleBarButton setTitle:textField.drawingToolbarPlaceholder]; } //Setting toolbar title font. // (Enhancement ID: #30) if (_placeholderFont && [_placeholderFont isKindOfClass:[UIFont class]]) { [toolbar.titleBarButton setTitleFont:_placeholderFont]; } //Setting toolbar title color. // (Enhancement ID: #880) if (_placeholderColor && [_placeholderColor isKindOfClass:[UIColor class]]) { [toolbar.titleBarButton setTitleColor:_placeholderColor]; } //Setting toolbar button title color. // (Enhancement ID: #880) if (_placeholderButtonColor && [_placeholderButtonColor isKindOfClass:[UIColor class]]) { [toolbar.titleBarButton setSelectableTitleColor:_placeholderButtonColor]; } } else { //Updating placeholder //(Bug ID: #272) toolbar.titleBarButton.title = nil; } } //In case of UITableView (Special), the next/previous buttons has to be refreshed everytime. (Bug ID: #56) // If firstTextField, then previous should not be enabled. if (siblings.firstObject == textField) { if (siblings.count == 1) { textField.keyboardToolbar.previousBarButton.enabled = NO; textField.keyboardToolbar.nextBarButton.enabled = NO; } else { textField.keyboardToolbar.previousBarButton.enabled = NO; textField.keyboardToolbar.nextBarButton.enabled = YES; } } // If lastTextField then next should not be enaled. else if ([siblings lastObject] == textField) { textField.keyboardToolbar.previousBarButton.enabled = YES; textField.keyboardToolbar.nextBarButton.enabled = NO; } else { textField.keyboardToolbar.previousBarButton.enabled = YES; textField.keyboardToolbar.nextBarButton.enabled = YES; } } } CFTimeInterval elapsedTime = CACurrentMediaTime() - startTime; [self showLog:[NSString stringWithFormat:@"****** %@ ended: %g seconds ******",NSStringFromSelector(_cmd),elapsedTime] indentation:-1]; } /** Remove any toolbar if it is IQToolbar. */ -(void)removeToolbarIfRequired // (Bug ID: #18) { CFTimeInterval startTime = CACurrentMediaTime(); [self showLog:[NSString stringWithFormat:@"****** %@ started ******",NSStringFromSelector(_cmd)] indentation:1]; // Getting all the sibling textFields. NSArray<UIView*> *siblings = [self responderViews]; [self showLog:[NSString stringWithFormat:@"Found %lu responder sibling(s)",(unsigned long)siblings.count]]; for (UITextField *textField in siblings) { UIView *toolbar = [textField inputAccessoryView]; // (Bug ID: #78) //setInputAccessoryView: check (Bug ID: #307) if ([textField respondsToSelector:@selector(setInputAccessoryView:)] && ([toolbar isKindOfClass:[IQToolbar class]] && (toolbar.tag == kIQDoneButtonToolbarTag || toolbar.tag == kIQPreviousNextButtonToolbarTag))) { textField.inputAccessoryView = nil; [textField reloadInputViews]; } } CFTimeInterval elapsedTime = CACurrentMediaTime() - startTime; [self showLog:[NSString stringWithFormat:@"****** %@ ended: %g seconds ******",NSStringFromSelector(_cmd),elapsedTime] indentation:-1]; } /** reloadInputViews to reload toolbar buttons enable/disable state on the fly Enhancement ID #434. */ - (void)reloadInputViews { //If enabled then adding toolbar. if ([self privateIsEnableAutoToolbar] == YES) { [self addToolbarIfRequired]; } //Else removing toolbar. else { [self removeToolbarIfRequired]; } } #pragma mark previous/next/done functionality /** previousAction. */ -(void)previousAction:(IQBarButtonItem*)barButton { //If user wants to play input Click sound. Then Play Input Click Sound. if (_shouldPlayInputClicks) { [[UIDevice currentDevice] playInputClick]; } if ([self canGoPrevious]) { UIView *currentTextFieldView = _textFieldView; BOOL isAcceptAsFirstResponder = [self goPrevious]; NSInvocation *invocation = barButton.invocation; UIView *sender = currentTextFieldView; //Handling search bar special case { UISearchBar *searchBar = currentTextFieldView.textFieldSearchBar; if (searchBar) { invocation = searchBar.keyboardToolbar.previousBarButton.invocation; sender = searchBar; } } if (isAcceptAsFirstResponder == YES && invocation) { if (invocation.methodSignature.numberOfArguments > 2) { [invocation setArgument:&sender atIndex:2]; } [invocation invoke]; } } } /** nextAction. */ -(void)nextAction:(IQBarButtonItem*)barButton { //If user wants to play input Click sound. Then Play Input Click Sound. if (_shouldPlayInputClicks) { [[UIDevice currentDevice] playInputClick]; } if ([self canGoNext]) { UIView *currentTextFieldView = _textFieldView; BOOL isAcceptAsFirstResponder = [self goNext]; NSInvocation *invocation = barButton.invocation; UIView *sender = currentTextFieldView; //Handling search bar special case { UISearchBar *searchBar = currentTextFieldView.textFieldSearchBar; if (searchBar) { invocation = searchBar.keyboardToolbar.nextBarButton.invocation; sender = searchBar; } } if (isAcceptAsFirstResponder == YES && invocation) { if (invocation.methodSignature.numberOfArguments > 2) { [invocation setArgument:&sender atIndex:2]; } [invocation invoke]; } } } /** doneAction. Resigning current textField. */ -(void)doneAction:(IQBarButtonItem*)barButton { //If user wants to play input Click sound. Then Play Input Click Sound. if (_shouldPlayInputClicks) { [[UIDevice currentDevice] playInputClick]; } UIView *currentTextFieldView = _textFieldView; BOOL isResignedFirstResponder = [self resignFirstResponder]; NSInvocation *invocation = barButton.invocation; UIView *sender = currentTextFieldView; //Handling search bar special case { UISearchBar *searchBar = currentTextFieldView.textFieldSearchBar; if (searchBar) { invocation = searchBar.keyboardToolbar.doneBarButton.invocation; sender = searchBar; } } if (isResignedFirstResponder == YES && invocation) { if (invocation.methodSignature.numberOfArguments > 2) { [invocation setArgument:&sender atIndex:2]; } [invocation invoke]; } } #pragma mark - Customised textField/textView support. /** Add customised Notification for third party customised TextField/TextView. */ -(void)registerTextFieldViewClass:(nonnull Class)aClass didBeginEditingNotificationName:(nonnull NSString *)didBeginEditingNotificationName didEndEditingNotificationName:(nonnull NSString *)didEndEditingNotificationName { [_registeredClasses addObject:aClass]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldViewDidBeginEditing:) name:didBeginEditingNotificationName object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldViewDidEndEditing:) name:didEndEditingNotificationName object:nil]; } /** Remove customised Notification for third party customised TextField/TextView. */ -(void)unregisterTextFieldViewClass:(nonnull Class)aClass didBeginEditingNotificationName:(nonnull NSString *)didBeginEditingNotificationName didEndEditingNotificationName:(nonnull NSString *)didEndEditingNotificationName { [_registeredClasses removeObject:aClass]; [[NSNotificationCenter defaultCenter] removeObserver:self name:didBeginEditingNotificationName object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:didEndEditingNotificationName object:nil]; } -(void)registerAllNotifications { // Registering for keyboard notification. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardDidHideNotification object:nil]; // Registering for UITextField notification. [self registerTextFieldViewClass:[UITextField class] didBeginEditingNotificationName:UITextFieldTextDidBeginEditingNotification didEndEditingNotificationName:UITextFieldTextDidEndEditingNotification]; // Registering for UITextView notification. [self registerTextFieldViewClass:[UITextView class] didBeginEditingNotificationName:UITextViewTextDidBeginEditingNotification didEndEditingNotificationName:UITextViewTextDidEndEditingNotification]; // Registering for orientation changes notification [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willChangeStatusBarOrientation:) name:UIApplicationWillChangeStatusBarOrientationNotification object:[UIApplication sharedApplication]]; } -(void)unregisterAllNotifications { // Unregistering for keyboard notification. [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidShowNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidHideNotification object:nil]; // Unregistering for UITextField notification. [self unregisterTextFieldViewClass:[UITextField class] didBeginEditingNotificationName:UITextFieldTextDidBeginEditingNotification didEndEditingNotificationName:UITextFieldTextDidEndEditingNotification]; // Unregistering for UITextView notification. [self unregisterTextFieldViewClass:[UITextView class] didBeginEditingNotificationName:UITextViewTextDidBeginEditingNotification didEndEditingNotificationName:UITextViewTextDidEndEditingNotification]; // Unregistering for orientation changes notification [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillChangeStatusBarOrientationNotification object:[UIApplication sharedApplication]]; } -(void)showLog:(NSString*)logString { [self showLog:logString indentation:0]; } -(void)showLog:(NSString*)logString indentation:(NSInteger)indent { static NSInteger indentation = 0; if (indent < 0) { indentation = MAX(0, indentation + indent); } if (_enableDebugging) { NSMutableString *preLog = [[NSMutableString alloc] init]; for (int i = 0; i<=indentation; i++) { [preLog appendString:@"|\t"]; } [preLog appendString:logString]; NSLog(@"%@",preLog); } if (indent > 0) { indentation += indent; } } @end
{'repo_name': 'aiononhiii/LGFFreePT', 'stars': '173', 'repo_language': 'Objective-C', 'file_name': 'LGFFreePTTitle.xib', 'mime_type': 'text/xml', 'hash': -6581098514798115595, 'source_dataset': 'data'}
/*! * jQuery Form Plugin * version: 2.52 (07-DEC-2010) * @requires jQuery v1.3.2 or later * * Examples and documentation at: http://malsup.com/jquery/form/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ ;(function($) { /* Usage Note: ----------- Do not use both ajaxSubmit and ajaxForm on the same form. These functions are intended to be exclusive. Use ajaxSubmit if you want to bind your own submit handler to the form. For example, $(document).ready(function() { $('#myForm').bind('submit', function(e) { e.preventDefault(); // <-- important $(this).ajaxSubmit({ target: '#output' }); }); }); Use ajaxForm when you want the plugin to manage all the event binding for you. For example, $(document).ready(function() { $('#myForm').ajaxForm({ target: '#output' }); }); When using ajaxForm, the ajaxSubmit function will be invoked for you at the appropriate time. */ /** * ajaxSubmit() provides a mechanism for immediately submitting * an HTML form using AJAX. */ $.fn.ajaxSubmit = function(options) { // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) if (!this.length) { log('ajaxSubmit: skipping submit process - no element selected'); return this; } if (typeof options == 'function') { options = { success: options }; } var action = this.attr('action'); var url = (typeof action === 'string') ? $.trim(action) : ''; if (url) { // clean url (don't include hash vaue) url = (url.match(/^([^#]+)/)||[])[1]; } url = url || window.location.href || ''; options = $.extend(true, { url: url, type: this.attr('method') || 'GET', iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' }, options); // hook for manipulating the form data before it is extracted; // convenient for use with rich editors like tinyMCE or FCKEditor var veto = {}; this.trigger('form-pre-serialize', [this, options, veto]); if (veto.veto) { log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); return this; } // provide opportunity to alter form data before it is serialized if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { log('ajaxSubmit: submit aborted via beforeSerialize callback'); return this; } var n,v,a = this.formToArray(options.semantic); if (options.data) { options.extraData = options.data; for (n in options.data) { if(options.data[n] instanceof Array) { for (var k in options.data[n]) { a.push( { name: n, value: options.data[n][k] } ); } } else { v = options.data[n]; v = $.isFunction(v) ? v() : v; // if value is fn, invoke it a.push( { name: n, value: v } ); } } } // give pre-submit callback an opportunity to abort the submit if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { log('ajaxSubmit: submit aborted via beforeSubmit callback'); return this; } // fire vetoable 'validate' event this.trigger('form-submit-validate', [a, this, options, veto]); if (veto.veto) { log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); return this; } var q = $.param(a); if (options.type.toUpperCase() == 'GET') { options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; options.data = null; // data is null for 'get' } else { options.data = q; // data is the query string for 'post' } var $form = this, callbacks = []; if (options.resetForm) { callbacks.push(function() { $form.resetForm(); }); } if (options.clearForm) { callbacks.push(function() { $form.clearForm(); }); } // perform a load on the target only if dataType is not provided if (!options.dataType && options.target) { var oldSuccess = options.success || function(){}; callbacks.push(function(data) { var fn = options.replaceTarget ? 'replaceWith' : 'html'; $(options.target)[fn](data).each(oldSuccess, arguments); }); } else if (options.success) { callbacks.push(options.success); } options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg var context = options.context || options; // jQuery 1.4+ supports scope context for (var i=0, max=callbacks.length; i < max; i++) { callbacks[i].apply(context, [data, status, xhr || $form, $form]); } }; // are there files to upload? var fileInputs = $('input:file', this).length > 0; var mp = 'multipart/form-data'; var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); // options.iframe allows user to force iframe mode // 06-NOV-09: now defaulting to iframe mode if file input is detected if (options.iframe !== false && (fileInputs || options.iframe || multipart)) { // hack to fix Safari hang (thanks to Tim Molendijk for this) // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d if (options.closeKeepAlive) { $.get(options.closeKeepAlive, fileUpload); } else { fileUpload(); } } else { $.ajax(options); } // fire 'notify' event this.trigger('form-submit-notify', [this, options]); return this; // private function for handling file uploads (hat tip to YAHOO!) function fileUpload() { var form = $form[0]; if ($(':input[name=submit],:input[id=submit]', form).length) { // if there is an input with a name or id of 'submit' then we won't be // able to invoke the submit fn on the form (at least not x-browser) alert('Error: Form elements must not have name or id of "submit".'); return; } var s = $.extend(true, {}, $.ajaxSettings, options); s.context = s.context || s; var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id; window[fn] = function() { var f = $io.data('form-plugin-onload'); if (f) { f(); window[fn] = undefined; try { delete window[fn]; } catch(e){} } } var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ s.iframeSrc +'" onload="window[\'_\'+this.id]()" />'); var io = $io[0]; $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' }); var xhr = { // mock object aborted: 0, responseText: null, responseXML: null, status: 0, statusText: 'n/a', getAllResponseHeaders: function() {}, getResponseHeader: function() {}, setRequestHeader: function() {}, abort: function() { this.aborted = 1; $io.attr('src', s.iframeSrc); // abort op in progress } }; var g = s.global; // trigger ajax global events so that activity/block indicators work like normal if (g && ! $.active++) { $.event.trigger("ajaxStart"); } if (g) { $.event.trigger("ajaxSend", [xhr, s]); } if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) { if (s.global) { $.active--; } return; } if (xhr.aborted) { return; } var cbInvoked = false; var timedOut = 0; // add submitting element to data if we know it var sub = form.clk; if (sub) { var n = sub.name; if (n && !sub.disabled) { s.extraData = s.extraData || {}; s.extraData[n] = sub.value; if (sub.type == "image") { s.extraData[n+'.x'] = form.clk_x; s.extraData[n+'.y'] = form.clk_y; } } } // take a breath so that pending repaints get some cpu time before the upload starts function doSubmit() { // make sure form attrs are set var t = $form.attr('target'), a = $form.attr('action'); // update form attrs in IE friendly way form.setAttribute('target',id); if (form.getAttribute('method') != 'POST') { form.setAttribute('method', 'POST'); } if (form.getAttribute('action') != s.url) { form.setAttribute('action', s.url); } // ie borks in some cases when setting encoding if (! s.skipEncodingOverride) { $form.attr({ encoding: 'multipart/form-data', enctype: 'multipart/form-data' }); } // support timout if (s.timeout) { setTimeout(function() { timedOut = true; cb(); }, s.timeout); } // add "extra" data to form if provided in options var extraInputs = []; try { if (s.extraData) { for (var n in s.extraData) { extraInputs.push( $('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />') .appendTo(form)[0]); } } // add iframe to doc and submit the form $io.appendTo('body'); $io.data('form-plugin-onload', cb); form.submit(); } finally { // reset attrs and remove "extra" input elements form.setAttribute('action',a); if(t) { form.setAttribute('target', t); } else { $form.removeAttr('target'); } $(extraInputs).remove(); } } if (s.forceSync) { doSubmit(); } else { setTimeout(doSubmit, 10); // this lets dom updates render } var data, doc, domCheckCount = 50; function cb() { if (cbInvoked) { return; } $io.removeData('form-plugin-onload'); var ok = true; try { if (timedOut) { throw 'timeout'; } // extract the server response from the iframe doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document; var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc); log('isXml='+isXml); if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) { if (--domCheckCount) { // in some browsers (Opera) the iframe DOM is not always traversable when // the onload callback fires, so we loop a bit to accommodate log('requeing onLoad callback, DOM not available'); setTimeout(cb, 250); return; } // let this fall through because server response could be an empty document //log('Could not access iframe DOM after mutiple tries.'); //throw 'DOMException: not available'; } //log('response detected'); cbInvoked = true; xhr.responseText = doc.documentElement ? doc.documentElement.innerHTML : null; xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc; xhr.getResponseHeader = function(header){ var headers = {'content-type': s.dataType}; return headers[header]; }; var scr = /(json|script)/.test(s.dataType); if (scr || s.textarea) { // see if user embedded response in textarea var ta = doc.getElementsByTagName('textarea')[0]; if (ta) { xhr.responseText = ta.value; } else if (scr) { // account for browsers injecting pre around json response var pre = doc.getElementsByTagName('pre')[0]; var b = doc.getElementsByTagName('body')[0]; if (pre) { xhr.responseText = pre.textContent; } else if (b) { xhr.responseText = b.innerHTML; } } } else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) { xhr.responseXML = toXml(xhr.responseText); } data = $.httpData(xhr, s.dataType); } catch(e){ log('error caught:',e); ok = false; xhr.error = e; $.handleError(s, xhr, 'error', e); } if (xhr.aborted) { log('upload aborted'); ok = false; } // ordering of these callbacks/triggers is odd, but that's how $.ajax does it if (ok) { s.success.call(s.context, data, 'success', xhr); if (g) { $.event.trigger("ajaxSuccess", [xhr, s]); } } if (g) { $.event.trigger("ajaxComplete", [xhr, s]); } if (g && ! --$.active) { $.event.trigger("ajaxStop"); } if (s.complete) { s.complete.call(s.context, xhr, ok ? 'success' : 'error'); } // clean up setTimeout(function() { $io.removeData('form-plugin-onload'); $io.remove(); xhr.responseXML = null; }, 100); } function toXml(s, doc) { if (window.ActiveXObject) { doc = new ActiveXObject('Microsoft.XMLDOM'); doc.async = 'false'; doc.loadXML(s); } else { doc = (new DOMParser()).parseFromString(s, 'text/xml'); } return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null; } } }; /** * ajaxForm() provides a mechanism for fully automating form submission. * * The advantages of using this method instead of ajaxSubmit() are: * * 1: This method will include coordinates for <input type="image" /> elements (if the element * is used to submit the form). * 2. This method will include the submit element's name/value data (for the element that was * used to submit the form). * 3. This method binds the submit() method to the form for you. * * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely * passes the options argument along after properly binding events for submit elements and * the form itself. */ $.fn.ajaxForm = function(options) { // in jQuery 1.3+ we can fix mistakes with the ready state if (this.length === 0) { var o = { s: this.selector, c: this.context }; if (!$.isReady && o.s) { log('DOM not ready, queuing ajaxForm'); $(function() { $(o.s,o.c).ajaxForm(options); }); return this; } // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); return this; } return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) { if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed e.preventDefault(); $(this).ajaxSubmit(options); } }).bind('click.form-plugin', function(e) { var target = e.target; var $el = $(target); if (!($el.is(":submit,input:image"))) { // is this a child element of the submit el? (ex: a span within a button) var t = $el.closest(':submit'); if (t.length == 0) { return; } target = t[0]; } var form = this; form.clk = target; if (target.type == 'image') { if (e.offsetX != undefined) { form.clk_x = e.offsetX; form.clk_y = e.offsetY; } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin var offset = $el.offset(); form.clk_x = e.pageX - offset.left; form.clk_y = e.pageY - offset.top; } else { form.clk_x = e.pageX - target.offsetLeft; form.clk_y = e.pageY - target.offsetTop; } } // clear form vars setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100); }); }; // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm $.fn.ajaxFormUnbind = function() { return this.unbind('submit.form-plugin click.form-plugin'); }; /** * formToArray() gathers form element data into an array of objects that can * be passed to any of the following ajax functions: $.get, $.post, or load. * Each object in the array has both a 'name' and 'value' property. An example of * an array for a simple login form might be: * * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ] * * It is this array that is passed to pre-submit callback functions provided to the * ajaxSubmit() and ajaxForm() methods. */ $.fn.formToArray = function(semantic) { var a = []; if (this.length === 0) { return a; } var form = this[0]; var els = semantic ? form.getElementsByTagName('*') : form.elements; if (!els) { return a; } var i,j,n,v,el,max,jmax; for(i=0, max=els.length; i < max; i++) { el = els[i]; n = el.name; if (!n) { continue; } if (semantic && form.clk && el.type == "image") { // handle image inputs on the fly when semantic == true if(!el.disabled && form.clk == el) { a.push({name: n, value: $(el).val()}); a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); } continue; } v = $.fieldValue(el, true); if (v && v.constructor == Array) { for(j=0, jmax=v.length; j < jmax; j++) { a.push({name: n, value: v[j]}); } } else if (v !== null && typeof v != 'undefined') { a.push({name: n, value: v}); } } if (!semantic && form.clk) { // input type=='image' are not found in elements array! handle it here var $input = $(form.clk), input = $input[0]; n = input.name; if (n && !input.disabled && input.type == 'image') { a.push({name: n, value: $input.val()}); a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); } } return a; }; /** * Serializes form data into a 'submittable' string. This method will return a string * in the format: name1=value1&amp;name2=value2 */ $.fn.formSerialize = function(semantic) { //hand off to jQuery.param for proper encoding return $.param(this.formToArray(semantic)); }; /** * Serializes all field elements in the jQuery object into a query string. * This method will return a string in the format: name1=value1&amp;name2=value2 */ $.fn.fieldSerialize = function(successful) { var a = []; this.each(function() { var n = this.name; if (!n) { return; } var v = $.fieldValue(this, successful); if (v && v.constructor == Array) { for (var i=0,max=v.length; i < max; i++) { a.push({name: n, value: v[i]}); } } else if (v !== null && typeof v != 'undefined') { a.push({name: this.name, value: v}); } }); //hand off to jQuery.param for proper encoding return $.param(a); }; /** * Returns the value(s) of the element in the matched set. For example, consider the following form: * * <form><fieldset> * <input name="A" type="text" /> * <input name="A" type="text" /> * <input name="B" type="checkbox" value="B1" /> * <input name="B" type="checkbox" value="B2"/> * <input name="C" type="radio" value="C1" /> * <input name="C" type="radio" value="C2" /> * </fieldset></form> * * var v = $(':text').fieldValue(); * // if no values are entered into the text inputs * v == ['',''] * // if values entered into the text inputs are 'foo' and 'bar' * v == ['foo','bar'] * * var v = $(':checkbox').fieldValue(); * // if neither checkbox is checked * v === undefined * // if both checkboxes are checked * v == ['B1', 'B2'] * * var v = $(':radio').fieldValue(); * // if neither radio is checked * v === undefined * // if first radio is checked * v == ['C1'] * * The successful argument controls whether or not the field element must be 'successful' * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). * The default value of the successful argument is true. If this value is false the value(s) * for each element is returned. * * Note: This method *always* returns an array. If no valid value can be determined the * array will be empty, otherwise it will contain one or more values. */ $.fn.fieldValue = function(successful) { for (var val=[], i=0, max=this.length; i < max; i++) { var el = this[i]; var v = $.fieldValue(el, successful); if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) { continue; } v.constructor == Array ? $.merge(val, v) : val.push(v); } return val; }; /** * Returns the value of the field element. */ $.fieldValue = function(el, successful) { var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); if (successful === undefined) { successful = true; } if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || (t == 'checkbox' || t == 'radio') && !el.checked || (t == 'submit' || t == 'image') && el.form && el.form.clk != el || tag == 'select' && el.selectedIndex == -1)) { return null; } if (tag == 'select') { var index = el.selectedIndex; if (index < 0) { return null; } var a = [], ops = el.options; var one = (t == 'select-one'); var max = (one ? index+1 : ops.length); for(var i=(one ? index : 0); i < max; i++) { var op = ops[i]; if (op.selected) { var v = op.value; if (!v) { // extra pain for IE... v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value; } if (one) { return v; } a.push(v); } } return a; } return $(el).val(); }; /** * Clears the form data. Takes the following actions on the form's input fields: * - input text fields will have their 'value' property set to the empty string * - select elements will have their 'selectedIndex' property set to -1 * - checkbox and radio inputs will have their 'checked' property set to false * - inputs of type submit, button, reset, and hidden will *not* be effected * - button elements will *not* be effected */ $.fn.clearForm = function() { return this.each(function() { $('input,select,textarea', this).clearFields(); }); }; /** * Clears the selected form elements. */ $.fn.clearFields = $.fn.clearInputs = function() { return this.each(function() { var t = this.type, tag = this.tagName.toLowerCase(); if (t == 'text' || t == 'password' || tag == 'textarea') { this.value = ''; } else if (t == 'checkbox' || t == 'radio') { this.checked = false; } else if (tag == 'select') { this.selectedIndex = -1; } }); }; /** * Resets the form data. Causes all form elements to be reset to their original value. */ $.fn.resetForm = function() { return this.each(function() { // guard against an input with the name of 'reset' // note that IE reports the reset function as an 'object' if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) { this.reset(); } }); }; /** * Enables or disables any matching elements. */ $.fn.enable = function(b) { if (b === undefined) { b = true; } return this.each(function() { this.disabled = !b; }); }; /** * Checks/unchecks any matching checkboxes or radio buttons and * selects/deselects and matching option elements. */ $.fn.selected = function(select) { if (select === undefined) { select = true; } return this.each(function() { var t = this.type; if (t == 'checkbox' || t == 'radio') { this.checked = select; } else if (this.tagName.toLowerCase() == 'option') { var $sel = $(this).parent('select'); if (select && $sel[0] && $sel[0].type == 'select-one') { // deselect all other options $sel.find('option').selected(false); } this.selected = select; } }); }; // helper fn for console logging // set $.fn.ajaxSubmit.debug to true to enable debug logging function log() { if ($.fn.ajaxSubmit.debug) { var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,''); if (window.console && window.console.log) { window.console.log(msg); } else if (window.opera && window.opera.postError) { window.opera.postError(msg); } } }; })(jQuery);
{'repo_name': 'agiliq/django-pubsub', 'stars': '151', 'repo_language': 'JavaScript', 'file_name': 'jquery.linkify.js', 'mime_type': 'text/html', 'hash': 3567417213419373728, 'source_dataset': 'data'}
define("dojox/dnd/BoundingBoxController", ["dojo", "dojox"], function(dojo, dojox) { return dojo.declare('dojox.dnd.BoundingBoxController', null, { // summary: // Allows the user draw bounding boxes around nodes on the page. // Publishes to the "/dojox/dnd/bounding" topic to tell the selector to check // to see whether any dnd items fall within the coordinates of the bounding box // x,y start and end coordinates for the bounding box _startX: null, _startY: null, _endX: null, _endY: null, constructor: function(sources, domNode) { // summary: // Sets mouse handlers for the document to capture when a user // is trying to draw a bounding box. // sources: dojox/dnd/Selector[] // an array of dojox.dnd.Selectors which need to be aware of // the positioning of the bounding box. // domNode: String|DomNode // the DOM node or id which represents the bounding box on the page. this.events = [ dojo.connect(dojo.doc, 'onmousedown', this, '_onMouseDown'), dojo.connect(dojo.doc, 'onmouseup', this, '_onMouseUp'), // cancel text selection and text dragging //dojo.connect(dojo.doc, "ondragstart", dojo.stopEvent), //dojo.connect(dojo.doc, "onselectstart", dojo.stopEvent), // when a user is scrolling using a scrollbar, don't draw the bounding box. dojo.connect(dojo.doc, 'onscroll', this, '_finishSelecting') ]; // set up a subscription so the client can easily cancel a user drawing a bounding box. this.subscriptions = [ dojo.subscribe('/dojox/bounding/cancel', this, '_finishSelecting') ]; dojo.forEach(sources, function(item) { // listen for "/dojox/dnd/bounding" events eminating from the bounding box. // for each of the dojox.dnd.selectors passed in args. if (item.selectByBBox) { this.subscriptions.push(dojo.subscribe('/dojox/dnd/bounding', item, 'selectByBBox')); } }, this); this.domNode = dojo.byId(domNode); dojo.style(this.domNode, { position: 'absolute', display: 'none' }); }, destroy: function() { // summary: // prepares this object to be garbage-collected dojo.forEach(this.events, dojo.disconnect); dojo.forEach(this.subscriptions, dojo.unsubscribe); this.domNode = null; }, shouldStartDrawingBox: function(evt) { // summary: // Override-able by the client as an extra check to ensure that a bounding // box should begin to be drawn. If the client has any preconditions to when a // bounding box should be drawn, they should be included in this method. // evt: Object // the mouse event which caused this callback to fire. return true; }, boundingBoxIsViable: function(evt) { // summary: // Override-able by the client as an extra check to ensure that a bounding // box is viable. In some instances, it might not make sense that // a mouse down -> mouse move -> mouse up interaction represents a bounding box. // For example, if a dialog is open the client might want to suppress a bounding // box. This function could be used by the client to ensure that a bounding box is only // drawn on the document when certain conditions are met. // evt: Object // the mouse event which caused this callback to fire. return true; }, _onMouseDown: function(evt) { // summary: // Executed when the user mouses down on the document. Resets the // this._startX and this._startY member variables. // evt: Object // the mouse event which caused this callback to fire. if (this.shouldStartDrawingBox(evt) && dojo.mouseButtons.isLeft(evt)) { if (this._startX == null) { this._startX = evt.clientX; this._startY = evt.clientY; } this.events.push( dojo.connect(dojo.doc, 'onmousemove', this, '_onMouseMove') ); } }, _onMouseMove: function(evt) { // summary: // Executed when the user moves the mouse over the document. Delegates to // this._drawBoundingBox if the user is trying to draw a bounding box. // whether the user was drawing a bounding box and publishes to the // "/dojox/dnd/bounding" topic if the user is finished drawing their bounding box. // evt: Object // the mouse event which caused this callback to fire. this._endX = evt.clientX; this._endY = evt.clientY; this._drawBoundingBox(); }, _onMouseUp: function(evt) { // summary: // Executed when the users mouses up on the document. Checks to see // whether the user was drawing a bounding box and publishes to the // "/dojox/dnd/bounding" topic if the user is finished drawing their bounding box. // evt: Object // the mouse event which caused this callback to fire. if (this._endX !== null && this.boundingBoxIsViable(evt)) { // the user has moused up ... tell the selector to check to see whether // any nodes within the bounding box need to be selected. dojo.publish('/dojox/dnd/bounding', [this._startX, this._startY, this._endX, this._endY]); } this._finishSelecting(); }, _finishSelecting: function() { // summary: // hide the bounding box and reset for the next time around if (this._startX !== null) { dojo.disconnect(this.events.pop()); dojo.style(this.domNode, 'display', 'none'); this._startX = null; this._endX = null; } }, _drawBoundingBox: function() { // summary: // draws the bounding box over the document. dojo.style(this.domNode, { left: Math.min(this._startX, this._endX) + 'px', top: Math.min(this._startY, this._endY) + 'px', width: Math.abs(this._startX - this._endX) + 'px', height: Math.abs(this._startY - this._endY) + 'px', display: '' }); } } ); });
{'repo_name': 'dotCMS/core', 'stars': '553', 'repo_language': 'Java', 'file_name': 'seed.source', 'mime_type': 'text/plain', 'hash': -483626563795895102, 'source_dataset': 'data'}
#ifndef _MU_MODEL_FACE_DEFS_H_ #define _MU_MODEL_FACE_DEFS_H_ struct data_vertex; struct data_face; typedef Tvertex<data_vertex> _vertex; typedef Tface<data_vertex> _face; typedef Tvertex<data_vertex> _vertex; typedef Tface<data_vertex> _face; //XRLC_LIGHT_API poolSS<_vertex,8*1024> &mu_vertices_pool(); //XRLC_LIGHT_API poolSS<_face,8*1024> &mu_faces_pool(); #endif
{'repo_name': 'OpenXRay/xray-15', 'stars': '145', 'repo_language': 'C++', 'file_name': 'pem.h', 'mime_type': 'text/x-c', 'hash': 676697997165653790, 'source_dataset': 'data'}
apiVersion: "0.1" gitVersion: commitSha: 1a6fc9d0e19e456b784ba1c23c03ec47648819d0 refSpec: master kind: ksonnet.io/registry libraries: argo: path: argo version: master core: path: core version: master tf-job: path: tf-job version: master tf-serving: path: tf-serving version: master
{'repo_name': 'GoogleCloudPlatform/training-data-analyst', 'stars': '3862', 'repo_language': 'Jupyter Notebook', 'file_name': 'home.pug', 'mime_type': 'text/plain', 'hash': -4367666190672005151, 'source_dataset': 'data'}
/* * GIT - The information manager from hell * * Copyright (C) Linus Torvalds, 2005 */ #include "cache.h" static int check_valid_sha1(unsigned char *sha1) { char *filename = sha1_file_name(sha1); int ret; /* If we were anal, we'd check that the sha1 of the contents actually matches */ ret = access(filename, R_OK); if (ret) perror(filename); return ret; } static int prepend_integer(char *buffer, unsigned val, int i) { buffer[--i] = '\0'; do { buffer[--i] = '0' + (val % 10); val /= 10; } while (val); return i; } #define ORIG_OFFSET (40) /* Enough space to add the header of "tree <size>\0" */ int main(int argc, char **argv) { unsigned long size, offset, val; int i, entries = read_cache(); char *buffer; if (entries <= 0) { fprintf(stderr, "No file-cache to create a tree of\n"); exit(1); } /* Guess at an initial size */ size = entries * 40 + 400; buffer = malloc(size); offset = ORIG_OFFSET; for (i = 0; i < entries; i++) { struct cache_entry *ce = active_cache[i]; if (check_valid_sha1(ce->sha1) < 0) exit(1); if (offset + ce->namelen + 60 > size) { size = alloc_nr(offset + ce->namelen + 60); buffer = realloc(buffer, size); } offset += sprintf(buffer + offset, "%o %s", ce->st_mode, ce->name); buffer[offset++] = 0; memcpy(buffer + offset, ce->sha1, 20); offset += 20; } i = prepend_integer(buffer, offset - ORIG_OFFSET, ORIG_OFFSET); i -= 5; memcpy(buffer+i, "tree ", 5); buffer += i; offset -= i; write_sha1_file(buffer, offset); return 0; }
{'repo_name': 'chyojn/git-0.01', 'stars': '146', 'repo_language': 'C', 'file_name': 'cat-file.c', 'mime_type': 'text/x-c', 'hash': -7168071267923662326, 'source_dataset': 'data'}
# tag::cli[] # gradle publishIvyJavaPublicationToIvyRepository # end::cli[] executable: gradle args: publishIvyJavaPublicationToIvyRepository expected-output-file: publishingIvyPublishSingle.out
{'repo_name': 'gradle/gradle', 'stars': '10712', 'repo_language': 'Groovy', 'file_name': 'DefaultRuleActionAdapterTest.groovy', 'mime_type': 'text/plain', 'hash': 8381812231756830093, 'source_dataset': 'data'}
'use strict' /** * @namespace yodaRT.activity */ var Descriptor = require('../lib/descriptor') var logger = require('logger')('visibility-descriptor') /** * @memberof yodaRT.activity.Activity * @class VisibilityClient * @hideconstructor * @extends EventEmitter */ class VisibilityDescriptor extends Descriptor { constructor (runtime) { super(runtime, 'visibility') this.vsbl = runtime.component.visibility } getKeyAndVisibleAppId () { return this.vsbl.getKeyAndVisibleAppId() } abandonKeyVisibility () { logger.info('abandoning key visibility') return this.vsbl.abandonKeyVisibility() } abandonAllVisibilities () { logger.info('abandoning all visibilities') return this.vsbl.abandonAllVisibilities() } } VisibilityDescriptor.methods = { /** * Get key and visible app id. * * @memberof yodaRT.activity.Activity.VisibilityClient * @instance * @function getKeyAndVisibleAppId * @returns {Promise<string|undefined>} */ getKeyAndVisibleAppId: { returns: 'promise' }, /** * Abandon key visibility if presents. * * @memberof yodaRT.activity.Activity.VisibilityClient * @instance * @function abandonKeyVisibility * @returns {Promise<void>} */ abandonKeyVisibility: { returns: 'promise' }, /** * Abandon all visibilities and recover to launcher if possible. * * @memberof yodaRT.activity.Activity.VisibilityClient * @instance * @function abandonAllVisibilities * @returns {Promise<void>} */ abandonAllVisibilities: { returns: 'promise' } } module.exports = VisibilityDescriptor
{'repo_name': 'yodaos-project/yoda.js', 'stars': '183', 'repo_language': 'JavaScript', 'file_name': 'FindNodeAddon.cmake', 'mime_type': 'text/plain', 'hash': -551799097301945810, 'source_dataset': 'data'}
.wrapper{ width: 424px;margin: 10px auto; zoom:1;position: relative} .tabbody{height:225px;} .tabbody .panel { position: absolute;width:100%; height:100%;background: #fff; display: none;} .tabbody .focus { display: block;} body{font-size: 12px;color: #888;overflow: hidden;} input,label{vertical-align:middle} .clear{clear: both;} .pl{padding-left: 18px;padding-left: 23px\9;} #imageList {width: 420px;height: 215px;margin-top: 10px;overflow: hidden;overflow-y: auto;} #imageList div {float: left;width: 100px;height: 95px;margin: 5px 10px;} #imageList img {cursor: pointer;border: 2px solid white;} .bgarea{margin: 10px;padding: 5px;height: 84%;border: 1px solid #A8A297;} .content div{margin: 10px 0 10px 5px;} .content .iptradio{margin: 0px 5px 5px 0px;} .txt{width:280px;} .wrapcolor{height: 19px;} div.color{float: left;margin: 0;} #colorPicker{width: 17px;height: 17px;border: 1px solid #CCC;display: inline-block;border-radius: 3px;box-shadow: 2px 2px 5px #D3D6DA;margin: 0;float: left;} div.alignment,#custom{margin-left: 23px;margin-left: 28px\9;} #custom input{height: 15px;min-height: 15px;width:20px;} #repeatType{width:100px;} /* 图片管理样式 */ #imgManager { width: 100%; height: 225px; } #imgManager #imageList{ width: 100%; overflow-x: hidden; overflow-y: auto; } #imgManager ul { display: block; list-style: none; margin: 0; padding: 0; } #imgManager li { float: left; display: block; list-style: none; padding: 0; width: 113px; height: 113px; margin: 9px 0 0 19px; background-color: #eee; overflow: hidden; cursor: pointer; position: relative; } #imgManager li.clearFloat { float: none; clear: both; display: block; width:0; height:0; margin: 0; padding: 0; } #imgManager li img { cursor: pointer; } #imgManager li .icon { cursor: pointer; width: 113px; height: 113px; position: absolute; top: 0; left: 0; z-index: 2; border: 0; background-repeat: no-repeat; } #imgManager li .icon:hover { width: 107px; height: 107px; border: 3px solid #1094fa; } #imgManager li.selected .icon { background-image: url(images/success.png); background-position: 75px 75px; } #imgManager li.selected .icon:hover { width: 107px; height: 107px; border: 3px solid #1094fa; background-position: 72px 72px; }
{'repo_name': 'kingschan1204/jblog', 'stars': '187', 'repo_language': 'Java', 'file_name': 'LuceneWordSuggesterTest.java', 'mime_type': 'text/x-c', 'hash': -8524771238130485376, 'source_dataset': 'data'}
module gitea.com/lunny/levelqueue require ( github.com/golang/snappy v0.0.1 // indirect github.com/stretchr/testify v1.3.0 github.com/syndtr/goleveldb v1.0.0 ) go 1.13
{'repo_name': 'go-gitea/gitea', 'stars': '20528', 'repo_language': 'Go', 'file_name': 'serv.go', 'mime_type': 'text/plain', 'hash': 5876889264887102389, 'source_dataset': 'data'}
0.1.3 / 2013-10-10 ================== * pkg: update type-detect version * index,test: conditional require in test bootstrap 0.1.2 / 2013-09-18 ================== * bug: [fix] misnamed variable from code migration (reference error) 0.1.1 / 2013-09-18 ================== * bug: [fix] last key of deep object ignored 0.1.0 / 2013-09-18 ================== * tests: add iterable * docs: readme * makefile: [ci] update cov handling * testing: [env] use karma for phantom * add tests (uncompleted) * add library * add dependencies * "Initial commit"
{'repo_name': 'tsayen/dom-to-image', 'stars': '6258', 'repo_language': 'JavaScript', 'file_name': 'tesseract-1.0.10.js', 'mime_type': 'text/plain', 'hash': -3965682296152719636, 'source_dataset': 'data'}
/* * drivers/char/hw_random/ixp4xx-rng.c * * RNG driver for Intel IXP4xx family of NPUs * * Author: Deepak Saxena <dsaxena@plexity.net> * * Copyright 2005 (c) MontaVista Software, Inc. * * Fixes by Michael Buesch * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any * warranty of any kind, whether express or implied. */ #include <linux/kernel.h> #include <linux/types.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> #include <linux/bitops.h> #include <linux/hw_random.h> #include <asm/io.h> #include <mach/hardware.h> static int ixp4xx_rng_data_read(struct hwrng *rng, u32 *buffer) { void __iomem * rng_base = (void __iomem *)rng->priv; *buffer = __raw_readl(rng_base); return 4; } static struct hwrng ixp4xx_rng_ops = { .name = "ixp4xx", .data_read = ixp4xx_rng_data_read, }; static int __init ixp4xx_rng_init(void) { void __iomem * rng_base; int err; if (!cpu_is_ixp46x()) /* includes IXP455 */ return -ENOSYS; rng_base = ioremap(0x70002100, 4); if (!rng_base) return -ENOMEM; ixp4xx_rng_ops.priv = (unsigned long)rng_base; err = hwrng_register(&ixp4xx_rng_ops); if (err) iounmap(rng_base); return err; } static void __exit ixp4xx_rng_exit(void) { void __iomem * rng_base = (void __iomem *)ixp4xx_rng_ops.priv; hwrng_unregister(&ixp4xx_rng_ops); iounmap(rng_base); } module_init(ixp4xx_rng_init); module_exit(ixp4xx_rng_exit); MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>"); MODULE_DESCRIPTION("H/W Pseudo-Random Number Generator (RNG) driver for IXP45x/46x"); MODULE_LICENSE("GPL");
{'repo_name': 'libos-nuse/net-next-nuse', 'stars': '238', 'repo_language': 'C', 'file_name': 'nf_tables_netdev.c', 'mime_type': 'text/x-c', 'hash': -1543514865137761475, 'source_dataset': 'data'}
package com.box.l10n.mojito.entity; import com.box.l10n.mojito.rest.View; import com.fasterxml.jackson.annotation.JsonView; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.ForeignKey; import javax.persistence.Index; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; /** * @author jaurambault */ @Entity @Table( name = "git_blame", indexes = { @Index(name = "I__GIT_BLAME__AUTHOR_EMAIL", columnList = "author_email"), @Index(name = "UK__GIT_BLAME__TM_TEXT_UNIT_ID", columnList = "tm_text_unit_id", unique = true) } ) public class GitBlame extends AuditableEntity { @ManyToOne(optional = false) @JoinColumn(name = "tm_text_unit_id", foreignKey = @ForeignKey(name = "FK__GIT_BLAME__TM_TEXT_UNIT__ID")) private TMTextUnit tmTextUnit; @JsonView(View.GitBlame.class) @Column(name = "author_email") private String authorEmail; @JsonView(View.GitBlame.class) @Column(name = "author_name") private String authorName; @JsonView(View.GitBlame.class) @Column(name = "commit_time") private String commitTime; @JsonView(View.GitBlame.class) @Column(name = "commit_name") private String commitName; public TMTextUnit getTmTextUnit() { return tmTextUnit; } public void setTmTextUnit(TMTextUnit tmTextUnit) { this.tmTextUnit = tmTextUnit; } public String getAuthorEmail() { return authorEmail; } public void setAuthorEmail(String authorEmail) { this.authorEmail = authorEmail; } public String getAuthorName() { return authorName; } public void setAuthorName(String authorName) { this.authorName = authorName; } public String getCommitTime() { return commitTime; } public void setCommitTime(String commitTime) { this.commitTime = commitTime; } public String getCommitName() { return commitName; } public void setCommitName(String commitName) { this.commitName = commitName; } }
{'repo_name': 'box/mojito', 'stars': '233', 'repo_language': 'Java', 'file_name': 'VirtualAssetPerformanceTest.java', 'mime_type': 'text/x-java', 'hash': -3312073180506711523, 'source_dataset': 'data'}
// Copyright (c) 2019 The BFE Authors. // // 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 mod_compress import ( "compress/gzip" "errors" "fmt" ) import ( "github.com/andybalholm/brotli" ) const ( ActionGzip = "GZIP" ActionBrotli = "BROTLI" ) type ActionFile struct { Cmd *string Quality *int FlushSize *int } type Action struct { Cmd string Quality int FlushSize int } func ActionFileCheck(conf *ActionFile) error { if conf.Cmd == nil { return errors.New("no Cmd") } switch *conf.Cmd { case ActionGzip: if *conf.Quality < gzip.HuffmanOnly || *conf.Quality > gzip.BestCompression { return fmt.Errorf("Quality should be [%d, %d]", gzip.HuffmanOnly, gzip.BestCompression) } case ActionBrotli: if *conf.Quality < brotli.BestSpeed || *conf.Quality > brotli.BestCompression { return fmt.Errorf("Quality should be [%d, %d]", brotli.BestSpeed, brotli.BestCompression) } default: return fmt.Errorf("invalid cmd: %s", *conf.Cmd) } if *conf.FlushSize < 64 || *conf.FlushSize > 4096 { return fmt.Errorf("FlushSize should be [64, 4096]") } return nil } func actionConvert(actionFile ActionFile) Action { action := Action{} action.Cmd = *actionFile.Cmd action.Quality = *actionFile.Quality action.FlushSize = *actionFile.FlushSize return action }
{'repo_name': 'bfenetworks/bfe', 'stars': '3884', 'repo_language': 'Go', 'file_name': 'parser_test.go', 'mime_type': 'text/plain', 'hash': -4813828883721437443, 'source_dataset': 'data'}
const ColorScheme = require('./lib/color-scheme'); const mainColor = '000000'; let scheme = new ColorScheme(); scheme.from_hex(mainColor) .scheme('triade') .distance(0.7) .variation('pastel');
{'repo_name': 'c0bra/color-scheme-js', 'stars': '325', 'repo_language': 'CoffeeScript', 'file_name': 'test.js', 'mime_type': 'text/plain', 'hash': 3002637788540049855, 'source_dataset': 'data'}
/* ******************************************************************************* * * Copyright (C) 2009-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* * file name: errorcode.h * encoding: US-ASCII * tab size: 8 (not used) * indentation:4 * * created on: 2009mar10 * created by: Markus W. Scherer */ #ifndef __ERRORCODE_H__ #define __ERRORCODE_H__ /** * \file * \brief C++ API: ErrorCode class intended to make it easier to use * ICU C and C++ APIs from C++ user code. */ #include "unicode/utypes.h" #include "unicode/uobject.h" U_NAMESPACE_BEGIN /** * Wrapper class for UErrorCode, with conversion operators for direct use * in ICU C and C++ APIs. * Intended to be used as a base class, where a subclass overrides * the handleFailure() function so that it throws an exception, * does an assert(), logs an error, etc. * This is not an abstract base class. This class can be used and instantiated * by itself, although it will be more useful when subclassed. * * Features: * - The constructor initializes the internal UErrorCode to U_ZERO_ERROR, * removing one common source of errors. * - Same use in C APIs taking a UErrorCode * (pointer) * and C++ taking UErrorCode & (reference) via conversion operators. * - Possible automatic checking for success when it goes out of scope. * * Note: For automatic checking for success in the destructor, a subclass * must implement such logic in its own destructor because the base class * destructor cannot call a subclass function (like handleFailure()). * The ErrorCode base class destructor does nothing. * * Note also: While it is possible for a destructor to throw an exception, * it is generally unsafe to do so. This means that in a subclass the destructor * and the handleFailure() function may need to take different actions. * * Sample code: * \code * class IcuErrorCode: public icu::ErrorCode { * public: * virtual ~IcuErrorCode() { // should be defined in .cpp as "key function" * // Safe because our handleFailure() does not throw exceptions. * if(isFailure()) { handleFailure(); } * } * protected: * virtual void handleFailure() const { * log_failure(u_errorName(errorCode)); * exit(errorCode); * } * }; * IcuErrorCode error_code; * UConverter *cnv = ucnv_open("Shift-JIS", error_code); * length = ucnv_fromUChars(dest, capacity, src, length, error_code); * ucnv_close(cnv); * // IcuErrorCode destructor checks for success. * \endcode * * @stable ICU 4.2 */ class U_COMMON_API ErrorCode: public UMemory { public: /** * Default constructor. Initializes its UErrorCode to U_ZERO_ERROR. * @stable ICU 4.2 */ ErrorCode() : errorCode(U_ZERO_ERROR) {} /** Destructor, does nothing. See class documentation for details. @stable ICU 4.2 */ virtual ~ErrorCode(); /** Conversion operator, returns a reference. @stable ICU 4.2 */ operator UErrorCode & () { return errorCode; } /** Conversion operator, returns a pointer. @stable ICU 4.2 */ operator UErrorCode * () { return &errorCode; } /** Tests for U_SUCCESS(). @stable ICU 4.2 */ UBool isSuccess() const { return U_SUCCESS(errorCode); } /** Tests for U_FAILURE(). @stable ICU 4.2 */ UBool isFailure() const { return U_FAILURE(errorCode); } /** Returns the UErrorCode value. @stable ICU 4.2 */ UErrorCode get() const { return errorCode; } /** Sets the UErrorCode value. @stable ICU 4.2 */ void set(UErrorCode value) { errorCode=value; } /** Returns the UErrorCode value and resets it to U_ZERO_ERROR. @stable ICU 4.2 */ UErrorCode reset(); /** * Asserts isSuccess(). * In other words, this method checks for a failure code, * and the base class handles it like this: * \code * if(isFailure()) { handleFailure(); } * \endcode * @stable ICU 4.4 */ void assertSuccess() const; /** * Return a string for the UErrorCode value. * The string will be the same as the name of the error code constant * in the UErrorCode enum. * @stable ICU 4.4 */ const char* errorName() const; protected: /** * Internal UErrorCode, accessible to subclasses. * @stable ICU 4.2 */ UErrorCode errorCode; /** * Called by assertSuccess() if isFailure() is true. * A subclass should override this function to deal with a failure code: * Throw an exception, log an error, terminate the program, or similar. * @stable ICU 4.2 */ virtual void handleFailure() const {} }; U_NAMESPACE_END #endif // __ERRORCODE_H__
{'repo_name': 'gagolews/stringi', 'stars': '187', 'repo_language': 'C++', 'file_name': 'stri_enc_mark.Rd', 'mime_type': 'text/plain', 'hash': -6842762443270604061, 'source_dataset': 'data'}
; Copyright (C) 2010-2015 Apple Inc. All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions ; are met: ; 1. Redistributions of source code must retain the above copyright ; notice, this list of conditions and the following disclaimer. ; 2. Redistributions in binary form must reproduce the above copyright ; notice, this list of conditions and the following disclaimer in the ; documentation and/or other materials provided with the distribution. ; ; THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' ; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ; THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS ; BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF ; THE POSSIBILITY OF SUCH DAMAGE. (version 1) (deny default (with partial-symbolication)) (allow system-audit file-read-metadata) (import "UIKit-apps.sb") (import "removed-dev-nodes.sb") (uikit-app 'with-opengl 'with-location-services) ;; Access to media controls (play-media) (media-remote) ;; Read-only preferences and data (mobile-preferences-read "com.apple.LaunchServices" "com.apple.WebFoundation" "com.apple.mobileipod" "com.apple.voiceservices.logging") ;; Sandbox extensions (define (apply-read-and-issue-extension op path-filter) (op file-read* path-filter) (op file-issue-extension (require-all (extension-class "com.apple.app-sandbox.read") path-filter))) (define (apply-write-and-issue-extension op path-filter) (op file-write* path-filter) (op file-issue-extension (require-all (extension-class "com.apple.app-sandbox.read-write") path-filter))) (define (read-only-and-issue-extensions path-filter) (apply-read-and-issue-extension allow path-filter)) (define (read-write-and-issue-extensions path-filter) (apply-read-and-issue-extension allow path-filter) (apply-write-and-issue-extension allow path-filter)) (read-only-and-issue-extensions (extension "com.apple.app-sandbox.read")) (read-write-and-issue-extensions (extension "com.apple.app-sandbox.read-write")) ;; Access to client's cache folder & re-vending to CFNetwork. ;; FIXME: Remove the webkti specific extension classes <rdar://problem/17755931> (allow file-issue-extension (require-all (extension "com.apple.app-sandbox.read-write") (extension-class "com.apple.nsurlstorage.extension-cache"))) ;; Allow the OpenGL Profiler to attach. (instruments-support) ; For <rdar://problem/7931952> ;; MediaAccessibility (mobile-preferences-read "com.apple.mediaaccessibility") (mobile-preferences-read-write "com.apple.mediaaccessibility.public") ;; Remote Web Inspector (allow mach-lookup (global-name "com.apple.webinspector")) ;; Various services required by CFNetwork and other frameworks (allow mach-lookup (global-name "com.apple.PowerManagement.control") (global-name "com.apple.accountsd.accountmanager") (global-name "com.apple.coremedia.audiodeviceclock")) (deny file-write-create (vnode-type SYMLINK)) (deny file-read-xattr file-write-xattr (xattr-regex #"^com\.apple\.security\.private\.")) ;; Allow loading injected bundles. (allow file-map-executable) ;; AWD logging (awd-log-directory "com.apple.WebKit.WebContent") (network-client (remote tcp) (remote udp)) ;; Allow ManagedPreference access (allow file-read* (literal "/private/var/Managed Preferences/mobile/com.apple.webcontentfilter.plist")) ;; Allow mediaserverd to issue file extensions for the purposes of reading media (allow file-issue-extension (require-all (extension "com.apple.app-sandbox.read") (extension-class "com.apple.mediaserverd.read")))
{'repo_name': 'naver/sling', 'stars': '115', 'repo_language': 'C++', 'file_name': 'configure-clang-linux.sh', 'mime_type': 'text/x-shellscript', 'hash': 3834272197212412992, 'source_dataset': 'data'}
; RUN: opt -S -basicaa -objc-arc < %s | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" target triple = "x86_64-apple-darwin11.0.0" %0 = type { i64, i64, i8*, i8*, i8*, i8* } %1 = type <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }> %struct.__block_descriptor = type { i64, i64 } @_NSConcreteStackBlock = external global i8* @.str = private unnamed_addr constant [6 x i8] c"v8@?0\00" @"\01L_OBJC_CLASS_NAME_" = internal global [3 x i8] c"\01@\00", section "__TEXT,__objc_classname,cstring_literals", align 1 @__block_descriptor_tmp = internal constant %0 { i64 0, i64 40, i8* bitcast (void (i8*, i8*)* @__copy_helper_block_ to i8*), i8* bitcast (void (i8*)* @__destroy_helper_block_ to i8*), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0) } @"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__DATA, __objc_imageinfo, regular, no_dead_strip" @llvm.used = appending global [2 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), i8* bitcast ([2 x i32]* @"\01L_OBJC_IMAGE_INFO" to i8*)], section "llvm.metadata" ; Eliminate unnecessary weak pointer copies. ; CHECK: define void @foo() { ; CHECK-NEXT: entry: ; CHECK-NEXT: %call = call i8* @bar() ; CHECK-NEXT: call void @use(i8* %call) [[NUW:#[0-9]+]] ; CHECK-NEXT: ret void ; CHECK-NEXT: } define void @foo() { entry: %w = alloca i8*, align 8 %x = alloca i8*, align 8 %call = call i8* @bar() %0 = call i8* @objc_initWeak(i8** %w, i8* %call) nounwind %1 = call i8* @objc_loadWeak(i8** %w) nounwind %2 = call i8* @objc_initWeak(i8** %x, i8* %1) nounwind %3 = call i8* @objc_loadWeak(i8** %x) nounwind call void @use(i8* %3) nounwind call void @objc_destroyWeak(i8** %x) nounwind call void @objc_destroyWeak(i8** %w) nounwind ret void } ; Eliminate unnecessary weak pointer copies in a block initialization. ; CHECK: define void @qux(i8* %me) #0 { ; CHECK-NEXT: entry: ; CHECK-NEXT: %block = alloca %1, align 8 ; CHECK-NOT: alloca ; CHECK: } define void @qux(i8* %me) nounwind { entry: %w = alloca i8*, align 8 %block = alloca %1, align 8 %0 = call i8* @objc_retain(i8* %me) nounwind %1 = call i8* @objc_initWeak(i8** %w, i8* %0) nounwind %block.isa = getelementptr inbounds %1, %1* %block, i64 0, i32 0 store i8* bitcast (i8** @_NSConcreteStackBlock to i8*), i8** %block.isa, align 8 %block.flags = getelementptr inbounds %1, %1* %block, i64 0, i32 1 store i32 1107296256, i32* %block.flags, align 8 %block.reserved = getelementptr inbounds %1, %1* %block, i64 0, i32 2 store i32 0, i32* %block.reserved, align 4 %block.invoke = getelementptr inbounds %1, %1* %block, i64 0, i32 3 store i8* bitcast (void (i8*)* @__qux_block_invoke_0 to i8*), i8** %block.invoke, align 8 %block.descriptor = getelementptr inbounds %1, %1* %block, i64 0, i32 4 store %struct.__block_descriptor* bitcast (%0* @__block_descriptor_tmp to %struct.__block_descriptor*), %struct.__block_descriptor** %block.descriptor, align 8 %block.captured = getelementptr inbounds %1, %1* %block, i64 0, i32 5 %2 = call i8* @objc_loadWeak(i8** %w) nounwind %3 = call i8* @objc_initWeak(i8** %block.captured, i8* %2) nounwind %4 = bitcast %1* %block to void ()* call void @use_block(void ()* %4) nounwind call void @objc_destroyWeak(i8** %block.captured) nounwind call void @objc_destroyWeak(i8** %w) nounwind call void @objc_release(i8* %0) nounwind, !clang.imprecise_release !0 ret void } declare i8* @objc_retain(i8*) declare void @use_block(void ()*) nounwind declare void @__qux_block_invoke_0(i8* %.block_descriptor) nounwind declare void @__copy_helper_block_(i8*, i8*) nounwind declare void @objc_copyWeak(i8**, i8**) declare void @__destroy_helper_block_(i8*) nounwind declare void @objc_release(i8*) declare i8* @bar() declare i8* @objc_initWeak(i8**, i8*) declare i8* @objc_loadWeak(i8**) declare void @use(i8*) nounwind declare void @objc_destroyWeak(i8**) ; CHECK: attributes [[NUW]] = { nounwind } !0 = !{}
{'repo_name': 'GJDuck/LowFat', 'stars': '118', 'repo_language': 'C++', 'file_name': 'crash-narrowfunctiontest.ll', 'mime_type': 'text/plain', 'hash': -3370522880962060815, 'source_dataset': 'data'}
const areYouPlayingBanjo = require('.') test('Test 1', () => { expect(areYouPlayingBanjo('Martin')).toBe('Martin does not play banjo') }) test('Test 2', () => { expect(areYouPlayingBanjo('Rikke')).toBe('Rikke plays banjo') })
{'repo_name': 'lndgalante/codewars-katas', 'stars': '183', 'repo_language': 'JavaScript', 'file_name': 'index.test.js', 'mime_type': 'text/plain', 'hash': -2574244277681555080, 'source_dataset': 'data'}
/** * Utility class for generating different styles of message boxes. The framework provides a global singleton * {@link Ext.Msg} for common usage which you should use in most cases. * * If you want to use {@link Ext.MessageBox} directly, just think of it as a modal {@link Ext.Container}. * * Note that the MessageBox is asynchronous. Unlike a regular JavaScript `alert` (which will halt browser execution), * showing a MessageBox will not cause the code to stop. For this reason, if you have code that should only run _after_ * some user feedback from the MessageBox, you must use a callback function (see the `fn` configuration option parameter * for the {@link #method-show show} method for more details). * * @example preview * Ext.Msg.alert('Title', 'The quick brown fox jumped over the lazy dog.', Ext.emptyFn); * * Checkout {@link Ext.Msg} for more examples. * */ Ext.define('Ext.MessageBox', { extend : 'Ext.Sheet', requires: [ 'Ext.Toolbar', 'Ext.field.Text', 'Ext.field.TextArea', 'Ext.util.InputBlocker' ], config: { /** * @cfg * @inheritdoc */ ui: 'dark', /** * @cfg * @inheritdoc */ baseCls: Ext.baseCSSPrefix + 'msgbox', /** * @cfg {String} iconCls * CSS class for the icon. The icon should be 40px x 40px. * @accessor */ iconCls: null, /** * @cfg * @inheritdoc */ showAnimation: { type: 'popIn', duration: 250, easing: 'ease-out' }, /** * @cfg * @inheritdoc */ hideAnimation: { type: 'popOut', duration: 250, easing: 'ease-out' }, /** * Override the default `zIndex` so it is normally always above floating components. */ zIndex: 999, /** * @cfg {Number} defaultTextHeight * The default height in pixels of the message box's multiline textarea if displayed. * @accessor */ defaultTextHeight: 75, /** * @cfg {String} title * The title of this {@link Ext.MessageBox}. * @accessor */ title: null, /** * @cfg {Array/Object} buttons * An array of buttons, or an object of a button to be displayed in the toolbar of this {@link Ext.MessageBox}. */ buttons: null, /** * @cfg {String} message * The message to be displayed in the {@link Ext.MessageBox}. * @accessor */ message: null, /** * @cfg {String} msg * The message to be displayed in the {@link Ext.MessageBox}. * @removed 2.0.0 Please use {@link #message} instead. */ /** * @cfg {Object} prompt * The configuration to be passed if you want an {@link Ext.field.Text} or {@link Ext.field.TextArea} field * in your {@link Ext.MessageBox}. * * Pass an object with the property `multiLine` with a value of `true`, if you want the prompt to use a TextArea. * * Alternatively, you can just pass in an object which has an xtype/xclass of another component. * * prompt: { * xtype: 'textareafield', * value: 'test' * } * * @accessor */ prompt: null, /** * @private */ modal: true, /** * @cfg * @inheritdoc */ layout: { type: 'vbox', pack: 'center' } }, platformConfig: [{ theme: ['Windows'], ui: 'light', showAnimation: { type: 'fadeIn' }, hideAnimation: { type: 'fadeOut' } }, { theme: ['Blackberry'], ui: 'plain' }, { theme: ['MoutainView'] }], statics: { OK : {text: 'OK', itemId: 'ok', ui: 'action'}, YES : {text: 'Yes', itemId: 'yes', ui: 'action'}, NO : {text: 'No', itemId: 'no'}, CANCEL: {text: 'Cancel', itemId: 'cancel'}, INFO : Ext.baseCSSPrefix + 'msgbox-info', WARNING : Ext.baseCSSPrefix + 'msgbox-warning', QUESTION: Ext.baseCSSPrefix + 'msgbox-question', ERROR : Ext.baseCSSPrefix + 'msgbox-error', OKCANCEL: [ {text: 'Cancel', itemId: 'cancel'}, {text: 'OK', itemId: 'ok', ui : 'action'} ], YESNOCANCEL: [ {text: 'Cancel', itemId: 'cancel'}, {text: 'No', itemId: 'no'}, {text: 'Yes', itemId: 'yes', ui: 'action'} ], YESNO: [ {text: 'No', itemId: 'no'}, {text: 'Yes', itemId: 'yes', ui: 'action'} ] }, constructor: function(config) { config = config || {}; if (config.hasOwnProperty('promptConfig')) { //<debug warn> Ext.Logger.deprecate("'promptConfig' config is deprecated, please use 'prompt' config instead", this); //</debug> Ext.applyIf(config, { prompt: config.promptConfig }); delete config.promptConfig; } if (config.hasOwnProperty('multiline') || config.hasOwnProperty('multiLine')) { config.prompt = config.prompt || {}; Ext.applyIf(config.prompt, { multiLine: config.multiline || config.multiLine }); delete config.multiline; delete config.multiLine; } this.defaultAllowedConfig = {}; var allowedConfigs = ['ui', 'showAnimation', 'hideAnimation', 'title', 'message', 'prompt', 'iconCls', 'buttons', 'defaultTextHeight'], ln = allowedConfigs.length, i, allowedConfig; for (i = 0; i < ln; i++) { allowedConfig = allowedConfigs[i]; this.defaultAllowedConfig[allowedConfig] = this.defaultConfig[allowedConfig]; } this.callParent([config]); }, /** * Creates a new {@link Ext.Toolbar} instance using {@link Ext#factory}. * @private */ applyTitle: function(config) { if (typeof config == "string") { config = { title: config }; } Ext.applyIf(config, { docked: 'top', minHeight: (Ext.filterPlatform('blackberry') || Ext.filterPlatform('ie10')) ? '2.6em' : '1.3em', ui: Ext.filterPlatform('blackberry') ? 'light' : 'dark', cls : this.getBaseCls() + '-title' }); return Ext.factory(config, Ext.Toolbar, this.getTitle()); }, /** * Adds the new {@link Ext.Toolbar} instance into this container. * @private */ updateTitle: function(newTitle) { if (newTitle) { this.add(newTitle); } }, /** * Adds the new {@link Ext.Toolbar} instance into this container. * @private */ updateButtons: function(newButtons) { var me = this; // If there are no new buttons or it is an empty array, set newButtons // to false newButtons = (!newButtons || newButtons.length === 0) ? false : newButtons; if (newButtons) { if (me.buttonsToolbar) { me.buttonsToolbar.show(); me.buttonsToolbar.removeAll(); me.buttonsToolbar.setItems(newButtons); } else { var layout = { type: 'hbox', pack: 'center' }; var isFlexed = Ext.theme.name == "CupertinoClassic" || Ext.theme.name == "MountainView" || Ext.theme.name == "Blackberry"; me.buttonsToolbar = Ext.create('Ext.Toolbar', { docked: 'bottom', defaultType: 'button', defaults: { flex: (isFlexed) ? 1 : undefined, ui: (Ext.theme.name == "Blackberry") ? 'action' : undefined }, layout: layout, ui: me.getUi(), cls: me.getBaseCls() + '-buttons', items: newButtons }); me.add(me.buttonsToolbar); } } else if (me.buttonsToolbar) { me.buttonsToolbar.hide(); } }, /** * @private */ applyMessage: function(config) { config = { html : config, cls : this.getBaseCls() + '-text' }; return Ext.factory(config, Ext.Component, this._message); }, /** * @private */ updateMessage: function(newMessage) { if (newMessage) { this.add(newMessage); } }, getMessage: function() { if (this._message) { return this._message.getHtml(); } return null; }, /** * @private */ applyIconCls: function(config) { config = { xtype : 'component', docked: 'left', width : 40, height: 40, baseCls: Ext.baseCSSPrefix + 'icon', hidden: (config) ? false : true, cls: config }; return Ext.factory(config, Ext.Component, this._iconCls); }, /** * @private */ updateIconCls: function(newIconCls, oldIconCls) { //ensure the title and button elements are added first this.getTitle(); this.getButtons(); if (newIconCls) { this.add(newIconCls); } else { this.remove(oldIconCls); } }, getIconCls: function() { var icon = this._iconCls, iconCls; if (icon) { iconCls = icon.getCls(); return (iconCls) ? iconCls[0] : null; } return null; }, /** * @private */ applyPrompt: function(prompt) { if (prompt) { var config = { label: false }; if (Ext.isObject(prompt)) { Ext.apply(config, prompt); } if (config.multiLine) { config.height = Ext.isNumber(config.multiLine) ? parseFloat(config.multiLine) : this.getDefaultTextHeight(); return Ext.factory(config, Ext.field.TextArea, this.getPrompt()); } else { return Ext.factory(config, Ext.field.Text, this.getPrompt()); } } return prompt; }, /** * @private */ updatePrompt: function(newPrompt, oldPrompt) { if (newPrompt) { this.add(newPrompt); } if (oldPrompt) { this.remove(oldPrompt); } }, // @private // pass `fn` config to show method instead onClick: function(button) { if (button) { var config = button.config.userConfig || {}, initialConfig = button.getInitialConfig(), prompt = this.getPrompt(); if (typeof config.fn == 'function') { button.disable(); this.on({ hiddenchange: function() { config.fn.call( config.scope || null, initialConfig.itemId || initialConfig.text, prompt ? prompt.getValue() : null, config ); button.enable(); }, single: true, scope: this }); } if (config.input) { config.input.dom.blur(); } } this.hide(); }, /** * Displays the {@link Ext.MessageBox} with a specified configuration. All * display functions (e.g. {@link #method-prompt}, {@link #alert}, {@link #confirm}) * on MessageBox call this function internally, although those calls * are basic shortcuts and do not support all of the config options allowed here. * * Example usage: * * @example * Ext.Msg.show({ * title: 'Address', * message: 'Please enter your address:', * width: 300, * buttons: Ext.MessageBox.OKCANCEL, * multiLine: true, * prompt : { maxlength : 180, autocapitalize : true }, * fn: function(buttonId) { * alert('You pressed the "' + buttonId + '" button.'); * } * }); * * @param {Object} config An object with the following config options: * * @param {Object/Array} [config.buttons=false] * A button config object or Array of the same(e.g., `Ext.MessageBox.OKCANCEL` or `{text:'Foo', itemId:'cancel'}`), * or false to not show any buttons. * * @param {String} config.cls * A custom CSS class to apply to the message box's container element. * * @param {Function} config.fn * A callback function which is called when the dialog is dismissed by clicking on the configured buttons. * * @param {String} config.fn.buttonId The `itemId` of the button pressed, one of: 'ok', 'yes', 'no', 'cancel'. * @param {String} config.fn.value Value of the input field if either `prompt` or `multiline` option is `true`. * @param {Object} config.fn.opt The config object passed to show. * * @param {Number} [config.width=auto] * A fixed width for the MessageBox. * * @param {Number} [config.height=auto] * A fixed height for the MessageBox. * * @param {Object} config.scope * The scope of the callback function * * @param {String} config.icon * A CSS class that provides a background image to be used as the body icon for the dialog * (e.g. Ext.MessageBox.WARNING or 'custom-class'). * * @param {Boolean} [config.modal=true] * `false` to allow user interaction with the page while the message box is displayed. * * @param {String} [config.message=&#160;] * A string that will replace the existing message box body text. * Defaults to the XHTML-compliant non-breaking space character `&#160;`. * * @param {Number} [config.defaultTextHeight=75] * The default height in pixels of the message box's multiline textarea if displayed. * * @param {Boolean} [config.prompt=false] * `true` to prompt the user to enter single-line text. Please view the {@link Ext.MessageBox#method-prompt} documentation in {@link Ext.MessageBox}. * for more information. * * @param {Boolean} [config.multiline=false] * `true` to prompt the user to enter multi-line text. * * @param {String} config.title * The title text. * * @param {String} config.value * The string value to set into the active textbox element if displayed. * * @return {Ext.MessageBox} this */ show: function(initialConfig) { Ext.util.InputBlocker.blockInputs(); //if it has not been added to a container, add it to the Viewport. if (!this.getParent() && Ext.Viewport) { Ext.Viewport.add(this); } if (!initialConfig) { return this.callParent(); } var config = Ext.Object.merge({}, { value: '' }, initialConfig); var buttons = initialConfig.buttons || Ext.MessageBox.OK || [], buttonBarItems = [], userConfig = initialConfig; Ext.each(buttons, function(buttonConfig) { if (!buttonConfig) { return; } buttonBarItems.push(Ext.apply({ userConfig: userConfig, scope : this, handler : 'onClick' }, buttonConfig)); }, this); config.buttons = buttonBarItems; if (config.promptConfig) { //<debug warn> Ext.Logger.deprecate("'promptConfig' config is deprecated, please use 'prompt' config instead", this); //</debug> } config.prompt = (config.promptConfig || config.prompt) || null; if (config.multiLine) { config.prompt = config.prompt || {}; config.prompt.multiLine = config.multiLine; delete config.multiLine; } config = Ext.merge({}, this.defaultAllowedConfig, config); this.setConfig(config); var prompt = this.getPrompt(); if (prompt) { prompt.setValue(initialConfig.value || ''); } this.callParent(); return this; }, /** * Displays a standard read-only message box with an OK button (comparable to the basic JavaScript alert prompt). If * a callback function is passed it will be called after the user clicks the button, and the `itemId` of the button * that was clicked will be passed as the only parameter to the callback. * * @param {String} title The title bar text. * @param {String} message The message box body text. * @param {Function} [fn] A callback function which is called when the dialog is dismissed by clicking on the configured buttons. * @param {String} fn.buttonId The `itemId` of the button pressed, one of: 'ok', 'yes', 'no', 'cancel'. * @param {String} fn.value Value of the input field if either `prompt` or `multiLine` option is `true`. * @param {Object} fn.opt The config object passed to show. * @param {Object} [scope] The scope (`this` reference) in which the callback is executed. * Defaults to: the browser window * * @return {Ext.MessageBox} this */ alert: function(title, message, fn, scope) { return this.show({ title: title || null, message: message || null, buttons: Ext.MessageBox.OK, promptConfig: false, fn: function() { if (fn) { fn.apply(scope, arguments); } }, scope: scope }); }, /** * Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm). If a callback * function is passed it will be called after the user clicks either button, and the id of the button that was * clicked will be passed as the only parameter to the callback (could also be the top-right close button). * * @param {String} title The title bar text. * @param {String} message The message box body text. * @param {Function} fn A callback function which is called when the dialog is dismissed by clicking on the configured buttons. * @param {String} fn.buttonId The `itemId` of the button pressed, one of: 'ok', 'yes', 'no', 'cancel'. * @param {String} fn.value Value of the input field if either `prompt` or `multiLine` option is `true`. * @param {Object} fn.opt The config object passed to show. * @param {Object} [scope] The scope (`this` reference) in which the callback is executed. * * Defaults to: the browser window * * @return {Ext.MessageBox} this */ confirm: function(title, message, fn, scope) { return this.show({ title : title || null, message : message || null, buttons : Ext.MessageBox.YESNO, promptConfig: false, scope : scope, fn: function() { if (fn) { fn.apply(scope, arguments); } } }); }, /** * Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to * JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it * will be called after the user clicks either button, and the id of the button that was clicked (could also be the * top-right close button) and the text that was entered will be passed as the two parameters to the callback. * * Example usage: * * @example * Ext.Msg.prompt( * 'Welcome!', * 'What\'s your name going to be today?', * function (buttonId, value) { * console.log(value); * }, * null, * false, * null, * { * autoCapitalize: true, * placeHolder: 'First-name please...' * } * ); * * @param {String} title The title bar text. * @param {String} message The message box body text. * @param {Function} fn A callback function which is called when the dialog is dismissed by clicking on the configured buttons. * @param {String} fn.buttonId The `itemId` of the button pressed, one of: 'ok', 'yes', 'no', 'cancel'. * @param {String} fn.value Value of the input field if either `prompt` or `multiLine` option is `true`. * @param {Object} fn.opt The config object passed to show. * @param {Object} scope The scope (`this` reference) in which the callback is executed. * * Defaults to: the browser window. * * @param {Boolean/Number} [multiLine=false] `true` to create a multiline textbox using the `defaultTextHeight` property, * or the height in pixels to create the textbox. * * @param {String} [value] Default value of the text input element. * * @param {Object} [prompt=true] * The configuration for the prompt. See the {@link Ext.MessageBox#cfg-prompt prompt} documentation in {@link Ext.MessageBox} * for more information. * * @return {Ext.MessageBox} this */ prompt: function(title, message, fn, scope, multiLine, value, prompt) { return this.show({ title : title || null, message : message || null, buttons : Ext.MessageBox.OKCANCEL, scope : scope, prompt : prompt || true, multiLine: multiLine, value : value, fn: function() { if (fn) { fn.apply(scope, arguments); } } }); } }, function(MessageBox) { // <deprecated product=touch since=2.0> this.override({ /** * @cfg {String} icon * Sets CSS class for icon. * @removed 2.0 Use #iconCls instead. */ /** * Sets #icon. * @deprecated 2.0 Please use #setIconCls instead. * @param {String} iconCls A CSS class name or empty string to clear the icon. * @return {Ext.MessageBox} this */ setIcon: function(iconCls, doLayout){ //<debug warn> Ext.Logger.deprecate("Ext.MessageBox#setIcon is deprecated, use setIconCls instead", 2); //</debug> this.setIconCls(iconCls); return this; }, /** * @inheritdoc Ext.MessageBox#setMessage * @deprecated 2.0.0 Please use #setMessage instead. */ updateText: function(text){ //<debug warn> Ext.Logger.deprecate("Ext.MessageBox#updateText is deprecated, use setMessage instead", 2); //</debug> this.setMessage(text); return this; } }); // </deprecated> Ext.onSetup(function() { /** * @class Ext.Msg * @extends Ext.MessageBox * @singleton * * A global shared singleton instance of the {@link Ext.MessageBox} class. * * Allows for simple creation of various different alerts and notifications. * * To change any configurations on this singleton instance, you must change the * `defaultAllowedConfig` object. For example to remove all animations on `Msg`: * * Ext.Msg.defaultAllowedConfig.showAnimation = false; * Ext.Msg.defaultAllowedConfig.hideAnimation = false; * * ## Examples * * ### Alert * Use the {@link #alert} method to show a basic alert: * * @example preview * Ext.Msg.alert('Title', 'The quick brown fox jumped over the lazy dog.', Ext.emptyFn); * * ### Prompt * Use the {@link #method-prompt} method to show an alert which has a textfield: * * @example preview * Ext.Msg.prompt('Name', 'Please enter your name:', function(text) { * // process text value and close... * }); * * ### Confirm * Use the {@link #confirm} method to show a confirmation alert (shows yes and no buttons). * * @example preview * Ext.Msg.confirm("Confirmation", "Are you sure you want to do that?", Ext.emptyFn); */ Ext.Msg = new MessageBox; }); });
{'repo_name': 'senchalabs/AppInspector', 'stars': '103', 'repo_language': 'JavaScript', 'file_name': 'clean.js', 'mime_type': 'text/plain', 'hash': 792848423677547970, 'source_dataset': 'data'}
<?php /* * Copyright 2014 Google Inc. * * 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. */ class Google_Service_Vision_GoogleCloudVisionV1p4beta1AsyncBatchAnnotateImagesResponse extends Google_Model { protected $outputConfigType = 'Google_Service_Vision_GoogleCloudVisionV1p4beta1OutputConfig'; protected $outputConfigDataType = ''; /** * @param Google_Service_Vision_GoogleCloudVisionV1p4beta1OutputConfig */ public function setOutputConfig(Google_Service_Vision_GoogleCloudVisionV1p4beta1OutputConfig $outputConfig) { $this->outputConfig = $outputConfig; } /** * @return Google_Service_Vision_GoogleCloudVisionV1p4beta1OutputConfig */ public function getOutputConfig() { return $this->outputConfig; } }
{'repo_name': 'WWBN/AVideo', 'stars': '1149', 'repo_language': 'PHP', 'file_name': 'design_themes.php', 'mime_type': 'text/html', 'hash': 8720373078281650021, 'source_dataset': 'data'}
// mksyscall.pl -l32 -tags darwin,arm syscall_bsd.go syscall_darwin.go syscall_darwin_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. // +build darwin,arm package unix import ( "syscall" "unsafe" ) var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { _p0 = unsafe.Pointer(&mib[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, timeval *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Madvise(b []byte, behav int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlock(b []byte) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mprotect(b []byte, prot int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Msync(b []byte, flags int) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlock(b []byte) (err error) { var _p0 unsafe.Pointer if len(b) > 0 { _p0 = unsafe.Pointer(&b[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pipe() (r int, w int, err error) { r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) r = int(r0) w = int(r1) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(attr) if err != nil { return } r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(attr) if err != nil { return } _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func removexattr(path string, attr string, options int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(attr) if err != nil { return } _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fremovexattr(fd int, attr string, options int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(attr) if err != nil { return } _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kill(pid int, signum int, posix int) (err error) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chflags(path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chmod(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Chroot(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup(fd int) (nfd int, err error) { r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exchangedata(path1 string, path2 string, options int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path1) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(path2) if err != nil { return } _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { Syscall(SYS_EXIT, uintptr(code), 0, 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Flock(fd int, how int) (err error) { _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { _p0 = unsafe.Pointer(&buf[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getdtablesize() (size int) { r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) size = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) egid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) uid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) gid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) pgrp = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) pid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) ppid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) uid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) tainted = bool(r0 != 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Link(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(link) if err != nil { return } _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(link) if err != nil { return } _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdir(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkdirat(dirfd int, path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mkfifo(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Open(path string, mode int, perm uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pathconf(path string, name int) (val int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pwrite(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlink(path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 unsafe.Pointer if len(buf) > 0 { _p1 = unsafe.Pointer(&buf[0]) } else { _p1 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 unsafe.Pointer if len(buf) > 0 { _p1 = unsafe.Pointer(&buf[0]) } else { _p1 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rename(from string, to string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(from) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(to) if err != nil { return } _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Renameat(fromfd int, from string, tofd int, to string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(from) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(to) if err != nil { return } _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Revoke(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Rmdir(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) newoffset = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) { _, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setlogin(name string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(name) if err != nil { return } _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setprivexec(flag int) (err error) { _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Statfs(path string, stat *Statfs_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlink(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(link) if err != nil { return } _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(newpath) if err != nil { return } _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) oldmask = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Undelete(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlink(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unlinkat(dirfd int, path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Unmount(path string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func write(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func gettimeofday(tp *Timeval) (sec int32, usec int32, err error) { r0, r1, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) sec = int32(r0) usec = int32(r1) if e1 != 0 { err = errnoErr(e1) } return }
{'repo_name': 'yext/edward', 'stars': '148', 'repo_language': 'Go', 'file_name': 'sudo.go', 'mime_type': 'text/plain', 'hash': 6336817253346928592, 'source_dataset': 'data'}
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jclouds.cloudwatch; import org.jclouds.View; import org.jclouds.rest.internal.BaseHttpApiMetadataTest; import org.testng.annotations.Test; import com.google.common.collect.ImmutableSet; import com.google.common.reflect.TypeToken; @Test(groups = "unit", testName = "CloudWatchApiMetadataTest") public class CloudWatchApiMetadataTest extends BaseHttpApiMetadataTest { // no monitoring abstraction, yet public CloudWatchApiMetadataTest() { super(new CloudWatchApiMetadata(), ImmutableSet.<TypeToken<? extends View>> of()); } }
{'repo_name': 'jclouds/jclouds', 'stars': '387', 'repo_language': 'Java', 'file_name': 'InitAdminAccessTest.java', 'mime_type': 'text/x-java', 'hash': 3172663444656264441, 'source_dataset': 'data'}
# negotiator [![NPM Version][npm-image]][npm-url] [![NPM Downloads][downloads-image]][downloads-url] [![Node.js Version][node-version-image]][node-version-url] [![Build Status][travis-image]][travis-url] [![Test Coverage][coveralls-image]][coveralls-url] An HTTP content negotiator for Node.js ## Installation ```sh $ npm install negotiator ``` ## API ```js var Negotiator = require('negotiator') ``` ### Accept Negotiation ```js availableMediaTypes = ['text/html', 'text/plain', 'application/json'] // The negotiator constructor receives a request object negotiator = new Negotiator(request) // Let's say Accept header is 'text/html, application/*;q=0.2, image/jpeg;q=0.8' negotiator.mediaTypes() // -> ['text/html', 'image/jpeg', 'application/*'] negotiator.mediaTypes(availableMediaTypes) // -> ['text/html', 'application/json'] negotiator.mediaType(availableMediaTypes) // -> 'text/html' ``` You can check a working example at `examples/accept.js`. #### Methods ##### mediaType() Returns the most preferred media type from the client. ##### mediaType(availableMediaType) Returns the most preferred media type from a list of available media types. ##### mediaTypes() Returns an array of preferred media types ordered by the client preference. ##### mediaTypes(availableMediaTypes) Returns an array of preferred media types ordered by priority from a list of available media types. ### Accept-Language Negotiation ```js negotiator = new Negotiator(request) availableLanguages = 'en', 'es', 'fr' // Let's say Accept-Language header is 'en;q=0.8, es, pt' negotiator.languages() // -> ['es', 'pt', 'en'] negotiator.languages(availableLanguages) // -> ['es', 'en'] language = negotiator.language(availableLanguages) // -> 'es' ``` You can check a working example at `examples/language.js`. #### Methods ##### language() Returns the most preferred language from the client. ##### language(availableLanguages) Returns the most preferred language from a list of available languages. ##### languages() Returns an array of preferred languages ordered by the client preference. ##### languages(availableLanguages) Returns an array of preferred languages ordered by priority from a list of available languages. ### Accept-Charset Negotiation ```js availableCharsets = ['utf-8', 'iso-8859-1', 'iso-8859-5'] negotiator = new Negotiator(request) // Let's say Accept-Charset header is 'utf-8, iso-8859-1;q=0.8, utf-7;q=0.2' negotiator.charsets() // -> ['utf-8', 'iso-8859-1', 'utf-7'] negotiator.charsets(availableCharsets) // -> ['utf-8', 'iso-8859-1'] negotiator.charset(availableCharsets) // -> 'utf-8' ``` You can check a working example at `examples/charset.js`. #### Methods ##### charset() Returns the most preferred charset from the client. ##### charset(availableCharsets) Returns the most preferred charset from a list of available charsets. ##### charsets() Returns an array of preferred charsets ordered by the client preference. ##### charsets(availableCharsets) Returns an array of preferred charsets ordered by priority from a list of available charsets. ### Accept-Encoding Negotiation ```js availableEncodings = ['identity', 'gzip'] negotiator = new Negotiator(request) // Let's say Accept-Encoding header is 'gzip, compress;q=0.2, identity;q=0.5' negotiator.encodings() // -> ['gzip', 'identity', 'compress'] negotiator.encodings(availableEncodings) // -> ['gzip', 'identity'] negotiator.encoding(availableEncodings) // -> 'gzip' ``` You can check a working example at `examples/encoding.js`. #### Methods ##### encoding() Returns the most preferred encoding from the client. ##### encoding(availableEncodings) Returns the most preferred encoding from a list of available encodings. ##### encodings() Returns an array of preferred encodings ordered by the client preference. ##### encodings(availableEncodings) Returns an array of preferred encodings ordered by priority from a list of available encodings. ## See Also The [accepts](https://npmjs.org/package/accepts#readme) module builds on this module and provides an alternative interface, mime type validation, and more. ## License [MIT](LICENSE) [npm-image]: https://img.shields.io/npm/v/negotiator.svg [npm-url]: https://npmjs.org/package/negotiator [node-version-image]: https://img.shields.io/node/v/negotiator.svg [node-version-url]: http://nodejs.org/download/ [travis-image]: https://img.shields.io/travis/jshttp/negotiator/master.svg [travis-url]: https://travis-ci.org/jshttp/negotiator [coveralls-image]: https://img.shields.io/coveralls/jshttp/negotiator/master.svg [coveralls-url]: https://coveralls.io/r/jshttp/negotiator?branch=master [downloads-image]: https://img.shields.io/npm/dm/negotiator.svg [downloads-url]: https://npmjs.org/package/negotiator
{'repo_name': 'solo-io/unik', 'stars': '2239', 'repo_language': 'Go', 'file_name': 'build.go', 'mime_type': 'text/plain', 'hash': -7374660749416250020, 'source_dataset': 'data'}
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/watch_picture_activity_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/black" android:orientation="vertical" > <com.netease.nim.uikit.common.ui.imageview.MultiTouchZoomableImageView android:id="@+id/watch_image_view" android:layout_width="match_parent" android:layout_height="match_parent" /> <include layout="@layout/nim_watch_media_download_progress_layout" /> </FrameLayout>
{'repo_name': 'netease-im/NIM_Android_UIKit', 'stars': '526', 'repo_language': 'Java', 'file_name': 'nim_touch_bg.xml', 'mime_type': 'text/xml', 'hash': -5073901274420006204, 'source_dataset': 'data'}