text
stringlengths
2
1.04M
meta
dict
package me.darwinlouistoledo.fontoapp; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.LinearLayout; import android.widget.TextView; import me.darwinlouistoledo.fonto.Fonto; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView tvLato = (TextView) findViewById(R.id.tvLato); tvLato.setTypeface(Fonto.with(this).useFont(FontNames.FONT_LATO)); TextView tvMonteserrat = (TextView) findViewById(R.id.tvMonteserrat); tvMonteserrat.setTypeface(Fonto.with(this).useFont(FontNames.FONT_MONTSERRAT)); LinearLayout linearLayout = (LinearLayout) findViewById(R.id.layoutContainer); Fonto.with(this).applyFontToView(linearLayout, FontNames.FONT_LATO); } }
{ "content_hash": "c9ee61da2f6e3a08d037f23138cd185b", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 87, "avg_line_length": 31.96551724137931, "alnum_prop": 0.7529665587918015, "repo_name": "darwinlouistoledo/Fonto", "id": "85d2f8667d8978782180a18a5e4c58c43c7e5e5c", "size": "2069", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "FontoApp/app/src/main/java/me/darwinlouistoledo/fontoapp/MainActivity.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "21237" } ], "symlink_target": "" }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "77a45af2e33791f335ee5b375f9915aa", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.307692307692308, "alnum_prop": 0.6940298507462687, "repo_name": "mdoering/backbone", "id": "9fc00a286aeabcb0c669e4967fd3de09b44697fe", "size": "190", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Ericales/Sapotaceae/Pouteria/Pouteria micrantha/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package org.elasticsearch.ingest.geoip; import com.carrotsearch.randomizedtesting.generators.RandomPicks; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.Randomness; import org.elasticsearch.index.VersionType; import org.elasticsearch.ingest.IngestDocument; import org.elasticsearch.ingest.geoip.IngestGeoIpPlugin.GeoIpCache; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.StreamsUtils; import org.junit.AfterClass; import org.junit.BeforeClass; import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasToString; import static org.hamcrest.Matchers.sameInstance; public class GeoIpProcessorFactoryTests extends ESTestCase { private static Map<String, DatabaseReaderLazyLoader> databaseReaders; @BeforeClass public static void loadDatabaseReaders() throws IOException { final Path geoIpDir = createTempDir(); final Path configDir = createTempDir(); final Path geoIpConfigDir = configDir.resolve("ingest-geoip"); Files.createDirectories(geoIpConfigDir); copyDatabaseFiles(geoIpDir); databaseReaders = IngestGeoIpPlugin.loadDatabaseReaders(geoIpDir, geoIpConfigDir); } @AfterClass public static void closeDatabaseReaders() throws IOException { for (DatabaseReaderLazyLoader reader : databaseReaders.values()) { reader.close(); } databaseReaders = null; } public void testBuildDefaults() throws Exception { GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders, new GeoIpCache(1000)); Map<String, Object> config = new HashMap<>(); config.put("field", "_field"); String processorTag = randomAlphaOfLength(10); GeoIpProcessor processor = factory.create(null, processorTag, null, config); assertThat(processor.getTag(), equalTo(processorTag)); assertThat(processor.getField(), equalTo("_field")); assertThat(processor.getTargetField(), equalTo("geoip")); assertThat(processor.getDatabaseType(), equalTo("GeoLite2-City")); assertThat(processor.getProperties(), sameInstance(GeoIpProcessor.Factory.DEFAULT_CITY_PROPERTIES)); assertFalse(processor.isIgnoreMissing()); } public void testSetIgnoreMissing() throws Exception { GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders, new GeoIpCache(1000)); Map<String, Object> config = new HashMap<>(); config.put("field", "_field"); config.put("ignore_missing", true); String processorTag = randomAlphaOfLength(10); GeoIpProcessor processor = factory.create(null, processorTag, null, config); assertThat(processor.getTag(), equalTo(processorTag)); assertThat(processor.getField(), equalTo("_field")); assertThat(processor.getTargetField(), equalTo("geoip")); assertThat(processor.getDatabaseType(), equalTo("GeoLite2-City")); assertThat(processor.getProperties(), sameInstance(GeoIpProcessor.Factory.DEFAULT_CITY_PROPERTIES)); assertTrue(processor.isIgnoreMissing()); } public void testCountryBuildDefaults() throws Exception { GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders, new GeoIpCache(1000)); Map<String, Object> config = new HashMap<>(); config.put("field", "_field"); config.put("database_file", "GeoLite2-Country.mmdb"); String processorTag = randomAlphaOfLength(10); GeoIpProcessor processor = factory.create(null, processorTag, null, config); assertThat(processor.getTag(), equalTo(processorTag)); assertThat(processor.getField(), equalTo("_field")); assertThat(processor.getTargetField(), equalTo("geoip")); assertThat(processor.getDatabaseType(), equalTo("GeoLite2-Country")); assertThat(processor.getProperties(), sameInstance(GeoIpProcessor.Factory.DEFAULT_COUNTRY_PROPERTIES)); assertFalse(processor.isIgnoreMissing()); } public void testAsnBuildDefaults() throws Exception { GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders, new GeoIpCache(1000)); Map<String, Object> config = new HashMap<>(); config.put("field", "_field"); config.put("database_file", "GeoLite2-ASN.mmdb"); String processorTag = randomAlphaOfLength(10); GeoIpProcessor processor = factory.create(null, processorTag, null, config); assertThat(processor.getTag(), equalTo(processorTag)); assertThat(processor.getField(), equalTo("_field")); assertThat(processor.getTargetField(), equalTo("geoip")); assertThat(processor.getDatabaseType(), equalTo("GeoLite2-ASN")); assertThat(processor.getProperties(), sameInstance(GeoIpProcessor.Factory.DEFAULT_ASN_PROPERTIES)); assertFalse(processor.isIgnoreMissing()); } public void testBuildTargetField() throws Exception { GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders, new GeoIpCache(1000)); Map<String, Object> config = new HashMap<>(); config.put("field", "_field"); config.put("target_field", "_field"); GeoIpProcessor processor = factory.create(null, null, null, config); assertThat(processor.getField(), equalTo("_field")); assertThat(processor.getTargetField(), equalTo("_field")); assertFalse(processor.isIgnoreMissing()); } public void testBuildDbFile() throws Exception { GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders, new GeoIpCache(1000)); Map<String, Object> config = new HashMap<>(); config.put("field", "_field"); config.put("database_file", "GeoLite2-Country.mmdb"); GeoIpProcessor processor = factory.create(null, null, null, config); assertThat(processor.getField(), equalTo("_field")); assertThat(processor.getTargetField(), equalTo("geoip")); assertThat(processor.getDatabaseType(), equalTo("GeoLite2-Country")); assertThat(processor.getProperties(), sameInstance(GeoIpProcessor.Factory.DEFAULT_COUNTRY_PROPERTIES)); assertFalse(processor.isIgnoreMissing()); } public void testBuildWithCountryDbAndAsnFields() throws Exception { GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders, new GeoIpCache(1000)); Map<String, Object> config = new HashMap<>(); config.put("field", "_field"); config.put("database_file", "GeoLite2-Country.mmdb"); EnumSet<GeoIpProcessor.Property> asnOnlyProperties = EnumSet.copyOf(GeoIpProcessor.Property.ALL_ASN_PROPERTIES); asnOnlyProperties.remove(GeoIpProcessor.Property.IP); String asnProperty = RandomPicks.randomFrom(Randomness.get(), asnOnlyProperties).toString(); config.put("properties", Collections.singletonList(asnProperty)); Exception e = expectThrows(ElasticsearchParseException.class, () -> factory.create(null, null, null, config)); assertThat(e.getMessage(), equalTo("[properties] illegal property value [" + asnProperty + "]. valid values are [IP, COUNTRY_ISO_CODE, COUNTRY_NAME, CONTINENT_NAME]")); } public void testBuildWithAsnDbAndCityFields() throws Exception { GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders, new GeoIpCache(1000)); Map<String, Object> config = new HashMap<>(); config.put("field", "_field"); config.put("database_file", "GeoLite2-ASN.mmdb"); EnumSet<GeoIpProcessor.Property> cityOnlyProperties = EnumSet.copyOf(GeoIpProcessor.Property.ALL_CITY_PROPERTIES); cityOnlyProperties.remove(GeoIpProcessor.Property.IP); String cityProperty = RandomPicks.randomFrom(Randomness.get(), cityOnlyProperties).toString(); config.put("properties", Collections.singletonList(cityProperty)); Exception e = expectThrows(ElasticsearchParseException.class, () -> factory.create(null, null, null, config)); assertThat(e.getMessage(), equalTo("[properties] illegal property value [" + cityProperty + "]. valid values are [IP, ASN, ORGANIZATION_NAME]")); } public void testBuildNonExistingDbFile() throws Exception { GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders, new GeoIpCache(1000)); Map<String, Object> config = new HashMap<>(); config.put("field", "_field"); config.put("database_file", "does-not-exist.mmdb"); Exception e = expectThrows(ElasticsearchParseException.class, () -> factory.create(null, null, null, config)); assertThat(e.getMessage(), equalTo("[database_file] database file [does-not-exist.mmdb] doesn't exist")); } public void testBuildFields() throws Exception { GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders, new GeoIpCache(1000)); Set<GeoIpProcessor.Property> properties = EnumSet.noneOf(GeoIpProcessor.Property.class); List<String> fieldNames = new ArrayList<>(); int counter = 0; int numFields = scaledRandomIntBetween(1, GeoIpProcessor.Property.values().length); for (GeoIpProcessor.Property property : GeoIpProcessor.Property.ALL_CITY_PROPERTIES) { properties.add(property); fieldNames.add(property.name().toLowerCase(Locale.ROOT)); if (++counter >= numFields) { break; } } Map<String, Object> config = new HashMap<>(); config.put("field", "_field"); config.put("properties", fieldNames); GeoIpProcessor processor = factory.create(null, null, null, config); assertThat(processor.getField(), equalTo("_field")); assertThat(processor.getProperties(), equalTo(properties)); assertFalse(processor.isIgnoreMissing()); } public void testBuildIllegalFieldOption() throws Exception { GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders, new GeoIpCache(1000)); Map<String, Object> config1 = new HashMap<>(); config1.put("field", "_field"); config1.put("properties", Collections.singletonList("invalid")); Exception e = expectThrows(ElasticsearchParseException.class, () -> factory.create(null, null, null, config1)); assertThat(e.getMessage(), equalTo("[properties] illegal property value [invalid]. valid values are [IP, COUNTRY_ISO_CODE, " + "COUNTRY_NAME, CONTINENT_NAME, REGION_ISO_CODE, REGION_NAME, CITY_NAME, TIMEZONE, LOCATION]")); Map<String, Object> config2 = new HashMap<>(); config2.put("field", "_field"); config2.put("properties", "invalid"); e = expectThrows(ElasticsearchParseException.class, () -> factory.create(null, null, null, config2)); assertThat(e.getMessage(), equalTo("[properties] property isn't a list, but of type [java.lang.String]")); } public void testLazyLoading() throws Exception { final Path geoIpDir = createTempDir(); final Path configDir = createTempDir(); final Path geoIpConfigDir = configDir.resolve("ingest-geoip"); Files.createDirectories(geoIpConfigDir); copyDatabaseFiles(geoIpDir); // Loading another database reader instances, because otherwise we can't test lazy loading as the // database readers used at class level are reused between tests. (we want to keep that otherwise running this // test will take roughly 4 times more time) Map<String, DatabaseReaderLazyLoader> databaseReaders = IngestGeoIpPlugin.loadDatabaseReaders(geoIpDir, geoIpConfigDir); GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders, new GeoIpCache(1000)); for (DatabaseReaderLazyLoader lazyLoader : databaseReaders.values()) { assertNull(lazyLoader.databaseReader.get()); } final Map<String, Object> field = Collections.singletonMap("_field", "1.1.1.1"); final IngestDocument document = new IngestDocument("index", "id", "routing", 1L, VersionType.EXTERNAL, field); Map<String, Object> config = new HashMap<>(); config.put("field", "_field"); config.put("database_file", "GeoLite2-City.mmdb"); final GeoIpProcessor city = factory.create(null, "_tag", null, config); // these are lazy loaded until first use so we expect null here assertNull(databaseReaders.get("GeoLite2-City.mmdb").databaseReader.get()); city.execute(document); // the first ingest should trigger a database load assertNotNull(databaseReaders.get("GeoLite2-City.mmdb").databaseReader.get()); config = new HashMap<>(); config.put("field", "_field"); config.put("database_file", "GeoLite2-Country.mmdb"); final GeoIpProcessor country = factory.create(null, "_tag", null, config); // these are lazy loaded until first use so we expect null here assertNull(databaseReaders.get("GeoLite2-Country.mmdb").databaseReader.get()); country.execute(document); // the first ingest should trigger a database load assertNotNull(databaseReaders.get("GeoLite2-Country.mmdb").databaseReader.get()); config = new HashMap<>(); config.put("field", "_field"); config.put("database_file", "GeoLite2-ASN.mmdb"); final GeoIpProcessor asn = factory.create(null, "_tag", null, config); // these are lazy loaded until first use so we expect null here assertNull(databaseReaders.get("GeoLite2-ASN.mmdb").databaseReader.get()); asn.execute(document); // the first ingest should trigger a database load assertNotNull(databaseReaders.get("GeoLite2-ASN.mmdb").databaseReader.get()); } public void testLoadingCustomDatabase() throws IOException { final Path geoIpDir = createTempDir(); final Path configDir = createTempDir(); final Path geoIpConfigDir = configDir.resolve("ingest-geoip"); Files.createDirectories(geoIpConfigDir); copyDatabaseFiles(geoIpDir); // fake the GeoIP2-City database copyDatabaseFile(geoIpConfigDir, "GeoLite2-City.mmdb"); Files.move(geoIpConfigDir.resolve("GeoLite2-City.mmdb"), geoIpConfigDir.resolve("GeoIP2-City.mmdb")); /* * Loading another database reader instances, because otherwise we can't test lazy loading as the database readers used at class * level are reused between tests. (we want to keep that otherwise running this test will take roughly 4 times more time). */ final Map<String, DatabaseReaderLazyLoader> databaseReaders = IngestGeoIpPlugin.loadDatabaseReaders(geoIpDir, geoIpConfigDir); final GeoIpProcessor.Factory factory = new GeoIpProcessor.Factory(databaseReaders, new GeoIpCache(1000)); for (DatabaseReaderLazyLoader lazyLoader : databaseReaders.values()) { assertNull(lazyLoader.databaseReader.get()); } final Map<String, Object> field = Collections.singletonMap("_field", "1.1.1.1"); final IngestDocument document = new IngestDocument("index", "id", "routing", 1L, VersionType.EXTERNAL, field); Map<String, Object> config = new HashMap<>(); config.put("field", "_field"); config.put("database_file", "GeoIP2-City.mmdb"); final GeoIpProcessor city = factory.create(null, "_tag", null, config); // these are lazy loaded until first use so we expect null here assertNull(databaseReaders.get("GeoIP2-City.mmdb").databaseReader.get()); city.execute(document); // the first ingest should trigger a database load assertNotNull(databaseReaders.get("GeoIP2-City.mmdb").databaseReader.get()); } public void testDatabaseNotExistsInDir() throws IOException { final Path geoIpDir = createTempDir(); final Path configDir = createTempDir(); final Path geoIpConfigDir = configDir.resolve("ingest-geoip"); if (randomBoolean()) { Files.createDirectories(geoIpConfigDir); } copyDatabaseFiles(geoIpDir); final String databaseFilename = randomFrom(IngestGeoIpPlugin.DEFAULT_DATABASE_FILENAMES); Files.delete(geoIpDir.resolve(databaseFilename)); final IOException e = expectThrows(IOException.class, () -> IngestGeoIpPlugin.loadDatabaseReaders(geoIpDir, geoIpConfigDir)); assertThat(e, hasToString(containsString("expected database [" + databaseFilename + "] to exist in [" + geoIpDir + "]"))); } public void testDatabaseExistsInConfigDir() throws IOException { final Path geoIpDir = createTempDir(); final Path configDir = createTempDir(); final Path geoIpConfigDir = configDir.resolve("ingest-geoip"); Files.createDirectories(geoIpConfigDir); copyDatabaseFiles(geoIpDir); final String databaseFilename = randomFrom(IngestGeoIpPlugin.DEFAULT_DATABASE_FILENAMES); copyDatabaseFile(geoIpConfigDir, databaseFilename); final IOException e = expectThrows(IOException.class, () -> IngestGeoIpPlugin.loadDatabaseReaders(geoIpDir, geoIpConfigDir)); assertThat(e, hasToString(containsString("expected database [" + databaseFilename + "] to not exist in [" + geoIpConfigDir + "]"))); } private static void copyDatabaseFile(final Path path, final String databaseFilename) throws IOException { Files.copy( new ByteArrayInputStream(StreamsUtils.copyToBytesFromClasspath("/" + databaseFilename)), path.resolve(databaseFilename)); } private static void copyDatabaseFiles(final Path path) throws IOException { for (final String databaseFilename : IngestGeoIpPlugin.DEFAULT_DATABASE_FILENAMES) { copyDatabaseFile(path, databaseFilename); } } }
{ "content_hash": "d78d854d8f543a736df4282411f50503", "timestamp": "", "source": "github", "line_count": 357, "max_line_length": 140, "avg_line_length": 51.56022408963585, "alnum_prop": 0.6964741674363014, "repo_name": "gingerwizard/elasticsearch", "id": "86f14c59403133c0efaeea66f3f403858fc770c9", "size": "19195", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "modules/ingest-geoip/src/test/java/org/elasticsearch/ingest/geoip/GeoIpProcessorFactoryTests.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "10862" }, { "name": "Groovy", "bytes": "510" }, { "name": "HTML", "bytes": "1502" }, { "name": "Java", "bytes": "29923429" }, { "name": "Perl", "bytes": "264378" }, { "name": "Perl6", "bytes": "103207" }, { "name": "Python", "bytes": "91186" }, { "name": "Ruby", "bytes": "17776" }, { "name": "Shell", "bytes": "85779" } ], "symlink_target": "" }
module BotFramework # Metdata for an attachment class AttachmentInfo < Base # Name of the attachment attr_accessor :name # ContentType of the attachment attr_accessor :type # attachment views attr_accessor :views # Attribute type mapping. def self.swagger_types { name: :String, type: :String, views: :'Array<AttachmentView>' } end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.name = attributes[:name] if attributes.key?(:name) self.type = attributes[:type] if attributes.key?(:type) if attributes.key?(:views) if (value = attributes[:views]).is_a?(Array) self.views = value end end end end end
{ "content_hash": "516b8f51426b3f37fc91c6cfb9ffaa91", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 82, "avg_line_length": 24.390243902439025, "alnum_prop": 0.616, "repo_name": "tachyons/botframework-ruby", "id": "c15a8cc1a353f04c1167ac92cc45be10e0c836c3", "size": "1000", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/bot_framework/models/attachment_info.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "73947" }, { "name": "Shell", "bytes": "131" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> <meta content="IE=edge" http-equiv="X-UA-Compatible"> <link rel="shortcut icon" type="image/x-icon" href="../../../favicon.ico" /> <title>NoSuchProviderException - Android SDK | Android Developers</title> <!-- STYLESHEETS --> <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto+Condensed"> <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold" title="roboto"> <link href="../../../assets/css/default.css?v=7" rel="stylesheet" type="text/css"> <!-- FULLSCREEN STYLESHEET --> <link href="../../../assets/css/fullscreen.css" rel="stylesheet" class="fullscreen" type="text/css"> <!-- JAVASCRIPT --> <script src="http://www.google.com/jsapi" type="text/javascript"></script> <script src="../../../assets/js/android_3p-bundle.js" type="text/javascript"></script> <script type="text/javascript"> var toRoot = "../../../"; var metaTags = []; var devsite = false; </script> <script src="../../../assets/js/docs.js?v=6" type="text/javascript"></script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-5831155-1', 'android.com'); ga('create', 'UA-49880327-2', 'android.com', {'name': 'universal'}); // New tracker); ga('send', 'pageview'); ga('universal.send', 'pageview'); // Send page view for new tracker. </script> </head> <body class="gc-documentation develop reference" itemscope itemtype="http://schema.org/Article"> <div id="doc-api-level" class="1" style="display:none"></div> <a name="top"></a> <a name="top"></a> <!-- dialog to prompt lang pref change when loaded from hardcoded URL <div id="langMessage" style="display:none"> <div> <div class="lang en"> <p>You requested a page in English, would you like to proceed with this language setting?</p> </div> <div class="lang es"> <p>You requested a page in Spanish (Español), would you like to proceed with this language setting?</p> </div> <div class="lang ja"> <p>You requested a page in Japanese (日本語), would you like to proceed with this language setting?</p> </div> <div class="lang ko"> <p>You requested a page in Korean (한국어), would you like to proceed with this language setting?</p> </div> <div class="lang ru"> <p>You requested a page in Russian (Русский), would you like to proceed with this language setting?</p> </div> <div class="lang zh-cn"> <p>You requested a page in Simplified Chinese (简体中文), would you like to proceed with this language setting?</p> </div> <div class="lang zh-tw"> <p>You requested a page in Traditional Chinese (繁體中文), would you like to proceed with this language setting?</p> </div> <a href="#" class="button yes" onclick="return false;"> <span class="lang en">Yes</span> <span class="lang es">Sí</span> <span class="lang ja">Yes</span> <span class="lang ko">Yes</span> <span class="lang ru">Yes</span> <span class="lang zh-cn">是的</span> <span class="lang zh-tw">没有</span> </a> <a href="#" class="button" onclick="$('#langMessage').hide();return false;"> <span class="lang en">No</span> <span class="lang es">No</span> <span class="lang ja">No</span> <span class="lang ko">No</span> <span class="lang ru">No</span> <span class="lang zh-cn">没有</span> <span class="lang zh-tw">没有</span> </a> </div> </div> --> <!-- Header --> <div id="header-wrapper"> <div class="dac-header" id="header"> <div class="dac-header-inner"> <a class="dac-nav-toggle" data-dac-toggle-nav href="javascript:;" title="Open navigation"> <span class="dac-nav-hamburger"> <span class="dac-nav-hamburger-top"></span> <span class="dac-nav-hamburger-mid"></span> <span class="dac-nav-hamburger-bot"></span> </span> </a> <a class="dac-header-logo" href="../../../index.html"> <img class="dac-header-logo-image" src="../../../assets/images/android_logo.png" srcset="../../../assets/images/[email protected] 2x" width="32" height="36" alt="Android" /> Developers </a> <ul class="dac-header-crumbs"> <li class="dac-header-crumbs-item"><span class="dac-header-crumbs-link current ">NoSuchProviderException - Android SDK</a></li> </ul> <div class="dac-header-search" id="search-container"> <div class="dac-header-search-inner"> <div class="dac-sprite dac-search dac-header-search-btn" id="search-btn"></div> <form class="dac-header-search-form" onsubmit="return submit_search()"> <input id="search_autocomplete" type="text" value="" autocomplete="off" name="q" onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)" onkeydown="return search_changed(event, true, '../../../')" onkeyup="return search_changed(event, false, '../../../')" class="dac-header-search-input" placeholder="Search" /> <a class="dac-header-search-close hide" id="search-close">close</a> </form> </div><!-- end dac-header-search-inner --> </div><!-- end dac-header-search --> <div class="search_filtered_wrapper"> <div class="suggest-card reference no-display"> <ul class="search_filtered"> </ul> </div> <div class="suggest-card develop no-display"> <ul class="search_filtered"> </ul> <div class="child-card guides no-display"> </div> <div class="child-card training no-display"> </div> <div class="child-card samples no-display"> </div> </div> <div class="suggest-card design no-display"> <ul class="search_filtered"> </ul> </div> <div class="suggest-card distribute no-display"> <ul class="search_filtered"> </ul> </div> </div> <a class="dac-header-console-btn" href="https://play.google.com/apps/publish/"> <span class="dac-sprite dac-google-play"></span> <span class="dac-visible-desktop-inline">Developer</span> Console </a> </div><!-- end header-wrap.wrap --> </div><!-- end header --> <div id="searchResults" class="wrap" style="display:none;"> <h2 id="searchTitle">Results</h2> <div id="leftSearchControl" class="search-control">Loading...</div> </div> </div> <!--end header-wrapper --> <!-- Navigation--> <nav class="dac-nav"> <div class="dac-nav-dimmer" data-dac-toggle-nav></div> <ul class="dac-nav-list" data-dac-nav> <li class="dac-nav-item dac-nav-head"> <a class="dac-nav-link dac-nav-logo" data-dac-toggle-nav href="javascript:;" title="Close navigation"> <img class="dac-logo-image" src="../../../assets/images/android_logo.png" srcset="../../../assets/images/[email protected] 2x" width="32" height="36" alt="Android" /> Developers </a> </li> <li class="dac-nav-item home"> <a class="dac-nav-link dac-visible-mobile-block" href="../../../index.html">Home</a> <ul class="dac-nav-secondary about"> <li class="dac-nav-item about"> <a class="dac-nav-link" href="../../../about/index.html">Android</a> </li> <li class="dac-nav-item wear"> <a class="dac-nav-link" href="../../../wear/index.html">Wear</a> </li> <li class="dac-nav-item tv"> <a class="dac-nav-link" href="../../../tv/index.html">TV</a> </li> <li class="dac-nav-item auto"> <a class="dac-nav-link" href="../../../auto/index.html">Auto</a> </li> </ul> </li> <li class="dac-nav-item design"> <a class="dac-nav-link" href="../../../design/index.html" zh-tw-lang="設計" zh-cn-lang="设计" ru-lang="Проектирование" ko-lang="디자인" ja-lang="設計" es-lang="Diseñar">Design</a> </li> <li class="dac-nav-item develop"> <a class="dac-nav-link" href="../../../develop/index.html" zh-tw-lang="開發" zh-cn-lang="开发" ru-lang="Разработка" ko-lang="개발" ja-lang="開発" es-lang="Desarrollar">Develop</a> <ul class="dac-nav-secondary develop"> <li class="dac-nav-item training"> <a class="dac-nav-link" href="../../../training/index.html" zh-tw-lang="訓練課程" zh-cn-lang="培训" ru-lang="Курсы" ko-lang="교육" ja-lang="トレーニング" es-lang="Capacitación">Training</a> </li> <li class="dac-nav-item guide"> <a class="dac-nav-link" href="../../../guide/index.html" zh-tw-lang="API 指南" zh-cn-lang="API 指南" ru-lang="Руководства по API" ko-lang="API 가이드" ja-lang="API ガイド" es-lang="Guías de la API">API Guides</a> </li> <li class="dac-nav-item reference"> <a class="dac-nav-link" href="../../../reference/packages.html" zh-tw-lang="參考資源" zh-cn-lang="参考" ru-lang="Справочник" ko-lang="참조문서" ja-lang="リファレンス" es-lang="Referencia">Reference</a> </li> <li class="dac-nav-item tools"> <a class="dac-nav-link" href="../../../sdk/index.html" zh-tw-lang="相關工具" zh-cn-lang="工具" ru-lang="Инструменты" ko-lang="도구" ja-lang="ツール" es-lang="Herramientas">Tools</a></li> <li class="dac-nav-item google"> <a class="dac-nav-link" href="../../../google/index.html">Google Services</a> </li> <li class="dac-nav-item preview"> <a class="dac-nav-link" href="../../../preview/index.html">Preview</a> </li> </ul> </li> <li class="dac-nav-item distribute"> <a class="dac-nav-link" href="../../../distribute/googleplay/index.html" zh-tw-lang="發佈" zh-cn-lang="分发" ru-lang="Распространение" ko-lang="배포" ja-lang="配布" es-lang="Distribuir">Distribute</a> <ul class="dac-nav-secondary distribute"> <li class="dac-nav-item googleplay"> <a class="dac-nav-link" href="../../../distribute/googleplay/index.html">Google Play</a></li> <li class="dac-nav-item essentials"> <a class="dac-nav-link" href="../../../distribute/essentials/index.html">Essentials</a></li> <li class="dac-nav-item users"> <a class="dac-nav-link" href="../../../distribute/users/index.html">Get Users</a></li> <li class="dac-nav-item engage"> <a class="dac-nav-link" href="../../../distribute/engage/index.html">Engage &amp; Retain</a></li> <li class="dac-nav-item monetize"> <a class="dac-nav-link" href="../../../distribute/monetize/index.html">Earn</a> </li> <li class="dac-nav-item analyze"> <a class="dac-nav-link" href="../../../distribute/analyze/index.html">Analyze</a> </li> <li class="dac-nav-item stories"> <a class="dac-nav-link" href="../../../distribute/stories/index.html">Stories</a> </li> </ul> </li> </ul> </nav> <!-- end navigation--> <div class="wrap clearfix" id="body-content"><div class="cols"> <div class="col-4 dac-hidden-mobile" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement"> <div id="devdoc-nav"> <div id="api-nav-header"> <div id="api-level-toggle"> <label for="apiLevelCheckbox" class="disabled" title="Select your target API level to dim unavailable APIs">API level: </label> <div class="select-wrapper"> <select id="apiLevelSelector"> <!-- option elements added by buildApiLevelSelector() --> </select> </div> </div><!-- end toggle --> <div id="api-nav-title">Android APIs</div> </div><!-- end nav header --> <script> var SINCE_DATA = [ '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23' ]; buildApiLevelSelector(); </script> <div id="swapper"> <div id="nav-panels"> <div id="resize-packages-nav"> <div id="packages-nav" class="scroll-pane"> <ul> <li class="api apilevel-1"> <a href="../../../reference/android/package-summary.html">android</a></li> <li class="api apilevel-4"> <a href="../../../reference/android/accessibilityservice/package-summary.html">android.accessibilityservice</a></li> <li class="api apilevel-5"> <a href="../../../reference/android/accounts/package-summary.html">android.accounts</a></li> <li class="api apilevel-11"> <a href="../../../reference/android/animation/package-summary.html">android.animation</a></li> <li class="api apilevel-16"> <a href="../../../reference/android/annotation/package-summary.html">android.annotation</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/app/package-summary.html">android.app</a></li> <li class="api apilevel-8"> <a href="../../../reference/android/app/admin/package-summary.html">android.app.admin</a></li> <li class="api apilevel-23"> <a href="../../../reference/android/app/assist/package-summary.html">android.app.assist</a></li> <li class="api apilevel-8"> <a href="../../../reference/android/app/backup/package-summary.html">android.app.backup</a></li> <li class="api apilevel-21"> <a href="../../../reference/android/app/job/package-summary.html">android.app.job</a></li> <li class="api apilevel-21"> <a href="../../../reference/android/app/usage/package-summary.html">android.app.usage</a></li> <li class="api apilevel-3"> <a href="../../../reference/android/appwidget/package-summary.html">android.appwidget</a></li> <li class="api apilevel-5"> <a href="../../../reference/android/bluetooth/package-summary.html">android.bluetooth</a></li> <li class="api apilevel-21"> <a href="../../../reference/android/bluetooth/le/package-summary.html">android.bluetooth.le</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/content/package-summary.html">android.content</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/content/pm/package-summary.html">android.content.pm</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/content/res/package-summary.html">android.content.res</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/database/package-summary.html">android.database</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/database/sqlite/package-summary.html">android.database.sqlite</a></li> <li class="api apilevel-"> <a href="../../../reference/android/databinding/package-summary.html">android.databinding</a></li> <li class="api apilevel-11"> <a href="../../../reference/android/drm/package-summary.html">android.drm</a></li> <li class="api apilevel-4"> <a href="../../../reference/android/gesture/package-summary.html">android.gesture</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/graphics/package-summary.html">android.graphics</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/graphics/drawable/package-summary.html">android.graphics.drawable</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/graphics/drawable/shapes/package-summary.html">android.graphics.drawable.shapes</a></li> <li class="api apilevel-19"> <a href="../../../reference/android/graphics/pdf/package-summary.html">android.graphics.pdf</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/hardware/package-summary.html">android.hardware</a></li> <li class="api apilevel-21"> <a href="../../../reference/android/hardware/camera2/package-summary.html">android.hardware.camera2</a></li> <li class="api apilevel-21"> <a href="../../../reference/android/hardware/camera2/params/package-summary.html">android.hardware.camera2.params</a></li> <li class="api apilevel-17"> <a href="../../../reference/android/hardware/display/package-summary.html">android.hardware.display</a></li> <li class="api apilevel-23"> <a href="../../../reference/android/hardware/fingerprint/package-summary.html">android.hardware.fingerprint</a></li> <li class="api apilevel-16"> <a href="../../../reference/android/hardware/input/package-summary.html">android.hardware.input</a></li> <li class="api apilevel-12"> <a href="../../../reference/android/hardware/usb/package-summary.html">android.hardware.usb</a></li> <li class="api apilevel-3"> <a href="../../../reference/android/inputmethodservice/package-summary.html">android.inputmethodservice</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/location/package-summary.html">android.location</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/media/package-summary.html">android.media</a></li> <li class="api apilevel-9"> <a href="../../../reference/android/media/audiofx/package-summary.html">android.media.audiofx</a></li> <li class="api apilevel-21"> <a href="../../../reference/android/media/browse/package-summary.html">android.media.browse</a></li> <li class="api apilevel-14"> <a href="../../../reference/android/media/effect/package-summary.html">android.media.effect</a></li> <li class="api apilevel-23"> <a href="../../../reference/android/media/midi/package-summary.html">android.media.midi</a></li> <li class="api apilevel-21"> <a href="../../../reference/android/media/projection/package-summary.html">android.media.projection</a></li> <li class="api apilevel-21"> <a href="../../../reference/android/media/session/package-summary.html">android.media.session</a></li> <li class="api apilevel-21"> <a href="../../../reference/android/media/tv/package-summary.html">android.media.tv</a></li> <li class="api apilevel-12"> <a href="../../../reference/android/mtp/package-summary.html">android.mtp</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/net/package-summary.html">android.net</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/net/http/package-summary.html">android.net.http</a></li> <li class="api apilevel-16"> <a href="../../../reference/android/net/nsd/package-summary.html">android.net.nsd</a></li> <li class="api apilevel-12"> <a href="../../../reference/android/net/rtp/package-summary.html">android.net.rtp</a></li> <li class="api apilevel-9"> <a href="../../../reference/android/net/sip/package-summary.html">android.net.sip</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/net/wifi/package-summary.html">android.net.wifi</a></li> <li class="api apilevel-14"> <a href="../../../reference/android/net/wifi/p2p/package-summary.html">android.net.wifi.p2p</a></li> <li class="api apilevel-16"> <a href="../../../reference/android/net/wifi/p2p/nsd/package-summary.html">android.net.wifi.p2p.nsd</a></li> <li class="api apilevel-9"> <a href="../../../reference/android/nfc/package-summary.html">android.nfc</a></li> <li class="api apilevel-19"> <a href="../../../reference/android/nfc/cardemulation/package-summary.html">android.nfc.cardemulation</a></li> <li class="api apilevel-10"> <a href="../../../reference/android/nfc/tech/package-summary.html">android.nfc.tech</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/opengl/package-summary.html">android.opengl</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/os/package-summary.html">android.os</a></li> <li class="api apilevel-9"> <a href="../../../reference/android/os/storage/package-summary.html">android.os.storage</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/preference/package-summary.html">android.preference</a></li> <li class="api apilevel-19"> <a href="../../../reference/android/print/package-summary.html">android.print</a></li> <li class="api apilevel-19"> <a href="../../../reference/android/print/pdf/package-summary.html">android.print.pdf</a></li> <li class="api apilevel-19"> <a href="../../../reference/android/printservice/package-summary.html">android.printservice</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/provider/package-summary.html">android.provider</a></li> <li class="api apilevel-11"> <a href="../../../reference/android/renderscript/package-summary.html">android.renderscript</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/sax/package-summary.html">android.sax</a></li> <li class="api apilevel-14"> <a href="../../../reference/android/security/package-summary.html">android.security</a></li> <li class="api apilevel-23"> <a href="../../../reference/android/security/keystore/package-summary.html">android.security.keystore</a></li> <li class="api apilevel-22"> <a href="../../../reference/android/service/carrier/package-summary.html">android.service.carrier</a></li> <li class="api apilevel-23"> <a href="../../../reference/android/service/chooser/package-summary.html">android.service.chooser</a></li> <li class="api apilevel-17"> <a href="../../../reference/android/service/dreams/package-summary.html">android.service.dreams</a></li> <li class="api apilevel-21"> <a href="../../../reference/android/service/media/package-summary.html">android.service.media</a></li> <li class="api apilevel-18"> <a href="../../../reference/android/service/notification/package-summary.html">android.service.notification</a></li> <li class="api apilevel-21"> <a href="../../../reference/android/service/restrictions/package-summary.html">android.service.restrictions</a></li> <li class="api apilevel-14"> <a href="../../../reference/android/service/textservice/package-summary.html">android.service.textservice</a></li> <li class="api apilevel-21"> <a href="../../../reference/android/service/voice/package-summary.html">android.service.voice</a></li> <li class="api apilevel-7"> <a href="../../../reference/android/service/wallpaper/package-summary.html">android.service.wallpaper</a></li> <li class="api apilevel-3"> <a href="../../../reference/android/speech/package-summary.html">android.speech</a></li> <li class="api apilevel-4"> <a href="../../../reference/android/speech/tts/package-summary.html">android.speech.tts</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/annotation/package-summary.html">android.support.annotation</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/app/recommendation/package-summary.html">android.support.app.recommendation</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/customtabs/package-summary.html">android.support.customtabs</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/design/package-summary.html">android.support.design</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/design/widget/package-summary.html">android.support.design.widget</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/multidex/package-summary.html">android.support.multidex</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/percent/package-summary.html">android.support.percent</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v13/app/package-summary.html">android.support.v13.app</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v14/preference/package-summary.html">android.support.v14.preference</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v17/leanback/package-summary.html">android.support.v17.leanback</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v17/leanback/app/package-summary.html">android.support.v17.leanback.app</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v17/leanback/database/package-summary.html">android.support.v17.leanback.database</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v17/leanback/graphics/package-summary.html">android.support.v17.leanback.graphics</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v17/leanback/system/package-summary.html">android.support.v17.leanback.system</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v17/leanback/widget/package-summary.html">android.support.v17.leanback.widget</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v17/preference/package-summary.html">android.support.v17.preference</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/accessibilityservice/package-summary.html">android.support.v4.accessibilityservice</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/animation/package-summary.html">android.support.v4.animation</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/app/package-summary.html">android.support.v4.app</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/content/package-summary.html">android.support.v4.content</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/content/pm/package-summary.html">android.support.v4.content.pm</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/content/res/package-summary.html">android.support.v4.content.res</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/database/package-summary.html">android.support.v4.database</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/graphics/package-summary.html">android.support.v4.graphics</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/graphics/drawable/package-summary.html">android.support.v4.graphics.drawable</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/hardware/display/package-summary.html">android.support.v4.hardware.display</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/hardware/fingerprint/package-summary.html">android.support.v4.hardware.fingerprint</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/media/package-summary.html">android.support.v4.media</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/media/session/package-summary.html">android.support.v4.media.session</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/net/package-summary.html">android.support.v4.net</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/os/package-summary.html">android.support.v4.os</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/print/package-summary.html">android.support.v4.print</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/provider/package-summary.html">android.support.v4.provider</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/text/package-summary.html">android.support.v4.text</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/util/package-summary.html">android.support.v4.util</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/view/package-summary.html">android.support.v4.view</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/view/accessibility/package-summary.html">android.support.v4.view.accessibility</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/view/animation/package-summary.html">android.support.v4.view.animation</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v4/widget/package-summary.html">android.support.v4.widget</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v7/app/package-summary.html">android.support.v7.app</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v7/appcompat/package-summary.html">android.support.v7.appcompat</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v7/cardview/package-summary.html">android.support.v7.cardview</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v7/graphics/package-summary.html">android.support.v7.graphics</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v7/graphics/drawable/package-summary.html">android.support.v7.graphics.drawable</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v7/gridlayout/package-summary.html">android.support.v7.gridlayout</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v7/media/package-summary.html">android.support.v7.media</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v7/mediarouter/package-summary.html">android.support.v7.mediarouter</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v7/preference/package-summary.html">android.support.v7.preference</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v7/recyclerview/package-summary.html">android.support.v7.recyclerview</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v7/util/package-summary.html">android.support.v7.util</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v7/view/package-summary.html">android.support.v7.view</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v7/widget/package-summary.html">android.support.v7.widget</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v7/widget/helper/package-summary.html">android.support.v7.widget.helper</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v7/widget/util/package-summary.html">android.support.v7.widget.util</a></li> <li class="api apilevel-"> <a href="../../../reference/android/support/v8/renderscript/package-summary.html">android.support.v8.renderscript</a></li> <li class="api apilevel-21"> <a href="../../../reference/android/system/package-summary.html">android.system</a></li> <li class="api apilevel-21"> <a href="../../../reference/android/telecom/package-summary.html">android.telecom</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/telephony/package-summary.html">android.telephony</a></li> <li class="api apilevel-5"> <a href="../../../reference/android/telephony/cdma/package-summary.html">android.telephony.cdma</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/telephony/gsm/package-summary.html">android.telephony.gsm</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/test/package-summary.html">android.test</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/test/mock/package-summary.html">android.test.mock</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/test/suitebuilder/package-summary.html">android.test.suitebuilder</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/test/suitebuilder/annotation/package-summary.html">android.test.suitebuilder.annotation</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/text/package-summary.html">android.text</a></li> <li class="api apilevel-3"> <a href="../../../reference/android/text/format/package-summary.html">android.text.format</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/text/method/package-summary.html">android.text.method</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/text/style/package-summary.html">android.text.style</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/text/util/package-summary.html">android.text.util</a></li> <li class="api apilevel-19"> <a href="../../../reference/android/transition/package-summary.html">android.transition</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/util/package-summary.html">android.util</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/view/package-summary.html">android.view</a></li> <li class="api apilevel-4"> <a href="../../../reference/android/view/accessibility/package-summary.html">android.view.accessibility</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/view/animation/package-summary.html">android.view.animation</a></li> <li class="api apilevel-3"> <a href="../../../reference/android/view/inputmethod/package-summary.html">android.view.inputmethod</a></li> <li class="api apilevel-14"> <a href="../../../reference/android/view/textservice/package-summary.html">android.view.textservice</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/webkit/package-summary.html">android.webkit</a></li> <li class="api apilevel-1"> <a href="../../../reference/android/widget/package-summary.html">android.widget</a></li> <li class="api apilevel-"> <a href="../../../reference/com/android/internal/backup/package-summary.html">com.android.internal.backup</a></li> <li class="api apilevel-"> <a href="../../../reference/com/android/internal/logging/package-summary.html">com.android.internal.logging</a></li> <li class="api apilevel-"> <a href="../../../reference/com/android/internal/os/package-summary.html">com.android.internal.os</a></li> <li class="api apilevel-"> <a href="../../../reference/com/android/internal/statusbar/package-summary.html">com.android.internal.statusbar</a></li> <li class="api apilevel-"> <a href="../../../reference/com/android/internal/widget/package-summary.html">com.android.internal.widget</a></li> <li class="api apilevel-"> <a href="../../../reference/com/android/test/runner/package-summary.html">com.android.test.runner</a></li> <li class="api apilevel-1"> <a href="../../../reference/dalvik/annotation/package-summary.html">dalvik.annotation</a></li> <li class="api apilevel-1"> <a href="../../../reference/dalvik/bytecode/package-summary.html">dalvik.bytecode</a></li> <li class="api apilevel-1"> <a href="../../../reference/dalvik/system/package-summary.html">dalvik.system</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/awt/font/package-summary.html">java.awt.font</a></li> <li class="api apilevel-3"> <a href="../../../reference/java/beans/package-summary.html">java.beans</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/io/package-summary.html">java.io</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/lang/package-summary.html">java.lang</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/lang/annotation/package-summary.html">java.lang.annotation</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/lang/ref/package-summary.html">java.lang.ref</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/lang/reflect/package-summary.html">java.lang.reflect</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/math/package-summary.html">java.math</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/net/package-summary.html">java.net</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/nio/package-summary.html">java.nio</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/nio/channels/package-summary.html">java.nio.channels</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/nio/channels/spi/package-summary.html">java.nio.channels.spi</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/nio/charset/package-summary.html">java.nio.charset</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/nio/charset/spi/package-summary.html">java.nio.charset.spi</a></li> <li class="selected api apilevel-1"> <a href="../../../reference/java/security/package-summary.html">java.security</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/security/acl/package-summary.html">java.security.acl</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/security/cert/package-summary.html">java.security.cert</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/security/interfaces/package-summary.html">java.security.interfaces</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/security/spec/package-summary.html">java.security.spec</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/sql/package-summary.html">java.sql</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/text/package-summary.html">java.text</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/util/package-summary.html">java.util</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/util/concurrent/package-summary.html">java.util.concurrent</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/util/concurrent/atomic/package-summary.html">java.util.concurrent.atomic</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/util/concurrent/locks/package-summary.html">java.util.concurrent.locks</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/util/jar/package-summary.html">java.util.jar</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/util/logging/package-summary.html">java.util.logging</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/util/prefs/package-summary.html">java.util.prefs</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/util/regex/package-summary.html">java.util.regex</a></li> <li class="api apilevel-1"> <a href="../../../reference/java/util/zip/package-summary.html">java.util.zip</a></li> <li class="api apilevel-1"> <a href="../../../reference/javax/crypto/package-summary.html">javax.crypto</a></li> <li class="api apilevel-1"> <a href="../../../reference/javax/crypto/interfaces/package-summary.html">javax.crypto.interfaces</a></li> <li class="api apilevel-1"> <a href="../../../reference/javax/crypto/spec/package-summary.html">javax.crypto.spec</a></li> <li class="api apilevel-1"> <a href="../../../reference/javax/microedition/khronos/egl/package-summary.html">javax.microedition.khronos.egl</a></li> <li class="api apilevel-1"> <a href="../../../reference/javax/microedition/khronos/opengles/package-summary.html">javax.microedition.khronos.opengles</a></li> <li class="api apilevel-1"> <a href="../../../reference/javax/net/package-summary.html">javax.net</a></li> <li class="api apilevel-1"> <a href="../../../reference/javax/net/ssl/package-summary.html">javax.net.ssl</a></li> <li class="api apilevel-1"> <a href="../../../reference/javax/security/auth/package-summary.html">javax.security.auth</a></li> <li class="api apilevel-1"> <a href="../../../reference/javax/security/auth/callback/package-summary.html">javax.security.auth.callback</a></li> <li class="api apilevel-1"> <a href="../../../reference/javax/security/auth/login/package-summary.html">javax.security.auth.login</a></li> <li class="api apilevel-1"> <a href="../../../reference/javax/security/auth/x500/package-summary.html">javax.security.auth.x500</a></li> <li class="api apilevel-1"> <a href="../../../reference/javax/security/cert/package-summary.html">javax.security.cert</a></li> <li class="api apilevel-1"> <a href="../../../reference/javax/sql/package-summary.html">javax.sql</a></li> <li class="api apilevel-1"> <a href="../../../reference/javax/xml/package-summary.html">javax.xml</a></li> <li class="api apilevel-8"> <a href="../../../reference/javax/xml/datatype/package-summary.html">javax.xml.datatype</a></li> <li class="api apilevel-8"> <a href="../../../reference/javax/xml/namespace/package-summary.html">javax.xml.namespace</a></li> <li class="api apilevel-1"> <a href="../../../reference/javax/xml/parsers/package-summary.html">javax.xml.parsers</a></li> <li class="api apilevel-8"> <a href="../../../reference/javax/xml/transform/package-summary.html">javax.xml.transform</a></li> <li class="api apilevel-8"> <a href="../../../reference/javax/xml/transform/dom/package-summary.html">javax.xml.transform.dom</a></li> <li class="api apilevel-8"> <a href="../../../reference/javax/xml/transform/sax/package-summary.html">javax.xml.transform.sax</a></li> <li class="api apilevel-8"> <a href="../../../reference/javax/xml/transform/stream/package-summary.html">javax.xml.transform.stream</a></li> <li class="api apilevel-8"> <a href="../../../reference/javax/xml/validation/package-summary.html">javax.xml.validation</a></li> <li class="api apilevel-8"> <a href="../../../reference/javax/xml/xpath/package-summary.html">javax.xml.xpath</a></li> <li class="api apilevel-1"> <a href="../../../reference/junit/framework/package-summary.html">junit.framework</a></li> <li class="api apilevel-1"> <a href="../../../reference/junit/runner/package-summary.html">junit.runner</a></li> <li class="api apilevel-1"> <a href="../../../reference/org/apache/http/conn/package-summary.html">org.apache.http.conn</a></li> <li class="api apilevel-1"> <a href="../../../reference/org/apache/http/conn/scheme/package-summary.html">org.apache.http.conn.scheme</a></li> <li class="api apilevel-1"> <a href="../../../reference/org/apache/http/conn/ssl/package-summary.html">org.apache.http.conn.ssl</a></li> <li class="api apilevel-1"> <a href="../../../reference/org/apache/http/params/package-summary.html">org.apache.http.params</a></li> <li class="api apilevel-1"> <a href="../../../reference/org/json/package-summary.html">org.json</a></li> <li class="api apilevel-1"> <a href="../../../reference/org/w3c/dom/package-summary.html">org.w3c.dom</a></li> <li class="api apilevel-8"> <a href="../../../reference/org/w3c/dom/ls/package-summary.html">org.w3c.dom.ls</a></li> <li class="api apilevel-1"> <a href="../../../reference/org/xml/sax/package-summary.html">org.xml.sax</a></li> <li class="api apilevel-1"> <a href="../../../reference/org/xml/sax/ext/package-summary.html">org.xml.sax.ext</a></li> <li class="api apilevel-1"> <a href="../../../reference/org/xml/sax/helpers/package-summary.html">org.xml.sax.helpers</a></li> <li class="api apilevel-1"> <a href="../../../reference/org/xmlpull/v1/package-summary.html">org.xmlpull.v1</a></li> <li class="api apilevel-1"> <a href="../../../reference/org/xmlpull/v1/sax2/package-summary.html">org.xmlpull.v1.sax2</a></li> </ul><br/> </div> <!-- end packages-nav --> </div> <!-- end resize-packages --> <div id="classes-nav" class="scroll-pane"> <ul> <li><h2>Interfaces</h2> <ul> <li class="api apilevel-1"><a href="../../../reference/java/security/Certificate.html">Certificate</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/DomainCombiner.html">DomainCombiner</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/Guard.html">Guard</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/Key.html">Key</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyStore.Entry.html">KeyStore.Entry</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyStore.LoadStoreParameter.html">KeyStore.LoadStoreParameter</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyStore.ProtectionParameter.html">KeyStore.ProtectionParameter</a></li> <li class="api apilevel-9"><a href="../../../reference/java/security/Policy.Parameters.html">Policy.Parameters</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/Principal.html">Principal</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/PrivateKey.html">PrivateKey</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/PrivilegedAction.html">PrivilegedAction</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/PrivilegedExceptionAction.html">PrivilegedExceptionAction</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/PublicKey.html">PublicKey</a></li> </ul> </li> <li><h2>Classes</h2> <ul> <li class="api apilevel-1"><a href="../../../reference/java/security/AccessControlContext.html">AccessControlContext</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/AccessController.html">AccessController</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/AlgorithmParameterGenerator.html">AlgorithmParameterGenerator</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/AlgorithmParameterGeneratorSpi.html">AlgorithmParameterGeneratorSpi</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/AlgorithmParameters.html">AlgorithmParameters</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/AlgorithmParametersSpi.html">AlgorithmParametersSpi</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/AllPermission.html">AllPermission</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/AuthProvider.html">AuthProvider</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/BasicPermission.html">BasicPermission</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/CodeSigner.html">CodeSigner</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/CodeSource.html">CodeSource</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/DigestInputStream.html">DigestInputStream</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/DigestOutputStream.html">DigestOutputStream</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/GuardedObject.html">GuardedObject</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/Identity.html">Identity</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/IdentityScope.html">IdentityScope</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyFactory.html">KeyFactory</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyFactorySpi.html">KeyFactorySpi</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyPair.html">KeyPair</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyPairGenerator.html">KeyPairGenerator</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyPairGeneratorSpi.html">KeyPairGeneratorSpi</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyRep.html">KeyRep</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyStore.html">KeyStore</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyStore.Builder.html">KeyStore.Builder</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyStore.CallbackHandlerProtection.html">KeyStore.CallbackHandlerProtection</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyStore.PasswordProtection.html">KeyStore.PasswordProtection</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyStore.PrivateKeyEntry.html">KeyStore.PrivateKeyEntry</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyStore.SecretKeyEntry.html">KeyStore.SecretKeyEntry</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyStore.TrustedCertificateEntry.html">KeyStore.TrustedCertificateEntry</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyStoreSpi.html">KeyStoreSpi</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/MessageDigest.html">MessageDigest</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/MessageDigestSpi.html">MessageDigestSpi</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/Permission.html">Permission</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/PermissionCollection.html">PermissionCollection</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/Permissions.html">Permissions</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/Policy.html">Policy</a></li> <li class="api apilevel-9"><a href="../../../reference/java/security/PolicySpi.html">PolicySpi</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/ProtectionDomain.html">ProtectionDomain</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/Provider.html">Provider</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/Provider.Service.html">Provider.Service</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/SecureClassLoader.html">SecureClassLoader</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/SecureRandom.html">SecureRandom</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/SecureRandomSpi.html">SecureRandomSpi</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/Security.html">Security</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/SecurityPermission.html">SecurityPermission</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/Signature.html">Signature</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/SignatureSpi.html">SignatureSpi</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/SignedObject.html">SignedObject</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/Signer.html">Signer</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/Timestamp.html">Timestamp</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/UnresolvedPermission.html">UnresolvedPermission</a></li> </ul> </li> <li><h2>Enums</h2> <ul> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyRep.Type.html">KeyRep.Type</a></li> </ul> </li> <li><h2>Exceptions</h2> <ul> <li class="api apilevel-1"><a href="../../../reference/java/security/AccessControlException.html">AccessControlException</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/DigestException.html">DigestException</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/GeneralSecurityException.html">GeneralSecurityException</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/InvalidAlgorithmParameterException.html">InvalidAlgorithmParameterException</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/InvalidKeyException.html">InvalidKeyException</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/InvalidParameterException.html">InvalidParameterException</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyException.html">KeyException</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyManagementException.html">KeyManagementException</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/KeyStoreException.html">KeyStoreException</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/NoSuchAlgorithmException.html">NoSuchAlgorithmException</a></li> <li class="selected api apilevel-1"><a href="../../../reference/java/security/NoSuchProviderException.html">NoSuchProviderException</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/PrivilegedActionException.html">PrivilegedActionException</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/ProviderException.html">ProviderException</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/SignatureException.html">SignatureException</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/UnrecoverableEntryException.html">UnrecoverableEntryException</a></li> <li class="api apilevel-1"><a href="../../../reference/java/security/UnrecoverableKeyException.html">UnrecoverableKeyException</a></li> </ul> </li> </ul><br/> </div><!-- end classes --> </div><!-- end nav-panels --> <div id="nav-tree" style="display:none" class="scroll-pane"> <div id="tree-list"></div> </div><!-- end nav-tree --> </div><!-- end swapper --> <div id="nav-swap"> <a class="fullscreen">fullscreen</a> <a href='#' onclick='swapNav();return false;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a> </div> </div> <!-- end devdoc-nav --> </div> <!-- end side-nav --> <script type="text/javascript"> // init fullscreen based on user pref var fullscreen = readCookie("fullscreen"); if (fullscreen != 0) { if (fullscreen == "false") { toggleFullscreen(false); } else { toggleFullscreen(true); } } // init nav version for mobile if (isMobile) { swapNav(); // tree view should be used on mobile $('#nav-swap').hide(); } else { chooseDefaultNav(); if ($("#nav-tree").is(':visible')) { init_default_navtree("../../../"); } } // scroll the selected page into view $(document).ready(function() { scrollIntoView("packages-nav"); scrollIntoView("classes-nav"); }); </script> <div class="col-12" id="doc-col"> <div id="api-info-block"> <div class="sum-details-links"> Summary: <a href="#pubctors">Ctors</a> &#124; <a href="#inhmethods">Inherited Methods</a> &#124; <a href="#" onclick="return toggleAllClassInherited()" id="toggleAllClassInherited">[Expand All]</a> </div><!-- end sum-details-links --> <div class="api-level"> Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a> </div> </div><!-- end api-info-block --> <!-- ======== START OF CLASS DATA ======== --> <div id="jd-header"> public class <h1 itemprop="name">NoSuchProviderException</h1> extends <a href="../../../reference/java/security/GeneralSecurityException.html">GeneralSecurityException</a><br/> </div><!-- end header --> <div id="naMessage"></div> <div id="jd-content" class="api apilevel-1"> <table class="jd-inheritance-table"> <tr> <td colspan="5" class="jd-inheritance-class-cell"><a href="../../../reference/java/lang/Object.html">java.lang.Object</a></td> </tr> <tr> <td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;&#x21b3;</td> <td colspan="4" class="jd-inheritance-class-cell"><a href="../../../reference/java/lang/Throwable.html">java.lang.Throwable</a></td> </tr> <tr> <td class="jd-inheritance-space">&nbsp;</td> <td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;&#x21b3;</td> <td colspan="3" class="jd-inheritance-class-cell"><a href="../../../reference/java/lang/Exception.html">java.lang.Exception</a></td> </tr> <tr> <td class="jd-inheritance-space">&nbsp;</td> <td class="jd-inheritance-space">&nbsp;</td> <td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;&#x21b3;</td> <td colspan="2" class="jd-inheritance-class-cell"><a href="../../../reference/java/security/GeneralSecurityException.html">java.security.GeneralSecurityException</a></td> </tr> <tr> <td class="jd-inheritance-space">&nbsp;</td> <td class="jd-inheritance-space">&nbsp;</td> <td class="jd-inheritance-space">&nbsp;</td> <td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;&#x21b3;</td> <td colspan="1" class="jd-inheritance-class-cell">java.security.NoSuchProviderException</td> </tr> </table> <div class="jd-descr"> <h2>Class Overview</h2> <p itemprop="articleBody"><code>NoSuchProviderException</code> indicates that a requested security provider could not be found. </p> </div><!-- jd-descr --> <div class="jd-descr"> <h2>Summary</h2> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <table id="pubctors" class="jd-sumtable"><tr><th colspan="12">Public Constructors</th></tr> <tr class="alt-color api apilevel-1" > <td class="jd-typecol"><nobr> </nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/security/NoSuchProviderException.html#NoSuchProviderException(java.lang.String)">NoSuchProviderException</a></span>(<a href="../../../reference/java/lang/String.html">String</a> msg)</nobr> <div class="jd-descrdiv"> Constructs a new instance of <code>NoSuchProviderException</code> with the given message. </div> </td></tr> <tr class=" api apilevel-1" > <td class="jd-typecol"><nobr> </nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/security/NoSuchProviderException.html#NoSuchProviderException()">NoSuchProviderException</a></span>()</nobr> <div class="jd-descrdiv"> Constructs a new instance of <code>NoSuchProviderException</code>. </div> </td></tr> </table> <!-- ========== METHOD SUMMARY =========== --> <table id="inhmethods" class="jd-sumtable"><tr><th> <a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a> <div style="clear:left;">Inherited Methods</div></th></tr> <tr class="api apilevel-" > <td colspan="12"> <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Throwable" class="jd-expando-trigger closed" ><img id="inherited-methods-java.lang.Throwable-trigger" src="../../../assets/images/triangle-closed.png" class="jd-expando-trigger-img" /></a> From class <a href="../../../reference/java/lang/Throwable.html">java.lang.Throwable</a> <div id="inherited-methods-java.lang.Throwable"> <div id="inherited-methods-java.lang.Throwable-list" class="jd-inheritedlinks"> </div> <div id="inherited-methods-java.lang.Throwable-summary" style="display: none;"> <table class="jd-sumtable-expando"> <tr class="alt-color api apilevel-19" > <td class="jd-typecol"><nobr> final void</nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Throwable.html#addSuppressed(java.lang.Throwable)">addSuppressed</a></span>(<a href="../../../reference/java/lang/Throwable.html">Throwable</a> throwable)</nobr> <div class="jd-descrdiv"> Adds <code>throwable</code> to the list of throwables suppressed by this. </div> </td></tr> <tr class=" api apilevel-1" > <td class="jd-typecol"><nobr> <a href="../../../reference/java/lang/Throwable.html">Throwable</a></nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Throwable.html#fillInStackTrace()">fillInStackTrace</a></span>()</nobr> <div class="jd-descrdiv"> Records the stack trace from the point where this method has been called to this <code>Throwable</code>. </div> </td></tr> <tr class="alt-color api apilevel-1" > <td class="jd-typecol"><nobr> <a href="../../../reference/java/lang/Throwable.html">Throwable</a></nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Throwable.html#getCause()">getCause</a></span>()</nobr> <div class="jd-descrdiv"> Returns the cause of this <code>Throwable</code>, or <code>null</code> if there is no cause. </div> </td></tr> <tr class=" api apilevel-1" > <td class="jd-typecol"><nobr> <a href="../../../reference/java/lang/String.html">String</a></nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Throwable.html#getLocalizedMessage()">getLocalizedMessage</a></span>()</nobr> <div class="jd-descrdiv"> Returns the detail message which was provided when this <code>Throwable</code> was created. </div> </td></tr> <tr class="alt-color api apilevel-1" > <td class="jd-typecol"><nobr> <a href="../../../reference/java/lang/String.html">String</a></nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Throwable.html#getMessage()">getMessage</a></span>()</nobr> <div class="jd-descrdiv"> Returns the detail message which was provided when this <code>Throwable</code> was created. </div> </td></tr> <tr class=" api apilevel-1" > <td class="jd-typecol"><nobr> <a href="../../../reference/java/lang/StackTraceElement.html">StackTraceElement[]</a></nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Throwable.html#getStackTrace()">getStackTrace</a></span>()</nobr> <div class="jd-descrdiv"> Returns a clone of the array of stack trace elements of this <code>Throwable</code>. </div> </td></tr> <tr class="alt-color api apilevel-19" > <td class="jd-typecol"><nobr> final <a href="../../../reference/java/lang/Throwable.html">Throwable[]</a></nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Throwable.html#getSuppressed()">getSuppressed</a></span>()</nobr> <div class="jd-descrdiv"> Returns the throwables suppressed by this. </div> </td></tr> <tr class=" api apilevel-1" > <td class="jd-typecol"><nobr> <a href="../../../reference/java/lang/Throwable.html">Throwable</a></nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Throwable.html#initCause(java.lang.Throwable)">initCause</a></span>(<a href="../../../reference/java/lang/Throwable.html">Throwable</a> throwable)</nobr> <div class="jd-descrdiv"> Initializes the cause of this <code>Throwable</code>. </div> </td></tr> <tr class="alt-color api apilevel-1" > <td class="jd-typecol"><nobr> void</nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Throwable.html#printStackTrace(java.io.PrintStream)">printStackTrace</a></span>(<a href="../../../reference/java/io/PrintStream.html">PrintStream</a> err)</nobr> <div class="jd-descrdiv"> Writes a printable representation of this <code>Throwable</code>'s stack trace to the given print stream. </div> </td></tr> <tr class=" api apilevel-1" > <td class="jd-typecol"><nobr> void</nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Throwable.html#printStackTrace(java.io.PrintWriter)">printStackTrace</a></span>(<a href="../../../reference/java/io/PrintWriter.html">PrintWriter</a> err)</nobr> <div class="jd-descrdiv"> Writes a printable representation of this <code>Throwable</code>'s stack trace to the specified print writer. </div> </td></tr> <tr class="alt-color api apilevel-1" > <td class="jd-typecol"><nobr> void</nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Throwable.html#printStackTrace()">printStackTrace</a></span>()</nobr> <div class="jd-descrdiv"> Writes a printable representation of this <code>Throwable</code>'s stack trace to the <code>System.err</code> stream. </div> </td></tr> <tr class=" api apilevel-1" > <td class="jd-typecol"><nobr> void</nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Throwable.html#setStackTrace(java.lang.StackTraceElement[])">setStackTrace</a></span>(<a href="../../../reference/java/lang/StackTraceElement.html">StackTraceElement[]</a> trace)</nobr> <div class="jd-descrdiv"> Sets the array of stack trace elements. </div> </td></tr> <tr class="alt-color api apilevel-1" > <td class="jd-typecol"><nobr> <a href="../../../reference/java/lang/String.html">String</a></nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Throwable.html#toString()">toString</a></span>()</nobr> <div class="jd-descrdiv"> Returns a string containing a concise, human-readable description of this object. </div> </td></tr> </table> </div> </div> </td></tr> <tr class="api apilevel-" > <td colspan="12"> <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Object" class="jd-expando-trigger closed" ><img id="inherited-methods-java.lang.Object-trigger" src="../../../assets/images/triangle-closed.png" class="jd-expando-trigger-img" /></a> From class <a href="../../../reference/java/lang/Object.html">java.lang.Object</a> <div id="inherited-methods-java.lang.Object"> <div id="inherited-methods-java.lang.Object-list" class="jd-inheritedlinks"> </div> <div id="inherited-methods-java.lang.Object-summary" style="display: none;"> <table class="jd-sumtable-expando"> <tr class="alt-color api apilevel-1" > <td class="jd-typecol"><nobr> <a href="../../../reference/java/lang/Object.html">Object</a></nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Object.html#clone()">clone</a></span>()</nobr> <div class="jd-descrdiv"> Creates and returns a copy of this <code>Object</code>. </div> </td></tr> <tr class=" api apilevel-1" > <td class="jd-typecol"><nobr> boolean</nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Object.html#equals(java.lang.Object)">equals</a></span>(<a href="../../../reference/java/lang/Object.html">Object</a> o)</nobr> <div class="jd-descrdiv"> Compares this instance with the specified object and indicates if they are equal. </div> </td></tr> <tr class="alt-color api apilevel-1" > <td class="jd-typecol"><nobr> void</nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Object.html#finalize()">finalize</a></span>()</nobr> <div class="jd-descrdiv"> Invoked when the garbage collector has detected that this instance is no longer reachable. </div> </td></tr> <tr class=" api apilevel-1" > <td class="jd-typecol"><nobr> final <a href="../../../reference/java/lang/Class.html">Class</a>&lt;?&gt;</nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Object.html#getClass()">getClass</a></span>()</nobr> <div class="jd-descrdiv"> Returns the unique instance of <code><a href="../../../reference/java/lang/Class.html">Class</a></code> that represents this object's class. </div> </td></tr> <tr class="alt-color api apilevel-1" > <td class="jd-typecol"><nobr> int</nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Object.html#hashCode()">hashCode</a></span>()</nobr> <div class="jd-descrdiv"> Returns an integer hash code for this object. </div> </td></tr> <tr class=" api apilevel-1" > <td class="jd-typecol"><nobr> final void</nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Object.html#notify()">notify</a></span>()</nobr> <div class="jd-descrdiv"> Causes a thread which is waiting on this object's monitor (by means of calling one of the <code>wait()</code> methods) to be woken up. </div> </td></tr> <tr class="alt-color api apilevel-1" > <td class="jd-typecol"><nobr> final void</nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Object.html#notifyAll()">notifyAll</a></span>()</nobr> <div class="jd-descrdiv"> Causes all threads which are waiting on this object's monitor (by means of calling one of the <code>wait()</code> methods) to be woken up. </div> </td></tr> <tr class=" api apilevel-1" > <td class="jd-typecol"><nobr> <a href="../../../reference/java/lang/String.html">String</a></nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Object.html#toString()">toString</a></span>()</nobr> <div class="jd-descrdiv"> Returns a string containing a concise, human-readable description of this object. </div> </td></tr> <tr class="alt-color api apilevel-1" > <td class="jd-typecol"><nobr> final void</nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Object.html#wait()">wait</a></span>()</nobr> <div class="jd-descrdiv"> Causes the calling thread to wait until another thread calls the <code>notify()</code> or <code>notifyAll()</code> method of this object. </div> </td></tr> <tr class=" api apilevel-1" > <td class="jd-typecol"><nobr> final void</nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Object.html#wait(long, int)">wait</a></span>(long millis, int nanos)</nobr> <div class="jd-descrdiv"> Causes the calling thread to wait until another thread calls the <code>notify()</code> or <code>notifyAll()</code> method of this object or until the specified timeout expires. </div> </td></tr> <tr class="alt-color api apilevel-1" > <td class="jd-typecol"><nobr> final void</nobr> </td> <td class="jd-linkcol" width="100%"><nobr> <span class="sympad"><a href="../../../reference/java/lang/Object.html#wait(long)">wait</a></span>(long millis)</nobr> <div class="jd-descrdiv"> Causes the calling thread to wait until another thread calls the <code>notify()</code> or <code>notifyAll()</code> method of this object or until the specified timeout expires. </div> </td></tr> </table> </div> </div> </td></tr> </table> </div><!-- jd-descr (summary) --> <!-- Details --> <!-- XML Attributes --> <!-- Enum Values --> <!-- Constants --> <!-- Fields --> <!-- Public ctors --> <!-- ========= CONSTRUCTOR DETAIL ======== --> <h2>Public Constructors</h2> <A NAME="NoSuchProviderException(java.lang.String)"></A> <div class="jd-details api apilevel-1"> <h4 class="jd-details-title"> <span class="normal"> public </span> <span class="sympad">NoSuchProviderException</span> <span class="normal">(<a href="../../../reference/java/lang/String.html">String</a> msg)</span> </h4> <div class="api-level"> <div> Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div> </div> <div class="jd-details-descr"> <div class="jd-tagdata jd-tagdescr"><p>Constructs a new instance of <code>NoSuchProviderException</code> with the given message.</p></div> <div class="jd-tagdata"> <h5 class="jd-tagtitle">Parameters</h5> <table class="jd-tagtable"> <tr> <th>msg</td> <td>the detail message for this exception. </td> </tr> </table> </div> </div> </div> <A NAME="NoSuchProviderException()"></A> <div class="jd-details api apilevel-1"> <h4 class="jd-details-title"> <span class="normal"> public </span> <span class="sympad">NoSuchProviderException</span> <span class="normal">()</span> </h4> <div class="api-level"> <div> Added in <a href="../../../guide/topics/manifest/uses-sdk-element.html#ApiLevels">API level 1</a></div> </div> <div class="jd-details-descr"> <div class="jd-tagdata jd-tagdescr"><p>Constructs a new instance of <code>NoSuchProviderException</code>. </p></div> </div> </div> <!-- ========= CONSTRUCTOR DETAIL ======== --> <!-- Protected ctors --> <!-- ========= METHOD DETAIL ======== --> <!-- Public methdos --> <!-- ========= METHOD DETAIL ======== --> <!-- ========= END OF CLASS DATA ========= --> <A NAME="navbar_top"></A> </div> <!-- jd-content --> <div class="wrap"> <div class="dac-footer"> <div class="cols dac-footer-main"> <div class="col-1of2"> <a class="dac-footer-getnews" data-modal-toggle="newsletter" href="javascript:;">Get news &amp; tips <span class="dac-fab dac-primary"><i class="dac-sprite dac-mail"></i></span></a> </div> <div class="col-1of2 dac-footer-reachout"> <div class="dac-footer-contact"> <a class="dac-footer-contact-link" href="http://android-developers.blogspot.com/">Blog</a> <a class="dac-footer-contact-link" href="/support.html">Support</a> </div> <div class="dac-footer-social"> <a class="dac-fab dac-footer-social-link" href="https://www.youtube.com/user/androiddevelopers"><i class="dac-sprite dac-youtube"></i></a> <a class="dac-fab dac-footer-social-link" href="https://plus.google.com/+AndroidDevelopers"><i class="dac-sprite dac-gplus"></i></a> <a class="dac-fab dac-footer-social-link" href="https://twitter.com/AndroidDev"><i class="dac-sprite dac-twitter"></i></a> </div> </div> </div> <hr class="dac-footer-separator"/> <p class="dac-footer-copyright"> Except as noted, this content is licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>. For details and restrictions, see the <a href="../../../license.html"> Content License</a>. </p> <p class="dac-footer-build"> Android 6.0&nbsp;r1 &mdash; <script src="../../../timestamp.js" type="text/javascript"></script> <script>document.write(BUILD_TIMESTAMP)</script> </p> <p class="dac-footer-links"> <a href="/about/index.html">About Android</a> <a href="/auto/index.html">Auto</a> <a href="/tv/index.html">TV</a> <a href="/wear/index.html">Wear</a> <a href="/legal.html">Legal</a> <span id="language" class="locales"> <select name="language" onchange="changeLangPref(this.value, true)"> <option value="en" selected="selected">English</option> <option value="es">Español</option> <option value="ja">日本語</option> <option value="ko">한국어</option> <option value="pt-br">Português Brasileiro</option> <option value="ru">Русский</option> <option value="zh-cn">中文(简体)</option> <option value="zh-tw">中文(繁體)</option> </select> </span> </p> </div> </div> <!-- end footer --> <div data-modal="newsletter" data-newsletter data-swap class="dac-modal newsletter"> <div class="dac-modal-container"> <div class="dac-modal-window"> <header class="dac-modal-header"> <button class="dac-modal-header-close" data-modal-toggle><i class="dac-sprite dac-close"></i></button> <div class="dac-swap" data-swap-container> <section class="dac-swap-section dac-active dac-down"> <h2 class="norule dac-modal-header-title">Get the latest Android developer news and tips that will help you find success on Google Play.</h2> <p class="dac-modal-header-subtitle">&#42; Required Fields</p> </section> <section class="dac-swap-section dac-up"> <h2 class="norule dac-modal-header-title">Hooray!</h2> </section> </div> </header> <div class="dac-swap" data-swap-container> <section class="dac-swap-section dac-active dac-left"> <form action="https://docs.google.com/forms/d/1QgnkzbEJIDu9lMEea0mxqWrXUJu0oBCLD7ar23V0Yys/formResponse" class="dac-form" method="post" target="dac-newsletter-iframe"> <section class="dac-modal-content"> <fieldset class="dac-form-fieldset"> <div class="cols"> <div class="col-1of2 newsletter-leftCol"> <div class="dac-form-input-group"> <label for="newsletter-full-name" class="dac-form-floatlabel">Full name</label> <input type="text" class="dac-form-input" name="entry.1357890476" id="newsletter-full-name" required> <span class="dac-form-required">*</span> </div> <div class="dac-form-input-group"> <label for="newsletter-email" class="dac-form-floatlabel">Email address</label> <input type="email" class="dac-form-input" name="entry.472100832" id="newsletter-email" required> <span class="dac-form-required">*</span> </div> </div> <div class="col-1of2 newsletter-rightCol"> <div class="dac-form-input-group"> <label for="newsletter-company" class="dac-form-floatlabel">Company / developer name</label> <input type="text" class="dac-form-input" name="entry.1664780309" id="newsletter-company"> </div> <div class="dac-form-input-group"> <label for="newsletter-play-store" class="dac-form-floatlabel">One of your Play Store app URLs</label> <input type="url" class="dac-form-input" name="entry.47013838" id="newsletter-play-store" required> <span class="dac-form-required">*</span> </div> </div> </div> </fieldset> <fieldset class="dac-form-fieldset"> <div class="cols"> <div class="col-1of2 newsletter-leftCol"> <legend class="dac-form-legend">Which best describes your business:<span class="dac-form-required">*</span> </legend> <div class="dac-form-radio-group"> <input type="radio" value="Apps" class="dac-form-radio" name="entry.1796324055" id="newsletter-business-type-app" required> <label for="newsletter-business-type-app" class="dac-form-radio-button"></label> <label for="newsletter-business-type-app" class="dac-form-label">Apps</label> </div> <div class="dac-form-radio-group"> <input type="radio" value="Games" class="dac-form-radio" name="entry.1796324055" id="newsletter-business-type-games" required> <label for="newsletter-business-type-games" class="dac-form-radio-button"></label> <label for="newsletter-business-type-games" class="dac-form-label">Games</label> </div> <div class="dac-form-radio-group"> <input type="radio" value="Apps and Games" class="dac-form-radio" name="entry.1796324055" id="newsletter-business-type-appsgames" required> <label for="newsletter-business-type-appsgames" class="dac-form-radio-button"></label> <label for="newsletter-business-type-appsgames" class="dac-form-label">Apps &amp; Games</label> </div> </div> <div class="col-1of2 newsletter-rightCol newsletter-checkboxes"> <div class="dac-form-radio-group"> <div class="dac-media"> <div class="dac-media-figure"> <input type="checkbox" class="dac-form-checkbox" name="entry.732309842" id="newsletter-add" required value="Add me to the mailing list for the monthly newsletter and occasional emails about development and Google Play opportunities."> <label for="newsletter-add" class="dac-form-checkbox-button"></label> </div> <div class="dac-media-body"> <label for="newsletter-add" class="dac-form-label dac-form-aside">Add me to the mailing list for the monthly newsletter and occasional emails about development and Google Play opportunities.<span class="dac-form-required">*</span></label> </div> </div> </div> <div class="dac-form-radio-group"> <div class="dac-media"> <div class="dac-media-figure"> <input type="checkbox" class="dac-form-checkbox" name="entry.2045036090" id="newsletter-terms" required value="I acknowledge that the information provided in this form will be subject to Google's privacy policy (https://www.google.com/policies/privacy/)."> <label for="newsletter-terms" class="dac-form-checkbox-button"></label> </div> <div class="dac-media-body"> <label for="newsletter-terms" class="dac-form-label dac-form-aside">I acknowledge that the information provided in this form will be subject to <a href="https://www.google.com/policies/privacy/">Google's privacy policy</a>.<span class="dac-form-required">*</span></label> </div> </div> </div> </div> </div> </fieldset> </section> <footer class="dac-modal-footer"> <div class="cols"> <div class="col-2of5"> </div> </div> <button type="submit" value="Submit" class="dac-fab dac-primary dac-large dac-modal-action"><i class="dac-sprite dac-arrow-right"></i></button> </footer> </form> </section> <section class="dac-swap-section dac-right"> <div class="dac-modal-content"> <p class="newsletter-success-message"> You have successfully signed up for the latest Android developer news and tips. </p> </div> </section> </div> </div> </div> </div> <!-- end footer --> </div><!-- end doc-content --> </div> <!-- end .cols --> </div> <!-- end body-content --> </body> </html>
{ "content_hash": "e4c7bd6f79a0ebf8f6a69243cb1dea8c", "timestamp": "", "source": "github", "line_count": 2316, "max_line_length": 297, "avg_line_length": 39.18696027633852, "alnum_prop": 0.5919212843086483, "repo_name": "anas-ambri/androidcompat", "id": "dfab8964986d5a90c063df53e9e7f5669961b636", "size": "91084", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/java/security/NoSuchProviderException.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "261862" }, { "name": "HTML", "bytes": "581707522" }, { "name": "JavaScript", "bytes": "639438" }, { "name": "Makefile", "bytes": "229" }, { "name": "Shell", "bytes": "138" } ], "symlink_target": "" }
<?php class Autoloader { public static $classes = []; public static function autoload($class) { if (class_exists($class, false) || interface_exists($class, false)) { return true; } $class = strtolower($class); $path = static::$classes[$class] ?? false; if ($path) { require_once $path; return true; } return false; } public static function reload($reload = false) { $key = 'lbry-classes-5'; if (ini_get('apc.enabled') && !$reload) { $classes = apcu_fetch($key, $success); if ($success) { static::$classes = $classes; return; } } static::$classes = []; $dir = new RecursiveDirectoryIterator(ROOT_DIR, RecursiveDirectoryIterator::SKIP_DOTS); $ite = new RecursiveIteratorIterator($dir); $pathIterator = new RegexIterator($ite, '/.*\.php$/', RegexIterator::GET_MATCH); foreach ($pathIterator as $paths) { foreach ($paths as $path) { static::$classes += static::parseFile($path); } } if (ini_get('apc.enabled')) { apcu_store($key, static::$classes); } } protected static function parseFile($path) { $mapping = []; $classes = []; preg_match_all('~^\s*(?:namespace)\s+([^;]+)~mi', file_get_contents($path), $namespaces); preg_match_all('~^\s*(?:abstract\s+|final\s+)?(?:class|interface)\s+(\w+)~mi', file_get_contents($path), $classes); if (isset($namespaces[1]) && count($namespaces[1]) > 2) { throw new RuntimeException('Autoloader cannot handle 2 namespaces in the same file'); } $prefix = isset($namespaces[1]) && count($namespaces[1]) ? reset($namespaces[1]) . '\\' : ''; foreach ($classes[1] as $class) { $mapping[strtolower($prefix . $class)] = $path; } return $mapping; } } ini_set('unserialize_callback_func', 'spl_autoload_call'); spl_autoload_register('Autoloader::autoload'); Autoloader::reload(true);
{ "content_hash": "dbf4df101f3037a9a657785c0e12dc00", "timestamp": "", "source": "github", "line_count": 73, "max_line_length": 123, "avg_line_length": 29.65753424657534, "alnum_prop": 0.5316397228637414, "repo_name": "lbryio/lbry.io", "id": "6f1cf5453889a682e2e337116e9a8b87033a8922", "size": "2165", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "autoload.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "55397" }, { "name": "HTML", "bytes": "54" }, { "name": "Hack", "bytes": "3719" }, { "name": "JavaScript", "bytes": "18408" }, { "name": "PHP", "bytes": "438860" }, { "name": "Shell", "bytes": "2266" } ], "symlink_target": "" }
<?xml version="1.0"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.cmmi</groupId> <artifactId>cmmi-common-service</artifactId> <version>1.0.0</version> </parent> <groupId>com.cmmi</groupId> <artifactId>cmmi-common-service-response</artifactId> <version>1.0.0</version> <packaging>jar</packaging> <name>cmmi-common-service-response</name> <url>http://maven.apache.org</url> <description>CMMI Modules Common Service Response Area</description> <dependencies> <!-- GENERAL UTILS begin --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> </dependency> <!-- GENERAL UTILS end --> </dependencies> </project>
{ "content_hash": "3c7bc2d33ae9806dfbddc3a544d61b51", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 99, "avg_line_length": 28.685714285714287, "alnum_prop": 0.7101593625498008, "repo_name": "chenlg/cmmi", "id": "3bd2e40485910f736adcd721531a20a32d1cd516", "size": "1004", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "cmmi-modules/cmmi-common/cmmi-common-service/cmmi-common-service-response/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "136239" } ], "symlink_target": "" }
// Copyright 2021 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.webapps.launchpad; import android.graphics.Bitmap; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import org.chromium.ui.modelutil.PropertyKey; import org.chromium.ui.modelutil.PropertyModel; import org.chromium.ui.modelutil.PropertyModelChangeProcessor.ViewBinder; /** * A {@link ViewBinder} responsible for gluing {@link AppManagementMenuHeaderProperties} to the * view. */ class AppManagementMenuHeaderViewBinder implements ViewBinder<PropertyModel, View, PropertyKey> { @Override public void bind(PropertyModel model, View view, PropertyKey propertyKey) { if (propertyKey == AppManagementMenuHeaderProperties.TITLE) { TextView titleText = view.findViewById(R.id.menu_header_title); titleText.setText(model.get(AppManagementMenuHeaderProperties.TITLE)); } else if (propertyKey == AppManagementMenuHeaderProperties.URL) { TextView urlText = view.findViewById(R.id.menu_header_url); urlText.setText(model.get(AppManagementMenuHeaderProperties.URL)); } else if (propertyKey == AppManagementMenuHeaderProperties.ICON) { Bitmap bitmap = model.get(AppManagementMenuHeaderProperties.ICON); if (bitmap != null) { ImageView imageView = view.findViewById(R.id.menu_header_image); imageView.setImageBitmap(bitmap); } } } }
{ "content_hash": "62fc5a7e35afd8205d8ca5dc3e08b3b8", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 97, "avg_line_length": 44.611111111111114, "alnum_prop": 0.7266500622665006, "repo_name": "nwjs/chromium.src", "id": "a854f76e40c69ad15d1c3e46ea64f4763c9c8430", "size": "1606", "binary": false, "copies": "1", "ref": "refs/heads/nw70", "path": "chrome/browser/android/webapps/launchpad/java/src/org/chromium/chrome/browser/webapps/launchpad/AppManagementMenuHeaderViewBinder.java", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * Description of TC_DashboardTab * * @author KottkeDP */ class TC_DashboardTab extends TC_Tab{ } ?>
{ "content_hash": "1c3f87e9c8dc5a32a59e6ded44de85fe", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 52, "avg_line_length": 14.058823529411764, "alnum_prop": 0.602510460251046, "repo_name": "USStateDept/thecurrent", "id": "d72241c651a1ee64ed434ad45dd8ae0088cfdaba", "size": "239", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "models/hosts/containers/TC_DashboardTab.class.php", "mode": "33188", "license": "mit", "language": [ { "name": "ActionScript", "bytes": "17461" }, { "name": "CSS", "bytes": "367612" }, { "name": "Elixir", "bytes": "2228" }, { "name": "JavaScript", "bytes": "331757" }, { "name": "PHP", "bytes": "4607223" }, { "name": "Shell", "bytes": "1805" }, { "name": "XSLT", "bytes": "9933" } ], "symlink_target": "" }
#include <linux/module.h> #include <linux/delay.h> #include <linux/dmi.h> #include <linux/input/mt.h> #include <linux/serio.h> #include <linux/libps2.h> #include <linux/slab.h> #include "psmouse.h" #include "synaptics.h" /* * The x/y limits are taken from the Synaptics TouchPad interfacing Guide, * section 2.3.2, which says that they should be valid regardless of the * actual size of the sensor. * Note that newer firmware allows querying device for maximum useable * coordinates. */ #define XMIN 0 #define XMAX 6143 #define YMIN 0 #define YMAX 6143 #define XMIN_NOMINAL 1472 #define XMAX_NOMINAL 5472 #define YMIN_NOMINAL 1408 #define YMAX_NOMINAL 4448 /* Size in bits of absolute position values reported by the hardware */ #define ABS_POS_BITS 13 /* * These values should represent the absolute maximum value that will * be reported for a positive position value. Some Synaptics firmware * uses this value to indicate a finger near the edge of the touchpad * whose precise position cannot be determined. * * At least one touchpad is known to report positions in excess of this * value which are actually negative values truncated to the 13-bit * reporting range. These values have never been observed to be lower * than 8184 (i.e. -8), so we treat all values greater than 8176 as * negative and any other value as positive. */ #define X_MAX_POSITIVE 8176 #define Y_MAX_POSITIVE 8176 /***************************************************************************** * Stuff we need even when we do not want native Synaptics support ****************************************************************************/ /* * Set the synaptics touchpad mode byte by special commands */ static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode) { unsigned char param[1]; if (psmouse_sliced_command(psmouse, mode)) return -1; param[0] = SYN_PS_SET_MODE2; if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_SETRATE)) return -1; return 0; } int synaptics_detect(struct psmouse *psmouse, bool set_properties) { struct ps2dev *ps2dev = &psmouse->ps2dev; unsigned char param[4]; param[0] = 0; ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES); ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO); if (param[1] != 0x47) return -ENODEV; if (set_properties) { psmouse->vendor = "Synaptics"; psmouse->name = "TouchPad"; } return 0; } void synaptics_reset(struct psmouse *psmouse) { /* reset touchpad back to relative mode, gestures enabled */ synaptics_mode_cmd(psmouse, 0); } #ifdef CONFIG_MOUSE_PS2_SYNAPTICS /***************************************************************************** * Synaptics communications functions ****************************************************************************/ /* * Synaptics touchpads report the y coordinate from bottom to top, which is * opposite from what userspace expects. * This function is used to invert y before reporting. */ static int synaptics_invert_y(int y) { return YMAX_NOMINAL + YMIN_NOMINAL - y; } /* * Send a command to the synpatics touchpad by special commands */ static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param) { if (psmouse_sliced_command(psmouse, c)) return -1; if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO)) return -1; return 0; } /* * Read the model-id bytes from the touchpad * see also SYN_MODEL_* macros */ static int synaptics_model_id(struct psmouse *psmouse) { struct synaptics_data *priv = psmouse->private; unsigned char mi[3]; if (synaptics_send_cmd(psmouse, SYN_QUE_MODEL, mi)) return -1; priv->model_id = (mi[0]<<16) | (mi[1]<<8) | mi[2]; return 0; } /* * Read the board id from the touchpad * The board id is encoded in the "QUERY MODES" response */ static int synaptics_board_id(struct psmouse *psmouse) { struct synaptics_data *priv = psmouse->private; unsigned char bid[3]; if (synaptics_send_cmd(psmouse, SYN_QUE_MODES, bid)) return -1; priv->board_id = ((bid[0] & 0xfc) << 6) | bid[1]; return 0; } /* * Read the firmware id from the touchpad */ static int synaptics_firmware_id(struct psmouse *psmouse) { struct synaptics_data *priv = psmouse->private; unsigned char fwid[3]; if (synaptics_send_cmd(psmouse, SYN_QUE_FIRMWARE_ID, fwid)) return -1; priv->firmware_id = (fwid[0] << 16) | (fwid[1] << 8) | fwid[2]; return 0; } /* * Read the capability-bits from the touchpad * see also the SYN_CAP_* macros */ static int synaptics_capability(struct psmouse *psmouse) { struct synaptics_data *priv = psmouse->private; unsigned char cap[3]; if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap)) return -1; priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2]; priv->ext_cap = priv->ext_cap_0c = 0; /* * Older firmwares had submodel ID fixed to 0x47 */ if (SYN_ID_FULL(priv->identity) < 0x705 && SYN_CAP_SUBMODEL_ID(priv->capabilities) != 0x47) { return -1; } /* * Unless capExtended is set the rest of the flags should be ignored */ if (!SYN_CAP_EXTENDED(priv->capabilities)) priv->capabilities = 0; if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) { if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) { psmouse_warn(psmouse, "device claims to have extended capabilities, but I'm not able to read them.\n"); } else { priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2]; /* * if nExtBtn is greater than 8 it should be considered * invalid and treated as 0 */ if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) > 8) priv->ext_cap &= 0xff0fff; } } if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 4) { if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB_0C, cap)) { psmouse_warn(psmouse, "device claims to have extended capability 0x0c, but I'm not able to read it.\n"); } else { priv->ext_cap_0c = (cap[0] << 16) | (cap[1] << 8) | cap[2]; } } return 0; } /* * Identify Touchpad * See also the SYN_ID_* macros */ static int synaptics_identify(struct psmouse *psmouse) { struct synaptics_data *priv = psmouse->private; unsigned char id[3]; if (synaptics_send_cmd(psmouse, SYN_QUE_IDENTIFY, id)) return -1; priv->identity = (id[0]<<16) | (id[1]<<8) | id[2]; if (SYN_ID_IS_SYNAPTICS(priv->identity)) return 0; return -1; } /* * Read touchpad resolution and maximum reported coordinates * Resolution is left zero if touchpad does not support the query */ static const int *quirk_min_max; static int synaptics_resolution(struct psmouse *psmouse) { struct synaptics_data *priv = psmouse->private; unsigned char resp[3]; if (quirk_min_max) { priv->x_min = quirk_min_max[0]; priv->x_max = quirk_min_max[1]; priv->y_min = quirk_min_max[2]; priv->y_max = quirk_min_max[3]; return 0; } if (SYN_ID_MAJOR(priv->identity) < 4) return 0; if (synaptics_send_cmd(psmouse, SYN_QUE_RESOLUTION, resp) == 0) { if (resp[0] != 0 && (resp[1] & 0x80) && resp[2] != 0) { priv->x_res = resp[0]; /* x resolution in units/mm */ priv->y_res = resp[2]; /* y resolution in units/mm */ } } if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 && SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) { if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) { psmouse_warn(psmouse, "device claims to have max coordinates query, but I'm not able to read it.\n"); } else { priv->x_max = (resp[0] << 5) | ((resp[1] & 0x0f) << 1); priv->y_max = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3); } } if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 && SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c)) { if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MIN_COORDS, resp)) { psmouse_warn(psmouse, "device claims to have min coordinates query, but I'm not able to read it.\n"); } else { priv->x_min = (resp[0] << 5) | ((resp[1] & 0x0f) << 1); priv->y_min = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3); } } return 0; } static int synaptics_query_hardware(struct psmouse *psmouse) { if (synaptics_identify(psmouse)) return -1; if (synaptics_model_id(psmouse)) return -1; if (synaptics_firmware_id(psmouse)) return -1; if (synaptics_board_id(psmouse)) return -1; if (synaptics_capability(psmouse)) return -1; if (synaptics_resolution(psmouse)) return -1; return 0; } static int synaptics_set_advanced_gesture_mode(struct psmouse *psmouse) { static unsigned char param = 0xc8; struct synaptics_data *priv = psmouse->private; if (!(SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) || SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c))) return 0; if (psmouse_sliced_command(psmouse, SYN_QUE_MODEL)) return -1; if (ps2_command(&psmouse->ps2dev, &param, PSMOUSE_CMD_SETRATE)) return -1; /* Advanced gesture mode also sends multi finger data */ priv->capabilities |= BIT(1); return 0; } static int synaptics_set_mode(struct psmouse *psmouse) { struct synaptics_data *priv = psmouse->private; priv->mode = 0; if (priv->absolute_mode) priv->mode |= SYN_BIT_ABSOLUTE_MODE; if (priv->disable_gesture) priv->mode |= SYN_BIT_DISABLE_GESTURE; if (psmouse->rate >= 80) priv->mode |= SYN_BIT_HIGH_RATE; if (SYN_CAP_EXTENDED(priv->capabilities)) priv->mode |= SYN_BIT_W_MODE; if (synaptics_mode_cmd(psmouse, priv->mode)) return -1; if (priv->absolute_mode && synaptics_set_advanced_gesture_mode(psmouse)) { psmouse_err(psmouse, "Advanced gesture mode init failed.\n"); return -1; } return 0; } static void synaptics_set_rate(struct psmouse *psmouse, unsigned int rate) { struct synaptics_data *priv = psmouse->private; if (rate >= 80) { priv->mode |= SYN_BIT_HIGH_RATE; psmouse->rate = 80; } else { priv->mode &= ~SYN_BIT_HIGH_RATE; psmouse->rate = 40; } synaptics_mode_cmd(psmouse, priv->mode); } /***************************************************************************** * Synaptics pass-through PS/2 port support ****************************************************************************/ static int synaptics_pt_write(struct serio *serio, unsigned char c) { struct psmouse *parent = serio_get_drvdata(serio->parent); char rate_param = SYN_PS_CLIENT_CMD; /* indicates that we want pass-through port */ if (psmouse_sliced_command(parent, c)) return -1; if (ps2_command(&parent->ps2dev, &rate_param, PSMOUSE_CMD_SETRATE)) return -1; return 0; } static int synaptics_pt_start(struct serio *serio) { struct psmouse *parent = serio_get_drvdata(serio->parent); struct synaptics_data *priv = parent->private; serio_pause_rx(parent->ps2dev.serio); priv->pt_port = serio; serio_continue_rx(parent->ps2dev.serio); return 0; } static void synaptics_pt_stop(struct serio *serio) { struct psmouse *parent = serio_get_drvdata(serio->parent); struct synaptics_data *priv = parent->private; serio_pause_rx(parent->ps2dev.serio); priv->pt_port = NULL; serio_continue_rx(parent->ps2dev.serio); } static int synaptics_is_pt_packet(unsigned char *buf) { return (buf[0] & 0xFC) == 0x84 && (buf[3] & 0xCC) == 0xC4; } static void synaptics_pass_pt_packet(struct serio *ptport, unsigned char *packet) { struct psmouse *child = serio_get_drvdata(ptport); if (child && child->state == PSMOUSE_ACTIVATED) { serio_interrupt(ptport, packet[1], 0); serio_interrupt(ptport, packet[4], 0); serio_interrupt(ptport, packet[5], 0); if (child->pktsize == 4) serio_interrupt(ptport, packet[2], 0); } else serio_interrupt(ptport, packet[1], 0); } static void synaptics_pt_activate(struct psmouse *psmouse) { struct synaptics_data *priv = psmouse->private; struct psmouse *child = serio_get_drvdata(priv->pt_port); /* adjust the touchpad to child's choice of protocol */ if (child) { if (child->pktsize == 4) priv->mode |= SYN_BIT_FOUR_BYTE_CLIENT; else priv->mode &= ~SYN_BIT_FOUR_BYTE_CLIENT; if (synaptics_mode_cmd(psmouse, priv->mode)) psmouse_warn(psmouse, "failed to switch guest protocol\n"); } } static void synaptics_pt_create(struct psmouse *psmouse) { struct serio *serio; serio = kzalloc(sizeof(struct serio), GFP_KERNEL); if (!serio) { psmouse_err(psmouse, "not enough memory for pass-through port\n"); return; } serio->id.type = SERIO_PS_PSTHRU; strlcpy(serio->name, "Synaptics pass-through", sizeof(serio->name)); strlcpy(serio->phys, "synaptics-pt/serio0", sizeof(serio->name)); serio->write = synaptics_pt_write; serio->start = synaptics_pt_start; serio->stop = synaptics_pt_stop; serio->parent = psmouse->ps2dev.serio; psmouse->pt_activate = synaptics_pt_activate; psmouse_info(psmouse, "serio: %s port at %s\n", serio->name, psmouse->phys); serio_register_port(serio); } /***************************************************************************** * Functions to interpret the absolute mode packets ****************************************************************************/ static void synaptics_mt_state_set(struct synaptics_mt_state *state, int count, int sgm, int agm) { state->count = count; state->sgm = sgm; state->agm = agm; } static void synaptics_parse_agm(const unsigned char buf[], struct synaptics_data *priv, struct synaptics_hw_state *hw) { struct synaptics_hw_state *agm = &priv->agm; int agm_packet_type; agm_packet_type = (buf[5] & 0x30) >> 4; switch (agm_packet_type) { case 1: /* Gesture packet: (x, y, z) half resolution */ agm->w = hw->w; agm->x = (((buf[4] & 0x0f) << 8) | buf[1]) << 1; agm->y = (((buf[4] & 0xf0) << 4) | buf[2]) << 1; agm->z = ((buf[3] & 0x30) | (buf[5] & 0x0f)) << 1; break; case 2: /* AGM-CONTACT packet: (count, sgm, agm) */ synaptics_mt_state_set(&agm->mt_state, buf[1], buf[2], buf[4]); break; default: break; } /* Record that at least one AGM has been received since last SGM */ priv->agm_pending = true; } static int synaptics_parse_hw_state(const unsigned char buf[], struct synaptics_data *priv, struct synaptics_hw_state *hw) { memset(hw, 0, sizeof(struct synaptics_hw_state)); if (SYN_MODEL_NEWABS(priv->model_id)) { hw->w = (((buf[0] & 0x30) >> 2) | ((buf[0] & 0x04) >> 1) | ((buf[3] & 0x04) >> 2)); hw->left = (buf[0] & 0x01) ? 1 : 0; hw->right = (buf[0] & 0x02) ? 1 : 0; if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { /* * Clickpad's button is transmitted as middle button, * however, since it is primary button, we will report * it as BTN_LEFT. */ hw->left = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; } else if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) { hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; if (hw->w == 2) hw->scroll = (signed char)(buf[1]); } if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) { hw->up = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; } if ((SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) || SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) && hw->w == 2) { synaptics_parse_agm(buf, priv, hw); return 1; } hw->x = (((buf[3] & 0x10) << 8) | ((buf[1] & 0x0f) << 8) | buf[4]); hw->y = (((buf[3] & 0x20) << 7) | ((buf[1] & 0xf0) << 4) | buf[5]); hw->z = buf[2]; if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && ((buf[0] ^ buf[3]) & 0x02)) { switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { default: /* * if nExtBtn is greater than 8 it should be * considered invalid and treated as 0 */ break; case 8: hw->ext_buttons |= ((buf[5] & 0x08)) ? 0x80 : 0; hw->ext_buttons |= ((buf[4] & 0x08)) ? 0x40 : 0; case 6: hw->ext_buttons |= ((buf[5] & 0x04)) ? 0x20 : 0; hw->ext_buttons |= ((buf[4] & 0x04)) ? 0x10 : 0; case 4: hw->ext_buttons |= ((buf[5] & 0x02)) ? 0x08 : 0; hw->ext_buttons |= ((buf[4] & 0x02)) ? 0x04 : 0; case 2: hw->ext_buttons |= ((buf[5] & 0x01)) ? 0x02 : 0; hw->ext_buttons |= ((buf[4] & 0x01)) ? 0x01 : 0; } } } else { hw->x = (((buf[1] & 0x1f) << 8) | buf[2]); hw->y = (((buf[4] & 0x1f) << 8) | buf[5]); hw->z = (((buf[0] & 0x30) << 2) | (buf[3] & 0x3F)); hw->w = (((buf[1] & 0x80) >> 4) | ((buf[0] & 0x04) >> 1)); hw->left = (buf[0] & 0x01) ? 1 : 0; hw->right = (buf[0] & 0x02) ? 1 : 0; } /* * Convert wrap-around values to negative. (X|Y)_MAX_POSITIVE * is used by some firmware to indicate a finger at the edge of * the touchpad whose precise position cannot be determined, so * convert these values to the maximum axis value. */ if (hw->x > X_MAX_POSITIVE) hw->x -= 1 << ABS_POS_BITS; else if (hw->x == X_MAX_POSITIVE) hw->x = XMAX; if (hw->y > Y_MAX_POSITIVE) hw->y -= 1 << ABS_POS_BITS; else if (hw->y == Y_MAX_POSITIVE) hw->y = YMAX; return 0; } static void synaptics_report_semi_mt_slot(struct input_dev *dev, int slot, bool active, int x, int y) { input_mt_slot(dev, slot); input_mt_report_slot_state(dev, MT_TOOL_FINGER, active); if (active) { input_report_abs(dev, ABS_MT_POSITION_X, x); input_report_abs(dev, ABS_MT_POSITION_Y, synaptics_invert_y(y)); } } static void synaptics_report_semi_mt_data(struct input_dev *dev, const struct synaptics_hw_state *a, const struct synaptics_hw_state *b, int num_fingers) { if (num_fingers >= 2) { synaptics_report_semi_mt_slot(dev, 0, true, min(a->x, b->x), min(a->y, b->y)); synaptics_report_semi_mt_slot(dev, 1, true, max(a->x, b->x), max(a->y, b->y)); } else if (num_fingers == 1) { synaptics_report_semi_mt_slot(dev, 0, true, a->x, a->y); synaptics_report_semi_mt_slot(dev, 1, false, 0, 0); } else { synaptics_report_semi_mt_slot(dev, 0, false, 0, 0); synaptics_report_semi_mt_slot(dev, 1, false, 0, 0); } } static void synaptics_report_buttons(struct psmouse *psmouse, const struct synaptics_hw_state *hw) { struct input_dev *dev = psmouse->dev; struct synaptics_data *priv = psmouse->private; int i; input_report_key(dev, BTN_LEFT, hw->left); input_report_key(dev, BTN_RIGHT, hw->right); if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) input_report_key(dev, BTN_MIDDLE, hw->middle); if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) { input_report_key(dev, BTN_FORWARD, hw->up); input_report_key(dev, BTN_BACK, hw->down); } for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++) input_report_key(dev, BTN_0 + i, hw->ext_buttons & (1 << i)); } static void synaptics_report_slot(struct input_dev *dev, int slot, const struct synaptics_hw_state *hw) { input_mt_slot(dev, slot); input_mt_report_slot_state(dev, MT_TOOL_FINGER, (hw != NULL)); if (!hw) return; input_report_abs(dev, ABS_MT_POSITION_X, hw->x); input_report_abs(dev, ABS_MT_POSITION_Y, synaptics_invert_y(hw->y)); input_report_abs(dev, ABS_MT_PRESSURE, hw->z); } static void synaptics_report_mt_data(struct psmouse *psmouse, struct synaptics_mt_state *mt_state, const struct synaptics_hw_state *sgm) { struct input_dev *dev = psmouse->dev; struct synaptics_data *priv = psmouse->private; struct synaptics_hw_state *agm = &priv->agm; struct synaptics_mt_state *old = &priv->mt_state; switch (mt_state->count) { case 0: synaptics_report_slot(dev, 0, NULL); synaptics_report_slot(dev, 1, NULL); break; case 1: if (mt_state->sgm == -1) { synaptics_report_slot(dev, 0, NULL); synaptics_report_slot(dev, 1, NULL); } else if (mt_state->sgm == 0) { synaptics_report_slot(dev, 0, sgm); synaptics_report_slot(dev, 1, NULL); } else { synaptics_report_slot(dev, 0, NULL); synaptics_report_slot(dev, 1, sgm); } break; default: /* * If the finger slot contained in SGM is valid, and either * hasn't changed, or is new, or the old SGM has now moved to * AGM, then report SGM in MTB slot 0. * Otherwise, empty MTB slot 0. */ if (mt_state->sgm != -1 && (mt_state->sgm == old->sgm || old->sgm == -1 || mt_state->agm == old->sgm)) synaptics_report_slot(dev, 0, sgm); else synaptics_report_slot(dev, 0, NULL); /* * If the finger slot contained in AGM is valid, and either * hasn't changed, or is new, then report AGM in MTB slot 1. * Otherwise, empty MTB slot 1. * * However, in the case where the AGM is new, make sure that * that it is either the same as the old SGM, or there was no * SGM. * * Otherwise, if the SGM was just 1, and the new AGM is 2, then * the new AGM will keep the old SGM's tracking ID, which can * cause apparent drumroll. This happens if in the following * valid finger sequence: * * Action SGM AGM (MTB slot:Contact) * 1. Touch contact 0 (0:0) * 2. Touch contact 1 (0:0, 1:1) * 3. Lift contact 0 (1:1) * 4. Touch contacts 2,3 (0:2, 1:3) * * In step 4, contact 3, in AGM must not be given the same * tracking ID as contact 1 had in step 3. To avoid this, * the first agm with contact 3 is dropped and slot 1 is * invalidated (tracking ID = -1). */ if (mt_state->agm != -1 && (mt_state->agm == old->agm || (old->agm == -1 && (old->sgm == -1 || mt_state->agm == old->sgm)))) synaptics_report_slot(dev, 1, agm); else synaptics_report_slot(dev, 1, NULL); break; } /* Don't use active slot count to generate BTN_TOOL events. */ input_mt_report_pointer_emulation(dev, false); /* Send the number of fingers reported by touchpad itself. */ input_mt_report_finger_count(dev, mt_state->count); synaptics_report_buttons(psmouse, sgm); input_sync(dev); } /* Handle case where mt_state->count = 0 */ static void synaptics_image_sensor_0f(struct synaptics_data *priv, struct synaptics_mt_state *mt_state) { synaptics_mt_state_set(mt_state, 0, -1, -1); priv->mt_state_lost = false; } /* Handle case where mt_state->count = 1 */ static void synaptics_image_sensor_1f(struct synaptics_data *priv, struct synaptics_mt_state *mt_state) { struct synaptics_hw_state *agm = &priv->agm; struct synaptics_mt_state *old = &priv->mt_state; /* * If the last AGM was (0,0,0), and there is only one finger left, * then we absolutely know that SGM contains slot 0, and all other * fingers have been removed. */ if (priv->agm_pending && agm->z == 0) { synaptics_mt_state_set(mt_state, 1, 0, -1); priv->mt_state_lost = false; return; } switch (old->count) { case 0: synaptics_mt_state_set(mt_state, 1, 0, -1); break; case 1: /* * If mt_state_lost, then the previous transition was 3->1, * and SGM now contains either slot 0 or 1, but we don't know * which. So, we just assume that the SGM now contains slot 1. * * If pending AGM and either: * (a) the previous SGM slot contains slot 0, or * (b) there was no SGM slot * then, the SGM now contains slot 1 * * Case (a) happens with very rapid "drum roll" gestures, where * slot 0 finger is lifted and a new slot 1 finger touches * within one reporting interval. * * Case (b) happens if initially two or more fingers tap * briefly, and all but one lift before the end of the first * reporting interval. * * (In both these cases, slot 0 will becomes empty, so SGM * contains slot 1 with the new finger) * * Else, if there was no previous SGM, it now contains slot 0. * * Otherwise, SGM still contains the same slot. */ if (priv->mt_state_lost || (priv->agm_pending && old->sgm <= 0)) synaptics_mt_state_set(mt_state, 1, 1, -1); else if (old->sgm == -1) synaptics_mt_state_set(mt_state, 1, 0, -1); break; case 2: /* * If mt_state_lost, we don't know which finger SGM contains. * * So, report 1 finger, but with both slots empty. * We will use slot 1 on subsequent 1->1 */ if (priv->mt_state_lost) { synaptics_mt_state_set(mt_state, 1, -1, -1); break; } /* * Since the last AGM was NOT (0,0,0), it was the finger in * slot 0 that has been removed. * So, SGM now contains previous AGM's slot, and AGM is now * empty. */ synaptics_mt_state_set(mt_state, 1, old->agm, -1); break; case 3: /* * Since last AGM was not (0,0,0), we don't know which finger * is left. * * So, report 1 finger, but with both slots empty. * We will use slot 1 on subsequent 1->1 */ synaptics_mt_state_set(mt_state, 1, -1, -1); priv->mt_state_lost = true; break; case 4: case 5: /* mt_state was updated by AGM-CONTACT packet */ break; } } /* Handle case where mt_state->count = 2 */ static void synaptics_image_sensor_2f(struct synaptics_data *priv, struct synaptics_mt_state *mt_state) { struct synaptics_mt_state *old = &priv->mt_state; switch (old->count) { case 0: synaptics_mt_state_set(mt_state, 2, 0, 1); break; case 1: /* * If previous SGM contained slot 1 or higher, SGM now contains * slot 0 (the newly touching finger) and AGM contains SGM's * previous slot. * * Otherwise, SGM still contains slot 0 and AGM now contains * slot 1. */ if (old->sgm >= 1) synaptics_mt_state_set(mt_state, 2, 0, old->sgm); else synaptics_mt_state_set(mt_state, 2, 0, 1); break; case 2: /* * If mt_state_lost, SGM now contains either finger 1 or 2, but * we don't know which. * So, we just assume that the SGM contains slot 0 and AGM 1. */ if (priv->mt_state_lost) synaptics_mt_state_set(mt_state, 2, 0, 1); /* * Otherwise, use the same mt_state, since it either hasn't * changed, or was updated by a recently received AGM-CONTACT * packet. */ break; case 3: /* * 3->2 transitions have two unsolvable problems: * 1) no indication is given which finger was removed * 2) no way to tell if agm packet was for finger 3 * before 3->2, or finger 2 after 3->2. * * So, report 2 fingers, but empty all slots. * We will guess slots [0,1] on subsequent 2->2. */ synaptics_mt_state_set(mt_state, 2, -1, -1); priv->mt_state_lost = true; break; case 4: case 5: /* mt_state was updated by AGM-CONTACT packet */ break; } } /* Handle case where mt_state->count = 3 */ static void synaptics_image_sensor_3f(struct synaptics_data *priv, struct synaptics_mt_state *mt_state) { struct synaptics_mt_state *old = &priv->mt_state; switch (old->count) { case 0: synaptics_mt_state_set(mt_state, 3, 0, 2); break; case 1: /* * If previous SGM contained slot 2 or higher, SGM now contains * slot 0 (one of the newly touching fingers) and AGM contains * SGM's previous slot. * * Otherwise, SGM now contains slot 0 and AGM contains slot 2. */ if (old->sgm >= 2) synaptics_mt_state_set(mt_state, 3, 0, old->sgm); else synaptics_mt_state_set(mt_state, 3, 0, 2); break; case 2: /* * If the AGM previously contained slot 3 or higher, then the * newly touching finger is in the lowest available slot. * * If SGM was previously 1 or higher, then the new SGM is * now slot 0 (with a new finger), otherwise, the new finger * is now in a hidden slot between 0 and AGM's slot. * * In all such cases, the SGM now contains slot 0, and the AGM * continues to contain the same slot as before. */ if (old->agm >= 3) { synaptics_mt_state_set(mt_state, 3, 0, old->agm); break; } /* * After some 3->1 and all 3->2 transitions, we lose track * of which slot is reported by SGM and AGM. * * For 2->3 in this state, report 3 fingers, but empty all * slots, and we will guess (0,2) on a subsequent 0->3. * * To userspace, the resulting transition will look like: * 2:[0,1] -> 3:[-1,-1] -> 3:[0,2] */ if (priv->mt_state_lost) { synaptics_mt_state_set(mt_state, 3, -1, -1); break; } /* * If the (SGM,AGM) really previously contained slots (0, 1), * then we cannot know what slot was just reported by the AGM, * because the 2->3 transition can occur either before or after * the AGM packet. Thus, this most recent AGM could contain * either the same old slot 1 or the new slot 2. * Subsequent AGMs will be reporting slot 2. * * To userspace, the resulting transition will look like: * 2:[0,1] -> 3:[0,-1] -> 3:[0,2] */ synaptics_mt_state_set(mt_state, 3, 0, -1); break; case 3: /* * If, for whatever reason, the previous agm was invalid, * Assume SGM now contains slot 0, AGM now contains slot 2. */ if (old->agm <= 2) synaptics_mt_state_set(mt_state, 3, 0, 2); /* * mt_state either hasn't changed, or was updated by a recently * received AGM-CONTACT packet. */ break; case 4: case 5: /* mt_state was updated by AGM-CONTACT packet */ break; } } /* Handle case where mt_state->count = 4, or = 5 */ static void synaptics_image_sensor_45f(struct synaptics_data *priv, struct synaptics_mt_state *mt_state) { /* mt_state was updated correctly by AGM-CONTACT packet */ priv->mt_state_lost = false; } static void synaptics_image_sensor_process(struct psmouse *psmouse, struct synaptics_hw_state *sgm) { struct synaptics_data *priv = psmouse->private; struct synaptics_hw_state *agm = &priv->agm; struct synaptics_mt_state mt_state; /* Initialize using current mt_state (as updated by last agm) */ mt_state = agm->mt_state; /* * Update mt_state using the new finger count and current mt_state. */ if (sgm->z == 0) synaptics_image_sensor_0f(priv, &mt_state); else if (sgm->w >= 4) synaptics_image_sensor_1f(priv, &mt_state); else if (sgm->w == 0) synaptics_image_sensor_2f(priv, &mt_state); else if (sgm->w == 1 && mt_state.count <= 3) synaptics_image_sensor_3f(priv, &mt_state); else synaptics_image_sensor_45f(priv, &mt_state); /* Send resulting input events to user space */ synaptics_report_mt_data(psmouse, &mt_state, sgm); /* Store updated mt_state */ priv->mt_state = agm->mt_state = mt_state; priv->agm_pending = false; } /* * called for each full received packet from the touchpad */ static void synaptics_process_packet(struct psmouse *psmouse) { struct input_dev *dev = psmouse->dev; struct synaptics_data *priv = psmouse->private; struct synaptics_hw_state hw; int num_fingers; int finger_width; if (synaptics_parse_hw_state(psmouse->packet, priv, &hw)) return; if (SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) { synaptics_image_sensor_process(psmouse, &hw); return; } if (hw.scroll) { priv->scroll += hw.scroll; while (priv->scroll >= 4) { input_report_key(dev, BTN_BACK, !hw.down); input_sync(dev); input_report_key(dev, BTN_BACK, hw.down); input_sync(dev); priv->scroll -= 4; } while (priv->scroll <= -4) { input_report_key(dev, BTN_FORWARD, !hw.up); input_sync(dev); input_report_key(dev, BTN_FORWARD, hw.up); input_sync(dev); priv->scroll += 4; } return; } if (hw.z > 0 && hw.x > 1) { num_fingers = 1; finger_width = 5; if (SYN_CAP_EXTENDED(priv->capabilities)) { switch (hw.w) { case 0 ... 1: if (SYN_CAP_MULTIFINGER(priv->capabilities)) num_fingers = hw.w + 2; break; case 2: if (SYN_MODEL_PEN(priv->model_id)) ; /* Nothing, treat a pen as a single finger */ break; case 4 ... 15: if (SYN_CAP_PALMDETECT(priv->capabilities)) finger_width = hw.w; break; } } } else { num_fingers = 0; finger_width = 0; } if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) synaptics_report_semi_mt_data(dev, &hw, &priv->agm, num_fingers); /* Post events * BTN_TOUCH has to be first as mousedev relies on it when doing * absolute -> relative conversion */ if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1); if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0); if (num_fingers > 0) { input_report_abs(dev, ABS_X, hw.x); input_report_abs(dev, ABS_Y, synaptics_invert_y(hw.y)); } input_report_abs(dev, ABS_PRESSURE, hw.z); if (SYN_CAP_PALMDETECT(priv->capabilities)) input_report_abs(dev, ABS_TOOL_WIDTH, finger_width); input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1); if (SYN_CAP_MULTIFINGER(priv->capabilities)) { input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2); input_report_key(dev, BTN_TOOL_TRIPLETAP, num_fingers == 3); } synaptics_report_buttons(psmouse, &hw); input_sync(dev); } static int synaptics_validate_byte(struct psmouse *psmouse, int idx, unsigned char pkt_type) { static const unsigned char newabs_mask[] = { 0xC8, 0x00, 0x00, 0xC8, 0x00 }; static const unsigned char newabs_rel_mask[] = { 0xC0, 0x00, 0x00, 0xC0, 0x00 }; static const unsigned char newabs_rslt[] = { 0x80, 0x00, 0x00, 0xC0, 0x00 }; static const unsigned char oldabs_mask[] = { 0xC0, 0x60, 0x00, 0xC0, 0x60 }; static const unsigned char oldabs_rslt[] = { 0xC0, 0x00, 0x00, 0x80, 0x00 }; const char *packet = psmouse->packet; if (idx < 0 || idx > 4) return 0; switch (pkt_type) { case SYN_NEWABS: case SYN_NEWABS_RELAXED: return (packet[idx] & newabs_rel_mask[idx]) == newabs_rslt[idx]; case SYN_NEWABS_STRICT: return (packet[idx] & newabs_mask[idx]) == newabs_rslt[idx]; case SYN_OLDABS: return (packet[idx] & oldabs_mask[idx]) == oldabs_rslt[idx]; default: psmouse_err(psmouse, "unknown packet type %d\n", pkt_type); return 0; } } static unsigned char synaptics_detect_pkt_type(struct psmouse *psmouse) { int i; for (i = 0; i < 5; i++) if (!synaptics_validate_byte(psmouse, i, SYN_NEWABS_STRICT)) { psmouse_info(psmouse, "using relaxed packet validation\n"); return SYN_NEWABS_RELAXED; } return SYN_NEWABS_STRICT; } static psmouse_ret_t synaptics_process_byte(struct psmouse *psmouse) { struct synaptics_data *priv = psmouse->private; if (psmouse->pktcnt >= 6) { /* Full packet received */ if (unlikely(priv->pkt_type == SYN_NEWABS)) priv->pkt_type = synaptics_detect_pkt_type(psmouse); if (SYN_CAP_PASS_THROUGH(priv->capabilities) && synaptics_is_pt_packet(psmouse->packet)) { if (priv->pt_port) synaptics_pass_pt_packet(priv->pt_port, psmouse->packet); } else synaptics_process_packet(psmouse); return PSMOUSE_FULL_PACKET; } return synaptics_validate_byte(psmouse, psmouse->pktcnt - 1, priv->pkt_type) ? PSMOUSE_GOOD_DATA : PSMOUSE_BAD_DATA; } /***************************************************************************** * Driver initialization/cleanup functions ****************************************************************************/ static void set_abs_position_params(struct input_dev *dev, struct synaptics_data *priv, int x_code, int y_code) { int x_min = priv->x_min ?: XMIN_NOMINAL; int x_max = priv->x_max ?: XMAX_NOMINAL; int y_min = priv->y_min ?: YMIN_NOMINAL; int y_max = priv->y_max ?: YMAX_NOMINAL; int fuzz = SYN_CAP_REDUCED_FILTERING(priv->ext_cap_0c) ? SYN_REDUCED_FILTER_FUZZ : 0; input_set_abs_params(dev, x_code, x_min, x_max, fuzz, 0); input_set_abs_params(dev, y_code, y_min, y_max, fuzz, 0); input_abs_set_res(dev, x_code, priv->x_res); input_abs_set_res(dev, y_code, priv->y_res); } static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) { int i; /* Things that apply to both modes */ __set_bit(INPUT_PROP_POINTER, dev->propbit); __set_bit(EV_KEY, dev->evbit); __set_bit(BTN_LEFT, dev->keybit); __set_bit(BTN_RIGHT, dev->keybit); if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) __set_bit(BTN_MIDDLE, dev->keybit); if (!priv->absolute_mode) { /* Relative mode */ __set_bit(EV_REL, dev->evbit); __set_bit(REL_X, dev->relbit); __set_bit(REL_Y, dev->relbit); return; } /* Absolute mode */ __set_bit(EV_ABS, dev->evbit); set_abs_position_params(dev, priv, ABS_X, ABS_Y); input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); if (SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) { set_abs_position_params(dev, priv, ABS_MT_POSITION_X, ABS_MT_POSITION_Y); /* Image sensors can report per-contact pressure */ input_set_abs_params(dev, ABS_MT_PRESSURE, 0, 255, 0, 0); input_mt_init_slots(dev, 2, INPUT_MT_POINTER); /* Image sensors can signal 4 and 5 finger clicks */ __set_bit(BTN_TOOL_QUADTAP, dev->keybit); __set_bit(BTN_TOOL_QUINTTAP, dev->keybit); } else if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) { /* Non-image sensors with AGM use semi-mt */ __set_bit(INPUT_PROP_SEMI_MT, dev->propbit); input_mt_init_slots(dev, 2, 0); set_abs_position_params(dev, priv, ABS_MT_POSITION_X, ABS_MT_POSITION_Y); } if (SYN_CAP_PALMDETECT(priv->capabilities)) input_set_abs_params(dev, ABS_TOOL_WIDTH, 0, 15, 0, 0); __set_bit(BTN_TOUCH, dev->keybit); __set_bit(BTN_TOOL_FINGER, dev->keybit); if (SYN_CAP_MULTIFINGER(priv->capabilities)) { __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); __set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); } if (SYN_CAP_FOUR_BUTTON(priv->capabilities) || SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) { __set_bit(BTN_FORWARD, dev->keybit); __set_bit(BTN_BACK, dev->keybit); } for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++) __set_bit(BTN_0 + i, dev->keybit); __clear_bit(EV_REL, dev->evbit); __clear_bit(REL_X, dev->relbit); __clear_bit(REL_Y, dev->relbit); if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); /* Clickpads report only left button */ __clear_bit(BTN_RIGHT, dev->keybit); __clear_bit(BTN_MIDDLE, dev->keybit); } } static ssize_t synaptics_show_disable_gesture(struct psmouse *psmouse, void *data, char *buf) { struct synaptics_data *priv = psmouse->private; return sprintf(buf, "%c\n", priv->disable_gesture ? '1' : '0'); } static ssize_t synaptics_set_disable_gesture(struct psmouse *psmouse, void *data, const char *buf, size_t len) { struct synaptics_data *priv = psmouse->private; unsigned int value; int err; err = kstrtouint(buf, 10, &value); if (err) return err; if (value > 1) return -EINVAL; if (value == priv->disable_gesture) return len; priv->disable_gesture = value; if (value) priv->mode |= SYN_BIT_DISABLE_GESTURE; else priv->mode &= ~SYN_BIT_DISABLE_GESTURE; if (synaptics_mode_cmd(psmouse, priv->mode)) return -EIO; return len; } PSMOUSE_DEFINE_ATTR(disable_gesture, S_IWUSR | S_IRUGO, NULL, synaptics_show_disable_gesture, synaptics_set_disable_gesture); static void synaptics_disconnect(struct psmouse *psmouse) { struct synaptics_data *priv = psmouse->private; if (!priv->absolute_mode && SYN_ID_DISGEST_SUPPORTED(priv->identity)) device_remove_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_disable_gesture.dattr); synaptics_reset(psmouse); kfree(priv); psmouse->private = NULL; } static int synaptics_reconnect(struct psmouse *psmouse) { struct synaptics_data *priv = psmouse->private; struct synaptics_data old_priv = *priv; unsigned char param[2]; int retry = 0; int error; do { psmouse_reset(psmouse); if (retry) { /* * On some boxes, right after resuming, the touchpad * needs some time to finish initializing (I assume * it needs time to calibrate) and start responding * to Synaptics-specific queries, so let's wait a * bit. */ ssleep(1); } ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETID); error = synaptics_detect(psmouse, 0); } while (error && ++retry < 3); if (error) return -1; if (retry > 1) psmouse_dbg(psmouse, "reconnected after %d tries\n", retry); if (synaptics_query_hardware(psmouse)) { psmouse_err(psmouse, "Unable to query device.\n"); return -1; } if (synaptics_set_mode(psmouse)) { psmouse_err(psmouse, "Unable to initialize device.\n"); return -1; } if (old_priv.identity != priv->identity || old_priv.model_id != priv->model_id || old_priv.capabilities != priv->capabilities || old_priv.ext_cap != priv->ext_cap) { psmouse_err(psmouse, "hardware appears to be different: id(%ld-%ld), model(%ld-%ld), caps(%lx-%lx), ext(%lx-%lx).\n", old_priv.identity, priv->identity, old_priv.model_id, priv->model_id, old_priv.capabilities, priv->capabilities, old_priv.ext_cap, priv->ext_cap); return -1; } return 0; } static bool impaired_toshiba_kbc; static const struct dmi_system_id __initconst toshiba_dmi_table[] = { #if defined(CONFIG_DMI) && defined(CONFIG_X86) { /* Toshiba Satellite */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), DMI_MATCH(DMI_PRODUCT_NAME, "Satellite"), }, }, { /* Toshiba Dynabook */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), DMI_MATCH(DMI_PRODUCT_NAME, "dynabook"), }, }, { /* Toshiba Portege M300 */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M300"), }, }, { /* Toshiba Portege M300 */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), DMI_MATCH(DMI_PRODUCT_NAME, "Portable PC"), DMI_MATCH(DMI_PRODUCT_VERSION, "Version 1.0"), }, }, #endif { } }; static bool broken_olpc_ec; static const struct dmi_system_id __initconst olpc_dmi_table[] = { #if defined(CONFIG_DMI) && defined(CONFIG_OLPC) { /* OLPC XO-1 or XO-1.5 */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "OLPC"), DMI_MATCH(DMI_PRODUCT_NAME, "XO"), }, }, #endif { } }; static const struct dmi_system_id min_max_dmi_table[] __initconst = { #if defined(CONFIG_DMI) { /* Lenovo ThinkPad Helix */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Helix"), }, .driver_data = (int []){1024, 5052, 2258, 4832}, }, { /* Lenovo ThinkPad X240 */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X240"), }, .driver_data = (int []){1232, 5710, 1156, 4696}, }, { /* Lenovo ThinkPad Edge E431 */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Edge E431"), }, .driver_data = (int []){1024, 5022, 2508, 4832}, }, { /* Lenovo ThinkPad T431s */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T431"), }, .driver_data = (int []){1024, 5112, 2024, 4832}, }, { /* Lenovo ThinkPad T440s */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T440"), }, .driver_data = (int []){1024, 5112, 2024, 4832}, }, { /* Lenovo ThinkPad L440 */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L440"), }, .driver_data = (int []){1024, 5112, 2024, 4832}, }, { /* Lenovo ThinkPad T540p */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T540"), }, .driver_data = (int []){1024, 5112, 2024, 4832}, }, { /* Lenovo ThinkPad L540 */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L540"), }, .driver_data = (int []){1024, 5112, 2024, 4832}, }, { /* Lenovo ThinkPad W540 */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W540"), }, .driver_data = (int []){1024, 5112, 2024, 4832}, }, { /* Lenovo Yoga S1 */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "ThinkPad S1 Yoga"), }, .driver_data = (int []){1232, 5710, 1156, 4696}, }, { /* Lenovo ThinkPad X1 Carbon Haswell (3rd generation) */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X1 Carbon 2nd"), }, .driver_data = (int []){1024, 5112, 2024, 4832}, }, #endif { } }; void __init synaptics_module_init(void) { const struct dmi_system_id *min_max_dmi; impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table); broken_olpc_ec = dmi_check_system(olpc_dmi_table); min_max_dmi = dmi_first_match(min_max_dmi_table); if (min_max_dmi) quirk_min_max = min_max_dmi->driver_data; } static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode) { struct synaptics_data *priv; int err = -1; /* * The OLPC XO has issues with Synaptics' absolute mode; the constant * packet spew overloads the EC such that key presses on the keyboard * are missed. Given that, don't even attempt to use Absolute mode. * Relative mode seems to work just fine. */ if (absolute_mode && broken_olpc_ec) { psmouse_info(psmouse, "OLPC XO detected, not enabling Synaptics protocol.\n"); return -ENODEV; } psmouse->private = priv = kzalloc(sizeof(struct synaptics_data), GFP_KERNEL); if (!priv) return -ENOMEM; psmouse_reset(psmouse); if (synaptics_query_hardware(psmouse)) { psmouse_err(psmouse, "Unable to query device.\n"); goto init_fail; } priv->absolute_mode = absolute_mode; if (SYN_ID_DISGEST_SUPPORTED(priv->identity)) priv->disable_gesture = true; if (synaptics_set_mode(psmouse)) { psmouse_err(psmouse, "Unable to initialize device.\n"); goto init_fail; } priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; psmouse_info(psmouse, "Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx, board id: %lu, fw id: %lu\n", SYN_ID_MODEL(priv->identity), SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), priv->model_id, priv->capabilities, priv->ext_cap, priv->ext_cap_0c, priv->board_id, priv->firmware_id); set_input_params(psmouse->dev, priv); /* * Encode touchpad model so that it can be used to set * input device->id.version and be visible to userspace. * Because version is __u16 we have to drop something. * Hardware info bits seem to be good candidates as they * are documented to be for Synaptics corp. internal use. */ psmouse->model = ((priv->model_id & 0x00ff0000) >> 8) | (priv->model_id & 0x000000ff); if (absolute_mode) { psmouse->protocol_handler = synaptics_process_byte; psmouse->pktsize = 6; } else { /* Relative mode follows standard PS/2 mouse protocol */ psmouse->protocol_handler = psmouse_process_byte; psmouse->pktsize = 3; } psmouse->set_rate = synaptics_set_rate; psmouse->disconnect = synaptics_disconnect; psmouse->reconnect = synaptics_reconnect; psmouse->cleanup = synaptics_reset; /* Synaptics can usually stay in sync without extra help */ psmouse->resync_time = 0; if (SYN_CAP_PASS_THROUGH(priv->capabilities)) synaptics_pt_create(psmouse); /* * Toshiba's KBC seems to have trouble handling data from * Synaptics at full rate. Switch to a lower rate (roughly * the same rate as a standard PS/2 mouse). */ if (psmouse->rate >= 80 && impaired_toshiba_kbc) { psmouse_info(psmouse, "Toshiba %s detected, limiting rate to 40pps.\n", dmi_get_system_info(DMI_PRODUCT_NAME)); psmouse->rate = 40; } if (!priv->absolute_mode && SYN_ID_DISGEST_SUPPORTED(priv->identity)) { err = device_create_file(&psmouse->ps2dev.serio->dev, &psmouse_attr_disable_gesture.dattr); if (err) { psmouse_err(psmouse, "Failed to create disable_gesture attribute (%d)", err); goto init_fail; } } return 0; init_fail: kfree(priv); return err; } int synaptics_init(struct psmouse *psmouse) { return __synaptics_init(psmouse, true); } int synaptics_init_relative(struct psmouse *psmouse) { return __synaptics_init(psmouse, false); } bool synaptics_supported(void) { return true; } #else /* CONFIG_MOUSE_PS2_SYNAPTICS */ void __init synaptics_module_init(void) { } int synaptics_init(struct psmouse *psmouse) { return -ENOSYS; } bool synaptics_supported(void) { return false; } #endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
{ "content_hash": "06604a4140671ce82ba2766a9c5c9acd", "timestamp": "", "source": "github", "line_count": 1723, "max_line_length": 103, "avg_line_length": 27.61752756819501, "alnum_prop": 0.6361668593044026, "repo_name": "manuelmagix/kernel_bq_piccolo", "id": "f36f7b88f2603d3cbe16eb2a88dffa63091362cd", "size": "48562", "binary": false, "copies": "508", "ref": "refs/heads/master", "path": "drivers/input/mouse/synaptics.c", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "4528" }, { "name": "Assembly", "bytes": "9818830" }, { "name": "Awk", "bytes": "18681" }, { "name": "C", "bytes": "494602785" }, { "name": "C++", "bytes": "4382330" }, { "name": "Clojure", "bytes": "480" }, { "name": "Groff", "bytes": "22012" }, { "name": "Lex", "bytes": "40805" }, { "name": "Makefile", "bytes": "1373737" }, { "name": "Objective-C", "bytes": "1218215" }, { "name": "Perl", "bytes": "406175" }, { "name": "Python", "bytes": "37296" }, { "name": "Scilab", "bytes": "21433" }, { "name": "Shell", "bytes": "137667" }, { "name": "SourcePawn", "bytes": "4687" }, { "name": "UnrealScript", "bytes": "6113" }, { "name": "Yacc", "bytes": "83091" } ], "symlink_target": "" }
dijehadi.github.com ===================
{ "content_hash": "b97d911c29e02e9b65fb8a8be63eabcf", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 19, "avg_line_length": 20, "alnum_prop": 0.425, "repo_name": "dijehadi/dijehadi.github.com", "id": "df683a3fa00f1d2d0fafa53452b1ec1b34f1bb2a", "size": "40", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "16923" }, { "name": "HTML", "bytes": "33122" }, { "name": "JavaScript", "bytes": "5354" } ], "symlink_target": "" }
<?php namespace Acme\CallendarBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class DefaultController extends Controller { public function indexAction($name) { return $this->render('AcmeCallendarBundle:Default:index.html.twig', array('name' => $name)); } }
{ "content_hash": "1fb8dadfd35e74e1420fbd9ba99e561e", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 100, "avg_line_length": 23.76923076923077, "alnum_prop": 0.7378640776699029, "repo_name": "WojciechMichna/CalendarProject", "id": "b9265176853a7314c6ca333b64a0cb830c849ef9", "size": "309", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/Acme/CallendarBundle/Controller/DefaultController.php", "mode": "33261", "license": "mit", "language": [ { "name": "PHP", "bytes": "71067" }, { "name": "Perl", "bytes": "3468" } ], "symlink_target": "" }
export const ItemTd = { flexGrow: 1, order: 1, alignSelf: 'center' };
{ "content_hash": "746ceb6a1047802ee3e03c3450cec97d", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 69, "avg_line_length": 70, "alnum_prop": 0.6714285714285714, "repo_name": "pauleonardo/demo-trans", "id": "a4ea88c8edc4c7b2fc2d12b670c8e82c600086c3", "size": "71", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/components/TableTrans/ItemList/styles.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "12090" }, { "name": "JavaScript", "bytes": "175443" } ], "symlink_target": "" }
/* * FileName: Excel2003Reader.java * Author: v_qinyuchen * Date: 2016年1月12日 下午2:02:12 * Description: //模块目的、功能描述 * History: //修改记录 * <author> <time> <version> <desc> * 修改人姓名 修改时间 版本号 描述 */ package org.alljet.service.util.readExcel; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.poi.hssf.eventusermodel.EventWorkbookBuilder.SheetRecordCollectingListener; import org.apache.poi.hssf.eventusermodel.FormatTrackingHSSFListener; import org.apache.poi.hssf.eventusermodel.HSSFEventFactory; import org.apache.poi.hssf.eventusermodel.HSSFListener; import org.apache.poi.hssf.eventusermodel.HSSFRequest; import org.apache.poi.hssf.eventusermodel.MissingRecordAwareHSSFListener; import org.apache.poi.hssf.eventusermodel.dummyrecord.LastCellOfRowDummyRecord; import org.apache.poi.hssf.eventusermodel.dummyrecord.MissingCellDummyRecord; import org.apache.poi.hssf.model.HSSFFormulaParser; import org.apache.poi.hssf.record.BOFRecord; import org.apache.poi.hssf.record.BlankRecord; import org.apache.poi.hssf.record.BoolErrRecord; import org.apache.poi.hssf.record.BoundSheetRecord; import org.apache.poi.hssf.record.FormulaRecord; import org.apache.poi.hssf.record.LabelRecord; import org.apache.poi.hssf.record.LabelSSTRecord; import org.apache.poi.hssf.record.NumberRecord; import org.apache.poi.hssf.record.Record; import org.apache.poi.hssf.record.SSTRecord; import org.apache.poi.hssf.record.StringRecord; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.poifs.filesystem.POIFSFileSystem; /** * 〈一句话功能简述〉<br> * 〈功能详细描述〉 * * @author v_qinyuchen * @see [相关类/方法](可选) * @since [产品/模块版本] (可选) */ public class Excel2003Reader implements HSSFListener { private final int minColumns = -1; private POIFSFileSystem fs; private int lastRowNumber; private int lastColumnNumber; /** Should we output the formula, or the value it has? */ private final boolean outputFormulaValues = true; /** For parsing Formulas */ private SheetRecordCollectingListener workbookBuildingListener; // excel2003工作薄 private HSSFWorkbook stubWorkbook; // Records we pick up as we process private SSTRecord sstRecord; private FormatTrackingHSSFListener formatListener; // 表索引 private int sheetIndex = -1; private BoundSheetRecord[] orderedBSRs; @SuppressWarnings("unchecked") private final ArrayList boundSheetRecords = new ArrayList(); // For handling formulas with string results private int nextRow; private int nextColumn; private boolean outputNextStringRecord; // 当前行 private int curRow = 0; // 存储行记录的容器 private final List<String> rowlist = new ArrayList<String>();; @SuppressWarnings("unused") private String sheetName; private IRowReader rowReader; public void setRowReader(IRowReader rowReader) { this.rowReader = rowReader; } private Map<String, Object> map = new HashMap<String, Object>(); int succCount = 0; int failCount = 0; StringBuffer msg = new StringBuffer(); private static final String MAP_KEY_SUCC_COUNT = "succCount"; private static final String MAP_KEY_FAIL_COUNT = "failCount"; private static final String MAP_KEY_MSG = "msg"; private static final String MAP_KEY_STATUS = "status"; private static final String MAP_KEY_TOTAL = "total"; public Map<String, Object> getResultMap() { return this.map; } /** * 遍历excel下所有的sheet * * @throws IOException */ public void process(InputStream in) throws IOException { this.fs = new POIFSFileSystem(in); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener(this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if (outputFormulaValues) { request.addListenerForAllRecords(formatListener); } else { workbookBuildingListener = new SheetRecordCollectingListener(formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); } /** * 遍历excel下所有的sheet * * @throws IOException */ public void process(String fileName) throws IOException { this.fs = new POIFSFileSystem(new FileInputStream(fileName)); MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener(this); formatListener = new FormatTrackingHSSFListener(listener); HSSFEventFactory factory = new HSSFEventFactory(); HSSFRequest request = new HSSFRequest(); if (outputFormulaValues) { request.addListenerForAllRecords(formatListener); } else { workbookBuildingListener = new SheetRecordCollectingListener(formatListener); request.addListenerForAllRecords(workbookBuildingListener); } factory.processWorkbookEvents(request, fs); } /** * HSSFListener 监听方法,处理 Record */ @Override @SuppressWarnings("unchecked") public void processRecord(Record record) { int thisRow = -1; int thisColumn = -1; String thisStr = null; String value = null; switch (record.getSid()) { case BoundSheetRecord.sid: boundSheetRecords.add(record); break; case BOFRecord.sid: BOFRecord br = (BOFRecord) record; if (br.getType() == BOFRecord.TYPE_WORKSHEET) { // 如果有需要,则建立子工作薄 if (workbookBuildingListener != null && stubWorkbook == null) { stubWorkbook = workbookBuildingListener.getStubHSSFWorkbook(); } sheetIndex++; if (orderedBSRs == null) { orderedBSRs = BoundSheetRecord.orderByBofPosition(boundSheetRecords); } sheetName = orderedBSRs[sheetIndex].getSheetname(); } break; case SSTRecord.sid: sstRecord = (SSTRecord) record; break; case BlankRecord.sid: BlankRecord brec = (BlankRecord) record; thisRow = brec.getRow(); thisColumn = brec.getColumn(); thisStr = ""; rowlist.add(thisColumn, thisStr); break; case BoolErrRecord.sid: // 单元格为布尔类型 BoolErrRecord berec = (BoolErrRecord) record; thisRow = berec.getRow(); thisColumn = berec.getColumn(); thisStr = berec.getBooleanValue() + ""; rowlist.add(thisColumn, thisStr); break; case FormulaRecord.sid: // 单元格为公式类型 FormulaRecord frec = (FormulaRecord) record; thisRow = frec.getRow(); thisColumn = frec.getColumn(); if (outputFormulaValues) { if (Double.isNaN(frec.getValue())) { // Formula result is a string // This is stored in the next record outputNextStringRecord = true; nextRow = frec.getRow(); nextColumn = frec.getColumn(); } else { thisStr = formatListener.formatNumberDateCell(frec); } } else { thisStr = '"' + HSSFFormulaParser.toFormulaString(stubWorkbook, frec.getParsedExpression()) + '"'; } rowlist.add(thisColumn, thisStr); break; case StringRecord.sid:// 单元格中公式的字符串 if (outputNextStringRecord) { // String for formula StringRecord srec = (StringRecord) record; thisStr = srec.getString(); thisRow = nextRow; thisColumn = nextColumn; outputNextStringRecord = false; } break; case LabelRecord.sid: LabelRecord lrec = (LabelRecord) record; curRow = thisRow = lrec.getRow(); thisColumn = lrec.getColumn(); value = lrec.getValue().trim(); value = value.equals("") ? " " : value; this.rowlist.add(thisColumn, value); break; case LabelSSTRecord.sid: // 单元格为字符串类型 LabelSSTRecord lsrec = (LabelSSTRecord) record; curRow = thisRow = lsrec.getRow(); thisColumn = lsrec.getColumn(); if (sstRecord == null) { rowlist.add(thisColumn, " "); } else { value = sstRecord.getString(lsrec.getSSTIndex()).toString().trim(); value = value.equals("") ? " " : value; rowlist.add(thisColumn, value); } break; case NumberRecord.sid: // 单元格为数字类型 NumberRecord numrec = (NumberRecord) record; curRow = thisRow = numrec.getRow(); thisColumn = numrec.getColumn(); value = formatListener.formatNumberDateCell(numrec).trim(); value = value.equals("") ? " " : value; // 向容器加入列值 rowlist.add(thisColumn, value); break; default: break; } // 遇到新行的操作 if (thisRow != -1 && thisRow != lastRowNumber) { lastColumnNumber = -1; } // 空值的操作 if (record instanceof MissingCellDummyRecord) { MissingCellDummyRecord mc = (MissingCellDummyRecord) record; curRow = thisRow = mc.getRow(); thisColumn = mc.getColumn(); rowlist.add(thisColumn, ""); } // 更新行和列的值 if (thisRow > -1) lastRowNumber = thisRow; if (thisColumn > -1) lastColumnNumber = thisColumn; // 行结束时的操作 if (record instanceof LastCellOfRowDummyRecord) { if (minColumns > 0) { // 列值重新置空 if (lastColumnNumber == -1) { lastColumnNumber = 0; } } lastColumnNumber = -1; // 每行结束时, 调用getRows() 方法 map = rowReader.getRows(sheetIndex, curRow, rowlist); if (Boolean.parseBoolean(map.get("isEmpty").toString())) { } else { if (Boolean.parseBoolean(map.get("status").toString())) { succCount++; } else { failCount++; msg.append(",").append(map.get("failRecords")); } } // 清空容器 rowlist.clear(); map.put(MAP_KEY_TOTAL, curRow); map.put(MAP_KEY_SUCC_COUNT, succCount); map.put(MAP_KEY_FAIL_COUNT, failCount); map.put(MAP_KEY_STATUS, map.get("status").toString()); map.put(MAP_KEY_MSG, msg); } } }
{ "content_hash": "7bf8da3afebc08b8755b7f98a0536ede", "timestamp": "", "source": "github", "line_count": 309, "max_line_length": 118, "avg_line_length": 38.18770226537217, "alnum_prop": 0.5699152542372882, "repo_name": "RinoQin/alljet-web", "id": "98c363f597d1621c27cf8687e8e76b50274e8c02", "size": "12226", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "alljet-web/src/main/java/org/alljet/service/util/readExcel/Excel2003Reader.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "19147" }, { "name": "FreeMarker", "bytes": "14176" }, { "name": "HTML", "bytes": "2164" }, { "name": "Java", "bytes": "237770" }, { "name": "JavaScript", "bytes": "5413" } ], "symlink_target": "" }
FROM balenalib/surface-pro-6-debian:buster-build RUN apt-get update \ && apt-get install -y --no-install-recommends \ ca-certificates \ curl \ \ # .NET Core dependencies libc6 \ libgcc1 \ libgssapi-krb5-2 \ libicu63 \ libssl1.1 \ libstdc++6 \ zlib1g \ && rm -rf /var/lib/apt/lists/* # Configure web servers to bind to port 80 when present ENV ASPNETCORE_URLS=http://+:80 \ # Enable detection of running in a container DOTNET_RUNNING_IN_CONTAINER=true # Install .NET Core ENV DOTNET_VERSION 3.1.12 RUN curl -SL --output dotnet.tar.gz "https://dotnetcli.blob.core.windows.net/dotnet/Runtime/$DOTNET_VERSION/dotnet-runtime-$DOTNET_VERSION-linux-x64.tar.gz" \ && dotnet_sha512='d1a815d26c75d9fe41479efc32626c1c83bdc616cdcde63768ff7480d721c37427a17fd3999366c738aa936afe43c5426162c4b188f923d810762c91230e2d8b' \ && echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \ && mkdir -p /usr/share/dotnet \ && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \ && rm dotnet.tar.gz \ && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet ENV ASPNETCORE_VERSION 3.1.12 RUN curl -SL --output aspnetcore.tar.gz "https://dotnetcli.blob.core.windows.net/dotnet/aspnetcore/Runtime/$ASPNETCORE_VERSION/aspnetcore-runtime-$ASPNETCORE_VERSION-linux-x64.tar.gz" \ && aspnetcore_sha512='e6d384a4c05bc6a693a85dc1da5f34e26449ad5d9414dee5f46a56805ac53eb304610be06d6a2a683f2d9e1447f316f47abea71fbfd6ee901dcc9da9d7c4e03b' \ && echo "$aspnetcore_sha512 aspnetcore.tar.gz" | sha512sum -c - \ && mkdir -p /usr/share/dotnet \ && tar -zxf aspnetcore.tar.gz -C /usr/share/dotnet ./shared/Microsoft.AspNetCore.App \ && rm aspnetcore.tar.gz CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/[email protected]" \ && echo "Running test-stack@dotnet" \ && chmod +x [email protected] \ && bash [email protected] \ && rm -rf [email protected] RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: Intel 64-bit (x86-64) \nOS: Debian Buster \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \ndotnet 3.1-aspnet \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
{ "content_hash": "d0a5f4e6f81492c1a714ecedbb673cef", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 696, "avg_line_length": 55.80357142857143, "alnum_prop": 0.71456, "repo_name": "nghiant2710/base-images", "id": "e3f5ca946de9ad342b42b7f135f6aeffb6ebf183", "size": "3146", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "balena-base-images/dotnet/surface-pro-6/debian/buster/3.1-aspnet/build/Dockerfile", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "144558581" }, { "name": "JavaScript", "bytes": "16316" }, { "name": "Shell", "bytes": "368690" } ], "symlink_target": "" }
using testing::BitEq; namespace v8 { namespace internal { namespace compiler { namespace simplified_operator_reducer_unittest { class SimplifiedOperatorReducerTest : public GraphTest { public: explicit SimplifiedOperatorReducerTest(int num_parameters = 1) : GraphTest(num_parameters), simplified_(zone()) {} ~SimplifiedOperatorReducerTest() override = default; protected: Reduction Reduce(Node* node) { MachineOperatorBuilder machine(zone()); JSOperatorBuilder javascript(zone()); JSGraph jsgraph(isolate(), graph(), common(), &javascript, simplified(), &machine); GraphReducer graph_reducer(zone(), graph(), tick_counter(), broker()); SimplifiedOperatorReducer reducer(&graph_reducer, &jsgraph, broker()); return reducer.Reduce(node); } SimplifiedOperatorBuilder* simplified() { return &simplified_; } private: SimplifiedOperatorBuilder simplified_; }; template <typename T> class SimplifiedOperatorReducerTestWithParam : public SimplifiedOperatorReducerTest, public ::testing::WithParamInterface<T> { public: explicit SimplifiedOperatorReducerTestWithParam(int num_parameters = 1) : SimplifiedOperatorReducerTest(num_parameters) {} ~SimplifiedOperatorReducerTestWithParam() override = default; }; namespace { const double kFloat64Values[] = { -V8_INFINITY, -6.52696e+290, -1.05768e+290, -5.34203e+268, -1.01997e+268, -8.22758e+266, -1.58402e+261, -5.15246e+241, -5.92107e+226, -1.21477e+226, -1.67913e+188, -1.6257e+184, -2.60043e+170, -2.52941e+168, -3.06033e+116, -4.56201e+52, -3.56788e+50, -9.9066e+38, -3.07261e+31, -2.1271e+09, -1.91489e+09, -1.73053e+09, -9.30675e+08, -26030, -20453, -15790, -11699, -111, -97, -78, -63, -58, -1.53858e-06, -2.98914e-12, -1.14741e-39, -8.20347e-57, -1.48932e-59, -3.17692e-66, -8.93103e-81, -3.91337e-83, -6.0489e-92, -8.83291e-113, -4.28266e-117, -1.92058e-178, -2.0567e-192, -1.68167e-194, -1.51841e-214, -3.98738e-234, -7.31851e-242, -2.21875e-253, -1.11612e-293, -0.0, 0.0, 2.22507e-308, 1.06526e-307, 4.16643e-227, 6.76624e-223, 2.0432e-197, 3.16254e-184, 1.37315e-173, 2.88603e-172, 1.54155e-99, 4.42923e-81, 1.40539e-73, 5.4462e-73, 1.24064e-58, 3.11167e-58, 2.75826e-39, 0.143815, 58, 67, 601, 7941, 11644, 13697, 25680, 29882, 1.32165e+08, 1.62439e+08, 4.16837e+08, 9.59097e+08, 1.32491e+09, 1.8728e+09, 1.0672e+17, 2.69606e+46, 1.98285e+79, 1.0098e+82, 7.93064e+88, 3.67444e+121, 9.36506e+123, 7.27954e+162, 3.05316e+168, 1.16171e+175, 1.64771e+189, 1.1622e+202, 2.00748e+239, 2.51778e+244, 3.90282e+306, 1.79769e+308, V8_INFINITY}; const int32_t kInt32Values[] = { -2147483647 - 1, -2104508227, -2103151830, -1435284490, -1378926425, -1318814539, -1289388009, -1287537572, -1279026536, -1241605942, -1226046939, -941837148, -779818051, -413830641, -245798087, -184657557, -127145950, -105483328, -32325, -26653, -23858, -23834, -22363, -19858, -19044, -18744, -15528, -5309, -3372, -2093, -104, -98, -97, -93, -84, -80, -78, -76, -72, -58, -57, -56, -55, -45, -40, -34, -32, -25, -24, -5, -2, 0, 3, 10, 24, 34, 42, 46, 47, 48, 52, 56, 64, 65, 71, 76, 79, 81, 82, 97, 102, 103, 104, 106, 107, 109, 116, 122, 3653, 4485, 12405, 16504, 26262, 28704, 29755, 30554, 16476817, 605431957, 832401070, 873617242, 914205764, 1062628108, 1087581664, 1488498068, 1534668023, 1661587028, 1696896187, 1866841746, 2032089723, 2147483647}; const double kNaNs[] = {-std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN(), bit_cast<double>(uint64_t{0x7FFFFFFFFFFFFFFF}), bit_cast<double>(uint64_t{0xFFFFFFFFFFFFFFFF})}; const CheckForMinusZeroMode kCheckForMinusZeroModes[] = { CheckForMinusZeroMode::kDontCheckForMinusZero, CheckForMinusZeroMode::kCheckForMinusZero}; } // namespace // ----------------------------------------------------------------------------- // BooleanNot TEST_F(SimplifiedOperatorReducerTest, BooleanNotWithBooleanNot) { Node* param0 = Parameter(0); Reduction reduction = Reduce( graph()->NewNode(simplified()->BooleanNot(), graph()->NewNode(simplified()->BooleanNot(), param0))); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(param0, reduction.replacement()); } TEST_F(SimplifiedOperatorReducerTest, BooleanNotWithFalseConstant) { Reduction reduction0 = Reduce(graph()->NewNode(simplified()->BooleanNot(), FalseConstant())); ASSERT_TRUE(reduction0.Changed()); EXPECT_THAT(reduction0.replacement(), IsTrueConstant()); } TEST_F(SimplifiedOperatorReducerTest, BooleanNotWithTrueConstant) { Reduction reduction1 = Reduce(graph()->NewNode(simplified()->BooleanNot(), TrueConstant())); ASSERT_TRUE(reduction1.Changed()); EXPECT_THAT(reduction1.replacement(), IsFalseConstant()); } // ----------------------------------------------------------------------------- // ChangeTaggedToBit TEST_F(SimplifiedOperatorReducerTest, ChangeBitToTaggedWithChangeTaggedToBit) { Node* param0 = Parameter(0); Reduction reduction = Reduce(graph()->NewNode( simplified()->ChangeBitToTagged(), graph()->NewNode(simplified()->ChangeTaggedToBit(), param0))); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(param0, reduction.replacement()); } TEST_F(SimplifiedOperatorReducerTest, ChangeBitToTaggedWithZeroConstant) { Reduction reduction = Reduce( graph()->NewNode(simplified()->ChangeBitToTagged(), Int32Constant(0))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsFalseConstant()); } TEST_F(SimplifiedOperatorReducerTest, ChangeBitToTaggedWithOneConstant) { Reduction reduction = Reduce( graph()->NewNode(simplified()->ChangeBitToTagged(), Int32Constant(1))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsTrueConstant()); } // ----------------------------------------------------------------------------- // ChangeTaggedToBit TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToBitWithFalseConstant) { Reduction reduction = Reduce( graph()->NewNode(simplified()->ChangeTaggedToBit(), FalseConstant())); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsInt32Constant(0)); } TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToBitWithTrueConstant) { Reduction reduction = Reduce( graph()->NewNode(simplified()->ChangeTaggedToBit(), TrueConstant())); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsInt32Constant(1)); } TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToBitWithChangeBitToTagged) { Node* param0 = Parameter(0); Reduction reduction = Reduce(graph()->NewNode( simplified()->ChangeTaggedToBit(), graph()->NewNode(simplified()->ChangeBitToTagged(), param0))); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(param0, reduction.replacement()); } // ----------------------------------------------------------------------------- // ChangeFloat64ToTagged TEST_F(SimplifiedOperatorReducerTest, ChangeFloat64ToTaggedWithConstant) { TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { TRACED_FOREACH(double, n, kFloat64Values) { Reduction reduction = Reduce(graph()->NewNode( simplified()->ChangeFloat64ToTagged(mode), Float64Constant(n))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsNumberConstant(BitEq(n))); } } } // ----------------------------------------------------------------------------- // ChangeInt32ToTagged TEST_F(SimplifiedOperatorReducerTest, ChangeInt32ToTaggedWithConstant) { TRACED_FOREACH(int32_t, n, kInt32Values) { Reduction reduction = Reduce(graph()->NewNode( simplified()->ChangeInt32ToTagged(), Int32Constant(n))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsNumberConstant(BitEq(FastI2D(n)))); } } // ----------------------------------------------------------------------------- // ChangeTaggedToFloat64 TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToFloat64WithChangeFloat64ToTagged) { Node* param0 = Parameter(0); TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { Reduction reduction = Reduce(graph()->NewNode( simplified()->ChangeTaggedToFloat64(), graph()->NewNode(simplified()->ChangeFloat64ToTagged(mode), param0))); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(param0, reduction.replacement()); } } TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToFloat64WithChangeInt32ToTagged) { Node* param0 = Parameter(0); Reduction reduction = Reduce(graph()->NewNode( simplified()->ChangeTaggedToFloat64(), graph()->NewNode(simplified()->ChangeInt32ToTagged(), param0))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsChangeInt32ToFloat64(param0)); } TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToFloat64WithChangeUint32ToTagged) { Node* param0 = Parameter(0); Reduction reduction = Reduce(graph()->NewNode( simplified()->ChangeTaggedToFloat64(), graph()->NewNode(simplified()->ChangeUint32ToTagged(), param0))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsChangeUint32ToFloat64(param0)); } TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToFloat64WithConstant) { TRACED_FOREACH(double, n, kFloat64Values) { Reduction reduction = Reduce(graph()->NewNode( simplified()->ChangeTaggedToFloat64(), NumberConstant(n))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsFloat64Constant(BitEq(n))); } } TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToFloat64WithNaNConstant) { TRACED_FOREACH(double, nan, kNaNs) { Reduction reduction = Reduce(graph()->NewNode( simplified()->ChangeTaggedToFloat64(), NumberConstant(nan))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsFloat64Constant(BitEq(nan))); } } // ----------------------------------------------------------------------------- // ChangeTaggedToInt32 TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToInt32WithChangeFloat64ToTagged) { Node* param0 = Parameter(0); TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { Reduction reduction = Reduce(graph()->NewNode( simplified()->ChangeTaggedToInt32(), graph()->NewNode(simplified()->ChangeFloat64ToTagged(mode), param0))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsChangeFloat64ToInt32(param0)); } } TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToInt32WithChangeInt32ToTagged) { Node* param0 = Parameter(0); Reduction reduction = Reduce(graph()->NewNode( simplified()->ChangeTaggedToInt32(), graph()->NewNode(simplified()->ChangeInt32ToTagged(), param0))); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(param0, reduction.replacement()); } // ----------------------------------------------------------------------------- // ChangeTaggedToUint32 TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToUint32WithChangeFloat64ToTagged) { Node* param0 = Parameter(0); TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { Reduction reduction = Reduce(graph()->NewNode( simplified()->ChangeTaggedToUint32(), graph()->NewNode(simplified()->ChangeFloat64ToTagged(mode), param0))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsChangeFloat64ToUint32(param0)); } } TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToUint32WithChangeUint32ToTagged) { Node* param0 = Parameter(0); Reduction reduction = Reduce(graph()->NewNode( simplified()->ChangeTaggedToUint32(), graph()->NewNode(simplified()->ChangeUint32ToTagged(), param0))); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(param0, reduction.replacement()); } // ----------------------------------------------------------------------------- // TruncateTaggedToWord32 TEST_F(SimplifiedOperatorReducerTest, TruncateTaggedToWord3WithChangeFloat64ToTagged) { Node* param0 = Parameter(0); TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { Reduction reduction = Reduce(graph()->NewNode( simplified()->TruncateTaggedToWord32(), graph()->NewNode(simplified()->ChangeFloat64ToTagged(mode), param0))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsTruncateFloat64ToWord32(param0)); } } TEST_F(SimplifiedOperatorReducerTest, TruncateTaggedToWord32WithConstant) { TRACED_FOREACH(double, n, kFloat64Values) { Reduction reduction = Reduce(graph()->NewNode( simplified()->TruncateTaggedToWord32(), NumberConstant(n))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsInt32Constant(DoubleToInt32(n))); } } // ----------------------------------------------------------------------------- // CheckedFloat64ToInt32 TEST_F(SimplifiedOperatorReducerTest, CheckedFloat64ToInt32WithConstant) { Node* effect = graph()->start(); Node* control = graph()->start(); TRACED_FOREACH(int32_t, n, kInt32Values) { Reduction r = Reduce(graph()->NewNode( simplified()->CheckedFloat64ToInt32( CheckForMinusZeroMode::kDontCheckForMinusZero, FeedbackSource()), Float64Constant(n), effect, control)); ASSERT_TRUE(r.Changed()); EXPECT_THAT(r.replacement(), IsInt32Constant(n)); } } // ----------------------------------------------------------------------------- // CheckHeapObject TEST_F(SimplifiedOperatorReducerTest, CheckHeapObjectWithChangeBitToTagged) { Node* param0 = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); Node* value = graph()->NewNode(simplified()->ChangeBitToTagged(), param0); Reduction reduction = Reduce(graph()->NewNode(simplified()->CheckHeapObject(), value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } TEST_F(SimplifiedOperatorReducerTest, CheckHeapObjectWithHeapConstant) { Node* effect = graph()->start(); Node* control = graph()->start(); Handle<HeapObject> kHeapObjects[] = { factory()->empty_string(), factory()->null_value(), factory()->species_symbol(), factory()->undefined_value()}; TRACED_FOREACH(Handle<HeapObject>, object, kHeapObjects) { Node* value = HeapConstant(object); Reduction reduction = Reduce(graph()->NewNode( simplified()->CheckHeapObject(), value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } } TEST_F(SimplifiedOperatorReducerTest, CheckHeapObjectWithCheckHeapObject) { Node* param0 = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); Node* value = effect = graph()->NewNode(simplified()->CheckHeapObject(), param0, effect, control); Reduction reduction = Reduce(graph()->NewNode(simplified()->CheckHeapObject(), value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } // ----------------------------------------------------------------------------- // CheckSmi TEST_F(SimplifiedOperatorReducerTest, CheckSmiWithChangeInt31ToTaggedSigned) { Node* param0 = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); Node* value = graph()->NewNode(simplified()->ChangeInt31ToTaggedSigned(), param0); Reduction reduction = Reduce(graph()->NewNode( simplified()->CheckSmi(FeedbackSource()), value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } TEST_F(SimplifiedOperatorReducerTest, CheckSmiWithNumberConstant) { Node* effect = graph()->start(); Node* control = graph()->start(); Node* value = NumberConstant(1.0); Reduction reduction = Reduce(graph()->NewNode( simplified()->CheckSmi(FeedbackSource()), value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } TEST_F(SimplifiedOperatorReducerTest, CheckSmiWithCheckSmi) { Node* param0 = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); Node* value = effect = graph()->NewNode( simplified()->CheckSmi(FeedbackSource()), param0, effect, control); Reduction reduction = Reduce(graph()->NewNode( simplified()->CheckSmi(FeedbackSource()), value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } // ----------------------------------------------------------------------------- // NumberAbs TEST_F(SimplifiedOperatorReducerTest, NumberAbsWithNumberConstant) { TRACED_FOREACH(double, n, kFloat64Values) { Reduction reduction = Reduce(graph()->NewNode(simplified()->NumberAbs(), NumberConstant(n))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsNumberConstant(std::fabs(n))); } } // ----------------------------------------------------------------------------- // ObjectIsSmi TEST_F(SimplifiedOperatorReducerTest, ObjectIsSmiWithChangeBitToTagged) { Node* param0 = Parameter(0); Reduction reduction = Reduce(graph()->NewNode( simplified()->ObjectIsSmi(), graph()->NewNode(simplified()->ChangeBitToTagged(), param0))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsFalseConstant()); } TEST_F(SimplifiedOperatorReducerTest, ObjectIsSmiWithChangeInt31ToTaggedSigned) { Node* param0 = Parameter(0); Reduction reduction = Reduce(graph()->NewNode( simplified()->ObjectIsSmi(), graph()->NewNode(simplified()->ChangeInt31ToTaggedSigned(), param0))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsTrueConstant()); } TEST_F(SimplifiedOperatorReducerTest, ObjectIsSmiWithHeapConstant) { Handle<HeapObject> kHeapObjects[] = { factory()->empty_string(), factory()->null_value(), factory()->species_symbol(), factory()->undefined_value()}; TRACED_FOREACH(Handle<HeapObject>, o, kHeapObjects) { Reduction reduction = Reduce(graph()->NewNode(simplified()->ObjectIsSmi(), HeapConstant(o))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsFalseConstant()); } } TEST_F(SimplifiedOperatorReducerTest, ObjectIsSmiWithNumberConstant) { TRACED_FOREACH(double, n, kFloat64Values) { Reduction reduction = Reduce( graph()->NewNode(simplified()->ObjectIsSmi(), NumberConstant(n))); ASSERT_TRUE(reduction.Changed()); EXPECT_THAT(reduction.replacement(), IsBooleanConstant(IsSmiDouble(n))); } } // ----------------------------------------------------------------------------- // CheckedInt32Add TEST_F(SimplifiedOperatorReducerTest, CheckedInt32AddConsecutivelyWithConstants) { Node* p0 = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); TRACED_FOREACH(int32_t, a, kInt32Values) { TRACED_FOREACH(int32_t, b, kInt32Values) { Node* add1 = graph()->NewNode(simplified()->CheckedInt32Add(), p0, Int32Constant(a), effect, control); Node* add2 = graph()->NewNode(simplified()->CheckedInt32Add(), add1, Int32Constant(b), add1, control); Reduction r = Reduce(add2); int32_t c; bool overflow = base::bits::SignedAddOverflow32(a, b, &c); if ((a >= 0) == (b >= 0) && !overflow) { ASSERT_TRUE(r.Changed()); Node* new_node = r.replacement(); ASSERT_EQ(new_node->opcode(), IrOpcode::kCheckedInt32Add); ASSERT_EQ(new_node->InputAt(0), p0); EXPECT_THAT(new_node->InputAt(1), IsInt32Constant(c)); ASSERT_EQ(new_node->InputAt(2), effect); ASSERT_EQ(new_node->InputAt(3), control); EXPECT_TRUE(add1->uses().empty()); } else { ASSERT_FALSE(r.Changed()); } } } } TEST_F(SimplifiedOperatorReducerTest, CheckedInt32AddConsecutivelyWithConstantsNoChanged) { Node* p0 = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); TRACED_FOREACH(int32_t, a, kInt32Values) { TRACED_FOREACH(int32_t, b, kInt32Values) { Node* add1 = graph()->NewNode(simplified()->CheckedInt32Add(), p0, Int32Constant(a), effect, control); Node* add2 = graph()->NewNode(simplified()->CheckedInt32Add(), add1, Int32Constant(b), add1, control); Node* add3 = graph()->NewNode(simplified()->CheckedInt32Add(), add1, Int32Constant(b), effect, control); // No changed since add1 has other value uses. Reduction r = Reduce(add2); ASSERT_FALSE(r.Changed()); r = Reduce(add3); ASSERT_FALSE(r.Changed()); } } } } // namespace simplified_operator_reducer_unittest } // namespace compiler } // namespace internal } // namespace v8
{ "content_hash": "62bf032fc0dd16dfb724d411ed250ea5", "timestamp": "", "source": "github", "line_count": 546, "max_line_length": 80, "avg_line_length": 38.98168498168498, "alnum_prop": 0.6534485998872392, "repo_name": "youtube/cobalt_sandbox", "id": "b73207ad98244c27f9fce2868a49722ace253a22", "size": "21922", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "third_party/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
package com.gemstone.gemfire.management.internal.cli.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.springframework.shell.core.Converter; import org.springframework.shell.core.annotation.CliCommand; /** * Annotation for Argument of a Command * * @author Nikhil Jadhav * @since 7.0 */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.PARAMETER) public @interface CliArgument{ /** * @return name of the argument, useful during help and warning messages */ String name(); /** * @return a help message for this option (the default is a blank String, * which means there is no help) */ String help() default ""; /** * @return true if this argument must be specified one way or the other by * the user (defaults to false) */ boolean mandatory() default false; /** * Returns a string providing context-specific information (e.g. a * comma-delimited set of keywords) to the {@link Converter} that handles * the annotated parameter's type. * <p> * For example, if a method parameter "thing" of type "Thing" is annotated * as follows: * * <pre> * <code>@CliArgument(..., argumentContext = "foo,bar", ...) Thing thing</code> * </pre> * * ... then the {@link Converter} that converts the text entered by the user * into an instance of Thing will be passed "foo,bar" as the value of the * <code>optionContext</code> parameter in its public methods. This allows * the behaviour of that Converter to be individually customised for each * {@link CliArgument} of each {@link CliCommand}. * * @return a non-<code>null</code> string (can be empty) */ String argumentContext() default ""; /** * @return if true, the user cannot specify this option and it is provided * by the shell infrastructure (defaults to false) */ boolean systemProvided() default false; /** * @return the default value to use if this argument is unspecified by the * user (defaults to __NULL__, which causes null to be presented to * any non-primitive parameter) */ String unspecifiedDefaultValue() default "__NULL__"; }
{ "content_hash": "216e823276ab172b60a0499dd9b58c48", "timestamp": "", "source": "github", "line_count": 73, "max_line_length": 80, "avg_line_length": 30.91780821917808, "alnum_prop": 0.6991581745680107, "repo_name": "gemxd/gemfirexd-oss", "id": "22b590b7c156707cade9341fde797dbdebca8527", "size": "2922", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/management/internal/cli/annotation/CliArgument.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AGS Script", "bytes": "90653" }, { "name": "Assembly", "bytes": "962433" }, { "name": "Batchfile", "bytes": "30248" }, { "name": "C", "bytes": "311620" }, { "name": "C#", "bytes": "1352292" }, { "name": "C++", "bytes": "2030283" }, { "name": "CSS", "bytes": "54987" }, { "name": "Gnuplot", "bytes": "3125" }, { "name": "HTML", "bytes": "8609160" }, { "name": "Java", "bytes": "118027963" }, { "name": "JavaScript", "bytes": "33027" }, { "name": "Makefile", "bytes": "18443" }, { "name": "Mathematica", "bytes": "92588" }, { "name": "Objective-C", "bytes": "1069" }, { "name": "PHP", "bytes": "581417" }, { "name": "PLSQL", "bytes": "86549" }, { "name": "PLpgSQL", "bytes": "33847" }, { "name": "Pascal", "bytes": "808" }, { "name": "Perl", "bytes": "196843" }, { "name": "Python", "bytes": "12796" }, { "name": "Ruby", "bytes": "1380" }, { "name": "SQLPL", "bytes": "219147" }, { "name": "Shell", "bytes": "533575" }, { "name": "SourcePawn", "bytes": "22351" }, { "name": "Thrift", "bytes": "33033" }, { "name": "XSLT", "bytes": "67112" } ], "symlink_target": "" }
<!-- ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. ~ ~ WSO2 Inc. 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. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.wso2.stote</groupId> <artifactId>es-integration-tests</artifactId> <packaging>pom</packaging> <version>2.0.0-SNAPSHOT</version> <name>WSO2 ES Integration Test</name> <modules> <module>tests</module> </modules> </project>
{ "content_hash": "eef23f653eab889887f10ea896d7378b", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 108, "avg_line_length": 38, "alnum_prop": 0.694078947368421, "repo_name": "maheshika/product-es", "id": "b5cefc80de49b6b52f8655a2e811e18f05da5047", "size": "1216", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "modules/integration/tests-integration/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "463710" }, { "name": "Java", "bytes": "592188" }, { "name": "JavaScript", "bytes": "5125559" }, { "name": "PHP", "bytes": "779" }, { "name": "Shell", "bytes": "3692" } ], "symlink_target": "" }
angular.module('ionic.service.core', []) /** * @private * Provides a safe interface to store objects in persistent memory */ .provider('persistentStorage', function() { return { $get: ['$q', '$window', function($q, $window) { var objectCache = {}; var memoryLocks = {}; var persistenceStrategy = { get: function(key) { return $window.localStorage.getItem(key); }, remove: function(key) { return $window.localStorage.removeItem(key); }, set: function(key, value) { return $window.localStorage.setItem(key, value); } }; return { /** * Stores an object in local storage under the given key */ storeObject: function(key, object) { // Convert object to JSON and store in localStorage var json = JSON.stringify(object); persistenceStrategy.set(key, json); // Then store it in the object cache objectCache[key] = object; }, /** * Either retrieves the cached copy of an object, * or the object itself from localStorage. * Returns null if the object couldn't be found. */ retrieveObject: function(key) { // First check to see if it's the object cache var cached = objectCache[key]; if (cached) { return cached; } // Deserialize the object from JSON var json = persistenceStrategy.get(key); // null or undefined --> return null. if (json == null) { return null; } try { return JSON.parse(json); } catch (err) { return null; } }, /** * Locks the async call represented by the given promise and lock key. * Only one asyncFunction given by the lockKey can be running at any time. * * @param lockKey should be a string representing the name of this async call. * This is required for persistence. * @param asyncFunction Returns a promise of the async call. * @returns A new promise, identical to the one returned by asyncFunction, * but with two new errors: 'in_progress', and 'last_call_interrupted'. */ lockedAsyncCall: function(lockKey, asyncFunction) { var deferred = $q.defer(); // If the memory lock is set, error out. if (memoryLocks[lockKey]) { deferred.reject('in_progress'); return deferred.promise; } // If there is a stored lock but no memory lock, flag a persistence error if (persistenceStrategy.get(lockKey) === 'locked') { deferred.reject('last_call_interrupted'); deferred.promise.then(null, function() { persistenceStrategy.remove(lockKey); }); return deferred.promise; } // Set stored and memory locks memoryLocks[lockKey] = true; persistenceStrategy.set(lockKey, 'locked'); // Perform the async operation asyncFunction().then(function(successData) { deferred.resolve(successData); // Remove stored and memory locks delete memoryLocks[lockKey]; persistenceStrategy.remove(lockKey); }, function(errorData) { deferred.reject(errorData); // Remove stored and memory locks delete memoryLocks[lockKey]; persistenceStrategy.remove(lockKey); }, function(notifyData) { deferred.notify(notifyData); }); return deferred.promise; } }; }] }; }) /** * A core Ionic account identity provider. * * Usage: * angular.module('myApp', ['ionic', 'ionic.service.core']) * .config(['$ionicAppProvider', function($ionicAccountProvider) { * $ionicAppProvider.identify({ * app_id: 'x34dfxjydi23dx' * }); * }]); */ .provider('$ionicApp', ['$httpProvider', function($httpProvider) { var app = {}; var settings = { 'api_server': 'https://apps.ionic.io', 'push_api_server': 'https://push.ionic.io', 'analytics_api_server': 'https://analytics.ionic.io' }; var _is_cordova_available = function() { console.log('Ionic Core: searching for cordova.js'); try { if (window.cordova || cordova) { console.log('Ionic Core: cordova.js has already been loaded'); return true; } } catch(e) {} var scripts = document.getElementsByTagName('script'); var len = scripts.length; for(var i = 0; i < len; i++) { var script = scripts[i].getAttribute('src'); if(script) { var parts = script.split('/'); var partsLength = 0; try { partsLength = parts.length; if (parts[partsLength-1] === 'cordova.js') { console.log('Ionic Core: cordova.js has previously been included.'); return true; } } catch(e) {} } } return false; }; this.identify = function(opts) { if (!opts.gcm_id){ opts.gcm_id = 'None'; } app = opts; }; /** * Set a config property. */ this.set = function(k, v) { settings[k] = v; }; this.setApiServer = function(server) { settings.api_server = server; }; this.$get = [function() { return { getId: function() { return app.app_id; }, getGcmId: function(){ return app.gcm_id; }, getValue: function(k) { return settings[k]; }, getApiUrl: function() { return this.getValue('api_server'); }, getApiKey: function() { return app.api_key; }, getApiEndpoint: function(service) { var app = this.getApp(); if(!app) return null; return this.getApiUrl() + '/api/v1/' + app.app_id + '/' + service; }, /** * Get the registered app for all commands. */ getApp: function() { return app; }, getDeviceTypeByNavigator: function() { return (navigator.userAgent.match(/iPad/i)) == "iPad" ? "ipad" : (navigator.userAgent.match(/iPhone/i)) == "iPhone" ? "iphone" : (navigator.userAgent.match(/Android/i)) == "Android" ? "android" : (navigator.userAgent.match(/BlackBerry/i)) == "BlackBerry" ? "blackberry" : "unknown"; }, loadCordova: function() { if(!_is_cordova_available()) { var cordova_script = document.createElement('script'); var cordova_src = 'cordova.js'; switch(this.getDeviceTypeByNavigator()) { case 'android': if (window.location.href.substring(0, 4) === "file") { cordova_src = 'file:///android_asset/www/cordova.js'; } break; case 'ipad': case 'iphone': try { var resource = window.location.search.match(/cordova_js_bootstrap_resource=(.*?)(&|#|$)/i); if (resource) { cordova_src = decodeURI(resource[1]); } } catch(e) { console.log('Could not find cordova_js_bootstrap_resource query param'); console.log(e); } break; case 'unknown': return false; default: break; } cordova_script.setAttribute('src', cordova_src); document.head.appendChild(cordova_script); console.log('Ionic Core: injecting cordova.js'); } }, bootstrap: function() { this.loadCordova(); } } }]; }]) /** * @ngdoc service * @name $ionicUser * @module ionic.service.core * @description * * An interface for storing data to a user object which will be sent with many ionic services * * Add tracking data to the user by passing objects in to the identify function. * The _id property identifies the user on this device and cannot be overwritten. * * @usage * ```javascript * $ionicUser.get(); * * // Add info to user object * $ionicUser.identify({ * username: "Timmy" * }); * * ``` */ .factory('$ionicUser', [ '$q', '$ionicCoreSettings', '$timeout', '$http', 'persistentStorage', '$ionicApp', function($q, $ionicCoreSettings, $timeout, $http, persistentStorage, $ionicApp) { // User object we'll use to store all our user info var storageKeyName = 'ionic_analytics_user_' + $ionicApp.getApp().app_id, user = persistentStorage.retrieveObject(storageKeyName) || {}, deviceCordova = ionic.Platform.device(), device = { screen_width: window.innerWidth * (window.devicePixelRatio || 1), screen_height: window.innerHeight * (window.devicePixelRatio || 1) }; if (deviceCordova.model) device.model = deviceCordova.model; if (deviceCordova.platform) device.platform = deviceCordova.platform; if (deviceCordova.version) device.version = deviceCordova.version; if (deviceCordova.uuid) device.uuid = deviceCordova.uuid; // Flag if we've changed anything on our user var dirty = false; dirty = storeOrDirty('is_on_device', ionic.Platform.isWebView()); dirty = storeOrDirty('device', device); if (!user._id) { user._id = generateGuid(); dirty = true; } if (dirty) { persistentStorage.storeObject(storageKeyName, user); } function generateGuid() { // Some crazy bit-twiddling to generate a random guid return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); return v.toString(16); }); } function storeOrDirty(key, value) { // Store the key on the user object and return whether something changed if (!angular.equals(user[key], value)) { user[key] = value; return true; } return false; } return { /** * Push a value to the array with the given key. * @param key the key * @param value the value * @param isUnique whether to only push if it doesn't exist in the set * */ _op: function(key, value, type) { var u = user.user_id; var appId = ''; if ($ionicCoreSettings.get('app_id')) { appId = $ionicCoreSettings.get('app_id') } else { appId = $ionicApp.getId(); } if(!u) { throw new Error("Please call identify with a user_id before calling push"); } var o = {}; o['user_id'] = u; o[key] = value; return $http.post($ionicApp.getApiUrl() + '/api/v1/app/' + appId + '/users/' + type, o); }, /** * Push the given value into the array field identified by the key. * Pass true to isUnique to only push the value if the value does not * already exist in the array. */ push: function(key, value, isUnique) { if(isUnique) { return this._op(key, value, 'pushUnique'); } else { return this._op(key, value, 'push'); } }, /** * Pull a given value out of the array identified by key. */ pull: function(key, value) { return this._op(key, value, 'pull'); }, /** * Set the given value under the key in the user. This overwrites * any other data under that field. To append data to list, use push above. */ set: function(key, value) { return this._op(key, value, 'set'); }, /** * Remove the field for the given key. */ unset: function(key) { return this._op(key, '', 'unset'); }, generateGUID: function() { return generateGuid(); }, identify: function(userData) { var appId = ''; if ($ionicCoreSettings.get('app_id')) { appId = $ionicCoreSettings.get('app_id') } else { appId = $ionicApp.getId(); } if (!userData.user_id) { var msg = 'You must supply a unique user_id field.'; throw new Error(msg) } // Copy all the data into our user object angular.extend(user, userData); // Write the user object to our local storage persistentStorage.storeObject(storageKeyName, user); return $http.post($ionicApp.getApiUrl() + '/api/v1/app/' + appId + '/users/identify', userData); }, identifyAnonymous: function() { var appId = ''; if ($ionicCoreSettings.get('app_id')) { appId = $ionicCoreSettings.get('app_id') } else { appId = $ionicApp.getId(); } userData = {}; userData['user_id'] = generateGuid(); userData['isAnonymous'] = true; // Copy all the data into our user object angular.extend(user, userData); // Write the user object to our local storage persistentStorage.storeObject(storageKeyName, user); return $http.post($ionicApp.getApiUrl() + '/api/v1/app/' + appId + '/users/identify', userData); }, get: function() { return user; } } }]) // Auto-generated configuration factory .factory('$ionicCoreSettings', function() { var settings = {"app_id":"702e0a7f","api_key":"6ae47edda48ad3c0b6238bfb099b71b3c56af629c46bf09e","dev_push":true}; return { get: function(setting) { if (settings[setting]) { return settings[setting]; } return null; } } }) // Auto-generated configuration factory .run(['$ionicApp', function($ionicApp) { console.log('Ionic Core: init'); $ionicApp.bootstrap(); }]);
{ "content_hash": "5ea27d63ba0a4989b4c4d8a64ef7dc97", "timestamp": "", "source": "github", "line_count": 468, "max_line_length": 292, "avg_line_length": 28.905982905982906, "alnum_prop": 0.5698551153163809, "repo_name": "Laylan/E-sim", "id": "13606d59769d39f6d7b1b338b361cec6648ac514", "size": "13528", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "www/lib/ionic-service-core/ionic-core.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1093138" }, { "name": "HTML", "bytes": "158542" }, { "name": "JavaScript", "bytes": "4432154" }, { "name": "Shell", "bytes": "616" } ], "symlink_target": "" }
import log from 'loglevel'; import Immutable from 'immutable'; import {EVENT_ACTION_TYPES} from './actionTypes'; import clientSettingsStore from './clientSettingsStore'; const LOGGER = log.getLogger('eventReducer'); /** * The event reducer handles backend-event actions. * These are equivalent to the event handlers in the backend as they modify the room state. * * @param {Immutable.Map} state * @param {object} action * @returns {Immutable.Map} the modified state */ function eventReducer(state, action) { const {event} = action; // currently, events from other rooms do not affect us (backend should not send such events in the first place) // so we do not modify our client-side state in any way if (state.get('roomId') !== event.roomId) { LOGGER.warn(`Event with different roomId received. localRoomId=${state.get('roomId')}, eventRoomId=${event.roomId} (${event.name})`); return state; } const matchingHandler = eventActionHandlers[action.type]; if (!matchingHandler) { LOGGER.warn('No matching backend-event handler for', action); return state; } let modifiedState = matchingHandler.fn(state, event.payload, event) || state; modifiedState = updateActionLog(matchingHandler.log, state, modifiedState, event); return modifiedState; } /** * adds a log message for a backend event to the state. * * @param {undefined | string | function} logObject defined in event handlers. If this is a function: username, eventPayload, oldState and newState will be passed. * @param {Immutable.Map} oldState The state before the action was reduced * @param {Immutable.Map} modifiedState The state after the action was reduced * @param {object} event * @returns {Immutable.Map} The new state containing updated actionLog */ function updateActionLog(logObject, oldState, modifiedState, event) { if (!logObject) { return modifiedState; } const matchingUser = modifiedState.getIn(['users', event.userId]); const username = matchingUser ? matchingUser.get('username') || '' : ''; const message = (typeof logObject === 'function') ? logObject(username, event.payload, oldState, modifiedState, event) : logObject; return modifiedState.update('actionLog', new Immutable.List(), log => log.push(new Immutable.Map({ tstamp: new Date(), message }))); } /** * Map of event handlers. * * Defines the modification (application/reduction) a backend event performs on our state. * Also defines an optional log function or string (this is separated intentionally - even though it is technically also a modification to the state). * * TODO: decide/discuss whether we should split these up into separate files (similar to backend) */ const eventActionHandlers = { /** * If the user joins a room that does not yet exist, it is created by the backend. * It will be followed by a "roomJoined" event. */ [EVENT_ACTION_TYPES.roomCreated]: { fn: (state) => state, log: (username, payload) => `Room "${payload.id}" created` }, /** * A user joined the room. This can be either your own user or someone else joined the room. */ [EVENT_ACTION_TYPES.joinedRoom]: { fn: (state, payload, event) => { if (state.get('userId')) { // if our client state has already a userId set, this event indicates that someone else joined return state.setIn(['users', payload.userId], Immutable.fromJS(payload.users[payload.userId])); } else { // you joined // set the page title document.title = `PoinZ - ${event.roomId}`; clientSettingsStore.setPresetUserId(payload.userId); clientSettingsStore.addRoomToHistory(event.roomId); // server sends current room state (users, stories, etc.) return state .set('roomId', event.roomId) .set('userId', payload.userId) .set('selectedStory', payload.selectedStory) .set('users', Immutable.fromJS(payload.users || {})) .set('stories', Immutable.fromJS(payload.stories || {})); } }, log: (username, payload, oldState, newState) => { return (oldState.get('userId')) ? `User ${username} joined` : `You joined room "${newState.get('roomId')}"`; } }, /** * A user left the room. This can be either your own user. Or someone else left the room. */ [EVENT_ACTION_TYPES.leftRoom]: { fn: (state, payload) => { const isOwnUser = state.get('userId') === payload.userId; if (isOwnUser) { // you (or you in another browser) left the room // set the page title document.title = 'PoinZ'; // let's clear some state return state .remove('userId') .remove('roomId') .remove('stories') .remove('users') .remove('selectedStory') .remove('userMenuShown') .remove('logShown') .remove('backlogShown') .set('roomHistory', Immutable.fromJS(clientSettingsStore.getRoomHistory())) .set('actionLog', new Immutable.List()); } else { // someone else left the room return state .update('stories', stories => stories.map(story => story.removeIn(['estimations', payload.userId]))) // remove leaving user's estimations from all stories .removeIn(['users', payload.userId]); // then remove user from room } }, log: (username, payload, oldState) => `User ${oldState.getIn(['users', payload.userId, 'username'])} left the room` }, /** * A disconnected user was kicked from the room. */ [EVENT_ACTION_TYPES.kicked]: { fn: (state, payload) => { return state .update('stories', stories => stories.map(story => story.removeIn(['estimations', payload.userId]))) // remove kicked user's estimations from all stories .removeIn(['users', payload.userId]); // then remove user from room }, log: (username, payload, oldState, newState, event) => `User ${oldState.getIn(['users', payload.userId, 'username'])} was kicked from the room by user ${newState.getIn(['users', event.userId, 'username'])}` }, /** * A user in the room lost the connection to the server. */ [EVENT_ACTION_TYPES.connectionLost]: { fn: (state, payload) => state.updateIn(['users', payload.userId], user => user ? user.set('disconnected', true) : undefined), log: (username) =>`${username} lost the connection` }, [EVENT_ACTION_TYPES.storyAdded]: { fn: (state, payload) => { const newStory = Immutable.fromJS(payload); return state.update('stories', stories => stories.set(payload.id, newStory)); }, log: (username, payload) => `${username} added new story "${payload.title}"` }, [EVENT_ACTION_TYPES.storyChanged]: { fn: (state, payload, event) => { state = state .setIn(['stories', payload.storyId, 'title'], payload.title) .setIn(['stories', payload.storyId, 'description'], payload.description); const isOwnUser = state.get('userId') === event.userId; if (isOwnUser) { // if you yourself changed the story, disable edit mode state = state.setIn(['stories', payload.storyId, 'editMode'], false); } return state; }, log: (username, payload) => `${username} changed story "${payload.title}"` }, /** * the selected story was set (i.e. the one that can be currently estimated by the team) */ [EVENT_ACTION_TYPES.storySelected]: { fn: (state, payload) => state.set('selectedStory', payload.storyId), log: (username, payload, oldState, newState) => `${username} selected current story "${newState.getIn(['stories', payload.storyId]).get('title')}"` }, [EVENT_ACTION_TYPES.usernameSet]: { fn: (state, payload) => { const isOwnUser = state.get('userId') === payload.userId; if (isOwnUser) { clientSettingsStore.setPresetUsername(payload.username); state = state.set('presetUsername', payload.username); } return state .updateIn(['users', payload.userId], user => user.set('username', payload.username)); }, log: (username, payload, oldState) => { const oldUsername = oldState.getIn(['users', payload.userId]).get('username'); if (oldUsername) { return `"${oldState.getIn(['users', payload.userId]).get('username')}" is now called "${payload.username}"`; } } }, [EVENT_ACTION_TYPES.emailSet]: { fn: (state, payload) => { const isOwnUser = state.get('userId') === payload.userId; if (isOwnUser) { clientSettingsStore.setPresetEmail(payload.email); } return state .updateIn(['users', payload.userId], user => user.set('email', payload.email)) .set('presetEmail', payload.email); }, log: (username, payload, oldState) => `${oldState.getIn(['users', payload.userId]).get('username')} set his/her email address` }, /** * visitor flag for a user was set */ [EVENT_ACTION_TYPES.visitorSet]: { fn: (state, payload) => state.updateIn(['users', payload.userId], person => person.set('visitor', true)), log: username => `${username} is now visitor` }, /** * visitor flag for a user was removed / unset */ [EVENT_ACTION_TYPES.visitorUnset]: { fn: (state, payload) => state.updateIn(['users', payload.userId], person => person.set('visitor', false)), log: username => `${username} is no longer visitor` }, [EVENT_ACTION_TYPES.storyEstimateGiven]: { fn: (state, payload) => state.setIn(['stories', payload.storyId, 'estimations', payload.userId], payload.value) // do not log -> if user is uncertain and switches between cards -> gives hints to other colleagues }, [EVENT_ACTION_TYPES.storyEstimateCleared]: { fn: (state, payload) => state.removeIn(['stories', payload.storyId, 'estimations', payload.userId]) // do not log -> if user is uncertain and switches between cards -> gives hints to other colleagues }, [EVENT_ACTION_TYPES.revealed]: { fn: (state, payload) => state.setIn(['stories', payload.storyId, 'revealed'], true), log: (username, payload) => payload.manually ? `${username} manually revealed estimates for the current story` : 'Estimates were automatically revealed for the current story' }, [EVENT_ACTION_TYPES.newEstimationRoundStarted]: { fn: (state, payload) => state .setIn(['stories', payload.storyId, 'estimations'], new Immutable.Map()) .setIn(['stories', payload.storyId, 'revealed'], false), log: username => `${username} started a new estimation round for the current story` }, [EVENT_ACTION_TYPES.commandRejected]: { fn: (state, payload, event) => LOGGER.error(event), log: (username, payload) => `An error occurred: ${payload.reason}` } }; export default eventReducer;
{ "content_hash": "3e64fb2c8e2f053dc250d1d70ec7260c", "timestamp": "", "source": "github", "line_count": 284, "max_line_length": 210, "avg_line_length": 38.017605633802816, "alnum_prop": 0.6508289339631379, "repo_name": "adrianbaertschi/poinz", "id": "76c7b522d10bf6ac6d753c7984ce200b39a3b780", "size": "10797", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "client/app/services/eventReducer.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "12987" }, { "name": "HTML", "bytes": "389" }, { "name": "JavaScript", "bytes": "197195" }, { "name": "Shell", "bytes": "697" } ], "symlink_target": "" }
using System; using System.Text; using System.Security.Permissions; using System.Runtime.Serialization; using OpenADK.Library; using OpenADK.Library.Global; using OpenADK.Library.us.Common; namespace OpenADK.Library.us.Instr{ /// <summary>Description of location of resource, i.e. location in library or URL, community resource, outside resource supplier.</summary> /// <remarks> /// /// <para>Author: Generated by adkgen</para> /// <para>Version: 2.6</para> /// <para>Since: 1.5r1</para> /// </remarks> [Serializable] public class ResourceLocation : SifKeyedElement { /// <summary> /// Creates an instance of a ResourceLocation /// </summary> public ResourceLocation() : base ( InstrDTD.RESOURCELOCATION ){} /// <summary> /// Constructor that accepts values for all mandatory fields /// </summary> ///<param name="referenceType">A qualifying attribute for the ResourceLocation payload. If ReferenceType is "URI", the payload contains a web address where the resource can be found.</param> ///<param name="value">Gets or sets the content value of the &amp;lt;ResourceLocation&amp;gt; element</param> /// public ResourceLocation( ReferenceType referenceType, string value ) : base( InstrDTD.RESOURCELOCATION ) { this.SetReferenceType( referenceType ); this.Value = value; } /// <summary> /// Constructor used by the .Net Serialization formatter /// </summary> [SecurityPermission( SecurityAction.Demand, SerializationFormatter=true )] protected ResourceLocation( SerializationInfo info, StreamingContext context ) : base( info, context ) {} /// <summary> /// Gets the metadata fields that make up the key of this object /// </summary> /// <value> /// an array of metadata fields that make up the object's key /// </value> public override IElementDef[] KeyFields { get { return new IElementDef[] { InstrDTD.RESOURCELOCATION_REFERENCETYPE }; } } /// <summary> /// Gets or sets the value of the <c>&lt;ResourceLocation&gt;</c> element. /// </summary> /// <value> The <c>Value</c> of the content of this object.</value> /// <remarks> /// <para>The SIF specification defines the meaning of this of the content as: "Gets or sets the content value of the &amp;lt;ResourceLocation&amp;gt; element"</para> /// <para>Version: 2.6</para> /// <para>Since: 1.5r1</para> /// </remarks> public string Value { get { return (string) GetSifSimpleFieldValue( InstrDTD.RESOURCELOCATION ) ; } set { SetFieldValue( InstrDTD.RESOURCELOCATION, new SifString( value ), value ); } } /// <summary> /// Gets or sets the value of the <c>ReferenceType</c> attribute. /// </summary> /// <value> The <c>ReferenceType</c> attribute of this object.</value> /// <remarks> /// <para>The SIF specification defines the meaning of this attribute as: "A qualifying attribute for the ResourceLocation payload. If ReferenceType is "URI", the payload contains a web address where the resource can be found."</para> /// <para>Version: 2.6</para> /// <para>Since: 1.5r1</para> /// </remarks> public string ReferenceType { get { return GetFieldValue( InstrDTD.RESOURCELOCATION_REFERENCETYPE ); } set { SetField( InstrDTD.RESOURCELOCATION_REFERENCETYPE, value ); } } /// <summary> /// Sets the value of the <c>ReferenceType</c> attribute. /// </summary> /// <param name="val">A ReferenceType object</param> /// <remarks> /// <para>The SIF specification defines the meaning of this attribute as: "A qualifying attribute for the ResourceLocation payload. If ReferenceType is "URI", the payload contains a web address where the resource can be found."</para> /// <para>Version: 2.6</para> /// <para>Since: 1.5r1</para> /// </remarks> public void SetReferenceType( ReferenceType val ) { SetField( InstrDTD.RESOURCELOCATION_REFERENCETYPE, val ); } }}
{ "content_hash": "7e3230f1bed344046d03d315c56f7bdc", "timestamp": "", "source": "github", "line_count": 109, "max_line_length": 235, "avg_line_length": 35, "alnum_prop": 0.7077326343381389, "repo_name": "open-adk/OpenADK-csharp", "id": "5dbe03d3649ead9139965ac657ebe0c9808a5b0b", "size": "3978", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/us/sdo/Instr/ResourceLocation.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "16903092" } ], "symlink_target": "" }
<?xml version="1.0" ?><!DOCTYPE TS><TS language="zh_CN" version="2.0"> <defaultcodec>UTF-8</defaultcodec> <context> <name>AboutDialog</name> <message> <location filename="../forms/aboutdialog.ui" line="+14"/> <source>About Neutrino</source> <translation>关于莱特币</translation> </message> <message> <location line="+39"/> <source>&lt;b&gt;Neutrino&lt;/b&gt; version</source> <translation>&lt;b&gt;莱特币&lt;/b&gt;版本</translation> </message> <message> <location line="+57"/> <source> This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young ([email protected]) and UPnP software written by Thomas Bernard.</source> <translation> This is experimental software. Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young ([email protected]) and UPnP software written by Thomas Bernard.</translation> </message> <message> <location filename="../aboutdialog.cpp" line="+14"/> <source>Copyright</source> <translation>版权</translation> </message> <message> <location line="+0"/> <source>The Neutrino developers</source> <translation>Neutrino-qt 客户端开发团队</translation> </message> </context> <context> <name>AddressBookPage</name> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>Address Book</source> <translation>通讯录</translation> </message> <message> <location line="+19"/> <source>Double-click to edit address or label</source> <translation>双击以编辑地址或标签</translation> </message> <message> <location line="+27"/> <source>Create a new address</source> <translation>创建新地址</translation> </message> <message> <location line="+14"/> <source>Copy the currently selected address to the system clipboard</source> <translation>复制当前选中地址到系统剪贴板</translation> </message> <message> <location line="-11"/> <source>&amp;New Address</source> <translation>&amp;新建地址</translation> </message> <message> <location filename="../addressbookpage.cpp" line="+63"/> <source>These are your Neutrino addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source> <translation>这是您用来收款的莱特币地址。为了标记不同的资金来源,建议为每个付款人保留不同的收款地址。</translation> </message> <message> <location filename="../forms/addressbookpage.ui" line="+14"/> <source>&amp;Copy Address</source> <translation>&amp;复制地址</translation> </message> <message> <location line="+11"/> <source>Show &amp;QR Code</source> <translation>显示二维码</translation> </message> <message> <location line="+11"/> <source>Sign a message to prove you own a Neutrino address</source> <translation>签名消息,证明这个地址属于您。</translation> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation>对消息签名</translation> </message> <message> <location line="+25"/> <source>Delete the currently selected address from the list</source> <translation>从列表中删除选中的地址</translation> </message> <message> <location line="+27"/> <source>Export the data in the current tab to a file</source> <translation>导出当前数据到文件</translation> </message> <message> <location line="+3"/> <source>&amp;Export</source> <translation>&amp;导出</translation> </message> <message> <location line="-44"/> <source>Verify a message to ensure it was signed with a specified Neutrino address</source> <translation>验证消息,确保消息是由指定的莱特币地址签名过的。</translation> </message> <message> <location line="+3"/> <source>&amp;Verify Message</source> <translation>&amp;验证消息</translation> </message> <message> <location line="+14"/> <source>&amp;Delete</source> <translation>&amp;删除</translation> </message> <message> <location filename="../addressbookpage.cpp" line="-5"/> <source>These are your Neutrino addresses for sending payments. Always check the amount and the receiving address before sending coins.</source> <translation>这是您用来付款的莱特币地址。在付款前,请总是核实付款金额和收款地址。</translation> </message> <message> <location line="+13"/> <source>Copy &amp;Label</source> <translation>复制 &amp;标签</translation> </message> <message> <location line="+1"/> <source>&amp;Edit</source> <translation>&amp;编辑</translation> </message> <message> <location line="+1"/> <source>Send &amp;Coins</source> <translation>付款</translation> </message> <message> <location line="+260"/> <source>Export Address Book Data</source> <translation>导出通讯录数据</translation> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>逗号分隔文件 (*.csv)</translation> </message> <message> <location line="+13"/> <source>Error exporting</source> <translation>导出错误</translation> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation>无法写入文件 %1。</translation> </message> </context> <context> <name>AddressTableModel</name> <message> <location filename="../addresstablemodel.cpp" line="+144"/> <source>Label</source> <translation>标签</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>地址</translation> </message> <message> <location line="+36"/> <source>(no label)</source> <translation>(没有标签)</translation> </message> </context> <context> <name>AskPassphraseDialog</name> <message> <location filename="../forms/askpassphrasedialog.ui" line="+26"/> <source>Passphrase Dialog</source> <translation>密码对话框</translation> </message> <message> <location line="+21"/> <source>Enter passphrase</source> <translation>输入密码</translation> </message> <message> <location line="+14"/> <source>New passphrase</source> <translation>新密码</translation> </message> <message> <location line="+14"/> <source>Repeat new passphrase</source> <translation>重复新密码</translation> </message> <message> <location filename="../askpassphrasedialog.cpp" line="+33"/> <source>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;10 or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source> <translation>输入钱包的新密码。&lt;br/&gt;使用的密码请至少包含&lt;b&gt;10个以上随机字符&lt;/&gt;,或者是&lt;b&gt;8个以上的单词&lt;/b&gt;。</translation> </message> <message> <location line="+1"/> <source>Encrypt wallet</source> <translation>加密钱包</translation> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation>该操作需要您首先使用密码解锁钱包。</translation> </message> <message> <location line="+5"/> <source>Unlock wallet</source> <translation>解锁钱包</translation> </message> <message> <location line="+3"/> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation>该操作需要您首先使用密码解密钱包。</translation> </message> <message> <location line="+5"/> <source>Decrypt wallet</source> <translation>解密钱包</translation> </message> <message> <location line="+3"/> <source>Change passphrase</source> <translation>修改密码</translation> </message> <message> <location line="+1"/> <source>Enter the old and new passphrase to the wallet.</source> <translation>请输入钱包的旧密码与新密码。</translation> </message> <message> <location line="+46"/> <source>Confirm wallet encryption</source> <translation>确认加密钱包</translation> </message> <message> <location line="+1"/> <source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR NEUTRINOS&lt;/b&gt;!</source> <translation>警告:如果您加密了您的钱包,但是忘记了密码,你将会&lt;b&gt;丢失所有的莱特币&lt;/b&gt;!</translation> </message> <message> <location line="+0"/> <source>Are you sure you wish to encrypt your wallet?</source> <translation>您确定需要为钱包加密吗?</translation> </message> <message> <location line="+15"/> <source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source> <translation>重要提示:您以前备份的钱包文件应该替换成最新生成的加密钱包文件(重新备份)。从安全性上考虑,您以前备份的未加密的钱包文件,在您使用新的加密钱包后将无效,请重新备份。</translation> </message> <message> <location line="+100"/> <location line="+24"/> <source>Warning: The Caps Lock key is on!</source> <translation>警告:大写锁定键处于打开状态!</translation> </message> <message> <location line="-130"/> <location line="+58"/> <source>Wallet encrypted</source> <translation>钱包已加密</translation> </message> <message> <location line="-56"/> <source>Neutrino will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your neutrinos from being stolen by malware infecting your computer.</source> <translation>将关闭软件以完成加密过程。 请您谨记:钱包加密并不是万能的,电脑中毒,您的莱特币还是有可能丢失。</translation> </message> <message> <location line="+13"/> <location line="+7"/> <location line="+42"/> <location line="+6"/> <source>Wallet encryption failed</source> <translation>钱包加密失败</translation> </message> <message> <location line="-54"/> <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source> <translation>由于一个本地错误,加密钱包操作已经失败。您的钱包没有被加密。</translation> </message> <message> <location line="+7"/> <location line="+48"/> <source>The supplied passphrases do not match.</source> <translation>密码不匹配。</translation> </message> <message> <location line="-37"/> <source>Wallet unlock failed</source> <translation>钱包解锁失败</translation> </message> <message> <location line="+1"/> <location line="+11"/> <location line="+19"/> <source>The passphrase entered for the wallet decryption was incorrect.</source> <translation>用于解密钱包的密码不正确。</translation> </message> <message> <location line="-20"/> <source>Wallet decryption failed</source> <translation>钱包解密失败。</translation> </message> <message> <location line="+14"/> <source>Wallet passphrase was successfully changed.</source> <translation>修改钱包密码成功。</translation> </message> </context> <context> <name>BitcoinGUI</name> <message> <location filename="../bitcoingui.cpp" line="+233"/> <source>Sign &amp;message...</source> <translation>对&amp;消息签名...</translation> </message> <message> <location line="+280"/> <source>Synchronizing with network...</source> <translation>正在与网络同步...</translation> </message> <message> <location line="-349"/> <source>&amp;Overview</source> <translation>&amp;概况</translation> </message> <message> <location line="+1"/> <source>Show general overview of wallet</source> <translation>显示钱包概况</translation> </message> <message> <location line="+20"/> <source>&amp;Transactions</source> <translation>&amp;交易记录</translation> </message> <message> <location line="+1"/> <source>Browse transaction history</source> <translation>查看交易历史</translation> </message> <message> <location line="+7"/> <source>Edit the list of stored addresses and labels</source> <translation>修改存储的地址和标签列表</translation> </message> <message> <location line="-14"/> <source>Show the list of addresses for receiving payments</source> <translation>显示接收支付的地址列表</translation> </message> <message> <location line="+31"/> <source>E&amp;xit</source> <translation>退出</translation> </message> <message> <location line="+1"/> <source>Quit application</source> <translation>退出程序</translation> </message> <message> <location line="+4"/> <source>Show information about Neutrino</source> <translation>显示莱特币的相关信息</translation> </message> <message> <location line="+2"/> <source>About &amp;Qt</source> <translation>关于 &amp;Qt</translation> </message> <message> <location line="+1"/> <source>Show information about Qt</source> <translation>显示Qt相关信息</translation> </message> <message> <location line="+2"/> <source>&amp;Options...</source> <translation>&amp;选项...</translation> </message> <message> <location line="+6"/> <source>&amp;Encrypt Wallet...</source> <translation>&amp;加密钱包...</translation> </message> <message> <location line="+3"/> <source>&amp;Backup Wallet...</source> <translation>&amp;备份钱包...</translation> </message> <message> <location line="+2"/> <source>&amp;Change Passphrase...</source> <translation>&amp;修改密码...</translation> </message> <message> <location line="+285"/> <source>Importing blocks from disk...</source> <translation>正在从磁盘导入数据块...</translation> </message> <message> <location line="+3"/> <source>Reindexing blocks on disk...</source> <translation>正在为数据块建立索引...</translation> </message> <message> <location line="-347"/> <source>Send coins to a Neutrino address</source> <translation>向一个莱特币地址发送莱特币</translation> </message> <message> <location line="+49"/> <source>Modify configuration options for Neutrino</source> <translation>设置选项</translation> </message> <message> <location line="+9"/> <source>Backup wallet to another location</source> <translation>备份钱包到其它文件夹</translation> </message> <message> <location line="+2"/> <source>Change the passphrase used for wallet encryption</source> <translation>修改钱包加密口令</translation> </message> <message> <location line="+6"/> <source>&amp;Debug window</source> <translation>&amp;调试窗口</translation> </message> <message> <location line="+1"/> <source>Open debugging and diagnostic console</source> <translation>在诊断控制台调试</translation> </message> <message> <location line="-4"/> <source>&amp;Verify message...</source> <translation>&amp;验证消息...</translation> </message> <message> <location line="-165"/> <location line="+530"/> <source>Neutrino</source> <translation>莱特币</translation> </message> <message> <location line="-530"/> <source>Wallet</source> <translation>钱包</translation> </message> <message> <location line="+101"/> <source>&amp;Send</source> <translation>&amp;发送</translation> </message> <message> <location line="+7"/> <source>&amp;Receive</source> <translation>&amp;接收</translation> </message> <message> <location line="+14"/> <source>&amp;Addresses</source> <translation>&amp;地址</translation> </message> <message> <location line="+22"/> <source>&amp;About Neutrino</source> <translation>&amp;关于莱特币</translation> </message> <message> <location line="+9"/> <source>&amp;Show / Hide</source> <translation>&amp;显示 / 隐藏</translation> </message> <message> <location line="+1"/> <source>Show or hide the main Window</source> <translation>显示或隐藏主窗口</translation> </message> <message> <location line="+3"/> <source>Encrypt the private keys that belong to your wallet</source> <translation>对钱包中的私钥加密</translation> </message> <message> <location line="+7"/> <source>Sign messages with your Neutrino addresses to prove you own them</source> <translation>用莱特币地址关联的私钥为消息签名,以证明您拥有这个莱特币地址</translation> </message> <message> <location line="+2"/> <source>Verify messages to ensure they were signed with specified Neutrino addresses</source> <translation>校验消息,确保该消息是由指定的莱特币地址所有者签名的</translation> </message> <message> <location line="+28"/> <source>&amp;File</source> <translation>&amp;文件</translation> </message> <message> <location line="+7"/> <source>&amp;Settings</source> <translation>&amp;设置</translation> </message> <message> <location line="+6"/> <source>&amp;Help</source> <translation>&amp;帮助</translation> </message> <message> <location line="+9"/> <source>Tabs toolbar</source> <translation>分页工具栏</translation> </message> <message> <location line="+17"/> <location line="+10"/> <source>[testnet]</source> <translation>[testnet]</translation> </message> <message> <location line="+47"/> <source>Neutrino client</source> <translation>莱特币客户端</translation> </message> <message numerus="yes"> <location line="+141"/> <source>%n active connection(s) to Neutrino network</source> <translation><numerusform>到莱特币网络的连接共有%n条</numerusform></translation> </message> <message> <location line="+22"/> <source>No block source available...</source> <translation>No block source available...</translation> </message> <message> <location line="+12"/> <source>Processed %1 of %2 (estimated) blocks of transaction history.</source> <translation>%1 / %2 个交易历史的区块已下载</translation> </message> <message> <location line="+4"/> <source>Processed %1 blocks of transaction history.</source> <translation>已处理 %1 个交易历史数据块。</translation> </message> <message numerus="yes"> <location line="+20"/> <source>%n hour(s)</source> <translation><numerusform>%n 小时前</numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n day(s)</source> <translation><numerusform>%n 天前</numerusform></translation> </message> <message numerus="yes"> <location line="+4"/> <source>%n week(s)</source> <translation><numerusform>%n 周前</numerusform></translation> </message> <message> <location line="+4"/> <source>%1 behind</source> <translation>落后 %1 </translation> </message> <message> <location line="+14"/> <source>Last received block was generated %1 ago.</source> <translation>最新收到的区块产生于 %1。</translation> </message> <message> <location line="+2"/> <source>Transactions after this will not yet be visible.</source> <translation>在此之后的交易尚未可见</translation> </message> <message> <location line="+22"/> <source>Error</source> <translation>错误</translation> </message> <message> <location line="+3"/> <source>Warning</source> <translation>警告</translation> </message> <message> <location line="+3"/> <source>Information</source> <translation>信息</translation> </message> <message> <location line="+70"/> <source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source> <translation>该交易的字节数超标。您可以选择支付%1的交易费给处理您的交易的网络节点,有助于莱特币网络的运行。您愿意支付这笔交易费用吗?</translation> </message> <message> <location line="-140"/> <source>Up to date</source> <translation>最新状态</translation> </message> <message> <location line="+31"/> <source>Catching up...</source> <translation>更新中...</translation> </message> <message> <location line="+113"/> <source>Confirm transaction fee</source> <translation>确认交易费</translation> </message> <message> <location line="+8"/> <source>Sent transaction</source> <translation>已发送交易</translation> </message> <message> <location line="+0"/> <source>Incoming transaction</source> <translation>流入交易</translation> </message> <message> <location line="+1"/> <source>Date: %1 Amount: %2 Type: %3 Address: %4 </source> <translation>日期: %1 金额: %2 类别: %3 地址: %4 </translation> </message> <message> <location line="+33"/> <location line="+23"/> <source>URI handling</source> <translation>URI 处理</translation> </message> <message> <location line="-23"/> <location line="+23"/> <source>URI can not be parsed! This can be caused by an invalid Neutrino address or malformed URI parameters.</source> <translation>URI无法解析!原因可能是莱特币地址不正确,或者URI参数错误。</translation> </message> <message> <location line="+17"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation>钱包已被&lt;b&gt;加密&lt;/b&gt;,当前为&lt;b&gt;解锁&lt;/b&gt;状态</translation> </message> <message> <location line="+8"/> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation>钱包已被&lt;b&gt;加密&lt;/b&gt;,当前为&lt;b&gt;锁定&lt;/b&gt;状态</translation> </message> <message> <location filename="../bitcoin.cpp" line="+111"/> <source>A fatal error occurred. Neutrino can no longer continue safely and will quit.</source> <translation>发生严重错误。</translation> </message> </context> <context> <name>ClientModel</name> <message> <location filename="../clientmodel.cpp" line="+104"/> <source>Network Alert</source> <translation>网络警报</translation> </message> </context> <context> <name>EditAddressDialog</name> <message> <location filename="../forms/editaddressdialog.ui" line="+14"/> <source>Edit Address</source> <translation>编辑地址</translation> </message> <message> <location line="+11"/> <source>&amp;Label</source> <translation>&amp;标签</translation> </message> <message> <location line="+10"/> <source>The label associated with this address book entry</source> <translation>与此地址条目关联的标签</translation> </message> <message> <location line="+7"/> <source>&amp;Address</source> <translation>&amp;地址</translation> </message> <message> <location line="+10"/> <source>The address associated with this address book entry. This can only be modified for sending addresses.</source> <translation>该地址与地址簿中的条目已关联,无法作为发送地址编辑。</translation> </message> <message> <location filename="../editaddressdialog.cpp" line="+21"/> <source>New receiving address</source> <translation>新接收地址</translation> </message> <message> <location line="+4"/> <source>New sending address</source> <translation>新发送地址</translation> </message> <message> <location line="+3"/> <source>Edit receiving address</source> <translation>编辑接收地址</translation> </message> <message> <location line="+4"/> <source>Edit sending address</source> <translation>编辑发送地址</translation> </message> <message> <location line="+76"/> <source>The entered address &quot;%1&quot; is already in the address book.</source> <translation>输入的地址 &quot;%1&quot; 已经存在于地址簿。</translation> </message> <message> <location line="-5"/> <source>The entered address &quot;%1&quot; is not a valid Neutrino address.</source> <translation>您输入的 &quot;%1&quot; 不是合法的莱特币地址.</translation> </message> <message> <location line="+10"/> <source>Could not unlock wallet.</source> <translation>无法解锁钱包</translation> </message> <message> <location line="+5"/> <source>New key generation failed.</source> <translation>密钥创建失败.</translation> </message> </context> <context> <name>GUIUtil::HelpMessageBox</name> <message> <location filename="../guiutil.cpp" line="+424"/> <location line="+12"/> <source>Neutrino-Qt</source> <translation>Neutrino-Qt</translation> </message> <message> <location line="-12"/> <source>version</source> <translation>版本</translation> </message> <message> <location line="+2"/> <source>Usage:</source> <translation>使用:</translation> </message> <message> <location line="+1"/> <source>command-line options</source> <translation>命令行选项</translation> </message> <message> <location line="+4"/> <source>UI options</source> <translation>UI选项</translation> </message> <message> <location line="+1"/> <source>Set language, for example &quot;de_DE&quot; (default: system locale)</source> <translation>设置语言, 例如 &quot;de_DE&quot; (缺省: 系统语言)</translation> </message> <message> <location line="+1"/> <source>Start minimized</source> <translation>启动时最小化 </translation> </message> <message> <location line="+1"/> <source>Show splash screen on startup (default: 1)</source> <translation>启动时显示版权页 (缺省: 1)</translation> </message> </context> <context> <name>OptionsDialog</name> <message> <location filename="../forms/optionsdialog.ui" line="+14"/> <source>Options</source> <translation>选项</translation> </message> <message> <location line="+16"/> <source>&amp;Main</source> <translation>&amp;主要的</translation> </message> <message> <location line="+6"/> <source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source> <translation type="unfinished"/> </message> <message> <location line="+15"/> <source>Pay transaction &amp;fee</source> <translation>支付交易 &amp;费用</translation> </message> <message> <location line="+31"/> <source>Automatically start Neutrino after logging in to the system.</source> <translation>登录系统后自动开启莱特币客户端</translation> </message> <message> <location line="+3"/> <source>&amp;Start Neutrino on system login</source> <translation>启动时&amp;运行</translation> </message> <message> <location line="+35"/> <source>Reset all client options to default.</source> <translation>恢复客户端的缺省设置</translation> </message> <message> <location line="+3"/> <source>&amp;Reset Options</source> <translation>恢复缺省设置</translation> </message> <message> <location line="+13"/> <source>&amp;Network</source> <translation>&amp;网络</translation> </message> <message> <location line="+6"/> <source>Automatically open the Neutrino client port on the router. This only works when your router supports UPnP and it is enabled.</source> <translation>自动在路由器中打开莱特币端口。只有当您的路由器开启 UPnP 选项时此功能才有效。</translation> </message> <message> <location line="+3"/> <source>Map port using &amp;UPnP</source> <translation>使用 &amp;UPnP 映射端口</translation> </message> <message> <location line="+7"/> <source>Connect to the Neutrino network through a SOCKS proxy (e.g. when connecting through Tor).</source> <translation>通过代理服务器连接莱特币网络(例如:通过Tor连接)</translation> </message> <message> <location line="+3"/> <source>&amp;Connect through SOCKS proxy:</source> <translation>&amp;通过Socks代理连接:</translation> </message> <message> <location line="+9"/> <source>Proxy &amp;IP:</source> <translation>代理服务器&amp;IP:</translation> </message> <message> <location line="+19"/> <source>IP address of the proxy (e.g. 127.0.0.1)</source> <translation>代理服务器IP (如 127.0.0.1)</translation> </message> <message> <location line="+7"/> <source>&amp;Port:</source> <translation>&amp;端口:</translation> </message> <message> <location line="+19"/> <source>Port of the proxy (e.g. 9050)</source> <translation>代理端口(例如 9050)</translation> </message> <message> <location line="+7"/> <source>SOCKS &amp;Version:</source> <translation>Socks &amp;版本</translation> </message> <message> <location line="+13"/> <source>SOCKS version of the proxy (e.g. 5)</source> <translation>Socks代理版本 (例如 5)</translation> </message> <message> <location line="+36"/> <source>&amp;Window</source> <translation>&amp;窗口</translation> </message> <message> <location line="+6"/> <source>Show only a tray icon after minimizing the window.</source> <translation>最小化窗口后仅显示托盘图标</translation> </message> <message> <location line="+3"/> <source>&amp;Minimize to the tray instead of the taskbar</source> <translation>&amp;最小化到托盘</translation> </message> <message> <location line="+7"/> <source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source> <translation>当窗口关闭时程序最小化而不是退出。当使用该选项时,程序只能通过在菜单中选择退出来关闭</translation> </message> <message> <location line="+3"/> <source>M&amp;inimize on close</source> <translation>单击关闭按钮最小化</translation> </message> <message> <location line="+21"/> <source>&amp;Display</source> <translation>&amp;显示</translation> </message> <message> <location line="+8"/> <source>User Interface &amp;language:</source> <translation>用户界面&amp;语言:</translation> </message> <message> <location line="+13"/> <source>The user interface language can be set here. This setting will take effect after restarting Neutrino.</source> <translation>在这里设置用户界面的语言。设置将在客户端重启后生效。</translation> </message> <message> <location line="+11"/> <source>&amp;Unit to show amounts in:</source> <translation>&amp;莱特币金额单位:</translation> </message> <message> <location line="+13"/> <source>Choose the default subdivision unit to show in the interface and when sending coins.</source> <translation>选择莱特币单位。</translation> </message> <message> <location line="+9"/> <source>Whether to show Neutrino addresses in the transaction list or not.</source> <translation>是否需要在交易清单中显示莱特币地址。</translation> </message> <message> <location line="+3"/> <source>&amp;Display addresses in transaction list</source> <translation>在交易清单中&amp;显示莱特币地址</translation> </message> <message> <location line="+71"/> <source>&amp;OK</source> <translation>&amp;确定</translation> </message> <message> <location line="+7"/> <source>&amp;Cancel</source> <translation>&amp;取消</translation> </message> <message> <location line="+10"/> <source>&amp;Apply</source> <translation>&amp;应用</translation> </message> <message> <location filename="../optionsdialog.cpp" line="+53"/> <source>default</source> <translation>缺省</translation> </message> <message> <location line="+130"/> <source>Confirm options reset</source> <translation>确认恢复缺省设置</translation> </message> <message> <location line="+1"/> <source>Some settings may require a client restart to take effect.</source> <translation>某些设置选项需要重启客户端才能生效</translation> </message> <message> <location line="+0"/> <source>Do you want to proceed?</source> <translation>您希望继续吗?</translation> </message> <message> <location line="+42"/> <location line="+9"/> <source>Warning</source> <translation>警告</translation> </message> <message> <location line="-9"/> <location line="+9"/> <source>This setting will take effect after restarting Neutrino.</source> <translation>需要重启客户端软件才能生效。</translation> </message> <message> <location line="+29"/> <source>The supplied proxy address is invalid.</source> <translation>提供的代理服务器地址无效。</translation> </message> </context> <context> <name>OverviewPage</name> <message> <location filename="../forms/overviewpage.ui" line="+14"/> <source>Form</source> <translation>表单</translation> </message> <message> <location line="+50"/> <location line="+166"/> <source>The displayed information may be out of date. Your wallet automatically synchronizes with the Neutrino network after a connection is established, but this process has not completed yet.</source> <translation>现在显示的消息可能是过期的. 在连接上莱特币网络节点后,您的钱包将自动与网络同步,但是这个过程还没有完成.</translation> </message> <message> <location line="-124"/> <source>Balance:</source> <translation>余额:</translation> </message> <message> <location line="+29"/> <source>Unconfirmed:</source> <translation>未确认:</translation> </message> <message> <location line="-78"/> <source>Wallet</source> <translation>钱包</translation> </message> <message> <location line="+107"/> <source>Immature:</source> <translation>未成熟的:</translation> </message> <message> <location line="+13"/> <source>Mined balance that has not yet matured</source> <translation>尚未成熟的挖矿收入余额</translation> </message> <message> <location line="+46"/> <source>&lt;b&gt;Recent transactions&lt;/b&gt;</source> <translation>&lt;b&gt;最近交易记录&lt;/b&gt;</translation> </message> <message> <location line="-101"/> <source>Your current balance</source> <translation>您的当前余额</translation> </message> <message> <location line="+29"/> <source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source> <translation>尚未确认的交易总额, 未计入当前余额</translation> </message> <message> <location filename="../overviewpage.cpp" line="+116"/> <location line="+1"/> <source>out of sync</source> <translation>数据同步中</translation> </message> </context> <context> <name>PaymentServer</name> <message> <location filename="../paymentserver.cpp" line="+107"/> <source>Cannot start neutrino: click-to-pay handler</source> <translation>暂时无法启动莱特币:点击支付功能</translation> </message> </context> <context> <name>QRCodeDialog</name> <message> <location filename="../forms/qrcodedialog.ui" line="+14"/> <source>QR Code Dialog</source> <translation>二维码对话框</translation> </message> <message> <location line="+59"/> <source>Request Payment</source> <translation>请求付款</translation> </message> <message> <location line="+56"/> <source>Amount:</source> <translation>金额:</translation> </message> <message> <location line="-44"/> <source>Label:</source> <translation>标签:</translation> </message> <message> <location line="+19"/> <source>Message:</source> <translation>消息:</translation> </message> <message> <location line="+71"/> <source>&amp;Save As...</source> <translation>&amp;另存为</translation> </message> <message> <location filename="../qrcodedialog.cpp" line="+62"/> <source>Error encoding URI into QR Code.</source> <translation>将 URI 转换成二维码失败.</translation> </message> <message> <location line="+40"/> <source>The entered amount is invalid, please check.</source> <translation>输入的金额非法,请检查。</translation> </message> <message> <location line="+23"/> <source>Resulting URI too long, try to reduce the text for label / message.</source> <translation>URI 太长, 请试着精简标签/消息的内容.</translation> </message> <message> <location line="+25"/> <source>Save QR Code</source> <translation>保存二维码</translation> </message> <message> <location line="+0"/> <source>PNG Images (*.png)</source> <translation>PNG图像文件(*.png)</translation> </message> </context> <context> <name>RPCConsole</name> <message> <location filename="../forms/rpcconsole.ui" line="+46"/> <source>Client name</source> <translation>客户端名称</translation> </message> <message> <location line="+10"/> <location line="+23"/> <location line="+26"/> <location line="+23"/> <location line="+23"/> <location line="+36"/> <location line="+53"/> <location line="+23"/> <location line="+23"/> <location filename="../rpcconsole.cpp" line="+339"/> <source>N/A</source> <translation>不可用</translation> </message> <message> <location line="-217"/> <source>Client version</source> <translation>客户端版本</translation> </message> <message> <location line="-45"/> <source>&amp;Information</source> <translation>&amp;信息</translation> </message> <message> <location line="+68"/> <source>Using OpenSSL version</source> <translation>使用OpenSSL版本</translation> </message> <message> <location line="+49"/> <source>Startup time</source> <translation>启动时间</translation> </message> <message> <location line="+29"/> <source>Network</source> <translation>网络</translation> </message> <message> <location line="+7"/> <source>Number of connections</source> <translation>连接数</translation> </message> <message> <location line="+23"/> <source>On testnet</source> <translation>当前为莱特币测试网络</translation> </message> <message> <location line="+23"/> <source>Block chain</source> <translation>数据链</translation> </message> <message> <location line="+7"/> <source>Current number of blocks</source> <translation>当前数据块数量</translation> </message> <message> <location line="+23"/> <source>Estimated total blocks</source> <translation>预计数据块数量</translation> </message> <message> <location line="+23"/> <source>Last block time</source> <translation>上一数据块时间</translation> </message> <message> <location line="+52"/> <source>&amp;Open</source> <translation>&amp;打开</translation> </message> <message> <location line="+16"/> <source>Command-line options</source> <translation>命令行选项</translation> </message> <message> <location line="+7"/> <source>Show the Neutrino-Qt help message to get a list with possible Neutrino command-line options.</source> <translation>显示Neutrino命令行选项帮助信息</translation> </message> <message> <location line="+3"/> <source>&amp;Show</source> <translation>&amp;显示</translation> </message> <message> <location line="+24"/> <source>&amp;Console</source> <translation>&amp;控制台</translation> </message> <message> <location line="-260"/> <source>Build date</source> <translation>创建时间</translation> </message> <message> <location line="-104"/> <source>Neutrino - Debug window</source> <translation>莱特币 - 调试窗口</translation> </message> <message> <location line="+25"/> <source>Neutrino Core</source> <translation>莱特币核心</translation> </message> <message> <location line="+279"/> <source>Debug log file</source> <translation>调试日志文件</translation> </message> <message> <location line="+7"/> <source>Open the Neutrino debug log file from the current data directory. This can take a few seconds for large log files.</source> <translation>打开当前目录中的调试日志文件。日志文件大的话可能要等上几秒钟。</translation> </message> <message> <location line="+102"/> <source>Clear console</source> <translation>清空控制台</translation> </message> <message> <location filename="../rpcconsole.cpp" line="-30"/> <source>Welcome to the Neutrino RPC console.</source> <translation>欢迎来到 RPC 控制台.</translation> </message> <message> <location line="+1"/> <source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source> <translation>使用上下方向键浏览历史, &lt;b&gt;Ctrl-L&lt;/b&gt;清除屏幕.</translation> </message> <message> <location line="+1"/> <source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation>使用 &lt;b&gt;help&lt;/b&gt; 命令显示帮助信息.</translation> </message> </context> <context> <name>SendCoinsDialog</name> <message> <location filename="../forms/sendcoinsdialog.ui" line="+14"/> <location filename="../sendcoinsdialog.cpp" line="+124"/> <location line="+5"/> <location line="+5"/> <location line="+5"/> <location line="+6"/> <location line="+5"/> <location line="+5"/> <source>Send Coins</source> <translation>发送货币</translation> </message> <message> <location line="+50"/> <source>Send to multiple recipients at once</source> <translation>一次发送给多个接收者</translation> </message> <message> <location line="+3"/> <source>Add &amp;Recipient</source> <translation>添加收款人</translation> </message> <message> <location line="+20"/> <source>Remove all transaction fields</source> <translation>移除所有交易项</translation> </message> <message> <location line="+3"/> <source>Clear &amp;All</source> <translation>清除 &amp;所有</translation> </message> <message> <location line="+22"/> <source>Balance:</source> <translation>余额:</translation> </message> <message> <location line="+10"/> <source>123.456 BTC</source> <translation>123.456 BTC</translation> </message> <message> <location line="+31"/> <source>Confirm the send action</source> <translation>确认并发送货币</translation> </message> <message> <location line="+3"/> <source>S&amp;end</source> <translation>发送</translation> </message> <message> <location filename="../sendcoinsdialog.cpp" line="-59"/> <source>&lt;b&gt;%1&lt;/b&gt; to %2 (%3)</source> <translation>&lt;b&gt;%1&lt;/b&gt; 到 %2 (%3)</translation> </message> <message> <location line="+5"/> <source>Confirm send coins</source> <translation>确认发送货币</translation> </message> <message> <location line="+1"/> <source>Are you sure you want to send %1?</source> <translation>确定您要发送 %1?</translation> </message> <message> <location line="+0"/> <source> and </source> <translation> 和 </translation> </message> <message> <location line="+23"/> <source>The recipient address is not valid, please recheck.</source> <translation>收款人地址不合法,请检查。</translation> </message> <message> <location line="+5"/> <source>The amount to pay must be larger than 0.</source> <translation>支付金额必须大于0.</translation> </message> <message> <location line="+5"/> <source>The amount exceeds your balance.</source> <translation>金额超出您的账上余额。</translation> </message> <message> <location line="+5"/> <source>The total exceeds your balance when the %1 transaction fee is included.</source> <translation>计入 %1 交易费后的金额超出您的账上余额。</translation> </message> <message> <location line="+6"/> <source>Duplicate address found, can only send to each address once per send operation.</source> <translation>发现重复的地址, 每次只能对同一地址发送一次.</translation> </message> <message> <location line="+5"/> <source>Error: Transaction creation failed!</source> <translation>错误:创建交易失败!</translation> </message> <message> <location line="+5"/> <source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation>错误: 交易被拒绝. 如果您使用的是备份钱包,可能存在两个钱包不同步的情况,另一个钱包中的莱特币已经被使用,但本地的这个钱包尚没有记录。</translation> </message> </context> <context> <name>SendCoinsEntry</name> <message> <location filename="../forms/sendcoinsentry.ui" line="+14"/> <source>Form</source> <translation>表单</translation> </message> <message> <location line="+15"/> <source>A&amp;mount:</source> <translation>金额</translation> </message> <message> <location line="+13"/> <source>Pay &amp;To:</source> <translation>付款&amp;给:</translation> </message> <message> <location line="+34"/> <source>The address to send the payment to (e.g. NWLUgn7gx13fUXShLiEHLMcGRjXwqFAUNC)</source> <translation>付款给这个地址 (例如 NWLUgn7gx13fUXShLiEHLMcGRjXwqFAUNC)</translation> </message> <message> <location line="+60"/> <location filename="../sendcoinsentry.cpp" line="+26"/> <source>Enter a label for this address to add it to your address book</source> <translation>为这个地址输入一个标签,以便将它添加到您的地址簿</translation> </message> <message> <location line="-78"/> <source>&amp;Label:</source> <translation>&amp;标签:</translation> </message> <message> <location line="+28"/> <source>Choose address from address book</source> <translation>从地址簿选择地址</translation> </message> <message> <location line="+10"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="+7"/> <source>Paste address from clipboard</source> <translation>从剪贴板粘贴地址</translation> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location line="+7"/> <source>Remove this recipient</source> <translation>移除此接收者</translation> </message> <message> <location filename="../sendcoinsentry.cpp" line="+1"/> <source>Enter a Neutrino address (e.g. NWLUgn7gx13fUXShLiEHLMcGRjXwqFAUNC)</source> <translation>请输入莱特币地址 (例如: NWLUgn7gx13fUXShLiEHLMcGRjXwqFAUNC)</translation> </message> </context> <context> <name>SignVerifyMessageDialog</name> <message> <location filename="../forms/signverifymessagedialog.ui" line="+14"/> <source>Signatures - Sign / Verify a Message</source> <translation>签名 - 为消息签名/验证签名消息</translation> </message> <message> <location line="+13"/> <source>&amp;Sign Message</source> <translation>&amp;签名消息</translation> </message> <message> <location line="+6"/> <source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source> <translation>您可以用你的地址对消息进行签名,以证明您是该地址的所有人。注意不要对模棱两可的消息签名,以免遭受钓鱼式攻击。请确保消息内容准确的表达了您的真实意愿。</translation> </message> <message> <location line="+18"/> <source>The address to sign the message with (e.g. NWLUgn7gx13fUXShLiEHLMcGRjXwqFAUNC)</source> <translation>用于签名消息的地址(例如: NWLUgn7gx13fUXShLiEHLMcGRjXwqFAUNC)</translation> </message> <message> <location line="+10"/> <location line="+213"/> <source>Choose an address from the address book</source> <translation>从地址簿选择地址</translation> </message> <message> <location line="-203"/> <location line="+213"/> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <location line="-203"/> <source>Paste address from clipboard</source> <translation>从剪贴板粘贴地址</translation> </message> <message> <location line="+10"/> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <location line="+12"/> <source>Enter the message you want to sign here</source> <translation>请输入您要发送的签名消息</translation> </message> <message> <location line="+7"/> <source>Signature</source> <translation>签名</translation> </message> <message> <location line="+27"/> <source>Copy the current signature to the system clipboard</source> <translation>复制当前签名至剪切板</translation> </message> <message> <location line="+21"/> <source>Sign the message to prove you own this Neutrino address</source> <translation>签名消息,证明这个地址属于您。</translation> </message> <message> <location line="+3"/> <source>Sign &amp;Message</source> <translation>消息签名</translation> </message> <message> <location line="+14"/> <source>Reset all sign message fields</source> <translation>清空所有签名消息栏</translation> </message> <message> <location line="+3"/> <location line="+146"/> <source>Clear &amp;All</source> <translation>清除 &amp;所有</translation> </message> <message> <location line="-87"/> <source>&amp;Verify Message</source> <translation>&amp;验证消息</translation> </message> <message> <location line="+6"/> <source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source> <translation>在下面输入签名地址,消息(请确保换行符、空格符、制表符等等一个不漏)和签名以验证消息。请确保签名信息准确,提防中间人攻击。</translation> </message> <message> <location line="+21"/> <source>The address the message was signed with (e.g. NWLUgn7gx13fUXShLiEHLMcGRjXwqFAUNC)</source> <translation>用于签名消息的地址(例如: NWLUgn7gx13fUXShLiEHLMcGRjXwqFAUNC)</translation> </message> <message> <location line="+40"/> <source>Verify the message to ensure it was signed with the specified Neutrino address</source> <translation>验证消息,确保消息是由指定的莱特币地址签名过的。</translation> </message> <message> <location line="+3"/> <source>Verify &amp;Message</source> <translation>验证消息签名</translation> </message> <message> <location line="+14"/> <source>Reset all verify message fields</source> <translation>清空所有验证消息栏</translation> </message> <message> <location filename="../signverifymessagedialog.cpp" line="+27"/> <location line="+3"/> <source>Enter a Neutrino address (e.g. NWLUgn7gx13fUXShLiEHLMcGRjXwqFAUNC)</source> <translation>请输入莱特币地址 (例如: NWLUgn7gx13fUXShLiEHLMcGRjXwqFAUNC)</translation> </message> <message> <location line="-2"/> <source>Click &quot;Sign Message&quot; to generate signature</source> <translation>单击“签名消息“产生签名。</translation> </message> <message> <location line="+3"/> <source>Enter Neutrino signature</source> <translation>输入莱特币签名</translation> </message> <message> <location line="+82"/> <location line="+81"/> <source>The entered address is invalid.</source> <translation>输入的地址非法。</translation> </message> <message> <location line="-81"/> <location line="+8"/> <location line="+73"/> <location line="+8"/> <source>Please check the address and try again.</source> <translation>请检查地址后重试。</translation> </message> <message> <location line="-81"/> <location line="+81"/> <source>The entered address does not refer to a key.</source> <translation>输入的地址没有关联的公私钥对。</translation> </message> <message> <location line="-73"/> <source>Wallet unlock was cancelled.</source> <translation>钱包解锁动作取消。</translation> </message> <message> <location line="+8"/> <source>Private key for the entered address is not available.</source> <translation>找不到输入地址关联的私钥。</translation> </message> <message> <location line="+12"/> <source>Message signing failed.</source> <translation>消息签名失败。</translation> </message> <message> <location line="+5"/> <source>Message signed.</source> <translation>消息已签名。</translation> </message> <message> <location line="+59"/> <source>The signature could not be decoded.</source> <translation>签名无法解码。</translation> </message> <message> <location line="+0"/> <location line="+13"/> <source>Please check the signature and try again.</source> <translation>请检查签名后重试。</translation> </message> <message> <location line="+0"/> <source>The signature did not match the message digest.</source> <translation>签名与消息摘要不匹配。</translation> </message> <message> <location line="+7"/> <source>Message verification failed.</source> <translation>消息验证失败。</translation> </message> <message> <location line="+5"/> <source>Message verified.</source> <translation>消息验证成功。</translation> </message> </context> <context> <name>SplashScreen</name> <message> <location filename="../splashscreen.cpp" line="+22"/> <source>The Neutrino developers</source> <translation>Neutrino-qt 客户端开发团队</translation> </message> <message> <location line="+1"/> <source>[testnet]</source> <translation>[testnet]</translation> </message> </context> <context> <name>TransactionDesc</name> <message> <location filename="../transactiondesc.cpp" line="+20"/> <source>Open until %1</source> <translation>至 %1 个数据块时开启</translation> </message> <message> <location line="+6"/> <source>%1/offline</source> <translation>%1 / 离线</translation> </message> <message> <location line="+2"/> <source>%1/unconfirmed</source> <translation>%1/未确认</translation> </message> <message> <location line="+2"/> <source>%1 confirmations</source> <translation>%1 确认项</translation> </message> <message> <location line="+18"/> <source>Status</source> <translation>状态</translation> </message> <message numerus="yes"> <location line="+7"/> <source>, broadcast through %n node(s)</source> <translation><numerusform>通过 %n 个节点广播</numerusform></translation> </message> <message> <location line="+4"/> <source>Date</source> <translation>日期</translation> </message> <message> <location line="+7"/> <source>Source</source> <translation>源</translation> </message> <message> <location line="+0"/> <source>Generated</source> <translation>生成</translation> </message> <message> <location line="+5"/> <location line="+17"/> <source>From</source> <translation>来自</translation> </message> <message> <location line="+1"/> <location line="+22"/> <location line="+58"/> <source>To</source> <translation>到</translation> </message> <message> <location line="-77"/> <location line="+2"/> <source>own address</source> <translation>自己的地址</translation> </message> <message> <location line="-2"/> <source>label</source> <translation>标签</translation> </message> <message> <location line="+37"/> <location line="+12"/> <location line="+45"/> <location line="+17"/> <location line="+30"/> <source>Credit</source> <translation>收入</translation> </message> <message numerus="yes"> <location line="-102"/> <source>matures in %n more block(s)</source> <translation><numerusform>将在 %n 个数据块后成熟</numerusform></translation> </message> <message> <location line="+2"/> <source>not accepted</source> <translation>未被接受</translation> </message> <message> <location line="+44"/> <location line="+8"/> <location line="+15"/> <location line="+30"/> <source>Debit</source> <translation>支出</translation> </message> <message> <location line="-39"/> <source>Transaction fee</source> <translation>交易费</translation> </message> <message> <location line="+16"/> <source>Net amount</source> <translation>净额</translation> </message> <message> <location line="+6"/> <source>Message</source> <translation>消息</translation> </message> <message> <location line="+2"/> <source>Comment</source> <translation>备注</translation> </message> <message> <location line="+2"/> <source>Transaction ID</source> <translation>交易ID</translation> </message> <message> <location line="+3"/> <source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to &quot;not accepted&quot; and it won&apos;t be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation>新挖出的莱特币必须等确120个确认才能使用。您生产出的数据块,将被广播到全网并添加到数据块链。如果入链失败,状态将变为“未被接受”,意味着您的数据块竞争失败,挖出的莱特币将不能使用。当某个节点先于你几秒生产出新的数据块,这种情况会偶尔发生。</translation> </message> <message> <location line="+7"/> <source>Debug information</source> <translation>调试信息</translation> </message> <message> <location line="+8"/> <source>Transaction</source> <translation>交易</translation> </message> <message> <location line="+3"/> <source>Inputs</source> <translation>输入</translation> </message> <message> <location line="+23"/> <source>Amount</source> <translation>金额</translation> </message> <message> <location line="+1"/> <source>true</source> <translation>正确</translation> </message> <message> <location line="+0"/> <source>false</source> <translation>错误</translation> </message> <message> <location line="-209"/> <source>, has not been successfully broadcast yet</source> <translation>, 未被成功广播</translation> </message> <message numerus="yes"> <location line="-35"/> <source>Open for %n more block(s)</source> <translation><numerusform>Open for %n more block</numerusform></translation> </message> <message> <location line="+70"/> <source>unknown</source> <translation>未知</translation> </message> </context> <context> <name>TransactionDescDialog</name> <message> <location filename="../forms/transactiondescdialog.ui" line="+14"/> <source>Transaction details</source> <translation>交易明细</translation> </message> <message> <location line="+6"/> <source>This pane shows a detailed description of the transaction</source> <translation>当前面板显示了交易的详细信息</translation> </message> </context> <context> <name>TransactionTableModel</name> <message> <location filename="../transactiontablemodel.cpp" line="+225"/> <source>Date</source> <translation>日期</translation> </message> <message> <location line="+0"/> <source>Type</source> <translation>类型</translation> </message> <message> <location line="+0"/> <source>Address</source> <translation>地址</translation> </message> <message> <location line="+0"/> <source>Amount</source> <translation>数量</translation> </message> <message numerus="yes"> <location line="+57"/> <source>Open for %n more block(s)</source> <translation><numerusform>Open for %n more block</numerusform></translation> </message> <message> <location line="+3"/> <source>Open until %1</source> <translation>至 %1 个数据块时开启</translation> </message> <message> <location line="+3"/> <source>Offline (%1 confirmations)</source> <translation>离线 (%1 个确认项)</translation> </message> <message> <location line="+3"/> <source>Unconfirmed (%1 of %2 confirmations)</source> <translation>未确认 (%1 / %2 条确认信息)</translation> </message> <message> <location line="+3"/> <source>Confirmed (%1 confirmations)</source> <translation>已确认 (%1 条确认信息)</translation> </message> <message numerus="yes"> <location line="+8"/> <source>Mined balance will be available when it matures in %n more block(s)</source> <translation><numerusform>挖矿收入余额将在 %n 个数据块后可用</numerusform></translation> </message> <message> <location line="+5"/> <source>This block was not received by any other nodes and will probably not be accepted!</source> <translation>此数据块未被其他节点接收,并可能不被接受!</translation> </message> <message> <location line="+3"/> <source>Generated but not accepted</source> <translation>已生成但未被接受</translation> </message> <message> <location line="+43"/> <source>Received with</source> <translation>接收于</translation> </message> <message> <location line="+2"/> <source>Received from</source> <translation>收款来自</translation> </message> <message> <location line="+3"/> <source>Sent to</source> <translation>发送到</translation> </message> <message> <location line="+2"/> <source>Payment to yourself</source> <translation>付款给自己</translation> </message> <message> <location line="+2"/> <source>Mined</source> <translation>挖矿所得</translation> </message> <message> <location line="+38"/> <source>(n/a)</source> <translation>(n/a)</translation> </message> <message> <location line="+199"/> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation>交易状态。 鼠标移到此区域上可显示确认消息项的数目。</translation> </message> <message> <location line="+2"/> <source>Date and time that the transaction was received.</source> <translation>接收莱特币的时间</translation> </message> <message> <location line="+2"/> <source>Type of transaction.</source> <translation>交易类别。</translation> </message> <message> <location line="+2"/> <source>Destination address of transaction.</source> <translation>交易目的地址。</translation> </message> <message> <location line="+2"/> <source>Amount removed from or added to balance.</source> <translation>从余额添加或移除的金额。</translation> </message> </context> <context> <name>TransactionView</name> <message> <location filename="../transactionview.cpp" line="+52"/> <location line="+16"/> <source>All</source> <translation>全部</translation> </message> <message> <location line="-15"/> <source>Today</source> <translation>今天</translation> </message> <message> <location line="+1"/> <source>This week</source> <translation>本周</translation> </message> <message> <location line="+1"/> <source>This month</source> <translation>本月</translation> </message> <message> <location line="+1"/> <source>Last month</source> <translation>上月</translation> </message> <message> <location line="+1"/> <source>This year</source> <translation>今年</translation> </message> <message> <location line="+1"/> <source>Range...</source> <translation>范围...</translation> </message> <message> <location line="+11"/> <source>Received with</source> <translation>接收于</translation> </message> <message> <location line="+2"/> <source>Sent to</source> <translation>发送到</translation> </message> <message> <location line="+2"/> <source>To yourself</source> <translation>到自己</translation> </message> <message> <location line="+1"/> <source>Mined</source> <translation>挖矿所得</translation> </message> <message> <location line="+1"/> <source>Other</source> <translation>其他</translation> </message> <message> <location line="+7"/> <source>Enter address or label to search</source> <translation>输入地址或标签进行搜索</translation> </message> <message> <location line="+7"/> <source>Min amount</source> <translation>最小金额</translation> </message> <message> <location line="+34"/> <source>Copy address</source> <translation>复制地址</translation> </message> <message> <location line="+1"/> <source>Copy label</source> <translation>复制标签</translation> </message> <message> <location line="+1"/> <source>Copy amount</source> <translation>复制金额</translation> </message> <message> <location line="+1"/> <source>Copy transaction ID</source> <translation>复制交易编号</translation> </message> <message> <location line="+1"/> <source>Edit label</source> <translation>编辑标签</translation> </message> <message> <location line="+1"/> <source>Show transaction details</source> <translation>显示交易详情</translation> </message> <message> <location line="+139"/> <source>Export Transaction Data</source> <translation>导出交易数据</translation> </message> <message> <location line="+1"/> <source>Comma separated file (*.csv)</source> <translation>逗号分隔文件(*.csv)</translation> </message> <message> <location line="+8"/> <source>Confirmed</source> <translation>已确认</translation> </message> <message> <location line="+1"/> <source>Date</source> <translation>日期</translation> </message> <message> <location line="+1"/> <source>Type</source> <translation>类别</translation> </message> <message> <location line="+1"/> <source>Label</source> <translation>标签</translation> </message> <message> <location line="+1"/> <source>Address</source> <translation>地址</translation> </message> <message> <location line="+1"/> <source>Amount</source> <translation>金额</translation> </message> <message> <location line="+1"/> <source>ID</source> <translation>ID</translation> </message> <message> <location line="+4"/> <source>Error exporting</source> <translation>导出错误</translation> </message> <message> <location line="+0"/> <source>Could not write to file %1.</source> <translation>无法写入文件 %1。</translation> </message> <message> <location line="+100"/> <source>Range:</source> <translation>范围:</translation> </message> <message> <location line="+8"/> <source>to</source> <translation>到</translation> </message> </context> <context> <name>WalletModel</name> <message> <location filename="../walletmodel.cpp" line="+193"/> <source>Send Coins</source> <translation>发送莱特币</translation> </message> </context> <context> <name>WalletView</name> <message> <location filename="../walletview.cpp" line="+42"/> <source>&amp;Export</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Export the data in the current tab to a file</source> <translation>导出当前数据到文件</translation> </message> <message> <location line="+193"/> <source>Backup Wallet</source> <translation>备份钱包</translation> </message> <message> <location line="+0"/> <source>Wallet Data (*.dat)</source> <translation>钱包文件(*.dat)</translation> </message> <message> <location line="+3"/> <source>Backup Failed</source> <translation>备份失败</translation> </message> <message> <location line="+0"/> <source>There was an error trying to save the wallet data to the new location.</source> <translation>备份钱包到其它文件夹失败.</translation> </message> <message> <location line="+4"/> <source>Backup Successful</source> <translation>备份成功</translation> </message> <message> <location line="+0"/> <source>The wallet data was successfully saved to the new location.</source> <translation>钱包数据成功存储到新位置</translation> </message> </context> <context> <name>bitcoin-core</name> <message> <location filename="../bitcoinstrings.cpp" line="+94"/> <source>Neutrino version</source> <translation>莱特币版本</translation> </message> <message> <location line="+102"/> <source>Usage:</source> <translation>使用:</translation> </message> <message> <location line="-29"/> <source>Send command to -server or neutrinod</source> <translation>发送命令到服务器或者 neutrinod </translation> </message> <message> <location line="-23"/> <source>List commands</source> <translation>列出命令 </translation> </message> <message> <location line="-12"/> <source>Get help for a command</source> <translation>获得某条命令的帮助 </translation> </message> <message> <location line="+24"/> <source>Options:</source> <translation>选项: </translation> </message> <message> <location line="+24"/> <source>Specify configuration file (default: neutrino.conf)</source> <translation>指定配置文件 (默认为 neutrino.conf) </translation> </message> <message> <location line="+3"/> <source>Specify pid file (default: neutrinod.pid)</source> <translation>指定 pid 文件 (默认为 neutrinod.pid) </translation> </message> <message> <location line="-1"/> <source>Specify data directory</source> <translation>指定数据目录 </translation> </message> <message> <location line="-9"/> <source>Set database cache size in megabytes (default: 25)</source> <translation>设置数据库缓冲区大小 (缺省: 25MB)</translation> </message> <message> <location line="-28"/> <source>Listen for connections on &lt;port&gt; (default: 8777 or testnet: 18777)</source> <translation>监听端口连接 &lt;port&gt; (缺省: 8777 or testnet: 18777)</translation> </message> <message> <location line="+5"/> <source>Maintain at most &lt;n&gt; connections to peers (default: 125)</source> <translation>最大连接数 &lt;n&gt; (缺省: 125)</translation> </message> <message> <location line="-48"/> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation>连接一个节点并获取对端地址, 然后断开连接</translation> </message> <message> <location line="+82"/> <source>Specify your own public address</source> <translation>指定您的公共地址</translation> </message> <message> <location line="+3"/> <source>Threshold for disconnecting misbehaving peers (default: 100)</source> <translation>Threshold for disconnecting misbehaving peers (缺省: 100)</translation> </message> <message> <location line="-134"/> <source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source> <translation>Number of seconds to keep misbehaving peers from reconnecting (缺省: 86400)</translation> </message> <message> <location line="-29"/> <source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source> <translation>设置RPC监听端口%u时发生错误, IPv4:%s</translation> </message> <message> <location line="+27"/> <source>Listen for JSON-RPC connections on &lt;port&gt; (default: 8776 or testnet: 18776)</source> <translation>JSON-RPC连接监听端口&lt;port&gt; (缺省:8776 testnet:18776)</translation> </message> <message> <location line="+37"/> <source>Accept command line and JSON-RPC commands</source> <translation>接受命令行和 JSON-RPC 命令 </translation> </message> <message> <location line="+76"/> <source>Run in the background as a daemon and accept commands</source> <translation>在后台运行并接受命令 </translation> </message> <message> <location line="+37"/> <source>Use the test network</source> <translation>使用测试网络 </translation> </message> <message> <location line="-112"/> <source>Accept connections from outside (default: 1 if no -proxy or -connect)</source> <translation>接受来自外部的连接 (缺省: 如果不带 -proxy or -connect 参数设置为1)</translation> </message> <message> <location line="-80"/> <source>%s, you must set a rpcpassword in the configuration file: %s It is recommended you use the following random password: rpcuser=neutrinorpc rpcpassword=%s (you do not need to remember this password) The username and password MUST NOT be the same. If the file does not exist, create it with owner-readable-only file permissions. It is also recommended to set alertnotify so you are notified of problems; for example: alertnotify=echo %%s | mail -s &quot;Neutrino Alert&quot; [email protected] </source> <translation>%s, 您必须在配置文件设置rpcpassword: %s 建议您使用下面的随机密码: rpcuser=neutrinorpc rpcpassword=%s (您无需记住此密码) 用户名和密码 必! 须! 不一样。 如果配置文件不存在,请自行建立一个只有所有者拥有只读权限的文件。 推荐您开启提示通知以便收到错误通知, 像这样: alertnotify=echo %%s | mail -s &quot;Neutrino Alert&quot; [email protected] </translation> </message> <message> <location line="+17"/> <source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source> <translation>在IPv6模式下设置RPC监听端口 %u 失败,返回到IPv4模式: %s</translation> </message> <message> <location line="+3"/> <source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source> <translation>绑定指定的IP地址开始监听。IPv6地址请使用[host]:port 格式</translation> </message> <message> <location line="+3"/> <source>Cannot obtain a lock on data directory %s. Neutrino is probably already running.</source> <translation>无法给数据目录 %s上锁。本软件可能已经在运行。</translation> </message> <message> <location line="+3"/> <source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation>错误:该交易被拒绝!发生这种错误的原因可能是:钱包中的莱特币已经被用掉,有可能您复制了wallet.dat钱包文件,然后用复制的钱包文件支付了莱特币,但是这个钱包文件中没有记录。</translation> </message> <message> <location line="+4"/> <source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source> <translation>错误:因为该交易的数量、复杂度或者动用了刚收到不久的资金,您需要支付不少于%s的交易费用。</translation> </message> <message> <location line="+3"/> <source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source> <translation>当收到相关通知时执行命令(命令行中的 %s 的替换为消息)</translation> </message> <message> <location line="+3"/> <source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source> <translation>当最佳区块变化时执行命令 (命令行中的 %s 会被替换成区块哈希值)</translation> </message> <message> <location line="+11"/> <source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source> <translation>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</translation> </message> <message> <location line="+6"/> <source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source> <translation>这是测试用的预发布版本 - 请谨慎使用 - 不要用来挖矿,或者在正式商用环境下使用</translation> </message> <message> <location line="+5"/> <source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source> <translation>警告:-paytxfee 交易费设置得太高了!每笔交易都将支付交易费。</translation> </message> <message> <location line="+3"/> <source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source> <translation>警告:显示的交易可能不正确!您需要升级客户端软件,或者网络上的其他节点需要升级。</translation> </message> <message> <location line="+3"/> <source>Warning: Please check that your computer&apos;s date and time are correct! If your clock is wrong Neutrino will not work properly.</source> <translation>警告:请检查电脑的日期时间设置是否正确!时间错误可能会导致莱特币客户端运行异常。</translation> </message> <message> <location line="+3"/> <source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source> <translation>警告:钱包文件wallet.dat读取失败!最重要的公钥、私钥数据都没有问题,但是交易记录或地址簿数据不正确,或者存在数据丢失。</translation> </message> <message> <location line="+3"/> <source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source> <translation>警告:钱包文件wallet.dat损坏! 原始的钱包文件已经备份到%s目录下并重命名为{timestamp}.bak 。如果您的账户余额或者交易记录不正确,请使用您的钱包备份文件恢复。</translation> </message> <message> <location line="+14"/> <source>Attempt to recover private keys from a corrupt wallet.dat</source> <translation>尝试从损坏的钱包文件wallet.dat中恢复私钥</translation> </message> <message> <location line="+2"/> <source>Block creation options:</source> <translation>数据块创建选项:</translation> </message> <message> <location line="+5"/> <source>Connect only to the specified node(s)</source> <translation>仅连接到指定节点</translation> </message> <message> <location line="+3"/> <source>Corrupted block database detected</source> <translation>检测发现数据块数据库损坏。请使用 -reindex参数重启客户端。</translation> </message> <message> <location line="+1"/> <source>Discover own IP address (default: 1 when listening and no -externalip)</source> <translation>发现自己的IP地址(缺省:不带 -externalip 参数监听时设置为1)</translation> </message> <message> <location line="+1"/> <source>Do you want to rebuild the block database now?</source> <translation>你想现在就重建块数据库吗?</translation> </message> <message> <location line="+2"/> <source>Error initializing block database</source> <translation>初始化数据块数据库出错</translation> </message> <message> <location line="+1"/> <source>Error initializing wallet database environment %s!</source> <translation>Error initializing wallet database environment %s!</translation> </message> <message> <location line="+1"/> <source>Error loading block database</source> <translation>导入数据块数据库出错</translation> </message> <message> <location line="+4"/> <source>Error opening block database</source> <translation>导入数据块数据库出错</translation> </message> <message> <location line="+2"/> <source>Error: Disk space is low!</source> <translation>错误:磁盘剩余空间低!</translation> </message> <message> <location line="+1"/> <source>Error: Wallet locked, unable to create transaction!</source> <translation>错误:钱包被锁定,无法创建交易!</translation> </message> <message> <location line="+1"/> <source>Error: system error: </source> <translation>错误:系统出错。</translation> </message> <message> <location line="+1"/> <source>Failed to listen on any port. Use -listen=0 if you want this.</source> <translation>监听端口失败。请使用 -listen=0 参数。</translation> </message> <message> <location line="+1"/> <source>Failed to read block info</source> <translation>无法读取数据块信息</translation> </message> <message> <location line="+1"/> <source>Failed to read block</source> <translation>读取数据块失败</translation> </message> <message> <location line="+1"/> <source>Failed to sync block index</source> <translation>无法同步数据块索引</translation> </message> <message> <location line="+1"/> <source>Failed to write block index</source> <translation>无法写入数据块索引</translation> </message> <message> <location line="+1"/> <source>Failed to write block info</source> <translation>无法写入数据块信息</translation> </message> <message> <location line="+1"/> <source>Failed to write block</source> <translation>无法写数据块</translation> </message> <message> <location line="+1"/> <source>Failed to write file info</source> <translation>无法写入文件信息</translation> </message> <message> <location line="+1"/> <source>Failed to write to coin database</source> <translation>无法写入coin数据库</translation> </message> <message> <location line="+1"/> <source>Failed to write transaction index</source> <translation>无法写入交易索引</translation> </message> <message> <location line="+1"/> <source>Failed to write undo data</source> <translation>无法写入回滚信息</translation> </message> <message> <location line="+2"/> <source>Find peers using DNS lookup (default: 1 unless -connect)</source> <translation>通过DNS查找节点(缺省:1 除非使用 -connect 选项)</translation> </message> <message> <location line="+1"/> <source>Generate coins (default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>How many blocks to check at startup (default: 288, 0 = all)</source> <translation>启动时检测多少个数据块(缺省:288,0=所有)</translation> </message> <message> <location line="+1"/> <source>How thorough the block verification is (0-4, default: 3)</source> <translation>How thorough the block verification is (0-4, default: 3)</translation> </message> <message> <location line="+19"/> <source>Not enough file descriptors available.</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Rebuild block chain index from current blk000??.dat files</source> <translation>重新为当前的blk000??.dat文件建立索引</translation> </message> <message> <location line="+16"/> <source>Set the number of threads to service RPC calls (default: 4)</source> <translation>设置使用调用服务 RPC 的线程数量(默认:4)</translation> </message> <message> <location line="+26"/> <source>Verifying blocks...</source> <translation>正在验证数据库的完整性...</translation> </message> <message> <location line="+1"/> <source>Verifying wallet...</source> <translation>正在检测钱包的完整性...</translation> </message> <message> <location line="-69"/> <source>Imports blocks from external blk000??.dat file</source> <translation>从blk000??.dat文件导入数据块</translation> </message> <message> <location line="-76"/> <source>Set the number of script verification threads (up to 16, 0 = auto, &lt;0 = leave that many cores free, default: 0)</source> <translation type="unfinished"/> </message> <message> <location line="+77"/> <source>Information</source> <translation>信息</translation> </message> <message> <location line="+3"/> <source>Invalid -tor address: &apos;%s&apos;</source> <translation>非法的 -tor 地址:&apos;%s&apos; </translation> </message> <message> <location line="+1"/> <source>Invalid amount for -minrelaytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Invalid amount for -mintxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation type="unfinished"/> </message> <message> <location line="+8"/> <source>Maintain a full transaction index (default: 0)</source> <translation>维护一份完整的交易索引(缺省:0)</translation> </message> <message> <location line="+2"/> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: 5000)</source> <translation>每个连接的最大接收缓存,&lt;n&gt;*1000 字节(缺省:5000)</translation> </message> <message> <location line="+1"/> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: 1000)</source> <translation>每个连接的最大发送缓存,&lt;n&gt;*1000 字节(缺省:1000)</translation> </message> <message> <location line="+2"/> <source>Only accept block chain matching built-in checkpoints (default: 1)</source> <translation>仅接受符合客户端检查点设置的数据块文件</translation> </message> <message> <location line="+1"/> <source>Only connect to nodes in network &lt;net&gt; (IPv4, IPv6 or Tor)</source> <translation>仅连接至指定网络的节点&lt;net&gt;(IPv4, IPv6 或者 Tor)</translation> </message> <message> <location line="+2"/> <source>Output extra debugging information. Implies all other -debug* options</source> <translation>输出额外的调试信息。打开所有 -debug* 开关</translation> </message> <message> <location line="+1"/> <source>Output extra network debugging information</source> <translation>输出额外的网络调试信息</translation> </message> <message> <location line="+2"/> <source>Prepend debug output with timestamp</source> <translation>为调试输出信息添加时间戳</translation> </message> <message> <location line="+5"/> <source>SSL options: (see the Neutrino Wiki for SSL setup instructions)</source> <translation>SSL选项:(参见Neutrino Wiki关于SSL设置栏目)</translation> </message> <message> <location line="+1"/> <source>Select the version of socks proxy to use (4-5, default: 5)</source> <translation>请选择Socks代理服务器版本 (4 或 5, 缺省: 5)</translation> </message> <message> <location line="+3"/> <source>Send trace/debug info to console instead of debug.log file</source> <translation>跟踪/调试信息输出到控制台,不输出到debug.log文件</translation> </message> <message> <location line="+1"/> <source>Send trace/debug info to debugger</source> <translation>跟踪/调试信息输出到 调试器debugger</translation> </message> <message> <location line="+5"/> <source>Set maximum block size in bytes (default: 250000)</source> <translation>设置最大数据块大小(缺省:250000)</translation> </message> <message> <location line="+1"/> <source>Set minimum block size in bytes (default: 0)</source> <translation>设置最小数据块大小(缺省:0)</translation> </message> <message> <location line="+2"/> <source>Shrink debug.log file on client startup (default: 1 when no -debug)</source> <translation>客户端启动时压缩debug.log文件(缺省:no-debug模式时为1)</translation> </message> <message> <location line="+1"/> <source>Signing transaction failed</source> <translation type="unfinished"/> </message> <message> <location line="+2"/> <source>Specify connection timeout in milliseconds (default: 5000)</source> <translation>设置连接超时时间(缺省:5000毫秒)</translation> </message> <message> <location line="+4"/> <source>System error: </source> <translation>系统错误:</translation> </message> <message> <location line="+4"/> <source>Transaction amount too small</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Transaction amounts must be positive</source> <translation type="unfinished"/> </message> <message> <location line="+1"/> <source>Transaction too large</source> <translation type="unfinished"/> </message> <message> <location line="+7"/> <source>Use UPnP to map the listening port (default: 0)</source> <translation>使用UPnp映射监听端口(缺省: 0)</translation> </message> <message> <location line="+1"/> <source>Use UPnP to map the listening port (default: 1 when listening)</source> <translation>使用UPnp映射监听端口(缺省: 监听状态设为1)</translation> </message> <message> <location line="+1"/> <source>Use proxy to reach tor hidden services (default: same as -proxy)</source> <translation>使用代理服务器访问隐藏服务(缺省:同 -proxy)</translation> </message> <message> <location line="+2"/> <source>Username for JSON-RPC connections</source> <translation>JSON-RPC连接用户名 </translation> </message> <message> <location line="+4"/> <source>Warning</source> <translation>警告</translation> </message> <message> <location line="+1"/> <source>Warning: This version is obsolete, upgrade required!</source> <translation>警告:该软件版本已过时,请升级!</translation> </message> <message> <location line="+1"/> <source>You need to rebuild the databases using -reindex to change -txindex</source> <translation>You need to rebuild the databases using -reindex to change -txindex</translation> </message> <message> <location line="+1"/> <source>wallet.dat corrupt, salvage failed</source> <translation>钱包文件wallet.dat损坏,抢救备份失败</translation> </message> <message> <location line="-50"/> <source>Password for JSON-RPC connections</source> <translation>JSON-RPC连接密码 </translation> </message> <message> <location line="-67"/> <source>Allow JSON-RPC connections from specified IP address</source> <translation>允许从指定IP接受到的JSON-RPC连接 </translation> </message> <message> <location line="+76"/> <source>Send commands to node running on &lt;ip&gt; (default: 127.0.0.1)</source> <translation>向IP地址为 &lt;ip&gt; 的节点发送指令 (缺省: 127.0.0.1) </translation> </message> <message> <location line="-120"/> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation>当最佳数据块变化时执行命令 (命令行中的 %s 会被替换成数据块哈希值)</translation> </message> <message> <location line="+147"/> <source>Upgrade wallet to latest format</source> <translation>将钱包升级到最新的格式</translation> </message> <message> <location line="-21"/> <source>Set key pool size to &lt;n&gt; (default: 100)</source> <translation>设置密钥池大小为 &lt;n&gt; (缺省: 100) </translation> </message> <message> <location line="-12"/> <source>Rescan the block chain for missing wallet transactions</source> <translation>重新扫描数据链以查找遗漏的交易 </translation> </message> <message> <location line="+35"/> <source>Use OpenSSL (https) for JSON-RPC connections</source> <translation>为 JSON-RPC 连接使用 OpenSSL (https)连接</translation> </message> <message> <location line="-26"/> <source>Server certificate file (default: server.cert)</source> <translation>服务器证书 (默认为 server.cert) </translation> </message> <message> <location line="+1"/> <source>Server private key (default: server.pem)</source> <translation>服务器私钥 (默认为 server.pem) </translation> </message> <message> <location line="-151"/> <source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source> <translation>可接受的加密器 (默认为 TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH) </translation> </message> <message> <location line="+165"/> <source>This help message</source> <translation>该帮助信息 </translation> </message> <message> <location line="+6"/> <source>Unable to bind to %s on this computer (bind returned error %d, %s)</source> <translation>无法绑定本机端口 %s (返回错误消息 %d, %s)</translation> </message> <message> <location line="-91"/> <source>Connect through socks proxy</source> <translation>通过 socks 代理连接</translation> </message> <message> <location line="-10"/> <source>Allow DNS lookups for -addnode, -seednode and -connect</source> <translation>使用 -addnode, -seednode 和 -connect选项时允许DNS查找</translation> </message> <message> <location line="+55"/> <source>Loading addresses...</source> <translation>正在加载地址...</translation> </message> <message> <location line="-35"/> <source>Error loading wallet.dat: Wallet corrupted</source> <translation>wallet.dat钱包文件加载错误:钱包损坏</translation> </message> <message> <location line="+1"/> <source>Error loading wallet.dat: Wallet requires newer version of Neutrino</source> <translation>wallet.dat钱包文件加载错误:请升级到最新Neutrino客户端</translation> </message> <message> <location line="+93"/> <source>Wallet needed to be rewritten: restart Neutrino to complete</source> <translation>钱包文件需要重写:请退出并重新启动Neutrino客户端</translation> </message> <message> <location line="-95"/> <source>Error loading wallet.dat</source> <translation>wallet.dat钱包文件加载错误</translation> </message> <message> <location line="+28"/> <source>Invalid -proxy address: &apos;%s&apos;</source> <translation>非法的代理地址: &apos;%s&apos;</translation> </message> <message> <location line="+56"/> <source>Unknown network specified in -onlynet: &apos;%s&apos;</source> <translation>被指定的是未知网络 -onlynet: &apos;%s&apos;</translation> </message> <message> <location line="-1"/> <source>Unknown -socks proxy version requested: %i</source> <translation>被指定的是未知socks代理版本: %i</translation> </message> <message> <location line="-96"/> <source>Cannot resolve -bind address: &apos;%s&apos;</source> <translation>无法解析 -bind 端口地址: &apos;%s&apos;</translation> </message> <message> <location line="+1"/> <source>Cannot resolve -externalip address: &apos;%s&apos;</source> <translation>无法解析 -externalip 地址: &apos;%s&apos;</translation> </message> <message> <location line="+44"/> <source>Invalid amount for -paytxfee=&lt;amount&gt;: &apos;%s&apos;</source> <translation>非法金额 -paytxfee=&lt;amount&gt;: &apos;%s&apos;</translation> </message> <message> <location line="+1"/> <source>Invalid amount</source> <translation>金额不对</translation> </message> <message> <location line="-6"/> <source>Insufficient funds</source> <translation>金额不足</translation> </message> <message> <location line="+10"/> <source>Loading block index...</source> <translation>加载数据块索引...</translation> </message> <message> <location line="-57"/> <source>Add a node to connect to and attempt to keep the connection open</source> <translation>添加节点并与其保持连接</translation> </message> <message> <location line="-25"/> <source>Unable to bind to %s on this computer. Neutrino is probably already running.</source> <translation>无法在本机绑定 %s 端口 . 莱特币客户端软件可能已经在运行.</translation> </message> <message> <location line="+64"/> <source>Fee per KB to add to transactions you send</source> <translation>每发送1KB交易所需的费用</translation> </message> <message> <location line="+19"/> <source>Loading wallet...</source> <translation>正在加载钱包...</translation> </message> <message> <location line="-52"/> <source>Cannot downgrade wallet</source> <translation>无法降级钱包格式</translation> </message> <message> <location line="+3"/> <source>Cannot write default address</source> <translation>无法写入缺省地址</translation> </message> <message> <location line="+64"/> <source>Rescanning...</source> <translation>正在重新扫描...</translation> </message> <message> <location line="-57"/> <source>Done loading</source> <translation>加载完成</translation> </message> <message> <location line="+82"/> <source>To use the %s option</source> <translation>使用 %s 选项</translation> </message> <message> <location line="-74"/> <source>Error</source> <translation>错误</translation> </message> <message> <location line="-31"/> <source>You must set rpcpassword=&lt;password&gt; in the configuration file: %s If the file does not exist, create it with owner-readable-only file permissions.</source> <translation>您必须在配置文件中加入选项 rpcpassword : %s 如果配置文件不存在,请新建,并将文件权限设置为仅允许文件所有者读取.</translation> </message> </context> </TS>
{ "content_hash": "c127a68c171ff6054ad11e05bdc2ecad", "timestamp": "", "source": "github", "line_count": 2960, "max_line_length": 395, "avg_line_length": 34.435135135135134, "alnum_prop": 0.6048092771368024, "repo_name": "neutrinofoundation/neutrino-digital-currency", "id": "1aeed5d4ff613b2ca74e6dedb561d32bab9a47f9", "size": "112168", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/qt/locale/bitcoin_zh_CN.ts", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "5064707" }, { "name": "C++", "bytes": "2646042" }, { "name": "CSS", "bytes": "1127" }, { "name": "Makefile", "bytes": "15730" }, { "name": "Objective-C", "bytes": "1052" }, { "name": "Objective-C++", "bytes": "5864" }, { "name": "Python", "bytes": "69719" }, { "name": "Shell", "bytes": "25903" } ], "symlink_target": "" }
/* Handles the procedure for adjusting styles in the preview area through the stylebar in the editor. */ // ----- Functions ----- // // Sets up an individual tool in the stylebar. function setupStyle(project, views, styleName) { views.stylebar.action(styleName, function (value) { var file = views.sidebar.activeFile(); views.stylebar.setStyle(styleName, value); views.editor.focus(); project.updateStyle(file, styleName, value); }); } // Builds the stylebar. function setup (project, views) { var styleTools = ['font_size', 'font_colour', 'background_colour', 'font_family', 'heading_family', 'heading_colour']; for (var i = styleTools.length - 1; i >= 0; i--) { setupStyle(project, views, styleTools[i]); } } // ----- Module Exports ----- // module.exports = { setup: setup };
{ "content_hash": "29818767b2adb424d5f2c4cebac68e50", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 77, "avg_line_length": 21.289473684210527, "alnum_prop": 0.6711990111248455, "repo_name": "Ap0c/didactylos", "id": "8c20333ac5d641d544f1e054517f2f3bd9a474b6", "size": "809", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "js/editor/style-tools.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "8062" }, { "name": "HTML", "bytes": "8556" }, { "name": "JavaScript", "bytes": "80505" } ], "symlink_target": "" }
import sbt._ import Keys._ import spray.revolver.RevolverPlugin._ object build extends Build { val gcsettings = Defaults.defaultSettings val gc = TaskKey[Unit]("gc", "runs garbage collector") val gcTask = gc := { println("requesting garbage collection") System gc() } lazy val project = Project ( "project", file("."), settings = gcsettings ++ Seq(gcTask) ++ Revolver.settings ) }
{ "content_hash": "8268fcb9271af4efb07918e072e9d8f9", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 61, "avg_line_length": 20.85, "alnum_prop": 0.6642685851318945, "repo_name": "mhamrah/stockman", "id": "2dc4e80a521808e1199eeeaa688f3355307322e4", "size": "417", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "project/build.scala", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "141" }, { "name": "JavaScript", "bytes": "13720" }, { "name": "Scala", "bytes": "28276" } ], "symlink_target": "" }
#ifndef __SOCK_H #define __SOCK_H #include <stdarg.h> #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #endif #ifdef HAVE_UNISTD_H #include <unistd.h> #elif _WIN32 #include <compat.h> #endif #ifdef HAVE_SYS_UIO_H #include <sys/uio.h> #else #ifndef _SYS_UIO_H struct iovec { void *iov_base; size_t iov_len; }; #endif #endif #if !defined(HAVE_INET_ATON) && defined(HAVE_INET_PTON) #define inet_aton(a,b) inet_pton(AF_INET, (a), (b)) #endif #ifdef INET6_ADDRSTRLEN #define MAX_ADDR_LEN INET6_ADDRSTRLEN #else #define MAX_ADDR_LEN 46 #endif typedef int sock_t; /* The following values are based on unix avoiding errno value clashes */ #define SOCK_SUCCESS 0 #define SOCK_ERROR -1 #define SOCK_TIMEOUT -2 #define SOCK_BLOCK 0 #define SOCK_NONBLOCK 1 /* sock connect macro */ #define sock_connect(h, p) sock_connect_wto(h, p, 0) #ifdef _mangle # define sock_initialize _mangle(sock_initialize) # define sock_shutdown _mangle(sock_shutdown) # define sock_get_localip _mangle(sock_get_localip) # define sock_error _mangle(sock_error) # define sock_recoverable _mangle(sock_recoverable) # define sock_stalled _mangle(sock_stalled) # define sock_valid_socket _mangle(sock_valid_socket) # define sock_set_blocking _mangle(sock_set_blocking) # define sock_set_nolinger _mangle(sock_set_nolinger) # define sock_set_nodelay _mangle(sock_set_nodelay) # define sock_set_keepalive _mangle(sock_set_keepalive) # define sock_close _mangle(sock_close) # define sock_connect_wto _mangle(sock_connect_wto) # define sock_connect_non_blocking _mangle(sock_connect_non_blocking) # define sock_connected _mangle(sock_connected) # define sock_write_bytes _mangle(sock_write_bytes) # define sock_write _mangle(sock_write) # define sock_write_fmt _mangle(sock_write_fmt) # define sock_write_string _mangle(sock_write_string) # define sock_writev _mangle(sock_writev) # define sock_read_bytes _mangle(sock_read_bytes) # define sock_read_line _mangle(sock_read_line) # define sock_get_server_socket _mangle(sock_get_server_socket) # define sock_listen _mangle(sock_listen) # define sock_accept _mangle(sock_accept) #endif /* Misc socket functions */ void sock_initialize(void); void sock_shutdown(void); char *sock_get_localip(char *buff, int len); int sock_error(void); int sock_recoverable(int error); int sock_stalled(int error); int sock_valid_socket(sock_t sock); int sock_set_blocking(sock_t sock, const int block); int sock_set_nolinger(sock_t sock); int sock_set_keepalive(sock_t sock); int sock_set_nodelay(sock_t sock); int sock_close(sock_t sock); /* Connection related socket functions */ sock_t sock_connect_wto(const char *hostname, const int port, const int timeout); int sock_connect_non_blocking(const char *host, const unsigned port); int sock_connected(int sock, int timeout); /* Socket write functions */ int sock_write_bytes(sock_t sock, const void *buff, const size_t len); int sock_write(sock_t sock, const char *fmt, ...); int sock_write_fmt(sock_t sock, const char *fmt, va_list ap); int sock_write_string(sock_t sock, const char *buff); ssize_t sock_writev (int sock, const struct iovec *iov, const size_t count); /* Socket read functions */ int sock_read_bytes(sock_t sock, char *buff, const int len); int sock_read_line(sock_t sock, char *string, const int len); /* server socket functions */ sock_t sock_get_server_socket(const int port, char *sinterface); int sock_listen(sock_t serversock, int backlog); int sock_accept(sock_t serversock, char *ip, int len); #ifdef _WIN32 int inet_aton(const char *s, struct in_addr *a); #endif #endif /* __SOCK_H */
{ "content_hash": "3536288fc0d23b94587fad83ce422b33", "timestamp": "", "source": "github", "line_count": 121, "max_line_length": 81, "avg_line_length": 29.58677685950413, "alnum_prop": 0.7374301675977654, "repo_name": "luisrevilla/IcesDroide", "id": "aa1442cef326c2b810bac50212eb8b50c9d5fc9e", "size": "4395", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "jni/libshout/src/net/sock.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "2441021" }, { "name": "C++", "bytes": "7492" }, { "name": "Java", "bytes": "29371" }, { "name": "Makefile", "bytes": "2134" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>coqeal-refinements: Not compatible 👼</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.7.2 / coqeal-refinements - 0.9.1</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> coqeal-refinements <small> 0.9.1 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-09-11 13:59:18 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-09-11 13:59:18 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base camlp5 7.14 Preprocessor-pretty-printer of OCaml conf-findutils 1 Virtual package relying on findutils conf-perl 2 Virtual package relying on perl coq 8.7.2 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.09.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.09.1 Official release 4.09.1 ocaml-config 1 OCaml Switch Configuration ocamlfind 1.9.5 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;Cyril Cohen &lt;[email protected]&gt;&quot; homepage: &quot;https://github.com/coq-community/coqeal&quot; dev-repo: &quot;git+https://github.com/coq-community/coqeal.git&quot; bug-reports: &quot;https://github.com/coq-community/coqeal/issues&quot; license: &quot;MIT&quot; synopsis: &quot;A refinement framework (for algebra)&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] depends: [ &quot;coq&quot; {&gt;= &quot;8.4pl4&quot; &amp; &lt; &quot;8.5~&quot;} &quot;coq-coqeal-theory&quot; {= version} ] tags: [ &quot;category:Computer Science/Decision Procedures and Certified Algorithms/Correctness proofs of algorithms&quot; &quot;keyword:Karatsuba multiplication&quot; &quot;keyword:refinements&quot; &quot;logpath:CoqEAL_refinements&quot; ] authors: [ &quot;Guillaume Cano&quot; &quot;Cyril Cohen&quot; &quot;Maxime Dénès&quot; &quot;Anders Mörtberg&quot; &quot;Vincent Siles&quot; ] url { src: &quot;https://github.com/coq-community/coqeal/releases/download/0.9.1/CoqEAL_refinements.0.9.1.tgz&quot; checksum: &quot;md5=5bb83c00bb33b9b3254f9f3cedae2447&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install 🏜️</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-coqeal-refinements.0.9.1 coq.8.7.2</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.7.2). The following dependencies couldn&#39;t be met: - coq-coqeal-refinements -&gt; coq &lt; 8.5~ -&gt; ocaml &lt; 4.03.0 base of this switch (use `--unlock-base&#39; to force) No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-coqeal-refinements.0.9.1</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "378a0d7e554d75fa805a370d6cd7b53d", "timestamp": "", "source": "github", "line_count": 170, "max_line_length": 159, "avg_line_length": 40.529411764705884, "alnum_prop": 0.5420899854862119, "repo_name": "coq-bench/coq-bench.github.io", "id": "412ad1a142733e79aef4366078a4b2756f91d8f9", "size": "6918", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.09.1-2.0.6/released/8.7.2/coqeal-refinements/0.9.1.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
'use strict'; describe('Localize directive', () => { let LocalizeStorage; let localize; let $scope; let element; // default english localizations let LOCALIZATIONS_EN = { key: '"{1}" equals "{1}" and <i>"{0}"</i> equals <i>"{0}"</i>.', }; let LOCALIZATIONS_DE = { key: '"{1}" gleicht "{1}" und <i>"{0}"</i> gleicht <i>"{0}"</i>.', }; function createTestEnv(keyString, varsString, htmlMode) { angular.mock.inject(($injector) => { $scope = $injector.get('$rootScope').$new(); element = angular.element( `<localize ng-app key="${keyString}" vars="${varsString}" ${(!!htmlMode ? 'localize-html' : '')/* output template as HTML */} ></localize>` ); let $compile = $injector.get('$compile'); let compile = $compile(element); let compiled = compile($scope); $scope.$digest(); element = compiled[0]; }); }; beforeEach(angular.mock.module('ngSanitize')); beforeEach(angular.mock.module('localize.directive')); beforeEach(angular.mock.inject(($injector) => { LocalizeStorage = $injector.get('LocalizeStorage'); localize = $injector.get('localize'); LocalizeStorage.add('en', LOCALIZATIONS_EN); LocalizeStorage.add('de', LOCALIZATIONS_DE); })); it('localizes a simple string', () => { createTestEnv('key'); expect(element.innerText).toEqual(localize('key')); }); it('updates a simple string when the current language changes', () => { createTestEnv('key'); expect(element.innerText).toEqual(localize('key')); LocalizeStorage.set('de'); expect(element.innerText).toEqual(localize('key')); }); it('localizes a string w/ a single string variable', () => { createTestEnv('key', "'test'"); expect(element.innerText).toEqual(localize('key', 'test')); }); it('updates a string w/ a single string variable when the current language changes', () => { createTestEnv('key', "'test'"); expect(element.innerText).toEqual(localize('key', 'test')); LocalizeStorage.set('de'); expect(element.innerText).toEqual(localize('key', 'test')); }); it('localizes a string w/ an array of strings', () => { createTestEnv('key', "['string 1', 'string 2']"); expect(element.innerText).toEqual(localize('key', 'string 1', 'string 2')); }); it('updates a string w/ an array of strings when the current language changes', () => { createTestEnv('key', "['string 1', 'string 2']"); expect(element.innerText).toEqual(localize('key', 'string 1', 'string 2')); LocalizeStorage.set('de'); expect(element.innerText).toEqual(localize('key', 'string 1', 'string 2')); }); it('localizes a string w/ a single $scope variable', () => { $scope.scopeVar = 'test'; createTestEnv('key', 'scopeVar'); expect(element.innerText).toEqual(localize('key', $scope.scopeVar)); }); it('updates a string w/ a single $scope variable when the current language changes', () => { $scope.scopeVar = 'test'; createTestEnv('key', 'scopeVar'); expect(element.innerText).toEqual(localize('key', $scope.scopeVar)); LocalizeStorage.set('de'); expect(element.innerText).toEqual(localize('key', $scope.scopeVar)); }); it('updates a string w/ a single $scope variable when the $scope variable changes', () => { $scope.scopeVar = 'test'; createTestEnv('key', 'scopeVar'); expect(element.innerText).toEqual(localize('key', $scope.scopeVar)); $scope.scopeVar += '?!'; $scope.$digest(); expect(element.innerText).toEqual(localize('key', $scope.scopeVar)); }); it('localizes a string w/ an array of $scope variables', () => { $scope.scopeVar1 = 'string 1'; $scope.scopeVar2 = 'string 2'; createTestEnv('key', '[scopeVar1, scopeVar2]'); expect(element.innerText).toEqual(localize('key', $scope.scopeVar1, $scope.scopeVar2)); }); it('updates a string w/ an array of $scope variables when the current language changes', () => { $scope.scopeVar1 = 'string 1'; $scope.scopeVar2 = 'string 2'; createTestEnv('key', '[scopeVar1, scopeVar2]'); expect(element.innerText).toEqual(localize('key', $scope.scopeVar1, $scope.scopeVar2)); LocalizeStorage.set('de'); expect(element.innerText).toEqual(localize('key', $scope.scopeVar1, $scope.scopeVar2)); }); it('updates a string w/ an array of $scope variables when the $scope variables change', () => { $scope.scopeVar1 = 'string 1'; $scope.scopeVar2 = 'string 2'; createTestEnv('key', '[scopeVar1, scopeVar2]'); expect(element.innerText).toEqual(localize('key', $scope.scopeVar1, $scope.scopeVar2)); $scope.scopeVar1 += '?!'; $scope.$digest(); expect(element.innerText).toEqual(localize('key', $scope.scopeVar1, $scope.scopeVar2)); $scope.scopeVar2 += '?!'; $scope.$digest(); expect(element.innerText).toEqual(localize('key', $scope.scopeVar1, $scope.scopeVar2)); }); it('inserts the template as HTML instead of text if the `localize-html` attribute is set', () => { $scope.scopeVar1 = 'string 1'; $scope.scopeVar2 = 'string 2'; createTestEnv('key', '[scopeVar1, scopeVar2]', !!'htmlMode'); expect(element.innerHTML).toEqual(localize('key', $scope.scopeVar1, $scope.scopeVar2)); $scope.scopeVar1 += '?!'; $scope.$digest(); expect(element.innerHTML).toEqual(localize('key', $scope.scopeVar1, $scope.scopeVar2)); $scope.scopeVar2 += '?!'; $scope.$digest(); expect(element.innerHTML).toEqual(localize('key', $scope.scopeVar1, $scope.scopeVar2)); }); });
{ "content_hash": "ffb2d553bdec08fdcc99a6eb5fa4bf1c", "timestamp": "", "source": "github", "line_count": 166, "max_line_length": 100, "avg_line_length": 33.7289156626506, "alnum_prop": 0.632434363279157, "repo_name": "philipvonbargen/angular-localization", "id": "2702e0737001651c0c54720d116f30eb2a6fcb7e", "size": "5599", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "test/localizationDirective.spec.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "152481" }, { "name": "HTML", "bytes": "11048" }, { "name": "JavaScript", "bytes": "1247564" } ], "symlink_target": "" }
class Npc < ActiveRecord::Base has_many :errands end
{ "content_hash": "ae76851cb0832f38bd6374d44c59cedd", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 30, "avg_line_length": 18.333333333333332, "alnum_prop": 0.7454545454545455, "repo_name": "Otthello/fetch-quest", "id": "719e1842745a627bb20ea8316b634a0a9f0ea301", "size": "55", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/models/npc.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1345" }, { "name": "CoffeeScript", "bytes": "844" }, { "name": "HTML", "bytes": "4888" }, { "name": "JavaScript", "bytes": "661" }, { "name": "Ruby", "bytes": "70757" } ], "symlink_target": "" }
FROM balenalib/odroid-ux3-ubuntu:focal-run ENV NODE_VERSION 15.6.0 ENV YARN_VERSION 1.22.4 RUN buildDeps='curl libatomic1' \ && set -x \ && for key in \ 6A010C5166006599AA17F08146C2130DFD2497F5 \ ; do \ gpg --keyserver pgp.mit.edu --recv-keys "$key" || \ gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" ; \ done \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends \ && rm -rf /var/lib/apt/lists/* \ && curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-armv7l.tar.gz" \ && echo "234871415c54174f91764f332a72631519a6af7b1a87797ad7c729855182f9cd node-v$NODE_VERSION-linux-armv7l.tar.gz" | sha256sum -c - \ && tar -xzf "node-v$NODE_VERSION-linux-armv7l.tar.gz" -C /usr/local --strip-components=1 \ && rm "node-v$NODE_VERSION-linux-armv7l.tar.gz" \ && curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \ && curl -fSLO --compressed "https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc" \ && gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ && mkdir -p /opt/yarn \ && tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn --strip-components=1 \ && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \ && ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg \ && rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \ && npm config set unsafe-perm true -g --unsafe-perm \ && rm -rf /tmp/* CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/[email protected]" \ && echo "Running test-stack@node" \ && chmod +x [email protected] \ && bash [email protected] \ && rm -rf [email protected] RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Ubuntu focal \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nNode.js v15.6.0, Yarn v1.22.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
{ "content_hash": "93cab561d994b551260d4232186fe9d8", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 690, "avg_line_length": 64.28888888888889, "alnum_prop": 0.7044590390597996, "repo_name": "nghiant2710/base-images", "id": "d281324e39fbd2c695060f8926d63a1733a1ff3e", "size": "2914", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "balena-base-images/node/odroid-ux3/ubuntu/focal/15.6.0/run/Dockerfile", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "144558581" }, { "name": "JavaScript", "bytes": "16316" }, { "name": "Shell", "bytes": "368690" } ], "symlink_target": "" }
FROM phusion/baseimage MAINTAINER Dan Leehr <[email protected]> RUN apt-get update && apt-get install -y \ python \ python-dev \ libffi-dev \ libssl-dev \ python-pip COPY requirements.txt / RUN pip install -r requirements.txt COPY docker-pipeline /docker-pipeline WORKDIR /docker-pipeline ENTRYPOINT ["python", "pipeline.py"] CMD ["-h"]
{ "content_hash": "5fcf9157302c26736ad35010cc88b182", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 42, "avg_line_length": 21.875, "alnum_prop": 0.7285714285714285, "repo_name": "Duke-GCB/docker-pipeline", "id": "8b23e8ddf7fff6a270c84f353fe7360ec9a1c10c", "size": "350", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Dockerfile", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "29612" }, { "name": "Shell", "bytes": "1128" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "8ab18683b19885b424c1fe642741de43", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "108f15cec6d57e040bc13474f6339e411f73b3f0", "size": "207", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Salicaceae/Salix/Salix humilis/ Syn. Salix humilis grandifolia/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package org.apache.river.mahalo; /** * * @author Sun Microsystems, Inc. * */ public class ResultNotReadyException extends JobException { static final long serialVersionUID = 5079803403238096285L; public ResultNotReadyException() { super(); } public ResultNotReadyException(String msg) { super(msg); } }
{ "content_hash": "9adff28575bd70854d081d5123d5a175", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 62, "avg_line_length": 16.7, "alnum_prop": 0.7035928143712575, "repo_name": "pfirmstone/JGDMS", "id": "04fae983363b5cd3bed5e086cdf17cfe447bc40d", "size": "1140", "binary": false, "copies": "2", "ref": "refs/heads/trunk", "path": "JGDMS/services/mahalo/mahalo-service/src/main/java/org/apache/river/mahalo/ResultNotReadyException.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "38260" }, { "name": "Groovy", "bytes": "30510" }, { "name": "HTML", "bytes": "107806458" }, { "name": "Java", "bytes": "24863323" }, { "name": "JavaScript", "bytes": "1702" }, { "name": "Makefile", "bytes": "3032" }, { "name": "Roff", "bytes": "863" }, { "name": "Shell", "bytes": "68247" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2010-2012 Luca Garulli (l.garulli(at)orientechnologies.com) ~ ~ 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. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.orientechnologies</groupId> <artifactId>orientdb-parent</artifactId> <version>2.0-SNAPSHOT</version> </parent> <artifactId>orientdb-object</artifactId> <packaging>jar</packaging> <name>OrientDB Object</name> <organization> <name>Orient Technologies</name> <url>http://www.orientechnologies.com</url> </organization> <dependencies> <dependency> <groupId>com.orientechnologies</groupId> <artifactId>orientdb-core</artifactId> <version>${project.version}</version> </dependency> <dependency> <!-- Use an OSGi ready dependency https://hibernate.onjira.com/browse/JPA-42 --> <groupId>org.hibernate.javax.persistence</groupId> <artifactId>hibernate-jpa-2.0-api</artifactId> <version>1.0.0.Final</version> <type>jar</type> </dependency> <dependency> <groupId>org.javassist</groupId> <artifactId>javassist</artifactId> <version>3.16.1-GA</version> <type>jar</type> </dependency> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>5.14.1</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> </plugins> <testResources> <testResource> <directory>src/test/resources</directory> <filtering>true</filtering> </testResource> </testResources> </build> <properties> <import.package>*</import.package> <export.package>com.orientechnologies.orient.object.*</export.package> </properties> <repositories> <repository> <id>jboss-releases-repository</id> <name>JBoss Releases Repository</name> <url>https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/</url> </repository> </repositories> </project>
{ "content_hash": "b281cbd67763b26371b89e2b297dc2d5", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 105, "avg_line_length": 36.154761904761905, "alnum_prop": 0.6190319394138953, "repo_name": "delebash/orientdb-parent", "id": "9744f71697362b6ab3625577180c5bf20bc74587", "size": "3037", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "object/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "9383610" }, { "name": "JavaScript", "bytes": "100030" }, { "name": "PHP", "bytes": "9168" }, { "name": "Shell", "bytes": "24915" } ], "symlink_target": "" }
angular.module('openshiftConsole') .filter('hashSize', function() { return function(hash) { return Object.keys(hash).length; }; });
{ "content_hash": "c58dbca3643375ed905c04837d68f47b", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 38, "avg_line_length": 24.833333333333332, "alnum_prop": 0.6375838926174496, "repo_name": "mrunalp/origin", "id": "56db5ff86f9239c8e01bbe0731f3245ab3650173", "size": "149", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "assets/app/scripts/filters/util.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "12317" }, { "name": "Go", "bytes": "7606473" }, { "name": "JavaScript", "bytes": "57106" }, { "name": "Makefile", "bytes": "1878" }, { "name": "Shell", "bytes": "64261" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "d6068b0854b1d0ae20b93bd7d7109823", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "b359ab8902d2d34ebdbca5f4fd4412abc625a9db", "size": "200", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Orchidaceae/Epidendrum/Epidendrum serpens/ Syn. Hormidium serpens/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
class ServicesController < ApplicationController include EnginesServicesSystemActions before_action :set_service def delete_orphaned_attached_service title = params[:service][:service_container_name].to_s + " on " + params[:service][:parent_engine].to_s result = EnginesAttachedService.delete_orphaned_service(params[:service]) if result.was_success flash[:notice] = "Deleted " + title else flash[:alert] = "Unable to delete " + title + ". " + result.result_mesg end redirect_to services_registry_path end private def set_service @service = Service.new(container_name: service_name) end def service_name params[:service_name] end end
{ "content_hash": "9243b8bc9f3ab2b74cb037f10d3a72e0", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 107, "avg_line_length": 21.424242424242426, "alnum_prop": 0.6973125884016973, "repo_name": "EnginesOS/SystemGui", "id": "38dd7cb3525da768190be381ec27fa6c7ba86957", "size": "707", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/controllers/services_controller.rb", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "14593" }, { "name": "HTML", "bytes": "212980" }, { "name": "JavaScript", "bytes": "46482" }, { "name": "Ruby", "bytes": "220822" } ], "symlink_target": "" }
namespace password_manager { // This backend forwards requests to two backends in order to compare and record // their results and time differences. The main backend fulfills the request // while the shadow backend is only queried to record shadow traffic. class PasswordStoreProxyBackend : public PasswordStoreBackend { public: // `main_backend` and `shadow_backend` must not be null and must outlive this // object as long as Shutdown() is not called. PasswordStoreProxyBackend( PasswordStoreBackend* main_backend, PasswordStoreBackend* shadow_backend, base::RepeatingCallback<bool()> is_syncing_passwords_callback); PasswordStoreProxyBackend(const PasswordStoreProxyBackend&) = delete; PasswordStoreProxyBackend(PasswordStoreProxyBackend&&) = delete; PasswordStoreProxyBackend& operator=(const PasswordStoreProxyBackend&) = delete; PasswordStoreProxyBackend& operator=(PasswordStoreProxyBackend&&) = delete; ~PasswordStoreProxyBackend() override; private: // Implements PasswordStoreBackend interface. base::WeakPtr<PasswordStoreBackend> GetWeakPtr() override; void InitBackend(RemoteChangesReceived remote_form_changes_received, base::RepeatingClosure sync_enabled_or_disabled_cb, base::OnceCallback<void(bool)> completion) override; void Shutdown(base::OnceClosure shutdown_completed) override; void GetAllLoginsAsync(LoginsOrErrorReply callback) override; void GetAutofillableLoginsAsync(LoginsOrErrorReply callback) override; void FillMatchingLoginsAsync( LoginsReply callback, bool include_psl, const std::vector<PasswordFormDigest>& forms) override; void AddLoginAsync(const PasswordForm& form, PasswordStoreChangeListReply callback) override; void UpdateLoginAsync(const PasswordForm& form, PasswordStoreChangeListReply callback) override; void RemoveLoginAsync(const PasswordForm& form, PasswordStoreChangeListReply callback) override; void RemoveLoginsByURLAndTimeAsync( const base::RepeatingCallback<bool(const GURL&)>& url_filter, base::Time delete_begin, base::Time delete_end, base::OnceCallback<void(bool)> sync_completion, PasswordStoreChangeListReply callback) override; void RemoveLoginsCreatedBetweenAsync( base::Time delete_begin, base::Time delete_end, PasswordStoreChangeListReply callback) override; void DisableAutoSignInForOriginsAsync( const base::RepeatingCallback<bool(const GURL&)>& origin_filter, base::OnceClosure completion) override; SmartBubbleStatsStore* GetSmartBubbleStatsStore() override; FieldInfoStore* GetFieldInfoStore() override; std::unique_ptr<syncer::ProxyModelTypeControllerDelegate> CreateSyncControllerDelegate() override; const raw_ptr<PasswordStoreBackend> main_backend_; const raw_ptr<PasswordStoreBackend> shadow_backend_; base::RepeatingCallback<bool()> is_syncing_passwords_callback_; base::WeakPtrFactory<PasswordStoreProxyBackend> weak_ptr_factory_{this}; }; } // namespace password_manager #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_PROXY_BACKEND_H_
{ "content_hash": "3963c3401f59f9b0e9d6b9b04ef47482", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 83, "avg_line_length": 48.63636363636363, "alnum_prop": 0.7638629283489097, "repo_name": "ric2b/Vivaldi-browser", "id": "0724074ebe591734b5976d4bf963860bb0ad59fc", "size": "3738", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "chromium/components/password_manager/core/browser/password_store_proxy_backend.h", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
#ifndef __D3D11RENDERSYSTEM_H__ #define __D3D11RENDERSYSTEM_H__ #include "OgreD3D11Prerequisites.h" #include "OgreRenderSystem.h" #include "OgreD3D11Device.h" #include "OgreD3D11Mappings.h" namespace Ogre { #define MAX_LIGHTS 8 class D3D11DriverList; class D3D11Driver; /** Implementation of DirectX9 as a rendering system. */ class D3D11RenderSystem : public RenderSystem { private: // an enum to define the driver type of d3d11 enum OGRE_D3D11_DRIVER_TYPE { DT_HARDWARE, // GPU based DT_SOFTWARE, // microsoft original (slow) software driver DT_WARP // microsoft new (faster) software driver - (Windows Advanced Rasterization Platform) - http://msdn.microsoft.com/en-us/library/dd285359.aspx }; OGRE_D3D11_DRIVER_TYPE mDriverType; // d3d11 driver type /// Direct3D //int mpD3D; /// Direct3D rendering device D3D11Device mDevice; // Stored options ConfigOptionMap mOptions; /// instance HINSTANCE mhInstance; /// List of D3D drivers installed (video cards) D3D11DriverList* mDriverList; /// Currently active driver D3D11Driver* mActiveD3DDriver; /// NVPerfHUD allowed? bool mUseNVPerfHUD; /// Per-stage constant support? (not in main caps since D3D specific & minor) bool mPerStageConstantSupport; /// structure holding texture unit settings for every stage D3D11DriverList* getDirect3DDrivers(void); void refreshD3DSettings(void); void refreshFSAAOptions(void); void freeDevice(void); // inline bool compareDecls( D3DVERTEXELEMENT9* pDecl1, D3DVERTEXELEMENT9* pDecl2, size_t size ); void initInputDevices(void); void processInputDevices(void); /// return anisotropy level DWORD _getCurrentAnisotropy(size_t unit); /// check if a FSAA is supported bool _checkMultiSampleQuality(UINT SampleCount, UINT *outQuality, DXGI_FORMAT format); D3D11HardwareBufferManager* mHardwareBufferManager; D3D11GpuProgramManager* mGpuProgramManager; D3D11HLSLProgramFactory* mHLSLProgramFactory; size_t mLastVertexSourceCount; /// Internal method for populating the capabilities structure RenderSystemCapabilities* createRenderSystemCapabilities() const; /** See RenderSystem definition */ void initialiseFromRenderSystemCapabilities(RenderSystemCapabilities* caps, RenderTarget* primary); void convertVertexShaderCaps(RenderSystemCapabilities* rsc) const; void convertPixelShaderCaps(RenderSystemCapabilities* rsc) const; void convertGeometryShaderCaps(RenderSystemCapabilities* rsc) const; bool checkVertexTextureFormats(void); void detachRenderTargetImpl(const String& name); CompareFunction mSceneAlphaRejectFunc; // should be merged with - mBlendDesc unsigned char mSceneAlphaRejectValue; // should be merged with - mBlendDesc bool mSceneAlphaToCoverage; D3D11_BLEND_DESC mBlendDesc; D3D11_RASTERIZER_DESC mRasterizerDesc; UINT mStencilRef; D3D11_DEPTH_STENCIL_DESC mDepthStencilDesc; PolygonMode mPolygonMode; FilterOptions FilterMinification; FilterOptions FilterMagnification; FilterOptions FilterMips; D3D11_RECT mScissorRect; D3D11HLSLProgram* mBoundVertexProgram; D3D11HLSLProgram* mBoundFragmentProgram; D3D11HLSLProgram* mBoundGeometryProgram; ID3D11BlendState * mBoundBlendState; ID3D11RasterizerState * mBoundRasterizer; ID3D11DepthStencilState * mBoundDepthStencilState; ID3D11SamplerState * mBoundSamplerStates[OGRE_MAX_TEXTURE_LAYERS]; size_t mBoundSamplerStatesCount; ID3D11ShaderResourceView * mBoundTextures[OGRE_MAX_TEXTURE_LAYERS]; size_t mBoundTexturesCount; /// structure holding texture unit settings for every stage struct sD3DTextureStageDesc { /// the type of the texture //D3D11Mappings::eD3DTexType texType; TextureType type; /// which texCoordIndex to use size_t coordIndex; /// type of auto tex. calc. used TexCoordCalcMethod autoTexCoordType; /// Frustum, used if the above is projection const Frustum *frustum; LayerBlendModeEx layerBlendMode; /// texture ID3D11ShaderResourceView *pTex; D3D11_SAMPLER_DESC samplerDesc; D3D11_SAMPLER_DESC currentSamplerDesc; //ID3D11SamplerState * pSampler; bool used; } mTexStageDesc[OGRE_MAX_TEXTURE_LAYERS]; // What follows is a set of duplicated lists just to make it // easier to deal with lost devices /// Primary window, the one used to create the device D3D11RenderWindow* mPrimaryWindow; typedef vector<D3D11RenderWindow*>::type SecondaryWindowList; // List of additional windows after the first (swap chains) SecondaryWindowList mSecondaryWindows; bool mBasicStatesInitialised; bool mRenderSystemWasInited; IDXGIFactory1* mpDXGIFactory; protected: void setClipPlanesImpl(const PlaneList& clipPlanes); public: // constructor D3D11RenderSystem( HINSTANCE hInstance ); // destructor ~D3D11RenderSystem(); void initRenderSystem(); virtual void initConfigOptions(void); // Overridden RenderSystem functions ConfigOptionMap& getConfigOptions(void); String validateConfigOptions(void); RenderWindow* _initialise( bool autoCreateWindow, const String& windowTitle = "OGRE Render Window" ); /// @copydoc RenderSystem::_createRenderWindow RenderWindow* _createRenderWindow(const String &name, unsigned int width, unsigned int height, bool fullScreen, const NameValuePairList *miscParams = 0); /// @copydoc RenderSystem::createRenderTexture RenderTexture * createRenderTexture( const String & name, unsigned int width, unsigned int height, TextureType texType = TEX_TYPE_2D, PixelFormat internalFormat = PF_X8R8G8B8, const NameValuePairList *miscParams = 0 ); /// @copydoc RenderSystem::createMultiRenderTarget virtual MultiRenderTarget * createMultiRenderTarget(const String & name); virtual DepthBuffer* _createDepthBufferFor( RenderTarget *renderTarget ); /** * This function is meant to add Depth Buffers to the pool that aren't released when the DepthBuffer * is deleted. This is specially useful to put the Depth Buffer created along with the window's * back buffer into the pool. All depth buffers introduced with this method go to POOL_DEFAULT */ DepthBuffer* _addManualDepthBuffer( ID3D11DepthStencilView *depthSurface, uint32 width, uint32 height, uint32 fsaa, uint32 fsaaQuality ); /// @copydoc RenderSystem::detachRenderTarget virtual RenderTarget * detachRenderTarget(const String &name); const String& getName(void) const; // Low-level overridden members void setConfigOption( const String &name, const String &value ); void reinitialise(); void shutdown(); void setAmbientLight( float r, float g, float b ); void setShadingType( ShadeOptions so ); void setLightingEnabled( bool enabled ); void destroyRenderTarget(const String& name); VertexElementType getColourVertexElementType(void) const; void setStencilCheckEnabled(bool enabled); void setStencilBufferParams(CompareFunction func = CMPF_ALWAYS_PASS, uint32 refValue = 0, uint32 mask = 0xFFFFFFFF, StencilOperation stencilFailOp = SOP_KEEP, StencilOperation depthFailOp = SOP_KEEP, StencilOperation passOp = SOP_KEEP, bool twoSidedOperation = false); void setNormaliseNormals(bool normalise); virtual String getErrorDescription(long errorNumber) const; // Low-level overridden members, mainly for internal use D3D11HLSLProgram* _getBoundVertexProgram() const; D3D11HLSLProgram* _getBoundFragmentProgram() const; D3D11HLSLProgram* _getBoundGeometryProgram() const; void _useLights(const LightList& lights, unsigned short limit); void _setWorldMatrix( const Matrix4 &m ); void _setViewMatrix( const Matrix4 &m ); void _setProjectionMatrix( const Matrix4 &m ); void _setSurfaceParams( const ColourValue &ambient, const ColourValue &diffuse, const ColourValue &specular, const ColourValue &emissive, Real shininess, TrackVertexColourType tracking ); void _setPointSpritesEnabled(bool enabled); void _setPointParameters(Real size, bool attenuationEnabled, Real constant, Real linear, Real quadratic, Real minSize, Real maxSize); void _setTexture(size_t unit, bool enabled, const TexturePtr &texPtr); void _setVertexTexture(size_t unit, const TexturePtr& tex); void _disableTextureUnit(size_t texUnit); void _setTextureCoordSet( size_t unit, size_t index ); void _setTextureCoordCalculation(size_t unit, TexCoordCalcMethod m, const Frustum* frustum = 0); void _setTextureBlendMode( size_t unit, const LayerBlendModeEx& bm ); void _setTextureAddressingMode(size_t stage, const TextureUnitState::UVWAddressingMode& uvw); void _setTextureBorderColour(size_t stage, const ColourValue& colour); void _setTextureMipmapBias(size_t unit, float bias); void _setTextureMatrix( size_t unit, const Matrix4 &xform ); void _setSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendOperation op = SBO_ADD); void _setSeparateSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendFactor sourceFactorAlpha, SceneBlendFactor destFactorAlpha, SceneBlendOperation op = SBO_ADD, SceneBlendOperation alphaOp = SBO_ADD); void _setAlphaRejectSettings( CompareFunction func, unsigned char value, bool alphaToCoverage ); void _setViewport( Viewport *vp ); void _beginFrame(void); void _endFrame(void); void _setCullingMode( CullingMode mode ); void _setDepthBufferParams( bool depthTest = true, bool depthWrite = true, CompareFunction depthFunction = CMPF_LESS_EQUAL ); void _setDepthBufferCheckEnabled( bool enabled = true ); bool _getDepthBufferCheckEnabled( void ); void _setColourBufferWriteEnabled(bool red, bool green, bool blue, bool alpha); void _setDepthBufferWriteEnabled(bool enabled = true); void _setDepthBufferFunction( CompareFunction func = CMPF_LESS_EQUAL ); void _setDepthBias(float constantBias, float slopeScaleBias); void _setFog( FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White, Real expDensity = 1.0, Real linearStart = 0.0, Real linearEnd = 1.0 ); void _convertProjectionMatrix(const Matrix4& matrix, Matrix4& dest, bool forGpuProgram = false); void _makeProjectionMatrix(const Radian& fovy, Real aspect, Real nearPlane, Real farPlane, Matrix4& dest, bool forGpuProgram = false); void _makeProjectionMatrix(Real left, Real right, Real bottom, Real top, Real nearPlane, Real farPlane, Matrix4& dest, bool forGpuProgram = false); void _makeOrthoMatrix(const Radian& fovy, Real aspect, Real nearPlane, Real farPlane, Matrix4& dest, bool forGpuProgram = false); void _applyObliqueDepthProjection(Matrix4& matrix, const Plane& plane, bool forGpuProgram); void _setPolygonMode(PolygonMode level); void _setTextureUnitFiltering(size_t unit, FilterType ftype, FilterOptions filter); void _setTextureLayerAnisotropy(size_t unit, unsigned int maxAnisotropy); void setVertexDeclaration(VertexDeclaration* decl); void setVertexDeclaration(VertexDeclaration* decl, VertexBufferBinding* binding); void setVertexBufferBinding(VertexBufferBinding* binding); void _render(const RenderOperation& op); /** See RenderSystem */ void bindGpuProgram(GpuProgram* prg); /** See RenderSystem */ void unbindGpuProgram(GpuProgramType gptype); /** See RenderSystem */ void bindGpuProgramParameters(GpuProgramType gptype, GpuProgramParametersSharedPtr params, uint16 mask); /** See RenderSystem */ void bindGpuProgramPassIterationParameters(GpuProgramType gptype); void setScissorTest(bool enabled, size_t left = 0, size_t top = 0, size_t right = 800, size_t bottom = 600); void clearFrameBuffer(unsigned int buffers, const ColourValue& colour = ColourValue::Black, Real depth = 1.0f, unsigned short stencil = 0); void setClipPlane (ushort index, Real A, Real B, Real C, Real D); void enableClipPlane (ushort index, bool enable); HardwareOcclusionQuery* createHardwareOcclusionQuery(void); Real getHorizontalTexelOffset(void); Real getVerticalTexelOffset(void); Real getMinimumDepthInputValue(void); Real getMaximumDepthInputValue(void); void registerThread(); void unregisterThread(); void preExtraThreadsStarted(); void postExtraThreadsStarted(); /** * Set current render target to target, enabling its GL context if needed */ void _setRenderTarget(RenderTarget *target); /** Check whether or not filtering is supported for the precise texture format requested with the given usage options. */ bool _checkTextureFilteringSupported(TextureType ttype, PixelFormat format, int usage); void determineFSAASettings(uint fsaa, const String& fsaaHint, DXGI_FORMAT format, DXGI_SAMPLE_DESC* outFSAASettings); /// @copydoc RenderSystem::getDisplayMonitorCount unsigned int getDisplayMonitorCount() const {return 1;} //todo /// @copydoc RenderSystem::beginProfileEvent virtual void beginProfileEvent( const String &eventName ); /// @copydoc RenderSystem::endProfileEvent virtual void endProfileEvent( void ); /// @copydoc RenderSystem::markProfileEvent virtual void markProfileEvent( const String &eventName ); }; } #endif
{ "content_hash": "4b00053cc62bd05f56262206ac212916", "timestamp": "", "source": "github", "line_count": 343, "max_line_length": 189, "avg_line_length": 39.48396501457726, "alnum_prop": 0.7482832459573211, "repo_name": "Kanma/Ogre", "id": "d87ba003da392f24ca0f1b1dadcec59f81d25a42", "size": "14902", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "RenderSystems/Direct3D11/include/OgreD3D11RenderSystem.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "2141984" }, { "name": "C++", "bytes": "13610649" }, { "name": "CSS", "bytes": "24100" }, { "name": "Objective-C", "bytes": "86240" }, { "name": "Objective-C++", "bytes": "79422" }, { "name": "Shell", "bytes": "701" }, { "name": "TeX", "bytes": "43359" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="294dip" android:layout_height="294dip"> <ImageView android:id="@+id/widget_bg_image" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <TextView android:id="@+id/widget_text" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingTop="40dip" android:paddingLeft="15dip" android:paddingRight="15dip" android:textSize="14sp" android:textColor="#FF663300" android:maxLines="12" android:lineSpacingMultiplier="1.2" /> </FrameLayout>
{ "content_hash": "eea07d0f5eb5154fe157a85d8b84e0e7", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 62, "avg_line_length": 31, "alnum_prop": 0.6397849462365591, "repo_name": "bq12345/Note", "id": "e4e752a6d2fe6942e997c3378e249bd08240d7d8", "size": "744", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "res/layout/widget_4x.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "37460" } ], "symlink_target": "" }
<div class="new-article"> <span class="vertical-half-spacer"></span> <button mat-raised-button class="create" (click)="createArticle()" color="accent"> New Article </button> <span class="vertical-spacer"></span> <span class="vertical-spacer"></span> <article-list></article-list> </div> <router-outlet></router-outlet>
{ "content_hash": "64eea4dbb3698f9f08fdfd8428b11fa3", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 84, "avg_line_length": 30.545454545454547, "alnum_prop": 0.6815476190476191, "repo_name": "LighthouseBlog/Blog", "id": "138af19f0bfed777d4e0b36d5e277ac3078e9a4c", "size": "336", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/app/article-portal/user-articles/user-articles.component.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "9440" }, { "name": "HTML", "bytes": "26858" }, { "name": "JavaScript", "bytes": "2167" }, { "name": "Shell", "bytes": "2169" }, { "name": "TypeScript", "bytes": "90873" } ], "symlink_target": "" }
/* * Altair Admin * @version v2.4.0 * @author tzd * @license http://themeforest.net/licenses * page_mailbox.js - page_mailbox.html */ $(function() { // mailbox init functions altair_mailbox.init(); }); // variables var $mailbox = $('#mailbox'), $split_view_btn = $('#mailbox_list_split'), $combined_view_btn = $('#mailbox_list_combined'), $msg_list = $mailbox.find('.md-card-list'), anim_duration = 250; altair_mailbox = { init: function() { // split/combined list altair_mailbox.list_switch(); // assign colors to each message (data-message-category-color) altair_mailbox.list_category_color(); // select messages altair_mailbox.select_messages(); // show/hide single message altair_mailbox.toggle_message(); // compose message altair_mailbox.create_message(); }, // split/combined list list_switch: function() { $combined_view_btn.on('click', function(e) { e.preventDefault(); e.stopPropagation(); $combined_view_btn.velocity("transition.expandOut", { duration: anim_duration, easing: easing_swiftOut, begin: function() { $mailbox .addClass('md-card-list-combined') .find('.md-card-list-header').not('.md-card-list-header-combined') .velocity("transition.expandOut", { duration: anim_duration, easing: easing_swiftOut, begin: function() { $msg_list.each(function(index) { if(index != 0 ) { $(this).velocity({ marginTop: '0' }, { duration: anim_duration + 200, easing: easing_swiftOut }) } }); }, complete: function() { $mailbox.find('.md-card-list-header-combined').velocity("transition.expandIn", { duration: anim_duration, easing: easing_swiftOut }) } }); }, complete: function() { $split_view_btn.velocity("transition.expandIn", { duration: anim_duration, easing: easing_swiftOut }) } }); }); $split_view_btn.on('click', function(e) { e.preventDefault(); $split_view_btn.velocity("transition.expandOut", { duration: anim_duration, easing: easing_swiftOut, begin: function() { var $list = $mailbox.find('.md-card-list'), list_length = $list.length; $mailbox .find('.md-card-list-header-combined') .velocity("transition.expandOut", { duration: anim_duration, easing: easing_swiftOut }); $list.reverse().each(function(index) { if(index != list_length-1 ) { $(this).velocity("reverse", { duration: anim_duration + 200, easing: easing_swiftOut }) } }); setTimeout(function() { $mailbox.removeClass('md-card-list-combined'); $('.md-card-list-header') .not('.md-card-list-header-combined') .show() .velocity("reverse"); },500); }, complete: function() { $combined_view_btn.velocity("transition.expandIn", { duration: anim_duration, easing: easing_swiftOut }) } }); }); if($mailbox.hasClass('md-card-list-combined')) { $combined_view_btn.click(); } else { $split_view_btn.hide(); } }, // assign colors to each message (data-message-category-color) list_category_color: function() { $('.md-card-list > ul > li').each(function() { $this = $(this); var thisCatColor = $this.attr('data-message-category-color'); if(thisCatColor) { $(this).find('span.md-card-list-item-avatar').css({ backgroundColor: '#'+thisCatColor }) } }) }, // select messages select_messages: function () { $mailbox.on('ifChanged', '[data-md-icheck]', function() { $(this).is(':checked') ? $(this).closest('li').addClass('md-card-list-item-selected') : $(this).closest('li').removeClass('md-card-list-item-selected'); }); $('#mailbox_select_all').on('ifChanged',function() { var $this = $(this); $mailbox.find('[data-md-icheck]').each(function() { $this.is(':checked') ? $(this).iCheck('check') : $(this).iCheck('uncheck'); }) }); }, // show/hide single message toggle_message: function() { $mailbox.on('click', '.md-card-list ul > li', function(e) { if ( !$(e.target).closest('.md-card-list-item-menu').length && !$(e.target).closest('.md-card-list-item-select').length ) { var $this = $(this); if (!$this.hasClass('item-shown')) { // get height of clicked message var el_min_height = $this.height() + $this.children('.md-card-list-item-content-wrapper').actual("height"); // hide opened message $mailbox.find('.item-shown').velocity("reverse", { begin: function (elements) { $(elements).removeClass('item-shown').children('.md-card-list-item-content-wrapper').hide().velocity("reverse"); } }); // show message $this.velocity({ marginTop: 40, marginBottom: 40, marginLeft: -20, marginRight: -20, minHeight: el_min_height }, { duration: 300, easing: easing_swiftOut, begin: function (elements) { $(elements).addClass('item-shown'); }, complete: function (elements) { // show: message content, reply form $(elements).children('.md-card-list-item-content-wrapper').show().velocity({ opacity: 1 }); // scroll to message var container = $('body'), scrollTo = $(elements); container.animate({ scrollTop: scrollTo.offset().top - $page_content.offset().top - 8 }, 1000, bez_easing_swiftOut); } }); } } }); // hide message on: outside click, esc button $(document).on('click keydown', function(e) { if ( ( !$(e.target).closest('li.item-shown').length ) || e.which == 27 ) { $mailbox.find('.item-shown').velocity("reverse", { begin: function(elements) { $(elements).removeClass('item-shown').children('.md-card-list-item-content-wrapper').hide().velocity("reverse"); } }); } }); }, // compose message create_message: function() { // callback on modal show $('#mailbox_new_message').on('show.uk.modal',function() { }); // file upload (check dropzone.js for more complex component) var progressbar = $("#mail_progressbar"), bar = progressbar.find('.uk-progress-bar'), settings = { action: './upload/', // upload url single: false, loadstart: function() { bar.css("width", "0%").text("0%"); progressbar.removeClass("uk-hidden uk-progress-danger"); }, progress: function(percent) { percent = Math.ceil(percent); bar.css("width", percent+"%").text(percent+"%"); if(percent == '100') { setTimeout(function(){ //progressbar.addClass("uk-hidden"); }, 1500); } }, error: function(event) { progressbar.addClass("uk-progress-danger"); bar.css({'width':'100%'}).text('100%'); }, abort: function(event) { console.log(event); }, complete: function(response, xhr) { console.log(response); } }; var select = UIkit.uploadSelect($("#mail_upload-select"), settings), drop = UIkit.uploadDrop($("#mail_upload-drop"), settings); } };
{ "content_hash": "e0c62be40dcb21caf0e911239cd74f44", "timestamp": "", "source": "github", "line_count": 268, "max_line_length": 140, "avg_line_length": 38.47761194029851, "alnum_prop": 0.40981380915438326, "repo_name": "denislevin/webapp-dashboard", "id": "ee353ee4d60519e9fe01252b6b564f81bc235c01", "size": "10312", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "resources/altair/assets/js/pages/page_mailbox.js", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "447" }, { "name": "CSS", "bytes": "1985410" }, { "name": "HTML", "bytes": "1628110" }, { "name": "JavaScript", "bytes": "5932815" }, { "name": "PHP", "bytes": "7904340" }, { "name": "Shell", "bytes": "6113" } ], "symlink_target": "" }
<!DOCTYPE HTML> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (11.0.16) on Thu Sep 15 09:38:29 CEST 2022 --> <title>Uses of Class com.google.ortools.sat.SatParameters.ClauseOrdering (com.google.ortools:ortools-java 9.4.1874 API)</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="dc.created" content="2022-09-15"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> <script type="text/javascript" src="../../../../../jquery/jszip/dist/jszip.min.js"></script> <script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> <!--[if IE]> <script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> <![endif]--> <script type="text/javascript" src="../../../../../jquery/jquery-3.5.1.js"></script> <script type="text/javascript" src="../../../../../jquery/jquery-ui.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class com.google.ortools.sat.SatParameters.ClauseOrdering (com.google.ortools:ortools-java 9.4.1874 API)"; } } catch(err) { } //--> var pathtoroot = "../../../../../"; var useModuleDirectories = true; loadScripts(document, 'script');</script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <header role="banner"> <nav role="navigation"> <div class="fixedNav"> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a id="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a id="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../index.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li> </ul> <ul class="navListSearch"> <li><label for="search">SEARCH:</label> <input type="text" id="search" value="search" disabled="disabled"> <input type="reset" id="reset" value="reset" disabled="disabled"> </li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> </div> <a id="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> </div> <div class="navPadding">&nbsp;</div> <script type="text/javascript"><!-- $('.navPadding').css('padding-top', $('.fixedNav').css("height")); //--> </script> </nav> </header> <main role="main"> <div class="header"> <h2 title="Uses of Class com.google.ortools.sat.SatParameters.ClauseOrdering" class="title">Uses of Class<br>com.google.ortools.sat.SatParameters.ClauseOrdering</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary"> <caption><span>Packages that use <a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">SatParameters.ClauseOrdering</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <th class="colFirst" scope="row"><a href="#com.google.ortools.sat">com.google.ortools.sat</a></th> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"> <section role="region"><a id="com.google.ortools.sat"> <!-- --> </a> <h3>Uses of <a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">SatParameters.ClauseOrdering</a> in <a href="../package-summary.html">com.google.ortools.sat</a></h3> <table class="useSummary"> <caption><span>Methods in <a href="../package-summary.html">com.google.ortools.sat</a> that return <a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">SatParameters.ClauseOrdering</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colSecond" scope="col">Method</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>static <a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">SatParameters.ClauseOrdering</a></code></td> <th class="colSecond" scope="row"><span class="typeNameLabel">SatParameters.ClauseOrdering.</span><code><span class="memberNameLink"><a href="../SatParameters.ClauseOrdering.html#forNumber(int)">forNumber</a></span>&#8203;(int&nbsp;value)</code></th> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">SatParameters.ClauseOrdering</a></code></td> <th class="colSecond" scope="row"><span class="typeNameLabel">SatParameters.Builder.</span><code><span class="memberNameLink"><a href="../SatParameters.Builder.html#getClauseCleanupOrdering()">getClauseCleanupOrdering</a></span>()</code></th> <td class="colLast"> <div class="block"><code>optional .operations_research.sat.SatParameters.ClauseOrdering clause_cleanup_ordering = 60 [default = CLAUSE_ACTIVITY];</code></div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">SatParameters.ClauseOrdering</a></code></td> <th class="colSecond" scope="row"><span class="typeNameLabel">SatParameters.</span><code><span class="memberNameLink"><a href="../SatParameters.html#getClauseCleanupOrdering()">getClauseCleanupOrdering</a></span>()</code></th> <td class="colLast"> <div class="block"><code>optional .operations_research.sat.SatParameters.ClauseOrdering clause_cleanup_ordering = 60 [default = CLAUSE_ACTIVITY];</code></div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">SatParameters.ClauseOrdering</a></code></td> <th class="colSecond" scope="row"><span class="typeNameLabel">SatParametersOrBuilder.</span><code><span class="memberNameLink"><a href="../SatParametersOrBuilder.html#getClauseCleanupOrdering()">getClauseCleanupOrdering</a></span>()</code></th> <td class="colLast"> <div class="block"><code>optional .operations_research.sat.SatParameters.ClauseOrdering clause_cleanup_ordering = 60 [default = CLAUSE_ACTIVITY];</code></div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>static <a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">SatParameters.ClauseOrdering</a></code></td> <th class="colSecond" scope="row"><span class="typeNameLabel">SatParameters.ClauseOrdering.</span><code><span class="memberNameLink"><a href="../SatParameters.ClauseOrdering.html#valueOf(int)">valueOf</a></span>&#8203;(int&nbsp;value)</code></th> <td class="colLast"> <div class="block"><span class="deprecatedLabel">Deprecated.</span></div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static <a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">SatParameters.ClauseOrdering</a></code></td> <th class="colSecond" scope="row"><span class="typeNameLabel">SatParameters.ClauseOrdering.</span><code><span class="memberNameLink"><a href="../SatParameters.ClauseOrdering.html#valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor)">valueOf</a></span>&#8203;(com.google.protobuf.Descriptors.EnumValueDescriptor&nbsp;desc)</code></th> <td class="colLast"> <div class="block">Returns the enum constant of this type with the specified name.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>static <a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">SatParameters.ClauseOrdering</a></code></td> <th class="colSecond" scope="row"><span class="typeNameLabel">SatParameters.ClauseOrdering.</span><code><span class="memberNameLink"><a href="../SatParameters.ClauseOrdering.html#valueOf(java.lang.String)">valueOf</a></span>&#8203;(java.lang.String&nbsp;name)</code></th> <td class="colLast"> <div class="block">Returns the enum constant of this type with the specified name.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static <a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">SatParameters.ClauseOrdering</a>[]</code></td> <th class="colSecond" scope="row"><span class="typeNameLabel">SatParameters.ClauseOrdering.</span><code><span class="memberNameLink"><a href="../SatParameters.ClauseOrdering.html#values()">values</a></span>()</code></th> <td class="colLast"> <div class="block">Returns an array containing the constants of this enum type, in the order they are declared.</div> </td> </tr> </tbody> </table> <table class="useSummary"> <caption><span>Methods in <a href="../package-summary.html">com.google.ortools.sat</a> that return types with arguments of type <a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">SatParameters.ClauseOrdering</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colSecond" scope="col">Method</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>static com.google.protobuf.Internal.EnumLiteMap&lt;<a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">SatParameters.ClauseOrdering</a>&gt;</code></td> <th class="colSecond" scope="row"><span class="typeNameLabel">SatParameters.ClauseOrdering.</span><code><span class="memberNameLink"><a href="../SatParameters.ClauseOrdering.html#internalGetValueMap()">internalGetValueMap</a></span>()</code></th> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> <table class="useSummary"> <caption><span>Methods in <a href="../package-summary.html">com.google.ortools.sat</a> with parameters of type <a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">SatParameters.ClauseOrdering</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colSecond" scope="col">Method</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../SatParameters.Builder.html" title="class in com.google.ortools.sat">SatParameters.Builder</a></code></td> <th class="colSecond" scope="row"><span class="typeNameLabel">SatParameters.Builder.</span><code><span class="memberNameLink"><a href="../SatParameters.Builder.html#setClauseCleanupOrdering(com.google.ortools.sat.SatParameters.ClauseOrdering)">setClauseCleanupOrdering</a></span>&#8203;(<a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">SatParameters.ClauseOrdering</a>&nbsp;value)</code></th> <td class="colLast"> <div class="block"><code>optional .operations_research.sat.SatParameters.ClauseOrdering clause_cleanup_ordering = 60 [default = CLAUSE_ACTIVITY];</code></div> </td> </tr> </tbody> </table> </section> </li> </ul> </li> </ul> </div> </main> <footer role="contentinfo"> <nav role="navigation"> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a id="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a id="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../index.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../SatParameters.ClauseOrdering.html" title="enum in com.google.ortools.sat">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> </div> <a id="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </nav> <p class="legalCopy"><small>Copyright &#169; 2022. All rights reserved.</small></p> </footer> </body> </html>
{ "content_hash": "9bfd6a0711d5fc813be979c076e3c519", "timestamp": "", "source": "github", "line_count": 275, "max_line_length": 429, "avg_line_length": 49.767272727272726, "alnum_prop": 0.6918749086657898, "repo_name": "or-tools/docs", "id": "40d8f39362d47e48c313ed2707bc8bb333560189", "size": "13686", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "docs/javadoc/com/google/ortools/sat/class-use/SatParameters.ClauseOrdering.html", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. /** Package containing the implementations for ConfluentManagementClient. null. */ package com.azure.resourcemanager.confluent.implementation;
{ "content_hash": "d17f9d81a8a0cebc379333ac99e39e76", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 82, "avg_line_length": 50, "alnum_prop": 0.7966666666666666, "repo_name": "Azure/azure-sdk-for-java", "id": "3cef6a967b68f15d54019792df73f8f2927f9f81", "size": "300", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "sdk/confluent/azure-resourcemanager-confluent/src/main/java/com/azure/resourcemanager/confluent/implementation/package-info.java", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "8762" }, { "name": "Bicep", "bytes": "15055" }, { "name": "CSS", "bytes": "7676" }, { "name": "Dockerfile", "bytes": "2028" }, { "name": "Groovy", "bytes": "3237482" }, { "name": "HTML", "bytes": "42090" }, { "name": "Java", "bytes": "432409546" }, { "name": "JavaScript", "bytes": "36557" }, { "name": "Jupyter Notebook", "bytes": "95868" }, { "name": "PowerShell", "bytes": "737517" }, { "name": "Python", "bytes": "240542" }, { "name": "Scala", "bytes": "1143898" }, { "name": "Shell", "bytes": "18488" }, { "name": "XSLT", "bytes": "755" } ], "symlink_target": "" }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class ExampleBullet : MonoBehaviour { public float lifetime = 4f; void Start() { Destroy(gameObject, lifetime); } void OnCollisionEnter(Collision col) { GetComponent<Renderer>().enabled = false; Destroy(this.gameObject); } }
{ "content_hash": "708397e060aca33fd2a2aee65536e9c0", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 43, "avg_line_length": 17.31578947368421, "alnum_prop": 0.7416413373860182, "repo_name": "benthroop/Frankenweapon", "id": "90d50db2cb5d015ac53a858c4c6db982bb214158", "size": "331", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Assets/Weapon-Throop/ExampleBullet.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "1721516" }, { "name": "Objective-C", "bytes": "6088" }, { "name": "ShaderLab", "bytes": "1352" }, { "name": "Smalltalk", "bytes": "575" } ], "symlink_target": "" }
layout: post title: "Welcome to Jekyll!" date: 2016-06-04 13:50:39 categories: jekyll --- You’ll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve`, which launches a web server and auto-regenerates your site when a file is updated. To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works. Jekyll also offers powerful support for code snippets: {% highlight ruby %} def print_hi(name) puts "Hi, #{name}" end print_hi('Tom') #=> prints 'Hi, Tom' to STDOUT. {% endhighlight %} Check out the [Jekyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll’s GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekyll’s dedicated Help repository][jekyll-help]. [jekyll]: http://jekyllrb.com [jekyll-gh]: https://github.com/jekyll/jekyll [jekyll-help]: https://github.com/jekyll/jekyll-help Nội dung **web** đang rất là *rối loạn*, do đó, chúng ta phải ~~hợp sức~~ nhằm tìm ra trên con đường sắp tới. $$\pi=3.14$$ > Trong gian nan này cần có người.
{ "content_hash": "1351eedc077d6fb8a367f23ad247c3c6", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 295, "avg_line_length": 45.5, "alnum_prop": 0.7274725274725274, "repo_name": "dodinhkhai/dodinhkhai.github.io", "id": "d23232114b00f64d3c54997949991acbf74f2045", "size": "1413", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/2015-07-11-welcome-to-jekyll.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "24999" }, { "name": "HTML", "bytes": "20877" }, { "name": "JavaScript", "bytes": "6778" }, { "name": "Ruby", "bytes": "1516" } ], "symlink_target": "" }
<div class="row"> <div class="col-md-6 text-left"> <section class="content-header"> <h1>Clientes </h1> </section> </div> <div class="col-md-6 text-right"> <section class="content-header"> <a href="<?php echo site_url('customers/form'); ?>"><button type="button" class="btn btn-sm btn-flat btn-primary"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Agregar</button></a> </section> </div> </div> <section class="content"> <div class="box"> <div class="box-header"> </div><!-- /.box-header --> <div class="box-body"> <div class="row"> <div class="col-md-12"> <table id="customersTable" class="table table-condensed table-hover" style="width:100%"> <thead> <tr> <th style="width:50%">Name</th> <th style="text-align:right"></th> </tr> </thead> <tbody> <?php foreach( $customers as $k=>$customer): ?> <tr> <td><?= $customer->name." ".$customer->lastname?></td> <td style="text-align:right"> <a href="<?=base_url('index.php/dashboard/customerProfile/'.$customer->pk_id)?>" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span> Ver/Editar</a> <!-- <a href="<?=base_url('index.php/suscriptions/actives?custId='.$customer->pk_id)?>" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-list-alt" aria-hidden="true"></span> Bonos</a> --> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> </div> </div> </section> <script type="text/javascript"> $('#customersTable').dataTable({ "language": { "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json" }, "columns": [ null, { "orderable": false } ] }); </script>
{ "content_hash": "54a77b11cdc9300d4434acabe2ca562d", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 260, "avg_line_length": 44.375, "alnum_prop": 0.4253521126760563, "repo_name": "leninbooter/impulse", "id": "2ba43fede652f52be6e8e131757813abdd83144c", "size": "2485", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "application/modules/customers/views/index.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "240" }, { "name": "CSS", "bytes": "787632" }, { "name": "HTML", "bytes": "8537334" }, { "name": "JavaScript", "bytes": "3678712" }, { "name": "PHP", "bytes": "5857765" } ], "symlink_target": "" }
from django.db import models from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin from django.contrib.auth.models import BaseUserManager class UserManager(BaseUserManager): def create_user(self, email, password, **kwargs): user = self.model( email=self.normalize_email(email), is_active=True, **kwargs ) user.set_password(password) user.save(using=self._db) return user def create_superuser(self, email, password, **kwargs): user = self.model( email=email, is_staff=True, is_superuser=True, is_active=True, **kwargs ) user.set_password(password) user.save(using=self._db) return user class User(AbstractBaseUser, PermissionsMixin): USERNAME_FIELD = 'email' email = models.EmailField(unique=True) is_active = models.BooleanField(default=False) is_staff = models.BooleanField(default=False) objects = UserManager() def get_full_name(self): return self.email def get_short_name(self): return self.email
{ "content_hash": "4b29a535809e1c5c33622ef37d4341b7", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 73, "avg_line_length": 26.34090909090909, "alnum_prop": 0.6255392579810182, "repo_name": "funkybob/django-dequorum", "id": "bda234b77acb2ff9594e111de895ee76ad0ce70d", "size": "1159", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "accounts/models.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "7431" }, { "name": "HTML", "bytes": "6237" }, { "name": "JavaScript", "bytes": "760" }, { "name": "Python", "bytes": "13252" } ], "symlink_target": "" }
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>MCollective &#187; Deploy &#187; Standard Deployment &#8212; Documentation &#8212; Puppet Labs</title> <link rel="alternate" type="application/atom+xml" title="Puppet Labs Documentation Updates" href="https://github.com/puppetlabs/puppet-docs/commits/master.atom" /> <link rel="alternate" type="application/atom+xml" title="Puppet Labs Blog Feed" href="http://puppetlabs.com/feed/atom/" /> <link rel="index" title="Puppet Labs Documentation" href="http://docs.puppetlabs.com" /> <link rel="icon" href="./../../favicon.ico" /> <meta name="description" content="SummaryThis getting started guide will help you deploy a standard MCollective environment. Jump to the first step, or keep reading for some context..." /> <!-- FIXME: absolute paths --> <script type="text/javascript" src="./../../files/javascripts/html5.js"></script> <script type="text/javascript" src="./../../files/javascripts/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="./../../files/javascripts/drop_down.js"></script> <script type="text/javascript" src="./../../files/javascripts/cufon-yui.js"></script> <script type="text/javascript" src="./../../files/fonts/Klavika_400-Klavika_600.font.js"></script> <script type="text/javascript" src="./../../files/javascripts/ampersands.js"></script> <script type="text/javascript" src="./../../files/javascripts/navigation-accordion.js"></script> <script type="text/javascript" src="http://puppetlabs.com/wp-content/themes/puppetlabs/javascripts/leadcapture.js"></script> <!-- All in One SEO Pack 1.6.10.1 by Michael Torbert of Semper Fi Web Design[127,146] --> <meta name="keywords" content="Puppet, puppet labs, reductive labs, open source, system administrator, ruby, data center, automation, support" /> <!-- /all in one seo pack --> <!-- Give us the option of setting a canonical URL in yaml frontmatter -NF --> <link rel="canonical" href="http://docs.puppetlabs.com/mcollective/deploy/standard.html" /> <!-- FIXME: absolute paths --> <link rel="stylesheet" type="text/css" href="./../../files/stylesheets/style.css" media="screen" /> <link rel="stylesheet" type="text/css" href="./../../files/stylesheets/syntax.css" media="screen" /> <!-- index --> <link rel="stylesheet" type="text/css" href="./../../files/stylesheets/adbanner.css" media="screen" /> <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="/files/stylesheets/ie_7.css" media="screen"> <!-- index --> <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="/files/stylesheets/ie_8.css" media="screen"> <!-- index --> <script type="text/javascript"><![CDATA[ Cufon.replace('h1, h2', { fontWeight: '600' }); ]]></script> </head> <body id="puppetlabsdocs" class="docs"> <style type="text/css"><![CDATA[h1, h2{ visibility : hidden }]]></style> <!--[if IE 8]> <style type="text/css">h1, h2{ visibility : visible }</style> <![endif]--> <header id="header"> <div class="site-width"> <h1><a href="http://puppetlabs.com/"><span>Puppet Labs</span></a></h1> <a class="screen-reader-content" href="#content">Skip navigation</a> <nav> <ul id="global-navigation"> <li id="puppet-tab" class="with-submenu"> <a href="http://puppetlabs.com/puppet/puppet-enterprise"> <span>Products</span> <span class="drop-down-trigger"></span> </a> <ul> <li> <ul> <a href="http://puppetlabs.com/puppet/what-is-puppet/">What is Puppet?</a> </ul> </li> <li> <ul> <a href="http://puppetlabs.com/puppet/puppet-enterprise/">Puppet Enterprise</a> </ul> </li> <li> <ul> <a href="http://puppetlabs.com/puppet/whats-new/">What's New in 2.5</a> </ul> </li> <li> <ul> <a href="http://puppetlabs.com/puppet/puppet-open-source/">Puppet Open Source</a> </ul> </li> <li> <ul> <a href="http://puppetlabs.com/puppet/enterprise-vs-open-source/">Enterprise vs. Open Source</a> </ul> </li> <li> <ul> <a href="http://forge.puppetlabs.com">Puppet Forge</a> </ul> </li> <li> <ul> <a href="http://puppetlabs.com/puppet/requirements/">Components &amp; Requirements</a> </ul> </li> <li> <ul> <a href="http://puppetlabs.com/puppet/faq/">FAQ</a> </ul> </li> <li> <ul> <a href="http://puppetlabs.com/puppet/how-to-buy/">How to Buy</a> </ul> </li> </ul> </li> <li id="solutions-tab" class="with-submenu"> <a href="http://puppetlabs.com/solutions/"> <span>Solutions</span> <span class="drop-down-trigger"></span> </a> <ul> <li class="page_item page-item-12296"><a href="http://puppetlabs.com/solutions/configuration-management/">Configuration Management</a></li> <li class="page_item page-item-986"><a href="http://puppetlabs.com/solutions/virtualization-management/">Virtualization Management</a></li> <li class="page_item page-item-993"><a href="http://puppetlabs.com/solutions/cloud-management/">Cloud Management</a></li> <li class="page_item page-item-996"><a href="http://puppetlabs.com/solutions/it-compliance/">IT Compliance</a></li> <li class="page_item page-item-9520"><a href="http://puppetlabs.com/solutions/devops/">DevOps</a></li> <li class="page_item page-item-991"><a href="http://puppetlabs.com/solutions/manage-os-x-resources/">OS X Desktops</a></li> </ul> </li> <li id="services-tab" class="with-submenu"> <a href="http://puppetlabs.com/services/"> <span>Services</span> <span class="drop-down-trigger"></span> </a> <ul> <li class="page_item page-item-783"><a href="http://puppetlabs.com/services/overview/">Overview</a></li> <li class="page_item page-item-1052"><a href="http://puppetlabs.com/services/customer-support/">Customer Support</a></li> <li class="page_item page-item-11022"><a href="http://puppetlabs.com/services/support-plans/">Support Plans</a></li> <li class="page_item page-item-845"><a href="http://puppetlabs.com/services/training-workshops/">On-Site Education</a></li> <li class="page_item page-item-4899"><a href="http://puppetlabs.com/services/consulting/">Professional Services</a></li> <li class="page_item page-item-849"><a href="http://puppetlabs.com/category/events/upcoming/">Events &amp; Workshops</a></li> <li class="page_item page-item-851"><a href="http://puppetlabs.com/services/partners/">Partners</a></li> </ul> </li> <li id="resources-tab" class="with-submenu"> <a href="http://puppetlabs.com/resources/"> <span>Resources</span> <span class="drop-down-trigger"></span> </a> <ul> <li class="page_item page-item-1048"><a href="http://puppetlabs.com/resources/overview-2/">Overview</a></li> <li class="page_item page-item-1040"><a href="http://docs.puppetlabs.com">Documentation</a></li> <li class="page_item page-item-872"><a href="http://info.puppetlabs.com/register-download">Downloads</a></li> <li class="page_item page-item-1961"><a href="http://forge.puppetlabs.com">Puppet Forge</a></li> <li class="page_item page-item-835"><a href="http://info.puppetlabs.com/download-whitepapers.html">White Papers</a></li> <li class="page_item page-item-1967"><a href="http://projects.puppetlabs.com/projects/puppet/wiki">Wiki</a></li> <li class="page_item page-item-7279"><a href="http://puppetlabs.com/resources/webinars/">Upcoming Webinars</a></li> <li class="page_item page-item-10183"><a href="http://puppetlabs.com/resources/newsletter/">Newsletter</a></li> <li class="page_item page-item-12263"><a href="http://puppetlabs.com/resources/tech-notes/">Tech Notes</a></li> <li class="page_item page-item-10265"><a href="http://info.puppetlabs.com/pe2-webinar.html">Webinars</a></li> </ul> </li> <li id="customers-tab" class="with-submenu"> <a href="http://puppetlabs.com/customers/companies/"> <span>Customers</span> <span class="drop-down-trigger"></span> </a> <ul> <li> <ul> <a href="http://puppetlabs.com/customers/companies/">Companies</a> </ul> </li> <li> <ul> <a href="http://puppetlabs.com/customers/case-studies/">Case Studies</a> </ul> </li> <li> <ul> <a href="http://puppetlabs.com/customers/product-testimonials/">Product Testimonials</a> </ul> </li> <li> <ul> <a href="http://puppetlabs.com/customers/what-customers-are-saying/">Service Testimonials</a> </ul> </li> </ul> </li> <li id="community-tab" class="with-submenu"> <a href="http://puppetlabs.com/community/"> <span>Community</span> <span class="drop-down-trigger"></span> </a> <ul> <li> <ul> <a href="http://puppetlabs.com/community/overview/">Overview</a> </ul> </li> <li> <ul> <a href="http://puppetlabs.com/blog">Blog</a> </ul> </li> <li> <ul> <a href="http://puppetlabs.com/community/puppet-camp/">Puppet Camp</a> </ul> </li> <li> <ul> <a href="http://puppetlabs.com/community/user-groups-and-devops-groups/">Puppet User Groups &amp; DevOps Groups</a> </ul> </li> <li> <ul> <a href="http://puppetlabs.com/community/presentations/">Presentations</a> </ul> </li> <li> <ul> <a href="http://puppetlabs.com/community/videos/">Videos</a> </ul> </li> </ul> </li><li id="company-tab" class="with-submenu"> <a href="http://puppetlabs.com/company/"> <span>Company</span> <span class="drop-down-trigger"></span> </a> <ul> <li class="page_item page-item-2316"><a href="http://puppetlabs.com/company/overview/">Overview</a></li> <li class="page_item page-item-2179"><a href="http://puppetlabs.com/company/news/">News</a> <ul class="children"> <li class="page_item page-item-2338"><a href="http://puppetlabs.com/company/news/press-releases/">Press Releases</a></li> <li class="page_item page-item-2383"><a href="http://puppetlabs.com/company/news/media-kit/">Media Kit</a></li> </ul> </li> <li class="page_item page-item-1571"><a href="http://puppetlabs.com/company/careers/">Careers</a></li> <li class="page_item page-item-10372"><a href="http://puppetlabs.com/company/management/">Management</a></li> <li class="page_item page-item-10311"><a href="http://puppetlabs.com/company/board-and-advisors/">Board and Advisors</a></li> <li class="page_item page-item-10367"><a href="http://puppetlabs.com/company/investors/">Investors</a></li> <li class="page_item page-item-2313"><a href="http://puppetlabs.com/company/contact-us/">Contact Us</a></li> <li class="page_item page-item-10579"><a href="http://puppetlabs.com/company/awards/">Awards</a></li> </ul> </li> </ul> <div id="misc-navigation"> <ul> <li><a href="http://puppetlabs.com/security/">Security</a></li> <li><a href="http://docs.puppetlabs.com">Documentation</a></li> <li><a href="http://puppetlabs.com/resources/customer-support/">Support</a></li> <li><a href="http://projects.puppetlabs.com/">Bug Tracker</a></li> <li><a href="http://puppetlabs.com/company/contact/contact-us">Contact Us</a></li> <li><a href="http://info.puppetlabs.com/download-pe2.html" class="gateway">Download</a></li> </ul> <form action="http://www.google.com/cse" id="cse-search-box"> <div> <input type="hidden" name="cx" value="017668764424496204839:ubligvgbenm" /> <input type="hidden" name="ie" value="UTF-8" /> <input type="text" name="q" class="gsc-input" size="31" /> <input type="submit" name="sa" class="searchbtn" value="Search" /> </div> </form> <script type="text/javascript" src="http://www.google.com/cse/brand?form=cse-search-box&amp;lang=en"></script> </div> </nav> </div> </header> <section id="masthead"> <div class="site-width"> <h1>Docs: <span class="section-name">MCollective &#187; Deploy &#187; Standard Deployment</span></h1> <ul id="doc-navigation"> <li><a href="./../../index.html">Docs Home</a></li> <li class="with-submenu"> <a href="#"> <span>Quick Nav</span> <span class="drop-down-trigger"></span> </a> <!-- the following links can't be relative, unfortunately --> <!-- future: add some JS to disable this if running from file:// --> <dl> <dt>Puppet Documentation</dt> <dd><a href="./../../puppet/3/reference/index.html">Puppet 3 Reference Manual</a></dd> <dd><a href="./../../puppet/2.7/reference/index.html">Puppet 2.7 Reference Manual</a></dd> <dd><a href="./../../pe/latest/index.html">Puppet Enterprise User's Guide</a></dd> <dd><a href="./../../learning/index.html">Learning Puppet</a></dd> <dd><a href="./../../references/latest/type.html">Resource Types</a></dd> <dd><a href="./../../references/latest/function.html">Functions</a></dd> <dd><a href="./../../references/latest/configuration.html">Configuration</a></dd> <dd><a href="./../../references/latest/developer/index.html">Developer</a></dd> <dd><a href="./../../references/glossary.html">Glossary of Puppet Terms</a></dd> <dd><a href="./../../references/index.html">Older References</a></dd> <dt>Facter</dt> <dd><a href="./../../facter/latest/core_facts.html">Core Facts Reference</a></dd> <dt>PuppetDB</dt> <dd><a href="./../../puppetdb/1/index.html">PuppetDB 1 Manual</a></dd> <dt>MCollective</dt> <dd><a href="./../../mcollective/index.html">Index</a></dd> <dd><a href="./../../mcollective/reference/index.html">References</a></dd> <dd><a href="./../../mcollective/simplerpc/index.html">Writing Plugins</a></dd> <dd><a href="./../../mcollective/releasenotes.html">Release Notes</a></dd> </dl> </li> <li><a href="./../../contribute.html">Contribute</a></li> </ul> </div> <br /> </section> <section id="content"> <div class="site-width"> <div class="primary-secondary-content"> <div class="primary-content"> <h1>Getting Started: Standard MCollective Deployment</h1> <nav class="in-page" id="page-nav"> <ol class="toc"> <li class="toc-lv2"><a href="#summary">Summary</a> <ol class="toc"> <li class="toc-lv3"><a href="#what-is-an-mcollective-deployment">What is an MCollective Deployment?</a></li> <li class="toc-lv3"><a href="#why-standard">Why &#8220;Standard?&#8221;</a></li> </ol></li> <li class="toc-lv2"><a href="#the-standard-mcollective-deployment">The Standard MCollective Deployment</a> <ol class="toc"> <li class="toc-lv3"><a href="#architecture-and-configuration">Architecture and Configuration</a></li> <li class="toc-lv3"><a href="#security-model">Security Model</a></li> <li class="toc-lv3"><a href="#future-expansion">Future Expansion</a></li> </ol></li> <li class="toc-lv2"><a href="#steps-to-deploy">Steps to Deploy</a> <ol class="toc"> <li class="toc-lv3"><a href="#best-practices">Best Practices</a></li> </ol></li> <li class="toc-lv2"><a href="#step-1-create-and-collect-credentials">Step 1: Create and Collect Credentials</a> <ol class="toc"> <li class="toc-lv3"><a href="#what-are-these">What Are These?</a></li> <li class="toc-lv3"><a href="#walkthrough--checklist">Walkthrough / Checklist</a></li> </ol></li> <li class="toc-lv2"><a href="#step-2-deploy-and-configure-middleware">Step 2: Deploy and Configure Middleware</a></li> <li class="toc-lv2"><a href="#step-3-install-mcollective">Step 3: Install MCollective</a></li> <li class="toc-lv2"><a href="#step-4-configure-servers">Step 4: Configure Servers</a> <ol class="toc"> <li class="toc-lv3"><a href="#locate-and-place-credentials">Locate and Place Credentials</a></li> <li class="toc-lv3"><a href="#populate-the-fact-file">Populate the Fact File</a></li> <li class="toc-lv3"><a href="#write-the-server-config-file">Write the Server Config File</a></li> </ol></li> <li class="toc-lv2"><a href="#step-5-configure-clients">Step 5: Configure Clients</a> <ol class="toc"> <li class="toc-lv3"><a href="#managing-client-credentials">Managing Client Credentials</a></li> <li class="toc-lv3"><a href="#write-the-client-config-file">Write the Client Config File</a></li> </ol></li> <li class="toc-lv2"><a href="#step-6-deploy-plugins">Step 6: Deploy plugins</a> <ol class="toc"> <li class="toc-lv3"><a href="#install-actionpolicy">Install ActionPolicy</a></li> <li class="toc-lv3"><a href="#install-agent-plugins">Install Agent Plugins</a></li> <li class="toc-lv3"><a href="#learn-mcollectives-command-line-interface">Learn MCollective&#8217;s Command Line Interface</a></li> </ol></li> </ol></nav> <h2 id="summary">Summary</h2> <p>This getting started guide will help you deploy a standard MCollective environment. <a href="#step-1-create-and-collect-credentials">Jump to the first step</a>, or keep reading for some context.</p> <blockquote> <p><strong>Note:</strong> If you&#8217;ve never used MCollective before, <a href="./demo.html">start with the Vagrant-based demo toolkit instead</a>. This guide is meant for production-grade deployments, and requires a bit of building before you can do a simple <code>mco ping</code> command.</p> </blockquote> <h3 id="what-is-an-mcollective-deployment">What is an MCollective Deployment?</h3> <p><a href="./../../mcollective/overview_components.html">See the MCollective components overview</a> for an introduction to the parts that make up an MCollective deployment.</p> <h3 id="why-standard">Why &#8220;Standard?&#8221;</h3> <p>MCollective is very pluggable, but the developers and community have settled on some common conventions for the most important configuration options. These defaults work very well for most new users, and create a good foundation for future expansion and reconfiguration.</p> <h2 id="the-standard-mcollective-deployment">The Standard MCollective Deployment</h2> <h3 id="architecture-and-configuration">Architecture and Configuration</h3> <p>In summary, these are the architecture and configuration conventions that make up the standard MCollective deployment:</p> <ul> <li>Middleware and connector: <strong>ActiveMQ</strong> <ul> <li>One ActiveMQ server (expandable later)</li> <li>CA-verified TLS</li> <li>No extra subcollectives</li> <li>One ActiveMQ user account/password for all MCollective traffic</li> </ul> </li> <li>Security plugin: <strong>SSL</strong> (authentication only)</li> <li>Credentials: <ul> <li>Certificate/key pair for each client user (for both connector and security plugins)</li> <li>One shared certificate/key pair for all servers (for security plugin)</li> <li>Pre-existing Puppet certificate/key pair on each server (for connector plugin) <ul> <li>Alternately, you can use the shared server certificate/key for both the connector and security plugins; unique certificates aren&#8217;t strictly necessary.</li> </ul> </li> </ul> </li> <li>Authorization: <strong>ActionPolicy plugin</strong></li> </ul> <h3 id="security-model">Security Model</h3> <ul> <li><a href="./../../mcollective/security.html">See here for a deeper explanation of MCollective&#8217;s various layers of security.</a></li> </ul> <p>In brief, this is what MCollective&#8217;s security model looks like with these conventions in place:</p> <h4 id="transport-level">Transport Level</h4> <ul> <li>The TLS between MCollective servers/clients and the ActiveMQ server <strong>encrypts traffic,</strong> preventing passive sniffing of sensitive data in requests and replies.</li> <li>Since the TLS is CA-verified, it also <strong>prevents man-in-the-middle attacks</strong> targeting the middleware.</li> <li>Requiring both a password and a signed certificate to connect to the middleware helps <strong>prevent unauthorized access to decrypted text.</strong> The password is easier to change, the certificate is harder to steal, and together they offer reasonable security. (For these credentials to be secure, we expect that you&#8217;ve made it reasonably difficult for attackers to gain root on your systems.)</li> <li>The middleware connection does not identify clients; this happens at the application level.</li> </ul> <h4 id="application-level">Application Level</h4> <p>With the SSL security plugin, each client user has a unique key pair and all servers share a single key pair. Each server node holds a collection of all authorized client public keys.</p> <ul> <li>When clients issue requests, they sign the payload and TTL with their private key; servers do the same when they send replies. This <strong>strongly identifies individual clients</strong> and <strong>identifies servers as a group.</strong> (An authorized server could theoretically impersonate another authorized server; in the common use cases for MCollective, this isn&#8217;t a significant concern.)</li> <li>Servers will reject requests signed by any key that isn&#8217;t in their collection of authorized clients. This acts as <strong>coarse-grained client authorization.</strong> (Note especially that the shared server key pair cannot be used to send requests, which is an advantage over the weaker PSK security plugin.)</li> <li>The ActionPolicy plugin allows <strong>fine-grained client authorization</strong> at the per-action level. (This relies on the client authentication provided by the SSL security plugin.)</li> <li>Servers also check the signature of the request payload and TTL, which <strong>protects against message tampering and replay attacks.</strong></li> </ul> <h4 id="summary-1">Summary</h4> <p>These measures focus mainly on strict control over who can command your infrastructure and protection of sensitive information in transit. They assume that authorized servers and clients are both sufficiently trusted to view all sensitive information passing through the middleware.</p> <p>This is suitable for most use cases. If some authorized servers are untrustworthy, there are opportunities for them to send misleading replies and bogus traffic, but they can&#8217;t command other nodes.</p> <h3 id="future-expansion">Future Expansion</h3> <p>Later, you may need to <a href="./../../mcollective/reference/integration/activemq_clusters.html">expand to a cluster of ActiveMQ servers</a>; at that point, you might also:</p> <ul> <li><a href="./../../mcollective/reference/basic/subcollectives.html">Divide your nodes into subcollectives</a></li> <li><a href="./middleware/activemq.html#destination-filtering">Filter traffic between datacenters</a></li> <li><a href="./middleware/activemq.html#authorization-group-permissions">Do per-user ActiveMQ authorization</a></li> </ul> <p>If you have already used modular Puppet code to set up a standard deployment, these changes can be incremental instead of a complete overhaul.</p> <p>(<a href="#content">&#8593; Back to top</a>)</p> <h2 id="steps-to-deploy">Steps to Deploy</h2> <p>You need to do the following to deploy MCollective:</p> <ol> <li>Create and collect credentials</li> <li>Deploy and configure middleware</li> <li>Install MCollective (on both servers and admin workstations)</li> <li>Configure servers</li> <li>Configure clients</li> <li>Deploy plugins</li> </ol> <p>This process isn&#8217;t 100% linear, but that&#8217;s the general order in which these tasks should be approached.</p> <h3 id="best-practices">Best Practices</h3> <p><strong>Use <a href="./../../puppet/index.html">Puppet</a> or some other form of configuration management to deploy MCollective.</strong> See <a href="./index.html#best-practices">the deployment overview</a> for why this is important.</p> <p>We don&#8217;t currently have drop-in Puppet code for a standard MCollective deployment, so you&#8217;ll have to do some building.</p> <p>(<a href="#content">&#8593; Back to top</a>)</p> <h2 id="step-1-create-and-collect-credentials">Step 1: Create and Collect Credentials</h2> <p>Credentials are the biggest area of shared global configuration in MCollective. Get them sorted before doing much else.</p> <p>A standard deployment uses the following credentials:</p> <table> <thead> <tr> <th>Credential</th> <th>Used By:</th> </tr> </thead> <tbody> <tr> <td>ActiveMQ username/password</td> <td>Middleware, servers, clients</td> </tr> <tr> <td>CA certificate</td> <td>Middleware, servers, clients</td> </tr> <tr> <td>Signed certificate and private key for <strong>ActiveMQ</strong></td> <td>Middleware</td> </tr> <tr> <td>Signed certificate and private key for each <strong>server</strong></td> <td>Servers</td> </tr> <tr> <td>Signed certificate and private key for each <strong>user</strong></td> <td>Clients (both parts), servers (certificate only)</td> </tr> <tr> <td>Shared server public and private key</td> <td>Servers (both parts), clients (public key only)</td> </tr> </tbody> </table> <h3 id="what-are-these">What Are These?</h3> <ul> <li>ActiveMQ &#8596; MCollective traffic uses CA-signed X.509 certificates for encryption and verification. These are just like the certs Puppet uses. <ul> <li>Unlike Puppet, we aren&#8217;t using the certificate DN/CN for authentication &#8212; the CA verification is solely to make man-in-the-middle attacks more difficult.</li> </ul> </li> <li>The SSL security plugin (on servers and clients) uses RSA public/private key pairs (or anything else readable by openssl) to do authentication, coarse-grained authorization, and message signing. The public portion is flexible: it can be either a raw RSA key, or a signed SSL certificate. The plugin identifies keys by filename.</li> <li>If you&#8217;re using Puppet, you can re-use its certificate authority, and use it to sign certificates.</li> <li>On MCollective nodes, all credentials should be in .pem format; on the middleware, some extra conversion is needed.</li> </ul> <h3 id="walkthrough--checklist">Walkthrough / Checklist</h3> <p>Make sure you&#8217;ve covered each of the following credentials, and keep track of the credentials for use in future steps. This guide assumes you&#8217;re using Puppet as your certificate authority. If you aren&#8217;t, you&#8217;ll need to generate each credential some other way.</p> <blockquote> <p><strong>Directories:</strong> Below, we refer to directories called <a href="./../../references/latest/configuration.html#certdir"><code>$certdir</code></a> and <a href="./../../references/latest/configuration.html#privatekeydir"><code>$privatekeydir</code></a> &#8212; these are defined by Puppet settings of the same names. Their locations may vary by platform, so you can locate them with <code>sudo puppet agent --configprint certdir,privatekeydir</code> (on an agent node) or <code>sudo puppet master --configprint certdir,privatekeydir</code> (on the CA master).</p> </blockquote> <ul> <li><strong>PASSWORD:</strong> <em>Do:</em> Decide on a username for connecting to ActiveMQ; we suggest <code>mcollective</code>. Create a strong arbitrary password for this user.</li> <li><strong>CA:</strong> <em>Already done:</em> Every node already has a local copy of the Puppet CA; you can use it directly. It&#8217;s always located at <code>$certdir/ca.pem</code>.</li> <li><strong>ACTIVEMQ CERT:</strong> <em>Decide:</em> You can either re-use the ActiveMQ server&#8217;s existing puppet agent certificate, or generate a new certificate on the CA puppet master with <code>sudo puppet cert generate activemq.example.com</code> (this name cannot conflict with an existing certificate name). In either case, find the certificate and private key at <code>$certdir/&lt;NAME&gt;.pem</code> and <code>$privatekeydir/&lt;NAME&gt;.pem</code>.</li> <li><strong>SHARED SERVER KEYS:</strong> <em>Do:</em> On the CA puppet master, generate a new certificate with <code>sudo puppet cert generate mcollective-servers</code>. (If you use a different name, substitute it for &#8220;mcollective-servers&#8221; everywhere we mention it below. Note that the name can only use letters, numbers, periods, and hyphens.) <!-- lib/mcollective/security/base.rb#214 --> Retrieve the certificate and private key from <code>$certdir/mcollective-servers.pem</code> and <code>$privatekeydir/mcollective-servers.pem</code>.</li> <li><strong>SERVER CERTS:</strong> <em>Already done:</em> Every server node already has its own puppet agent certificate. You can re-use it. The certificate and key are located at <code>$certdir/&lt;NAME&gt;.pem</code> and <code>$privatekeydir/&lt;NAME&gt;.pem</code>.</li> <li><strong>CLIENT CERTS:</strong> <em>Do:</em> You will need to continually create client credentials as you add new admin users. <ul> <li>For the first admin user &#8212; yourself &#8212; you can generate a certificate on the CA puppet master with <code>sudo puppet cert generate &lt;NAME&gt;</code> (letters, numbers, periods, and hyphens only) and retrieve the cert and key from <code>$certdir/&lt;NAME&gt;.pem</code> and <code>$privatekeydir/&lt;NAME&gt;.pem</code>; delete the CA&#8217;s copy of the private key once you&#8217;ve retrieved it.</li> <li>For future admin users, you need to build a process for issuing and distributing credentials. <a href="#managing-client-credentials">See &#8220;Managing Client Credentials&#8221; below</a> for notes about this.</li> </ul> </li> </ul> <blockquote> <p><strong>Deployment status:</strong> Nothing has happened yet.</p> </blockquote> <p>(<a href="#content">&#8593; Back to top</a>)</p> <h2 id="step-2-deploy-and-configure-middleware">Step 2: Deploy and Configure Middleware</h2> <p>As ever, note that you&#8217;ll have an easier time later if you perform these steps with Puppet or something like it. We suggest using a template for the activemq.xml file and using the <a href="http://forge.puppetlabs.com/puppetlabs/java_ks"><code>java_ks</code></a> resource type for the keystores.</p> <ol> <li>Install ActiveMQ 5.5 or higher on your ActiveMQ server. If you are using Fedora or a relative of Red Hat Enterprise Linux, enable <a href="./../../guides/puppetlabs_package_repositories.html">the Puppet Labs package repos</a> and install the <code>activemq</code> package. The most recent versions of Debian and Ubuntu have ActiveMQ packages, and you may be able to install <code>activemq</code> without enabling any extra repos. For other systems, <a href="http://activemq.apache.org/getting-started.html">adapt the instructions from the ActiveMQ documentation</a>, or roll your own packages.</li> <li>Locate the activemq.xml file. Replace it with the <a href="https://raw.github.com/puppetlabs/marionette-collective/master/ext/activemq/examples/single-broker/activemq.xml">example config file</a> from the MCollective source. You will be editing this example activemq.xml file to suit your deployment in the next four steps.</li> <li><a href="./middleware/activemq.html#authentication-users-and-groups">Change the passwords</a> for the admin user and the <code>mcollective</code> user. For the MCollective user, <strong>use the password from the list of credentials above.</strong></li> <li><a href="./middleware/activemq.html#transport-connectors">Change the port and protocol</a> on the stomp transport connector to <code>stomp+nio+ssl://0.0.0.0:61614?needClientAuth=true</code>, since we&#8217;ll be using CA-verified TLS. (If you are running ActiveMQ 5.5.x or 5.6.x, set it to <code>stomp+ssl://0.0.0.0:61614?needClientAuth=true</code> instead; the stomp+nio+ssl protocol had a bug on 5.6 and didn&#8217;t exist in 5.5.)</li> <li>Follow the <a href="./middleware/activemq_keystores.html">ActiveMQ keystores guide</a>, using <strong>the CA certificate and the ActiveMQ certificate/key.</strong> (See list of credentials above.)</li> <li><a href="./middleware/activemq.html#tls-credentials">Write an <code>sslContext</code> element</a> in the activemq.xml file to use the keystores you created. (If you are using ActiveMQ 5.5, make sure you are arranging elements alphabetically to work around the XML validation bug.)</li> <li>Start or restart the ActiveMQ service.</li> <li>Ensure that the server&#8217;s firewall allows inbound traffic on port 61614.</li> </ol> <p>For more details about configuring ActiveMQ, see the <a href="./middleware/activemq.html">ActiveMQ config reference for MCollective users</a>. It&#8217;s fairly exhaustive, and is mostly for users doing things like networks of brokers and traffic filtering; for a standard deployment, you just need to change the passwords and configure TLS.</p> <blockquote> <p><strong>Deployment status:</strong> The middleware is fully ready, but nothing is using it yet.</p> </blockquote> <p>(<a href="#content">&#8593; Back to top</a>)</p> <h2 id="step-3-install-mcollective">Step 3: Install MCollective</h2> <p><a href="./install.html">See the &#8220;Install MCollective&#8221; page for complete instructions.</a> In summary:</p> <ul> <li>Install the <code>mcollective</code> package on your server nodes.</li> <li>Install the <code>mcollective-client</code> package on your admin workstations.</li> <li>If you don&#8217;t have official packages for your OS, you may need to <a href="./install.html#running-from-source">run from source</a>.</li> <li>Make sure you install the same version everywhere.</li> </ul> <blockquote> <p><strong>Deployment status:</strong> MCollective is installed, but isn&#8217;t ready to do anything at this point. The <code>mcollective</code> service will probably refuse to start since it lacks a connector and security plugin.</p> </blockquote> <p>(<a href="#content">&#8593; Back to top</a>)</p> <h2 id="step-4-configure-servers">Step 4: Configure Servers</h2> <p>To configure servers, you&#8217;ll need to:</p> <ul> <li>Locate and place the credentials</li> <li>Populate the fact file</li> <li>Write the server config file, with appropriate settings</li> </ul> <h3 id="locate-and-place-credentials">Locate and Place Credentials</h3> <p><a href="#step-1-create-and-collect-credentials">As mentioned above in Step 1</a>, servers need the CA, an individual certificate and key, the shared server keypair, and every authorized client certificate.</p> <ul> <li>If you&#8217;re using Puppet, the CA, individual cert, and individual key are already present.</li> <li>Put a copy of the shared public key at <code>/etc/mcollective/server_public.pem</code>.</li> <li>Put a copy of the shared private key at <code>/etc/mcollective/server_private.pem</code>.</li> <li>Create a <code>/etc/mcollective/clients</code> directory and put a copy of every client certificate in it. You will need to maintain this directory centrally, and keep it up to date on every server as you add and delete admin users. (E.g. as a <a href="./../../references/latest/type.html#file">file resource</a> with <code>ensure =&gt; directory, recurse =&gt; true</code>.)</li> </ul> <h3 id="populate-the-fact-file">Populate the Fact File</h3> <p>Every MCollective server will need to populate the <code>/etc/mcollective/facts.yaml</code> file with a cache of its facts. (You can get by without this file, but doing so will limit your ability to filter requests.)</p> <p>Make sure you include a resource like the following in the Puppet code you&#8217;re using to deploy MCollective:</p> <div class="highlight"><pre><code class="ruby"> <span class="n">file</span><span class="p">{</span><span class="s2">"/etc/mcollective/facts.yaml"</span><span class="p">:</span> <span class="n">owner</span> <span class="o">=&gt;</span> <span class="n">root</span><span class="p">,</span> <span class="n">group</span> <span class="o">=&gt;</span> <span class="n">root</span><span class="p">,</span> <span class="n">mode</span> <span class="o">=&gt;</span> <span class="mi">400</span><span class="p">,</span> <span class="n">loglevel</span> <span class="o">=&gt;</span> <span class="n">debug</span><span class="p">,</span> <span class="c1"># reduce noise in Puppet reports</span> <span class="n">content</span> <span class="o">=&gt;</span> <span class="n">inline_template</span><span class="p">(</span><span class="s2">"&lt;%= scope.to_hash.reject { |k,v| k.to_s =~ /(uptime_seconds|timestamp|free)/ }.to_yaml %&gt;"</span><span class="p">),</span> <span class="c1"># exclude rapidly changing facts</span> <span class="p">}</span> </code></pre> </div> <h3 id="write-the-server-config-file">Write the Server Config File</h3> <p>The server config file is located at <code>/etc/mcollective/server.cfg</code>.</p> <blockquote> <p>See the <a href="./../../mcollective/configure/server.html">server configuration reference</a> for complete details about the server&#8217;s config file, including its format and available settings.</p> </blockquote> <p>This config file has many settings that should be identical across the deployment, and several settings that must be unique per server, which is why we suggest managing it with Puppet. If your site uses only a few agent plugins and they don&#8217;t require a lot of configuration, you can use a <a href="./../../guides/templating.html">template</a>; otherwise, we recommend <a href="./../../mcollective/configure/server.html#best-practices">managing each setting as a resource.</a></p> <p><strong>Be sure to always restart the <code>mcollective</code> service after editing the config file.</strong> In your Puppet code, you can do this with a <a href="./../../puppet/latest/reference/lang_relationships.html#ordering-and-notification">notification relationship</a>.</p> <h4 id="server-settings-for-a-standard-deployment">Server Settings for a Standard Deployment</h4> <p>This example template snippet shows the settings you need to use in a standard deployment. Converting it to <a href="./../../mcollective/configure/server.html#best-practices">settings-as-resources</a> would be fairly straightforward.</p> <p>(Note that it assumes an <a href="./../../references/latest/configuration.html#ssldir"><code>$ssldir</code></a> of <code>/var/lib/puppet/ssl</code>, which might differ in your Puppet setup. This template also requires variables named <code>$activemq_server</code> and <code>$activemq_mcollective_password</code>.)</p> <div class="highlight"><pre><code class="erb"><span class="x"> </span><span class="cp">&lt;%</span> <span class="n">ssldir</span> <span class="o">=</span> <span class="s1">'/var/lib/puppet/ssl'</span> <span class="cp">%&gt;</span><span class="x"></span> <span class="x"> # /etc/mcollective/server.cfg</span> <span class="x"> # ActiveMQ connector settings:</span> <span class="x"> connector = activemq</span> <span class="x"> direct_addressing = 1</span> <span class="x"> plugin.activemq.pool.size = 1</span> <span class="x"> plugin.activemq.pool.1.host = </span><span class="cp">&lt;%=</span> <span class="vi">@activemq_server</span> <span class="cp">%&gt;</span><span class="x"></span> <span class="x"> plugin.activemq.pool.1.port = 61614</span> <span class="x"> plugin.activemq.pool.1.user = mcollective</span> <span class="x"> plugin.activemq.pool.1.password = </span><span class="cp">&lt;%=</span> <span class="vi">@activemq_mcollective_password</span> <span class="cp">%&gt;</span><span class="x"></span> <span class="x"> plugin.activemq.pool.1.ssl = 1</span> <span class="x"> plugin.activemq.pool.1.ssl.ca = </span><span class="cp">&lt;%=</span> <span class="n">ssldir</span> <span class="cp">%&gt;</span><span class="x">/certs/ca.pem</span> <span class="x"> plugin.activemq.pool.1.ssl.cert = </span><span class="cp">&lt;%=</span> <span class="n">ssldir</span> <span class="cp">%&gt;</span><span class="x">/certs/</span><span class="cp">&lt;%=</span> <span class="n">scope</span><span class="o">.</span><span class="n">lookupvar</span><span class="p">(</span><span class="s1">'::clientcert'</span><span class="p">)</span> <span class="cp">%&gt;</span><span class="x">.pem</span> <span class="x"> plugin.activemq.pool.1.ssl.key = </span><span class="cp">&lt;%=</span> <span class="n">ssldir</span> <span class="cp">%&gt;</span><span class="x">/private_keys/</span><span class="cp">&lt;%=</span> <span class="n">scope</span><span class="o">.</span><span class="n">lookupvar</span><span class="p">(</span><span class="s1">'::clientcert'</span><span class="p">)</span> <span class="cp">%&gt;</span><span class="x">.pem</span> <span class="x"> plugin.activemq.pool.1.ssl.fallback = 0</span> <span class="x"> # SSL security plugin settings:</span> <span class="x"> securityprovider = ssl</span> <span class="x"> plugin.ssl_client_cert_dir = /etc/mcollective/clients</span> <span class="x"> plugin.ssl_server_private = /etc/mcollective/server_private.pem</span> <span class="x"> plugin.ssl_server_public = /etc/mcollective/server_public.pem</span> <span class="x"> # Facts, identity, and classes:</span> <span class="x"> identity = </span><span class="cp">&lt;%=</span> <span class="n">scope</span><span class="o">.</span><span class="n">lookupvar</span><span class="p">(</span><span class="s1">'::fqdn'</span><span class="p">)</span> <span class="cp">%&gt;</span><span class="x"></span> <span class="x"> factsource = yaml</span> <span class="x"> plugin.yaml = /etc/mcollective/facts.yaml</span> <span class="x"> classesfile = /var/lib/puppet/state/classes.txt</span> <span class="x"> # No additional subcollectives:</span> <span class="x"> collectives = mcollective</span> <span class="x"> main_collective = mcollective</span> <span class="x"> # Registration:</span> <span class="x"> # We don't configure a listener, and only send these messages to keep the</span> <span class="x"> # Stomp connection alive. This will use the default "agentlist" registration</span> <span class="x"> # plugin.</span> <span class="x"> registerinterval = 600</span> <span class="x"> # Auditing (optional):</span> <span class="x"> # If you turn this on, you must arrange to rotate the log file it creates.</span> <span class="x"> rpcaudit = 1</span> <span class="x"> rpcauditprovider = logfile</span> <span class="x"> plugin.rpcaudit.logfile = /var/log/mcollective-audit.log</span> <span class="x"> # Authorization:</span> <span class="x"> # If you turn this on now, you won't be able to issue most MCollective</span> <span class="x"> # commands, although `mco ping` will work. You should deploy the</span> <span class="x"> # ActionPolicy plugin before uncommenting this; see "Deploy Plugins" below.</span> <span class="x"> # rpcauthorization = 1</span> <span class="x"> # rpcauthprovider = action_policy</span> <span class="x"> # plugin.actionpolicy.allow_unconfigured = 1</span> <span class="x"> # Logging:</span> <span class="x"> logger_type = file</span> <span class="x"> loglevel = info</span> <span class="x"> logfile = /var/log/mcollective.log</span> <span class="x"> keeplogs = 5</span> <span class="x"> max_log_size = 2097152</span> <span class="x"> logfacility = user</span> <span class="x"> # Platform defaults:</span> <span class="x"> # These settings differ based on platform; the default config file created by</span> <span class="x"> # the package should include correct values. If you are managing settings as</span> <span class="x"> # resources, you can ignore them, but with a template you'll have to account</span> <span class="x"> # for the differences.</span> <span class="x"> </span><span class="cp">&lt;%</span> <span class="k">if</span> <span class="n">scope</span><span class="o">.</span><span class="n">lookupvar</span><span class="p">(</span><span class="s1">'::osfamily'</span><span class="p">)</span> <span class="o">==</span> <span class="s1">'RedHat'</span> <span class="cp">-%&gt;</span><span class="x"></span> <span class="x"> libdir = /usr/libexec/mcollective</span> <span class="x"> daemonize = 1</span> <span class="x"> </span><span class="cp">&lt;%</span> <span class="k">elsif</span> <span class="n">scope</span><span class="o">.</span><span class="n">lookupvar</span><span class="p">(</span><span class="s1">'::osfamily'</span><span class="p">)</span> <span class="o">==</span> <span class="s1">'Debian'</span> <span class="cp">-%&gt;</span><span class="x"></span> <span class="x"> libdir = /usr/share/mcollective/plugins</span> <span class="x"> daemonize = 1</span> <span class="x"> </span><span class="cp">&lt;%</span> <span class="k">else</span> <span class="cp">-%&gt;</span><span class="x"></span> <span class="x"> # INSERT PLATFORM-APPROPRIATE VALUES FOR LIBDIR AND DAEMONIZE</span> <span class="x"> </span><span class="cp">&lt;%</span> <span class="k">end</span> <span class="cp">%&gt;</span><span class="x"></span> </code></pre> </div> <blockquote> <p><strong>Deployment status:</strong> The servers are ready, connected to the middleware, and will accept and process requests from authorized clients. The authorized clients don&#8217;t exist yet.</p> </blockquote> <p>(<a href="#content">&#8593; Back to top</a>)</p> <h2 id="step-5-configure-clients">Step 5: Configure Clients</h2> <p>Unlike servers, clients will probably run with per-user configs on admin workstations, and will have to be configured partially by hand. (If you are running any automated clients, you&#8217;ll want to deploy those with config management; most of the principles covered below will still apply.)</p> <p>To configure clients, each new admin user will need to:</p> <ul> <li>Request, retrieve, and place their credentials</li> <li>Write the client config file, with appropriate sitewide and per-user settings</li> </ul> <p>Unless the client will be run by root or a system user, we recommend putting the client config file at <code>~/.mcollective</code> and supporting files like credentials in <code>~/.mcollective.d</code>.</p> <h3 id="managing-client-credentials">Managing Client Credentials</h3> <p>For your first admin user, you can manually generate a certificate (as suggested in Step 1) and add it to the authorized clients directory that you&#8217;re syncing to servers with Puppet. However, this does not scale beyond one or two users.</p> <p>When a new admin user joins your team, you need a documented process that does ALL of the following:</p> <ul> <li>Issues the user a signed SSL certificate, while assuring the user that no one else has <em>ever</em> had custody of their private key.</li> <li>Adds a copy of the user&#8217;s certificate to every MCollective server.</li> <li>Gives the user a copy of the shared server public key, the CA cert, and the ActiveMQ username/password.</li> </ul> <blockquote> <p><strong>Note:</strong> The filename of the <strong>public key</strong> must be identical on both the client and the servers. The client uses the filename to set the caller ID in its requests, and the servers use the request&#8217;s caller ID to choose which public key file to validate it with.</p> </blockquote> <p>This will have to be at least partially manual, but if you&#8217;ve used the Puppet CA to issue certificates, you can pretty easily patch together and document a process using the existing Puppet tools.</p> <p>Below, we outline a suggested process. It assumes a flat hierarchy of admins where everyone can command all servers, with any additional restrictions being handled by the ActionPolicy plugin (see &#8220;Step 6: Deploy Plugins&#8221; below) rather than the certificate distribution process.</p> <h4 id="example-client-onboarding-process">Example Client Onboarding Process</h4> <ol> <li>The new user should have Puppet installed on their workstation (or the server from which they will be issuing mco commands). It does not need to be managing their workstation, it just needs to be present.</li> <li> <p>The new user should run the following commands on their workstation &#8212; note that the name can only use letters, numbers, periods, and hyphens:</p> <pre><code> $ mkdir -p ~/.mcollective.d/credentials $ puppet certificate generate &lt;NAME&gt; --ssldir ~/.mcollective.d/credentials --ca-location remote --ca_server &lt;CA PUPPET MASTER&gt; </code></pre> <p>(Note the use of the <code>puppet certificate</code> command, which isn&#8217;t the same thing as the <code>puppet cert</code> command. This specific invocation will send a certificate signing request to the CA while safeguarding the private key.)</p> </li> <li>The new user should tell the MCollective admins which name they used, and optionally the fingerprint of the CSR they submitted.</li> <li>The MCollective admins should run <code>sudo puppet cert sign &lt;NAME&gt;</code> on the CA puppet master, then copy the certificate from <code>$certdir/&lt;NAME&gt;.pem</code> into the directory of authorized client keys that is being synced to the MCollective servers; each server will recognize the new user after its next Puppet run.</li> <li>The MCollective admins should tell the new user that they have signed the certificate request, and give them the ActiveMQ password and a partially filled-out client config file containing the relevant hostnames and ports. (See &#8220;Write the Client Config File&#8221; below.)</li> <li> <p>The new user should run the following commands on their workstation:</p> <pre><code> $ puppet certificate find &lt;NAME&gt; --ssldir ~/.mcollective.d/credentials --ca-location remote --ca_server &lt;CA PUPPET MASTER&gt; $ puppet certificate find mcollective-servers --ssldir ~/.mcollective.d/credentials --ca-location remote --ca_server &lt;CA PUPPET MASTER&gt; $ puppet certificate find ca --ssldir ~/.mcollective.d/credentials --ca-location remote --ca_server &lt;CA PUPPET MASTER&gt; </code></pre> </li> <li>The new user should copy the partial client config file they were provided to <code>~/.mcollective</code> on their workstation, and finish filling it out as described below.</li> </ol> <p>After all these steps, and following a Puppet run on each MCollective server, the new user should be able to issue valid mco commands.</p> <h3 id="write-the-client-config-file">Write the Client Config File</h3> <p>For admin users running commands on a workstation, the client config file is located at <code>~/.mcollective</code>. For system users (e.g. for use in automated scripts), it is located at <code>/etc/mcollective/client.cfg</code>.</p> <blockquote> <p>See the <a href="./../../mcollective/configure/client.html">client configuration reference</a> for complete details about the client config file, including its format and available settings.</p> </blockquote> <p>This config file has many settings that should be identical across the deployment, and several settings that must be unique per user. To save your new users time, we recommend giving them a partial config file with settings like the ActiveMQ hostname/port/password already entered; this way, they only have to fill in the paths to their unique credentials. The settings that must be modified by each user are:</p> <ul> <li><code>plugin.activemq.pool.1.ssl.ca</code></li> <li><code>plugin.activemq.pool.1.ssl.cert</code></li> <li><code>plugin.activemq.pool.1.ssl.key</code></li> <li><code>plugin.ssl_server_public</code></li> <li><code>plugin.ssl_client_private</code></li> <li><code>plugin.ssl_client_public</code></li> </ul> <h4 id="client-settings-for-a-standard-deployment">Client Settings for a Standard Deployment</h4> <p>After receiving this partial config file, a new user should fill out the credential paths, substituting <code>&lt;HOME&gt;</code> for the fully qualified path to their home directory and <code>&lt;NAME&gt;</code> for the name of the certificate they requested. (Note that MCollective cannot expand shorthand paths to the home directory &#8212; <code>~/.mcollective.d/credentials...</code> &#8212; so you must use fully qualified paths.)</p> <pre><code># ~/.mcollective # or # /etc/mcollective/client.cfg # ActiveMQ connector settings: connector = activemq direct_addressing = 1 plugin.activemq.pool.size = 1 plugin.activemq.pool.1.host = &lt;ActiveMQ SERVER HOSTNAME&gt; plugin.activemq.pool.1.port = 61614 plugin.activemq.pool.1.user = mcollective plugin.activemq.pool.1.password = &lt;ActiveMQ PASSWORD&gt; plugin.activemq.pool.1.ssl = 1 plugin.activemq.pool.1.ssl.ca = &lt;HOME&gt;/.mcollective.d/credentials/certs/ca.pem plugin.activemq.pool.1.ssl.cert = &lt;HOME&gt;/.mcollective.d/credentials/certs/&lt;NAME&gt;.pem plugin.activemq.pool.1.ssl.key = &lt;HOME&gt;/.mcollective.d/credentials/private_keys/&lt;NAME&gt;.pem plugin.activemq.pool.1.ssl.fallback = 0 # SSL security plugin settings: securityprovider = ssl plugin.ssl_server_public = &lt;HOME&gt;/.mcollective.d/credentials/certs/mcollective-servers.pem plugin.ssl_client_private = &lt;HOME&gt;/.mcollective.d/credentials/private_keys/&lt;NAME&gt;.pem plugin.ssl_client_public = &lt;HOME&gt;/.mcollective.d/credentials/certs/&lt;NAME&gt;.pem # Interface settings: default_discovery_method = mc direct_addressing_threshold = 10 ttl = 60 color = 1 rpclimitmethod = first # No additional subcollectives: collectives = mcollective main_collective = mcollective # Platform defaults: # These settings differ based on platform; the default config file created # by the package should include correct values or omit the setting if the # default value is fine. libdir = /usr/libexec/mcollective helptemplatedir = /etc/mcollective # Logging: logger_type = console loglevel = warn </code></pre> <blockquote> <p><strong>Deployment status:</strong> MCollective is <strong>fully functional.</strong> Any configured admin user can run <code>mco ping</code> to discover nodes, use the <code>mco inventory</code> command to search for more detailed information, and use the <code>mco rpc</code> command to trigger actions from installed agents (currently only the <code>rpcutil</code> agent). See the <a href="./../../mcollective/reference/basic/basic_cli_usage.html">mco command-line interface documentation</a> for more detailed information on filtering and addressing commands.</p> <p>However, it can&#8217;t yet do much other than collect inventory info. To perform more useful functions, you must install agent plugins on each server and admin workstation. Additionally, if you want to do per-action authorization for certain dangerous commands, you will need to install and configure the ActionPolicy plugin.</p> </blockquote> <p>(<a href="#content">&#8593; Back to top</a>)</p> <h2 id="step-6-deploy-plugins">Step 6: Deploy plugins</h2> <p>To let MCollective do anything beyond retrieving inventory data, you must deploy various plugins to all of your server and client nodes. You will usually also want to write custom agent plugins to serve business purposes in your infrastructure.</p> <h3 id="install-actionpolicy">Install ActionPolicy</h3> <p>For a long-lived standard deployment, we recommend that you deploy the ActionPolicy authorization plugin to all servers.</p> <p>By default, the standard deployment allows <strong>all</strong> authorized clients to execute <strong>all</strong> actions on <strong>all</strong> servers. This is reasonable as long as MCollective&#8217;s capabilities are limited, but as you hire more admin staff and deploy agent plugins that can cause significant changes to production servers, you may wish to begin limiting who can execute what. ActionPolicy allows you to distribute policy files for specific agents, which will restrict the set of users able to run a given action.</p> <ol> <li><a href="https://github.com/puppetlabs/mcollective-actionpolicy-auth">Download the ActionPolicy plugin at its GitHub repo.</a></li> <li>Install it on all <strong>servers</strong> using the <a href="./plugins.html#method-2-copying-plugins-into-the-libdir">libdir copy install method</a>.</li> <li>Uncomment the <code>rpcauthorization</code>, <code>rpcauthprovider</code>, and <code>plugin.actionpolicy.allow_unconfigured</code> settings in the server config file.</li> <li>As needed, write per-agent policy files and distribute them to servers. <a href="http://projects.puppetlabs.com/projects/mcollective-plugins/wiki/AuthorizationActionPolicy">See the ActionPolicy documentation for details on how to write policies.</a></li> </ol> <h4 id="notes">Notes</h4> <ul> <li>The SSL security plugin sets the message caller ID to <code>cert=&lt;NAME&gt;</code>, where <code>&lt;NAME&gt;</code> is the filename of the client&#8217;s public key file without the <code>.pem</code> extension. This string (including the <code>cert=</code>) can be used as the second field of a policy line. (The ActionPolicy documentation uses <code>uid=</code> for its examples, which is a caller ID set by the PSK security plugin.)</li> <li>With the configuration <a href="#server-settings-for-a-standard-deployment">shown above in the server config file</a>, ActionPolicy is opt-in <strong>per agent.</strong> If you don&#8217;t distribute any policy files, MCollective will continue to work as before, with no additional authorization.</li> <li>Since policy files define which servers their rules apply to (based on facts and other metadata), they can safely be distributed to all servers.</li> </ul> <h3 id="install-agent-plugins">Install Agent Plugins</h3> <p>Agent plugins do all of MCollective&#8217;s heavy lifting. All parts of an agent need to be installed on servers, and the DDL file needs to be installed on clients.</p> <p>You can:</p> <ul> <li>Install any number of pre-existing agents. See <a href="http://projects.puppetlabs.com/projects/mcollective-plugins/wiki">the mcollective-plugins wiki</a> for a list of the most common ones. You will probably want to install at least the <code>puppet</code>, <code>package</code>, and <code>service</code> agents.</li> <li><a href="./../../mcollective/simplerpc/agents.html">Develop your own agent plugins</a> to serve site-specific purposes. These can help with application deployments, automate routine tasks like retrying mail queues, collect complex inventory information in real time, and more. <a href="./../../mcollective/simplerpc/agents.html">See the documentation on writing agent plugins for more info.</a></li> </ul> <p>For more information on how to install these agents, <a href="./plugins.html">see &#8220;Installing and Packaging MCollective Plugins.&#8221;</a> Specifically: * <a href="./plugins.html#method-1-installing-plugins-with-native-packages">Installing plugins with packages</a> * <a href="./plugins.html#method-2-copying-plugins-into-the-libdir">Installing plugins by copying into the libdir</a></p> <h3 id="learn-mcollectives-command-line-interface">Learn MCollective&#8217;s Command Line Interface</h3> <ul> <li><a href="./../../mcollective/reference/basic/basic_cli_usage.html">See here for general info on using MCollective&#8217;s <code>mco</code> CLI client.</a></li> <li><a href="./../../mcollective/reference/ui/filters.html">See here for additional info about filtering requests.</a></li> </ul> <blockquote> <p><strong>Deployment status:</strong> MCollective can do anything you&#8217;ve written or downloaded plugins for, on any number of servers, filtered and grouped by arbitrary metadata.</p> </blockquote> <blockquote><p style="font-size: 1.3em; text-align: center;"><a href="#content">&#8593; Back to top</a></p></blockquote> </div> <nav class="main"> <div id="subCol"> <ul> <li><strong>Overview</strong> <ul> <li><a href="./../../mcollective/index.html">Introduction</a></li> <li><a href="./../../mcollective/overview_components.html">Overview of Components</a></li> <li><a href="./../../mcollective/terminology.html">Terminology</a></li> <li><a href="./../../mcollective/screencasts.html">Screencasts</a></li> <li><a href="./../../mcollective/releasenotes.html">Release Notes</a></li> <li><a href="./../../mcollective/changelog.html">Changelog</a></li> </ul> </li> <li><strong>Deploying MCollective</strong> <ul> <li><a href="./../../mcollective/deploy/index.html">Index</a></li> <li><a href="./../../mcollective/deploy/demo.html">Demo</a></li> <li><span class="currentpage">Getting Started (Standard Deployment)</span></li> </ul> </li> <li><strong>Configuration / Deployment Topics</strong> <ul> <li><strong>Installation:</strong></li> <li><a href="./../../mcollective/deploy/install.html">Installing MCollective</a></li> <li><a href="./../../mcollective/deploy/plugins.html">Installing Plugins</a></li> <li><strong>Configuration:</strong></li> <li><a href="./../../mcollective/configure/server.html">Server Config Reference</a></li> <li><a href="./../../mcollective/configure/client.html">Client Config Reference</a></li> <li><a href="./../../mcollective/reference/integration/puppet.html">Puppet Integration</a></li> <li><a href="./../../mcollective/reference/integration/chef.html">Chef Integration</a></li> <li><strong>Middleware:</strong></li> <li><a href="./../../mcollective/deploy/middleware/index.html">Middleware Types</a></li> <li><a href="./../../mcollective/deploy/middleware/activemq.html">ActiveMQ Configs for MCollective</a></li> <li><a href="./../../mcollective/deploy/middleware/activemq_keystores.html">ActiveMQ TLS Keystore Setup</a></li> <li><a href="./../../mcollective/reference/integration/activemq_clusters.html">ActiveMQ Clustering</a></li> <li><a href="./../../mcollective/reference/integration/activemq_ssl.html">ActiveMQ TLS</a></li> <li><a href="./../../mcollective/reference/integration/activemq_security.html">ActiveMQ Security</a></li> <li><strong>Connector Plugins:</strong></li> <li><a href="./../../mcollective/reference/plugins/connector_activemq.html">The ActiveMQ Connector</a></li> <li><a href="./../../mcollective/reference/plugins/connector_rabbitmq.html">The RabbitMQ Connector</a></li> <li><strong>Security Plugins:</strong></li> <li><a href="./../../mcollective/reference/plugins/security_ssl.html">Configuring SSL Validation Security</a></li> <li><strong>Advanced Features:</strong></li> <li><a href="./../../mcollective/reference/basic/subcollectives.html">Subcollectives and Partitioning</a></li> <li><a href="./../../mcollective/simplerpc/auditing.html">Auditing</a> <!-- contains plugin-writing info --></li> </ul> </li> <li><strong>Use and Administer MCollective</strong> <ul> <li><a href="./../../mcollective/reference/basic/basic_cli_usage.html">Command Line Usage Instructions</a></li> <li><a href="./../../mcollective/reference/ui/filters.html">Command Filtering and Discovery</a></li> <li><a href="./../../mcollective/reference/basic/daemon.html">Controlling the MCollective Daemon</a></li> <li><a href="./../../mcollective/reference/plugins/rpcutil.html">Controlling the MCollective Daemon with the rpcutil Agent</a></li> <li><a href="./../../mcollective/reference/ui/nodereports.html">On-Demand Node Reports</a></li> </ul> </li> <li><strong>Write Agent Plugins</strong> <ul> <li><a href="./../../mcollective/simplerpc/agents.html">Writing Agent Plugins</a></li> <li><a href="./../../mcollective/reference/plugins/ddl.html">Writing DDL Files</a></li> <li><a href="./../../mcollective/reference/plugins/aggregate.html">Aggregating Results</a> <!-- mixes DDL info with info about writing aggregate plugins --></li> </ul> </li> <li><strong>Write Clients and Applications</strong> <ul> <li><a href="./../../mcollective/simplerpc/clients.html">Writing Clients</a></li> <li><a href="./../../mcollective/reference/plugins/application.html">Writing New mco Subcommands</a></li> </ul> </li> <li><strong>Write Other Plugins</strong> <ul> <li><a href="./../../mcollective/simplerpc/authorization.html">Writing Authorization Plugins and Enabling Authorization</a> <!-- contains deploy/config info --></li> <li><a href="./../../mcollective/reference/plugins/data.html">Writing Data Plugins</a></li> <li><a href="./../../mcollective/reference/plugins/discovery.html">Writing and Using Discovery Plugins</a> <!-- contains usage info --></li> <li><a href="./../../mcollective/reference/plugins/facts.html">Writing Facts Plugins</a></li> <li><a href="./../../mcollective/reference/plugins/registration.html">Writing Registration Plugins</a></li> <li><a href="./../../mcollective/reference/plugins/validator.html">Writing Validator Plugins</a></li> </ul> </li> <li><a href="http://projects.puppetlabs.com/projects/mcollective-plugins/wiki">Plugin Directory</a></li> <li><strong>Internals</strong> <ul> <li><a href="./../../mcollective/reference/basic/messageflow.html">Message Flow</a> <!-- needs more/needs update --></li> <li><a href="./../../mcollective/simplerpc/index.html">SimpleRPC Overview</a></li> <li><a href="./../../mcollective/simplerpc/messageformat.html">SimpleRPC Message Format</a></li> <li><a href="./../../mcollective/reference/basic/messageformat.html">Core Message Format</a></li> <li><a href="./../../mcollective/security.html">Security Overview</a></li> </ul> </li> <li><strong>Older and Non-Recommended Information</strong> <ul> <li><a href="./../../mcollective/reference/plugins/security_aes.html">Configuring AES Security</a></li> <li><a href="./../../mcollective/reference/plugins/connector_stomp.html">Configuring the Generic Stomp Connector</a></li> <li><a href="./../../mcollective/reference/basic/basic_agent_and_client.html">Writing Old-Style Agent Plugins</a></li> <li><a href="./../../mcollective/reference/index.html">Alternate Index</a></li> </ul> </li> </ul> <div style="margin-top: 1.5em; padding-bottom: 10px;"> <p style="font-family: 'Lucida Grande',Lucida,Verdana,sans-serif;font-size: 16px; font-weight: bold; line-height: 22px; margin-bottom: 10px;">Download the Docs</p> <a href="http://info.puppetlabs.com/download-pdfs.html"><img src="./../../images/smallbits_small_docs.png" alt="Puppet docs download" /></a> </div> <div style="margin-top: 0; padding-bottom: 10px;"> <p style="font-family: 'Lucida Grande',Lucida,Verdana,sans-serif;font-size: 16px; font-weight: bold; line-height: 22px; margin-bottom: 10px;">Download Puppet Enterprise</p> <a href="http://info.puppetlabs.com/download-pe.html"><img src="./../../images/puppet_cert_home.jpg" alt="Puppet Enterprise promo" /></a> </div> </div> </nav> </div> </div> </section> <footer id="footer"> <div class="site-width"> <div class="primary-secondary-content"> <div class="primary-content"> <section id="newsletter"> <h4>Puppet Labs is Hiring</h4> <p><a href="http://www.puppetlabs.com/company/jobs/">Engineers, developers &amp; consultants</a> </p><p> </p><h4>Newsletter</h4> <p>Stay up to date on all things puppet</p> <form class="lpeRegForm formNotEmpty" method="post" enctype="application/x-www-form-urlencoded" action="http://info.puppetlabs.com/index.php/leadCapture/save" id="mktForm_1013" name="mktForm_1013"> <label>Email Address:</label><span class="mktInput"><input class="mktFormText mktFormEmail" name="Email" id="Email" type="text" value="" maxlength="255" /><span class="mktFormMsg"></span></span> <input id="mktFrmSubmit" type="submit" class="btn" style="width: auto; overflow: visible; padding-left: .25em; padding-right: .25em;" value="Subscribe" name="submitButton" onclick="formSubmit(document.getElementById(&quot;mktForm_1013&quot;)); return false;" /> <input style="display: none;" id="mktFrmReset" type="reset" value="Clear" name="resetButton" onclick="formReset(document.getElementById(&quot;mktForm_1013&quot;)); return false;" /> <span style="display:none;"><input type="text" name="_marketo_comments" value="" /></span> <input type="hidden" name="lpId" value="-1" /> <input type="hidden" name="subId" value="100" /> <input type="hidden" name="kw" value="" /> <input type="hidden" name="cr" value="" /> <input type="hidden" name="searchstr" value="" /> <input type="hidden" name="lpurl" value="http://info.puppetlabs.com/testsubscription.html?cr={creative}&amp;kw={keyword}" /> <input type="hidden" name="formid" value="1013" /> <input type="hidden" name="returnURL" value="http://www.puppetlabs.com/misc/subscription-thank-you/" /> <input type="hidden" name="retURL" value="http://www.puppetlabs.com/misc/subscription-thank-you/" /> <input type="hidden" name="_mkt_disp" value="return" /> <input type="hidden" name="_mkt_trk" value="" /> </form> <script type="text/javascript" src="http://info.puppetlabs.com/js/mktFormSupport.js"></script> <script type="text/javascript"><![CDATA[ function formSubmit(elt) { return Mkto.formSubmit(elt); } function formReset(elt) { return Mkto.formReset(elt); } ]]></script> <a href="http://info.puppetlabs.com/puppet-enterprise" class="fbtn">Try Puppet Enterprise FREE</a> </section> <section id="elsewhere"> <h4>Get Involved</h4> <ul> <li class="chat"><a href="http://webchat.freenode.net/?channels=puppet" rel="external"><span class="indicator"></span><span>Chat with us on IRC</span></a></li> <li class="discussion"><a href="http://groups.google.com/group/puppet-dev" rel="external"><span class="indicator"></span><span>Join the Puppet Developer List</span></a></li> <li class="discussion"><a href="http://groups.google.com/group/puppet-users?pli=1" rel="external"><span class="indicator"></span><span>Join the Puppet User List</span></a></li> <li class="linkedin"><a href="http://www.linkedin.com/groups?about=&amp;gid=696467&amp;trk=anet_ug_grppro" rel="external"><span class="indicator"></span><span>Join the Puppet Users LinkedIn group</span></a></li> </ul> <p> </p><h4>Follow us&#8230;</h4> <ul class="followus"> <li><a href="http://feeds.feedburner.com/PuppetLabs" target="_blank"><img src="http://www.puppetlabs.com/wp-content/plugins/my-profiles/images/rss.png" border="0" /></a></li> <li><a href="http://www.facebook.com/pages/Puppet-Labs/219089920711" target="_blank"><img src="http://www.puppetlabs.com//wp-content/plugins/my-profiles/images/facebook.png" border="0" /></a></li> <li><a href="http://www.twitter.com/puppetlabs" target="_blank"><img src="http://www.puppetlabs.com//wp-content/plugins/my-profiles/images/twitter.png" border="0" /></a></li> <li><a href="http://www.linkedin.com/groups?about=&amp;gid=696467&amp;trk=anet_ug_grppro" target="_blank"><img src="http://www.puppetlabs.com//wp-content/uploads/2011/01/LinkedIn_IN_Icon_32px.png" border="0" /></a></li> <li><a href="https://github.com/puppetlabs" target="_blank"><img src="http://www.puppetlabs.com//wp-content/uploads/2011/01/github_icon.png" border="0" /></a></li> <li><a href="https://plus.google.com/112682055028218091774?rel=author" target="_blank"><img src="https://puppetlabs.com/wp-content/uploads/2013/05/google_plus32x32.png" alt="Find Us on Google+" border="0" /></a></li> </ul> </section> </div> <div class="secondary-content"> <section id="book-it"> <h4>Get the book!</h4> <p>James Turnbull and Jeff McCune's book <a href="http://www.apress.com/9781430230571" rel="nofollow">Pro Puppet</a> is a comprehensive and up-to-date look at Puppet and MCollective. </p> <a href="http://www.apress.com/9781430230571" rel="nofollow"><img src="http://www.puppetlabs.com/wp-content/uploads/2011/05/propuppetthumb.png" /></a> </section> </div> </div> </div> </footer> <div id="copyright"> <div class="site-width"> &#169; 2011 <a href="http://www.puppetlabs.com/" title="Puppet Labs">Puppet Labs</a> <span class="vcard"> <span class="org"></span> <a class="email" href="mailto:[email protected]">[email protected]</a> <span class="adr"> <span class="street-address">926 NW 13th Avenue #210</span> / <span class="locality">Portland</span>, <span class="region">OR</span> <span class="postal-code">97209</span> </span> <span class="tel">1-877-575-9775</span> </span> </div> </div> <script type="text/javascript"><![CDATA[Cufon.now();]]></script> <style type="text/css"><![CDATA[h1, h2, .btn { visibility : visible; }]]></style> </body> </html>
{ "content_hash": "b242bab1c55e0f06ebabb4911b41fc36", "timestamp": "", "source": "github", "line_count": 1176, "max_line_length": 604, "avg_line_length": 64.30272108843538, "alnum_prop": 0.6696641100238032, "repo_name": "Smolations/more-dash-docsets", "id": "8a260c8fa1b693a0dd83090235cda62899a0a336", "size": "75620", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docsets/Puppet.docset/Contents/Resources/Documents/mcollective/deploy/standard.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1456655" }, { "name": "Emacs Lisp", "bytes": "3680" }, { "name": "JavaScript", "bytes": "139712" }, { "name": "Puppet", "bytes": "15851" }, { "name": "Ruby", "bytes": "66500" }, { "name": "Shell", "bytes": "11437" } ], "symlink_target": "" }
package com.amazonaws.services.cloudsearchdomain.model.transform; import java.util.Map; import java.util.Map.Entry; import com.amazonaws.services.cloudsearchdomain.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * SuggestStatus JSON Unmarshaller */ public class SuggestStatusJsonUnmarshaller implements Unmarshaller<SuggestStatus, JsonUnmarshallerContext> { public SuggestStatus unmarshall(JsonUnmarshallerContext context) throws Exception { SuggestStatus suggestStatus = new SuggestStatus(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) return null; while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("timems", targetDepth)) { context.nextToken(); suggestStatus.setTimems(LongJsonUnmarshaller.getInstance() .unmarshall(context)); } if (context.testExpression("rid", targetDepth)) { context.nextToken(); suggestStatus.setRid(StringJsonUnmarshaller.getInstance() .unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals( currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return suggestStatus; } private static SuggestStatusJsonUnmarshaller instance; public static SuggestStatusJsonUnmarshaller getInstance() { if (instance == null) instance = new SuggestStatusJsonUnmarshaller(); return instance; } }
{ "content_hash": "6d9fa763691e73ab29cd56bbc3d06e9d", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 78, "avg_line_length": 34.25352112676056, "alnum_prop": 0.5982730263157895, "repo_name": "trasa/aws-sdk-java", "id": "43f7d68a8c57769874f25f2cd1c98d7b891e8f45", "size": "3016", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "aws-java-sdk-cloudsearch/src/main/java/com/amazonaws/services/cloudsearchdomain/model/transform/SuggestStatusJsonUnmarshaller.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "100011199" }, { "name": "Scilab", "bytes": "2354" } ], "symlink_target": "" }
<html> <head> <style> canvas { background-color: lightblue; } </style> </head> <body> <canvas id="canvas"></canvas> <script> const url = "http://159.203.104.60:8000/pop"; //Python server endpoint const directions = ["up", "down", "left", "right"]; const canvas = document.getElementById("canvas"); const ctx = canvas.getContext("2d"); const increment = 25; //Pixels to move per command const width = 800; const height = 600; var x = width / 2; //Starting point var y = height / 2; window.onload = function() { canvas.width = width; //Set up canvas canvas.height = height; draw(); //Draw initial starting point poll(); //Begin infinitely polling the server }; function draw() { ctx.clearRect(0, 0, width, height); //Clear the canvas ctx.beginPath(); ctx.arc(x,y,6,0,Math.PI*2); //Draw our new circle ctx.fill(); } function poll() { fetch(url).then(function(response) { //Ask server for new messages return response.json(); //Parse out JSON }).then(function(data) { data = data.map(function(d) { return d.message.trim().toLowerCase(); }); //Clean up people's texts return data.filter(function(d) { return (directions.indexOf(d) !== -1) }); //Ensure it's in the list of directions }).then(function(data) { data.forEach(function(d) { switch (d) { //Change x/y appropriately case 'left': x -= increment; break; case 'right': x += increment; break; case 'up': y -= increment; break; case 'down': y += increment; break; default: console.log("shouldnt get here"); } x = Math.min(Math.max(0, x), width); //Obey walls y = Math.min(Math.max(0, y), height); draw(); //Update canvas }); poll(); //TODO do with an event instead of recursion }).catch(function(e) { console.log(e); //Something went wrong with server }); } </script> </body> </html>
{ "content_hash": "742f7e47bff217a03a78e8a04ae9ab12", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 118, "avg_line_length": 25.792207792207794, "alnum_prop": 0.5926485397784491, "repo_name": "HackBinghamton/club", "id": "443a5625dbfa17bedd2ce65988bcc96b0abeb93b", "size": "1986", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "demo/sms/game.html", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "24061" }, { "name": "JavaScript", "bytes": "733" }, { "name": "Less", "bytes": "10151" }, { "name": "Ruby", "bytes": "49" } ], "symlink_target": "" }
describe('Registry', function () { 'use strict'; var expect; var subdivision; if (typeof window === 'undefined') { expect = require('chai').expect; subdivision = require('./../../dist/subdivision.node.js'); } else { expect = chai.expect; subdivision = window.subdivision; } afterEach(function () { subdivision.registry.$clear(); }); describe('Verify Axis', function () { it('should return false if axis is null, undefined, number, etc', function () { expect(subdivision.registry.verifyAxis(null)).to.be.false; expect(subdivision.registry.verifyAxis(undefined)).to.be.false; expect(subdivision.registry.verifyAxis(10)).to.be.false; expect(subdivision.registry.verifyAxis(true)).to.be.false; }); it('should return false if axis an empty string', function () { expect(subdivision.registry.verifyAxis('')).to.be.false; }); it('should return false if axis contains the delimiter', function () { expect(subdivision.registry.verifyAxis('Hello/world')).to.be.false; expect(subdivision.registry.verifyAxis('/d')).to.be.false; expect(subdivision.registry.verifyAxis('/')).to.be.false; }); it('should return true for a valid axis', function () { expect(subdivision.registry.verifyAxis('Hello world')).to.be.true; }); }); describe('Join Path', function () { it('should build an empty path when called with no args', function () { expect(subdivision.registry.joinPath()).to.be.equal(''); }); it('should build a path from array', function () { expect(subdivision.registry.joinPath(['a', 'bcd', 'ef'])).to.be.equal('a/bcd/ef'); expect(subdivision.registry.joinPath(['a', ['bcd'], ['ef', 'g']])).to.be.equal('a/bcd/ef/g'); }); it('should build a path from arguments', function () { expect(subdivision.registry.joinPath('a')).to.be.equal('a'); expect(subdivision.registry.joinPath('a', 'bcd', 'ef')).to.be.equal('a/bcd/ef'); }); it('should build a path with multiple paths as arguments', function(){ expect(subdivision.registry.joinPath('a/bcd', 'ef')).to.be.equal('a/bcd/ef'); expect(subdivision.registry.joinPath('a/bcd', 'ef/g')).to.be.equal('a/bcd/ef/g'); expect(subdivision.registry.joinPath('a', 'ef/g')).to.be.equal('a/ef/g'); expect(subdivision.registry.joinPath('', 'ef/g')).to.be.equal('ef/g'); expect(subdivision.registry.joinPath('ef/g','')).to.be.equal('ef/g'); }); it('should return an empty path if all the arguments are empty', function(){ expect(subdivision.registry.joinPath('','')).to.be.equal(''); }); }); describe('Break Path', function () { it('should throw if the path is not a string', function () { expect(function () { subdivision.registry.breakPath({}); }).to.throw('path must be a string {}'); }); it('should throw if the path contains empty axes', function () { expect(function () { subdivision.registry.breakPath('/a/b/c'); }).to.throw('Invalid axis '); expect(function () { subdivision.registry.breakPath('a/b/c/'); }).to.throw('Invalid axis '); }); it('should break an empty path', function () { expect(subdivision.registry.breakPath('')).to.be.eql([]); }); it('should break a path', function () { expect(subdivision.registry.breakPath('abv')).to.be.eql(['abv']); expect(subdivision.registry.breakPath('abv/efg/aaa')).to.be.eql(['abv', 'efg', 'aaa']); }); }); describe('Path Exists', function () { it('should return false for non existing nodes', function () { expect(subdivision.registry.pathExists('abv')).to.be.false; expect(subdivision.registry.pathExists('abv/aaa')).to.be.false; }); it('should return true for existing nodes', function () { subdivision.addAddin('abv'); expect(subdivision.registry.pathExists('abv')).to.be.true; subdivision.addAddin('abv/ccc/a'); expect(subdivision.registry.pathExists('abv/ccc/a')).to.be.true; expect(subdivision.registry.pathExists('abv/ccc')).to.be.true; }); }); describe('Sub Paths', function () { it('should return all the subpaths of a given node', function () { subdivision.addAddin('abv/ccc/a'); subdivision.addAddin('abv/ccc/b'); subdivision.addAddin('abv/ccc/c'); var subpaths = subdivision.registry.getSubPaths('abv/ccc'); expect(subpaths).to.be.ok; expect(subpaths.length).to.be.equal(3); expect(subpaths.indexOf('a')).to.not.be.equal(-1); expect(subpaths.indexOf('b')).to.not.be.equal(-1); expect(subpaths.indexOf('c')).to.not.be.equal(-1); }); it('should return null for non existing path', function () { var subpaths = subdivision.registry.getSubPaths('abv/ccc'); expect(subpaths).to.be.null; }); }); describe('Clear', function () { it('should clear the registry', function () { expect(subdivision.registry.pathExists('aaa')).to.be.false; subdivision.addAddin('aaa'); expect(subdivision.registry.pathExists('aaa')).to.be.true; subdivision.registry.$clear(); expect(subdivision.registry.pathExists('aaa')).to.be.false; }); }); });
{ "content_hash": "7ffa2b987d1bdf34d814e7661552ad2c", "timestamp": "", "source": "github", "line_count": 145, "max_line_length": 99, "avg_line_length": 36.33103448275862, "alnum_prop": 0.6292710706150342, "repo_name": "BorisKozo/subdivision", "id": "bc761940deef52470f8863b2aeb2486c9f44dceb", "size": "5270", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "test/unit/registry.spec.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "3994" }, { "name": "JavaScript", "bytes": "213845" } ], "symlink_target": "" }
package com.darrenfang.commons.validation.validators; import com.darrenfang.commons.validation.constraints.EqualsTo; @EqualsTo(filedName = "confirmPassword", dependFieldName = "password") public class RegisterUser { public RegisterUser(String password, String confirmPassword) { this.password = password; this.confirmPassword = confirmPassword; } private String password; private String confirmPassword; public String getPassword() { return password; } public String getConfirmPassword() { return confirmPassword; } }
{ "content_hash": "130ec7fcf053adc0e601ce242e1a5bb5", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 70, "avg_line_length": 25.565217391304348, "alnum_prop": 0.7210884353741497, "repo_name": "darrenfang/commons", "id": "5bc44db01931234aeeba5361c2a9c5820a35b3a7", "size": "588", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/test/java/com/darrenfang/commons/validation/validators/RegisterUser.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "66530" }, { "name": "Shell", "bytes": "476" } ], "symlink_target": "" }
<div class="container" data-ng-controller="HeaderController"> <div class="navbar-header"> <button class="navbar-toggle" type="button" data-ng-click="toggleCollapsibleMenu()"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a href="/#!/" class="navbar-brand">Ristruttura TU</a> </div> <nav class="collapse navbar-collapse" collapse="!isCollapsed" role="navigation"> <ul class="nav navbar-nav" data-ng-if="menu.shouldRender(authentication.user);"> <li data-ng-repeat="item in menu.items | orderBy: 'position'" data-ng-if="item.shouldRender(authentication.user);" ng-switch="item.menuItemType" ui-route="{{item.uiRoute}}" class="{{item.menuItemClass}}" ng-class="{active: ($uiRoute)}" dropdown="item.menuItemType === 'dropdown'"> <a ng-switch-when="dropdown" class="dropdown-toggle"> <span data-ng-bind="item.title"></span> <b class="caret"></b> </a> <ul ng-switch-when="dropdown" class="dropdown-menu"> <li data-ng-repeat="subitem in item.items | orderBy: 'position'" data-ng-if="subitem.shouldRender(authentication.user);" ui-route="{{subitem.uiRoute}}" ng-class="{active: $uiRoute}"> <a href="/#!/{{subitem.link}}" data-ng-bind="subitem.title"></a> </li> </ul> <a ng-switch-default href="/#!/{{item.link}}" data-ng-bind="item.title"></a> </li> </ul> <ul class="nav navbar-nav navbar-right" data-ng-hide="authentication.user"> <li ui-route="/signup" ng-class="{active: $uiRoute}"> <a href="/#!/signup">Sign Up</a> </li> <li class="divider-vertical"></li> <li ui-route="/signin" ng-class="{active: $uiRoute}"> <a href="/#!/signin">Sign In</a> </li> </ul> <ul class="nav navbar-nav navbar-right" data-ng-show="authentication.user"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <span data-ng-bind="authentication.user.displayName"></span> <b class="caret"></b> </a> <ul class="dropdown-menu"> <li> <a href="/#!/settings/profile">Edit Profile</a> </li> <li> <a href="/#!/settings/accounts">Manage Social Accounts</a> </li> <li data-ng-show="authentication.user.provider === 'local'"> <a href="/#!/settings/password">Change Password</a> </li> <li class="divider"></li> <li> <a href="/auth/signout">Signout</a> </li> </ul> </li> </ul> </nav> </div>
{ "content_hash": "9e431e75e0fcfed6f744a8326d15bd08", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 283, "avg_line_length": 42.86206896551724, "alnum_prop": 0.6246983105390185, "repo_name": "Igor-Ioriatti/meanjs", "id": "5db22f83f30c4014ec404539308716deba613045", "size": "2486", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "public/modules/core/views/header.client.view.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "700" }, { "name": "HTML", "bytes": "29035" }, { "name": "JavaScript", "bytes": "111293" }, { "name": "Shell", "bytes": "414" } ], "symlink_target": "" }
package com.navigationsample; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. */ @Override protected String getMainComponentName() { return "NavigationSample"; } }
{ "content_hash": "cbd5fcbedb814b863115767b35c2e702", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 73, "avg_line_length": 25.133333333333333, "alnum_prop": 0.7108753315649867, "repo_name": "dotnetprofessional/abusjs-react-native-sample", "id": "c4a13f60c0ed7ce12d3f1ae947c67c2b9b623d98", "size": "377", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "android/app/src/main/java/com/navigationsample/MainActivity.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "1417" }, { "name": "JavaScript", "bytes": "1684" }, { "name": "Objective-C", "bytes": "4446" }, { "name": "Python", "bytes": "1657" }, { "name": "TypeScript", "bytes": "25111" } ], "symlink_target": "" }
FOUNDATION_EXPORT double SAConfettiViewVersionNumber; FOUNDATION_EXPORT const unsigned char SAConfettiViewVersionString[];
{ "content_hash": "ce676af3a61c4763acba3bc15ff1ae4c", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 68, "avg_line_length": 41.333333333333336, "alnum_prop": 0.8790322580645161, "repo_name": "lojals/QRGen", "id": "79a3ef2d570517a5977c91f75673eb1410328bdd", "size": "150", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Pods/Target Support Files/SAConfettiView/SAConfettiView-umbrella.h", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "373" }, { "name": "Swift", "bytes": "33664" } ], "symlink_target": "" }
package natyla import ( "fmt" "net" "testing" "time" ) type DummyConn struct { T *testing.T } func (d DummyConn) Write(b []byte) (n int, err error) { //test the "help" command and check if the repsonse is correct checkCommand(1, b, showHelp(), d.T) //test if the response was "unknown command" for an unknown command checkCommand(2, b, "Unknown Command\n", d.T) //test if the response was "Element Created" for a post command checkCommand(3, b, "Element Created: 1\n", d.T) //test the "post" command and check if the repsonse is correct with the content checkCommand(4, b, "{\"id\":1,\"name\":\"Grande\"}\n", d.T) //test the "post" command and check if the repsonse is correct with the content checkCommand(5, b, "1\n", d.T) //test the "search" command and check if the repsonse is correct with the content checkCommand(6, b, "[{\"id\":1,\"name\":\"Grande\"}]\n", d.T) //test the "delete" command response checkCommand(7, b, "Key: 1 from: casa deleted\n", d.T) //test the "memory" command response if commandNumber == 8 { response := string(b) if response[:4] != "Uses" { d.T.Fatalf("Response: '%s' different from expected: '%s'", response[:4], "Uses") } } //test the get and delete to unknown keys checkCommand(9, b, "Key not found\n", d.T) checkCommand(10, b, "Key not found\n", d.T) return 50, nil } func (d DummyConn) Close() error { //check if the exit was in the specific command if commandNumber != 11 { d.T.Fatalf("Close connection in an invalid command: %v %s", commandNumber, "expected: 6") } return nil } func (d DummyConn) LocalAddr() net.Addr { return nil } func (d DummyConn) RemoteAddr() net.Addr { return nil } func (d DummyConn) SetDeadline(t time.Time) error { return nil } func (d DummyConn) SetReadDeadline(t time.Time) error { return nil } func (d DummyConn) SetWriteDeadline(t time.Time) error { return nil } //variable to hold the sequence of the commands var commandNumber int func (d DummyConn) Read(b []byte) (n int, err error) { //execute the command in the following sequense.... //increase the sequence commandNumber++ fmt.Println("d.Command: ", commandNumber) //send the "help" command to ses the help screen if commandNumber == 1 { return sendCommand("help", b), nil } //test an unknown command if commandNumber == 2 { return sendCommand("pipi", b), nil } //test the "post" command if commandNumber == 3 { //define a json content content := "{\"id\":1,\"name\":\"Grande\"}" //delete the previous disk content deleteJSONFromDisk("casa", "1") command := "post casa " + content return sendCommand(command, b), nil } //test the "get" command if commandNumber == 4 { return sendCommand("get casa 1", b), nil } //test the "elements" command if commandNumber == 5 { //sends the elements command to the server return sendCommand("elements casa", b), nil } //test the "get" command if commandNumber == 6 { return sendCommand("search casa name Grande", b), nil } //test the "get" command if commandNumber == 7 { return sendCommand("delete casa 1", b), nil } //test the "get" command if commandNumber == 8 { return sendCommand("memory", b), nil } //try to get and delete unknown keys if commandNumber == 9 { return sendCommand("get puf 1", b), nil } //try to get and delete unknown keys if commandNumber == 10 { return sendCommand("delete purr 1", b), nil } //exit the telnet return sendCommand("exit", b), nil } //Check the command number, with the apropiated response content func checkCommand(number int, b []byte, content string, t *testing.T) { //test if the response was "Element Created" if commandNumber == number { response := string(b) if response != content { t.Fatalf("Response: '%s' different from expected: '%s'", response, content) } } } //send the command to the telnet service func sendCommand(content string, b []byte) int { byts := []byte(content) for pos := 0; pos < len(byts); pos++ { b[pos] = byts[pos] } return len(byts) + 2 } //Connects agains the telnet service and send the command func Test_first_connection_to_telnet_console(t *testing.T) { //Create the dummy connection conn := DummyConn{t} //process the connection handleTCPConnection(conn) }
{ "content_hash": "26ba44eecf4fe9335236757965179ab1", "timestamp": "", "source": "github", "line_count": 181, "max_line_length": 91, "avg_line_length": 23.591160220994475, "alnum_prop": 0.675175644028103, "repo_name": "Fersca/natyla", "id": "d7884d92e52a41f281641b8a40c4bd1358ccc3bc", "size": "4270", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/natyla/console_test.go", "mode": "33188", "license": "mit", "language": [ { "name": "Go", "bytes": "50284" }, { "name": "HTML", "bytes": "1163" }, { "name": "Shell", "bytes": "538" } ], "symlink_target": "" }
package de.mineformers.investiture.allomancy.api.misting.mental; import de.mineformers.investiture.allomancy.api.metal.Metal; import de.mineformers.investiture.allomancy.api.metal.Metals; import de.mineformers.investiture.allomancy.api.power.AllomanticPower; import static de.mineformers.investiture.allomancy.api.power.Category.MENTAL; import static de.mineformers.investiture.allomancy.api.power.Effect.PULL; import static de.mineformers.investiture.allomancy.api.power.Scope.EXTERNAL; /** * ${JDOC} */ @AllomanticPower(category = MENTAL, scope = EXTERNAL, effect = PULL) public interface Soother extends EmotionManipulator { @Override default Metal baseMetal() { return Metals.BRASS; } }
{ "content_hash": "8adda22f44fe53e27f2497839031e2ed", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 77, "avg_line_length": 32.72727272727273, "alnum_prop": 0.7888888888888889, "repo_name": "PaleoCrafter/Allomancy", "id": "f4f8fca0cca9f43f6ad6bcf4fb3d4a6960545eab", "size": "720", "binary": false, "copies": "1", "ref": "refs/heads/dev", "path": "src/main/java/de/mineformers/investiture/allomancy/api/misting/mental/Soother.java", "mode": "33188", "license": "mit", "language": [ { "name": "GLSL", "bytes": "7302" }, { "name": "Java", "bytes": "416088" } ], "symlink_target": "" }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE190_Integer_Overflow__int64_t_fscanf_add_82.h Label Definition File: CWE190_Integer_Overflow.label.xml Template File: sources-sinks-82.tmpl.h */ /* * @description * CWE: 190 Integer Overflow * BadSource: fscanf Read data from the console using fscanf() * GoodSource: Set data to a small, non-zero number (two) * Sinks: add * GoodSink: Ensure there will not be an overflow before adding 1 to data * BadSink : Add 1 to data, which can cause an overflow * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer * * */ #include "std_testcase.h" namespace CWE190_Integer_Overflow__int64_t_fscanf_add_82 { class CWE190_Integer_Overflow__int64_t_fscanf_add_82_base { public: /* pure virtual function */ virtual void action(int64_t data) = 0; }; #ifndef OMITBAD class CWE190_Integer_Overflow__int64_t_fscanf_add_82_bad : public CWE190_Integer_Overflow__int64_t_fscanf_add_82_base { public: void action(int64_t data); }; #endif /* OMITBAD */ #ifndef OMITGOOD class CWE190_Integer_Overflow__int64_t_fscanf_add_82_goodG2B : public CWE190_Integer_Overflow__int64_t_fscanf_add_82_base { public: void action(int64_t data); }; class CWE190_Integer_Overflow__int64_t_fscanf_add_82_goodB2G : public CWE190_Integer_Overflow__int64_t_fscanf_add_82_base { public: void action(int64_t data); }; #endif /* OMITGOOD */ }
{ "content_hash": "747968c96fd3244b0a2c73a9fd7b53ee", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 121, "avg_line_length": 26.642857142857142, "alnum_prop": 0.6997319034852547, "repo_name": "JianpingZeng/xcc", "id": "3175d24b46ff42b6d463c4c45532c4407dcd8149", "size": "1492", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "xcc/test/juliet/testcases/CWE190_Integer_Overflow/s01/CWE190_Integer_Overflow__int64_t_fscanf_add_82.h", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
package org.linqs.psl.experimental.optimizer.lbfgs; import java.lang.management.*; import java.io.PrintStream; /** * @author Stanley Kok * Date: 12/19/10 * Time: 12:13 PM * This class returns CPU, user and system time. */ public class Timer { public Timer() {} /** Returns CPU time in nanoseconds. */ public long time() { return cpuTime(); } /** Returns CPU time in nanoseconds. */ public long cpuTime() { ThreadMXBean b = ManagementFactory.getThreadMXBean(); return b.isCurrentThreadCpuTimeSupported() ? b.getCurrentThreadCpuTime() : 0L; } /** Returns user time in nanoseconds. */ public long userTime() { ThreadMXBean b = ManagementFactory.getThreadMXBean(); return b.isCurrentThreadCpuTimeSupported() ? b.getCurrentThreadUserTime() : 0L; } /** Returns system time in nanoseconds. */ public long sysTime( ) { ThreadMXBean b = ManagementFactory.getThreadMXBean(); return b.isCurrentThreadCpuTimeSupported() ? (b.getCurrentThreadCpuTime() - b.getCurrentThreadUserTime()) : 0L; } /** Print time as days, hours, mins, secs. */ public static void printTime(PrintStream out, long nanoSec) { long sec = nanoSec/1000000000; if (sec < 60) out.print(sec + " secs"); else if (sec < 3600) out.print((long)(sec/60) + " mins, " + (sec-(long)(sec/60)*60) +" secs"); else if (sec < 86400) out.print((long)(sec/3600) + " hrs, " + (sec-(long)(sec/3600)*3600)/60.0 +" mins"); else out.print((long)(sec/86400) + " days, " + (sec-(long)(sec/86400)*86400)/3600.0 + " hrs"); } public static void main(String[] args) throws InterruptedException { Timer timer = new Timer(); long startTime = timer.cpuTime(); long ii = 0; for (long i = 0; i < 1000000000; i++) ii++; for (long i = 0; i < 1000000000; i++) ii++; for (long i = 0; i < 1000000000; i++) ii++; long endTime = timer.cpuTime(); System.out.println(ii); System.out.println("startTime = " + startTime); System.out.println("endTime = " + endTime); System.out.println("Time Elapsed = " + (endTime - startTime)); timer.printTime(System.out, endTime-startTime); } }
{ "content_hash": "a68ff43119d0532a28d16cbfb66f7b99", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 115, "avg_line_length": 32.85507246376812, "alnum_prop": 0.6127040141155713, "repo_name": "linqs/psl-experimental", "id": "a27fe0967ec4a0b3c71e5f7386edd75bbbd4a088", "size": "2997", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "psl-optimize/src/main/java/org/linqs/psl/experimental/optimizer/lbfgs/Timer.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "528386" }, { "name": "Python", "bytes": "4187" }, { "name": "Shell", "bytes": "876" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "5c278077152536b3b4bcf55385964f0d", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "ce8510fbcf19d9ca27272822901bb280daae7c3d", "size": "187", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Orchidaceae/Gastrorchis/Gastrorchis tuberculosa/ Syn. Limodorum tuberculosum/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Etiqueta: Ley | La Red Semanario</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <meta name="description" content="Noticias del Sur del Estado de Mexico"> <meta property="og:type" content="website"> <meta property="og:title" content="La Red Semanario"> <meta property="og:url" content="https://laredsemanario.com/tags/Ley/index.html"> <meta property="og:site_name" content="La Red Semanario"> <meta property="og:description" content="Noticias del Sur del Estado de Mexico"> <meta name="twitter:card" content="summary"> <meta name="twitter:title" content="La Red Semanario"> <meta name="twitter:description" content="Noticias del Sur del Estado de Mexico"> <meta name="twitter:creator" content="@3171117842"> <meta property="fb:app_id" content="956176474392711"> <link rel="icon" href="/favicon.ico" /> <link rel="stylesheet" href="/vendor/font-awesome/css/font-awesome.min.css"> <link rel="stylesheet" href="/vendor/titillium-web/styles.css"> <link rel="stylesheet" href="/vendor/source-code-pro/styles.css"> <link rel="stylesheet" href="/css/style.css"> <script src="/vendor/jquery/2.0.3/jquery.min.js"></script> <link rel="stylesheet" href="/vendor/fancybox/jquery.fancybox.css"> <link rel="stylesheet" href="/vendor/scrollLoading/style.css"> <script type="text/javascript"> (function(i,s,o,g,r,a,m) {i['GoogleAnalyticsObject']=r;i[r]=i[r]||function() { (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-62238178-1', 'auto'); ga('send', 'pageview'); </script> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <script> (adsbygoogle = window.adsbygoogle || []).push({ google_ad_client: "ca-pub-4967243132865960", enable_page_level_ads: true }); </script> </head> <body> <div id="wrap"> <header id="header"> <div id="header-outer" class="outer"> <div class="container"> <div class="container-inner"> <div id="header-title"> <h1 class="logo-wrap"> <a href="/" class="logo"></a> </h1> <div id="ads"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- header-lared --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-4967243132865960" data-ad-slot="2438400321" data-ad-format="auto"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script></div> </div> <div id="header-inner" class="nav-container"> <a id="main-nav-toggle" class="nav-icon fa fa-bars"></a> <div class="nav-container-inner"> <ul id="main-nav"> <li class="main-nav-list-item" > <a class="main-nav-list-link" href="/">Inicio</a> </li> </ul> <nav id="sub-nav"> <div id="search-form-wrap"> <form class="search-form"> <input type="text" class="ins-search-input search-form-input" placeholder="Buscar" /> <button type="submit" class="search-form-submit"></button> </form> <div class="ins-search"> <div class="ins-search-mask"></div> <div class="ins-search-container"> <div class="ins-input-wrapper"> <input type="text" class="ins-search-input" placeholder="Escribe algo..." /> <span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span> </div> <div class="ins-section-wrapper"> <div class="ins-section-container"></div> </div> </div> </div> <script> (function (window) { var INSIGHT_CONFIG = { TRANSLATION: { POSTS: 'Entradas', PAGES: 'Pages', CATEGORIES: 'Categorias', TAGS: 'Etiquetas', UNTITLED: '(Sin titulo)', }, ROOT_URL: '/', CONTENT_URL: '/content.json', }; window.INSIGHT_CONFIG = INSIGHT_CONFIG; })(window); </script> <script src="/js/insight.js"></script> </div> </nav> </div> </div> </div> </div> </div> </header> <div class="container"> <div class="main-body container-inner"> <div class="main-body-inner"> <section id="main"> <div class="main-body-header"> <h1 class="header"> <i class="icon fa fa-tag"></i>Etiqueta: <em>Ley</em> </h1> </div> <div class="main-body-content"> <section class="archives-wrap"> <div class="archive-year-wrap"> <a href="/archives/2016" class="archive-year"><i class="icon fa fa-calendar-o"></i>2016</a> </div> <div class="archives"> <div class="article-row"> <article class="article article-summary"> <div class="article-summary-inner"> <a href="/2016/05/Hoy-entra-en-vigor-Ley-de-Transparencia-y-Acceso-a-la-Informacion/" class="thumbnail"> <span style="background-image:url(/images/nieto-2017305.jpg)" alt="Hoy entra en vigor Ley de Transparencia y Acceso a la Información" class="thumbnail-image"></span> <span class="comment-counter"> <i class="fa fa-comments-o"></i> <span class="disqus-comment-count" data-disqus-url="https://laredsemanario.com/2016/05/Hoy-entra-en-vigor-Ley-de-Transparencia-y-Acceso-a-la-Informacion/">0</span> </span> </a> <div class="article-meta"> <p class="category"> <a class="article-category-link" href="/categories/Nacional/">Nacional</a> </p> <p class="date"><time datetime="2016-05-10T13:43:37.000Z" itemprop="datePublished">2016-05-10</time></p> </div> <h1 class="article-title" itemprop="name"> <a href="/2016/05/Hoy-entra-en-vigor-Ley-de-Transparencia-y-Acceso-a-la-Informacion/">Hoy entra en vigor Ley de Transparencia y Acceso a la Información</a> </h1> <p class="article-excerpt"> Este martes entra en vigor la Ley Federal de Transparencia y Acceso a la Información Pública, nuevo marco normativo que se aplicará para los 882 sujetos obligados del ámbito federal, informó el Insti </p> </div> </article> </div> </div></section> </div> </section> <aside id="sidebar"> <a class="sidebar-toggle" title="Expand Sidebar"><i class="toggle icon"></i></a> <div class="sidebar-top"> <p>seguir:</p> <ul class="social-links"> <li> <a class="social-tooltip" title="twitter" href="https://twitter.com/RedSemanario" target="_blank"> <i class="icon fa fa-twitter"></i> </a> </li> <li> <a class="social-tooltip" title="facebook" href="https://www.facebook.com/laredsemanario" target="_blank"> <i class="icon fa fa-facebook"></i> </a> </li> <li> <a class="social-tooltip" title="google-plus" href="https://google.com/+Laredsemanariocom" target="_blank"> <i class="icon fa fa-google-plus"></i> </a> </li> <li> <a class="social-tooltip" title="youtube" href="https://www.youtube.com/channel/UCnaA5qW5xL0WHoABQQRRTSw" target="_blank"> <i class="icon fa fa-youtube"></i> </a> </li> <li> <a class="social-tooltip" title="rss" href="http://feeds.feedburner.com/laredsemanario/huQt" target="_blank"> <i class="icon fa fa-rss"></i> </a> </li> </ul> </div> <div class="widgets-container"> <div class="widget-wrap"> <h3 class="widget-title">recientes</h3> <div class="widget"> <ul id="recent-post" class=""> <li> <div class="item-thumbnail"> <a href="/2016/05/Detienen-a-Leopoldo-Duarte-acusado-de-abuso-sexual-en-el-Colegio-Matatena/" class="thumbnail"> <span style="background-image:url(https://res.cloudinary.com/pidmx/image/upload/v1462977034/pederasta_montesori_2_wunyo5.jpg)" alt="Detienen a Leopoldo Duarte, acusado de abuso sexual en el Colegio Matatena" class="thumbnail-image"></span> </a> </div> <div class="item-inner"> <p class="item-category"><a class="article-category-link" href="/categories/Nacional/">Nacional</a></p> <p class="item-title"><a href="/2016/05/Detienen-a-Leopoldo-Duarte-acusado-de-abuso-sexual-en-el-Colegio-Matatena/" class="title">Detienen a Leopoldo Duarte, acusado de abuso sexual en el Colegio Matatena</a></p> <p class="item-date"><time datetime="2016-05-11T14:29:50.000Z" itemprop="datePublished">2016-05-11</time></p> </div> </li> <li> <div class="item-thumbnail"> <a href="/2016/05/Telescopio-espacial-Kepler-descubre-1284-nuevos-planetas-fuera-del-sistema-solar/" class="thumbnail"> <span style="background-image:url(https://res.cloudinary.com/pidmx/image/upload/v1462976759/NASA-nuevos-planetas-e1462972761598_jyf4qz.jpg)" alt="Telescopio espacial Kepler descubre 1284 nuevos planetas fuera del sistema solar" class="thumbnail-image"></span> </a> </div> <div class="item-inner"> <p class="item-category"><a class="article-category-link" href="/categories/Ciencia/">Ciencia</a></p> <p class="item-title"><a href="/2016/05/Telescopio-espacial-Kepler-descubre-1284-nuevos-planetas-fuera-del-sistema-solar/" class="title">Telescopio espacial Kepler descubre 1284 nuevos planetas fuera del sistema solar</a></p> <p class="item-date"><time datetime="2016-05-11T14:24:56.000Z" itemprop="datePublished">2016-05-11</time></p> </div> </li> <li> <div class="item-thumbnail"> <a href="/2016/05/Billy-Alvarez-dejaria-Cruz-Azul/" class="thumbnail"> <span style="background-image:url(https://res.cloudinary.com/pidmx/image/upload/v1462976365/billy-alvarez-cruz-azul_vz32jv.jpg)" alt="Billy Álvarez dejaría Cruz Azul" class="thumbnail-image"></span> </a> </div> <div class="item-inner"> <p class="item-category"><a class="article-category-link" href="/categories/Deportes/">Deportes</a></p> <p class="item-title"><a href="/2016/05/Billy-Alvarez-dejaria-Cruz-Azul/" class="title">Billy Álvarez dejaría Cruz Azul</a></p> <p class="item-date"><time datetime="2016-05-11T14:14:24.000Z" itemprop="datePublished">2016-05-11</time></p> </div> </li> <li> <div class="item-thumbnail"> <a href="/2016/05/Por-ser-desproporcionadas-El-Bronco-cancelara-10-mil-becas-estudiantiles/" class="thumbnail"> <span style="background-image:url(/images/bronco-gobernador.jpg)" alt="Por ser desproporcionadas, El Bronco cancelará 10 mil becas estudiantiles" class="thumbnail-image"></span> </a> </div> <div class="item-inner"> <p class="item-category"><a class="article-category-link" href="/categories/Politica/">Politica</a></p> <p class="item-title"><a href="/2016/05/Por-ser-desproporcionadas-El-Bronco-cancelara-10-mil-becas-estudiantiles/" class="title">Por ser desproporcionadas, El Bronco cancelará 10 mil becas estudiantiles</a></p> <p class="item-date"><time datetime="2016-05-11T14:08:06.000Z" itemprop="datePublished">2016-05-11</time></p> </div> </li> <li> <div class="item-thumbnail"> <a href="/2016/05/Los-11-mandamientos-de-la-Iglesia-de-Satan-son-mucho-mas-sensatos-de-lo-que-imaginarias/" class="thumbnail"> <span style="background-image:url(/images/934606971.jpg)" alt="Los 11 mandamientos de la Iglesia de Satán son mucho más sensatos de lo que imaginarías" class="thumbnail-image"></span> </a> </div> <div class="item-inner"> <p class="item-category"><a class="article-category-link" href="/categories/Cultura/">Cultura</a></p> <p class="item-title"><a href="/2016/05/Los-11-mandamientos-de-la-Iglesia-de-Satan-son-mucho-mas-sensatos-de-lo-que-imaginarias/" class="title">Los 11 mandamientos de la Iglesia de Satán son mucho más sensatos de lo que imaginarías</a></p> <p class="item-date"><time datetime="2016-05-10T14:05:56.000Z" itemprop="datePublished">2016-05-10</time></p> </div> </li> </ul> </div> </div> </div> </aside> </div> </div> </div> <footer id="footer"> <div class="container"> <div class="container-inner"> <a id="back-to-top" href="javascript:;"><i class="icon fa fa-angle-up"></i></a> <div class="credit"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- Primera página - 1 (www.laredsemanario.com) --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-4967243132865960" data-ad-slot="4621813528" data-ad-format="auto"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <p>&copy; 2014 - 2016 La Red Semanario</p> </div> </div> <script type="application/ld+json"> { "@context" : "http://schema.org", "@type" : "WebSite", "name" : "La Red Semanario", "alternateName" : "La Red", "url" : "https://www.laredsemanario.com" } </script> </div> </footer> <script> var disqus_shortname = 'laredsemanario'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> <script src="/vendor/fancybox/jquery.fancybox.pack.js"></script> <script src="/vendor/scrollLoading/jquery.scrollLoading.js"></script> <script src="/vendor/scrollLoading/main.js"></script> <!-- Custom Scripts --> <script src="/js/main.js"></script> </div> </body> </html>
{ "content_hash": "1efe8ff0d4114848385804b2582cf09f", "timestamp": "", "source": "github", "line_count": 451, "max_line_length": 267, "avg_line_length": 38.28381374722838, "alnum_prop": 0.509093015174331, "repo_name": "reneisrael/reneisrael.github.io", "id": "7322632d7eb9c837c5e2a30dc4e974430bc2d096", "size": "17286", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tags/Ley/index.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "62905" }, { "name": "HTML", "bytes": "6248" } ], "symlink_target": "" }
package com.rentIT; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class RentItApplication { public static void main(String[] args) { SpringApplication.run(RentItApplication.class, args); } }
{ "content_hash": "17058bd5d935a9604444d76e8ee2c13d", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 68, "avg_line_length": 27.363636363636363, "alnum_prop": 0.8239202657807309, "repo_name": "rpopescu92/rentIT", "id": "d99b4fa740775e05e200c5d87cde8a36a3540dc2", "size": "301", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/rentIT/RentItApplication.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "5006" }, { "name": "CSS", "bytes": "3094" }, { "name": "HTML", "bytes": "30250" }, { "name": "Java", "bytes": "76004" }, { "name": "JavaScript", "bytes": "56947" }, { "name": "Shell", "bytes": "7058" } ], "symlink_target": "" }
// Code generated by client-gen. DO NOT EDIT. package fake import ( v1 "github.com/tektoncd/pipeline/pkg/client/clientset/versioned/typed/pipeline/v1" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) type FakeTektonV1 struct { *testing.Fake } func (c *FakeTektonV1) Pipelines(namespace string) v1.PipelineInterface { return &FakePipelines{c, namespace} } func (c *FakeTektonV1) PipelineRuns(namespace string) v1.PipelineRunInterface { return &FakePipelineRuns{c, namespace} } func (c *FakeTektonV1) Tasks(namespace string) v1.TaskInterface { return &FakeTasks{c, namespace} } func (c *FakeTektonV1) TaskRuns(namespace string) v1.TaskRunInterface { return &FakeTaskRuns{c, namespace} } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeTektonV1) RESTClient() rest.Interface { var ret *rest.RESTClient return ret }
{ "content_hash": "b26866f2f4e5627500d2d1d9aa3030f9", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 83, "avg_line_length": 24.36842105263158, "alnum_prop": 0.765658747300216, "repo_name": "tektoncd/pipeline", "id": "8b2549cfd0ba44e85b91c73bada00e1d3e97a78e", "size": "1490", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "pkg/client/clientset/versioned/typed/pipeline/v1/fake/fake_pipeline_client.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "282" }, { "name": "Go", "bytes": "5173860" }, { "name": "Makefile", "bytes": "5967" }, { "name": "Mustache", "bytes": "1078" }, { "name": "Shell", "bytes": "36398" }, { "name": "Smarty", "bytes": "3940" } ], "symlink_target": "" }
VulkanWrapper::VWBufferClear::VWBufferClear() { // Set the initial data // ... } VulkanWrapper::VWBufferClear::~VWBufferClear() { } bool VulkanWrapper::VWBufferClear::Initialize() { return true; } void VulkanWrapper::VWBufferClear::CreateCommandBuffers(VWGraphicAdapter* _adapter, VWGraphicInstance* _graphicInstance, VWSwapChain* _swapChain) { // Get the swap chain images const std::vector<VkImageView>& swapChainImageViews = _swapChain->GetImageViews(); const std::vector<VkImage>& swapChainImages = _swapChain->GetImages(); if (commandBuffers.size() > 0) { vkFreeCommandBuffers(_graphicInstance->GetDevice(), commandPool, commandBuffers.size(), commandBuffers.data()); } commandBuffers.resize(swapChainImages.size()); VkCommandBufferAllocateInfo allocInfo = {}; allocInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; allocInfo.commandPool = commandPool; allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; allocInfo.commandBufferCount = (uint32_t)commandBuffers.size(); if (vkAllocateCommandBuffers(_graphicInstance->GetDevice(), &allocInfo, commandBuffers.data()) != VK_SUCCESS) { throw std::runtime_error("failed to allocate command buffers!"); } VkClearColorValue clear_color = { 0.0f, 0.0f, 0.0f, 1.0f }; VkClearDepthStencilValue depth_clear_color = { 1.0f, 0.0f}; VkImageSubresourceRange image_subresource_range = { VK_IMAGE_ASPECT_COLOR_BIT, // VkImageAspectFlags aspectMask 0, // uint32_t baseMipLevel 1, // uint32_t levelCount 0, // uint32_t baseArrayLayer 1 // uint32_t layerCount }; VkImageSubresourceRange depth_image_subresource_range = { VK_IMAGE_ASPECT_DEPTH_BIT, // VkImageAspectFlags aspectMask 0, // uint32_t baseMipLevel 1, // uint32_t levelCount 0, // uint32_t baseArrayLayer 1 // uint32_t layerCount }; for (size_t i = 0; i < commandBuffers.size(); i++) { VkCommandBufferBeginInfo beginInfo = {}; beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; beginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT; VkImageMemoryBarrier barrier_from_present_to_clear = { VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // VkStructureType sType nullptr, // const void *pNext 0, // VkAccessFlags srcAccessMask VK_ACCESS_TRANSFER_WRITE_BIT, // VkAccessFlags dstAccessMask VK_IMAGE_LAYOUT_UNDEFINED, // VkImageLayout oldLayout VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // VkImageLayout newLayout _graphicInstance->GetPresentQueue().index, // uint32_t srcQueueFamilyIndex _graphicInstance->GetPresentQueue().index, // uint32_t dstQueueFamilyIndex swapChainImages[i], // VkImage image image_subresource_range // VkImageSubresourceRange subresourceRange }; VkImageMemoryBarrier barrier_from_clear_to_present = { VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, // VkStructureType sType nullptr, // const void *pNext VK_ACCESS_TRANSFER_WRITE_BIT, // VkAccessFlags srcAccessMask VK_ACCESS_MEMORY_READ_BIT, // VkAccessFlags dstAccessMask VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, // VkImageLayout oldLayout VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, // VkImageLayout newLayout _graphicInstance->GetPresentQueue().index, // uint32_t srcQueueFamilyIndex _graphicInstance->GetPresentQueue().index, // uint32_t dstQueueFamilyIndex swapChainImages[i], // VkImage image image_subresource_range // VkImageSubresourceRange subresourceRange }; vkBeginCommandBuffer(commandBuffers[i], &beginInfo); // // vkCmdPipelineBarrier(commandBuffers[i], VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier_from_present_to_clear); vkCmdClearColorImage(commandBuffers[i], swapChainImages[i], VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &clear_color, 1, &image_subresource_range); vkCmdClearDepthStencilImage(commandBuffers[i], _swapChain->GetDepthImage()->GetRawImage(), VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, &depth_clear_color, 1, &depth_image_subresource_range); vkCmdPipelineBarrier(commandBuffers[i], VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier_from_clear_to_present); // // if (vkEndCommandBuffer(commandBuffers[i]) != VK_SUCCESS) { throw std::runtime_error("failed to record command buffer!"); } } } void VulkanWrapper::VWBufferClear::CreateCommandPool(VWGraphicAdapter* _adapter, VWGraphicInstance* _graphicInstance) { VWGraphicInstance::QueueFamilyIndices queueFamilyIndices = _graphicInstance->FindQueueFamilies(_graphicInstance->GetPhysicalDevice(), _graphicInstance->GetSurface()); VkCommandPoolCreateInfo poolInfo = {}; poolInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; poolInfo.queueFamilyIndex = queueFamilyIndices.graphicsFamily; if (vkCreateCommandPool(_graphicInstance->GetDevice(), &poolInfo, nullptr, &commandPool) != VK_SUCCESS) { throw std::runtime_error("failed to create command pool!"); } }
{ "content_hash": "4a5529084992ede7c7e3f98b1a2ec10c", "timestamp": "", "source": "github", "line_count": 135, "max_line_length": 198, "avg_line_length": 47.54074074074074, "alnum_prop": 0.5789965721408539, "repo_name": "RodrigoHolztrattner/Wonderland", "id": "cdeb7aa35d29ca2cf9e554e4dcf83e86a7f66601", "size": "6749", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Wonderland/Wonderland/Editor/Modules/VulkanWrapper/Misc/VWBufferClear.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "266" }, { "name": "C", "bytes": "9313" }, { "name": "C++", "bytes": "1746103" }, { "name": "GLSL", "bytes": "4699" }, { "name": "Objective-C", "bytes": "3158" } ], "symlink_target": "" }
package com.amazonaws.services.cloudfront.model; import java.io.Serializable; import javax.annotation.Generated; /** * <p> * The returned result of the corresponding request. * </p> * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/cloudfront-2019-03-26/GetStreamingDistribution" * target="_top">AWS API Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class GetStreamingDistributionResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable { /** * <p> * The streaming distribution's information. * </p> */ private StreamingDistribution streamingDistribution; /** * <p> * The current version of the streaming distribution's information. For example: <code>E2QWRUHAPOMQZL</code>. * </p> */ private String eTag; /** * <p> * The streaming distribution's information. * </p> * * @param streamingDistribution * The streaming distribution's information. */ public void setStreamingDistribution(StreamingDistribution streamingDistribution) { this.streamingDistribution = streamingDistribution; } /** * <p> * The streaming distribution's information. * </p> * * @return The streaming distribution's information. */ public StreamingDistribution getStreamingDistribution() { return this.streamingDistribution; } /** * <p> * The streaming distribution's information. * </p> * * @param streamingDistribution * The streaming distribution's information. * @return Returns a reference to this object so that method calls can be chained together. */ public GetStreamingDistributionResult withStreamingDistribution(StreamingDistribution streamingDistribution) { setStreamingDistribution(streamingDistribution); return this; } /** * <p> * The current version of the streaming distribution's information. For example: <code>E2QWRUHAPOMQZL</code>. * </p> * * @param eTag * The current version of the streaming distribution's information. For example: <code>E2QWRUHAPOMQZL</code>. */ public void setETag(String eTag) { this.eTag = eTag; } /** * <p> * The current version of the streaming distribution's information. For example: <code>E2QWRUHAPOMQZL</code>. * </p> * * @return The current version of the streaming distribution's information. For example: <code>E2QWRUHAPOMQZL</code> * . */ public String getETag() { return this.eTag; } /** * <p> * The current version of the streaming distribution's information. For example: <code>E2QWRUHAPOMQZL</code>. * </p> * * @param eTag * The current version of the streaming distribution's information. For example: <code>E2QWRUHAPOMQZL</code>. * @return Returns a reference to this object so that method calls can be chained together. */ public GetStreamingDistributionResult withETag(String eTag) { setETag(eTag); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getStreamingDistribution() != null) sb.append("StreamingDistribution: ").append(getStreamingDistribution()).append(","); if (getETag() != null) sb.append("ETag: ").append(getETag()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetStreamingDistributionResult == false) return false; GetStreamingDistributionResult other = (GetStreamingDistributionResult) obj; if (other.getStreamingDistribution() == null ^ this.getStreamingDistribution() == null) return false; if (other.getStreamingDistribution() != null && other.getStreamingDistribution().equals(this.getStreamingDistribution()) == false) return false; if (other.getETag() == null ^ this.getETag() == null) return false; if (other.getETag() != null && other.getETag().equals(this.getETag()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStreamingDistribution() == null) ? 0 : getStreamingDistribution().hashCode()); hashCode = prime * hashCode + ((getETag() == null) ? 0 : getETag().hashCode()); return hashCode; } @Override public GetStreamingDistributionResult clone() { try { return (GetStreamingDistributionResult) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
{ "content_hash": "aa07762f35db54fa4a4dcd4d78aa766a", "timestamp": "", "source": "github", "line_count": 172, "max_line_length": 157, "avg_line_length": 31.91860465116279, "alnum_prop": 0.6327868852459017, "repo_name": "jentfoo/aws-sdk-java", "id": "9510c3770ba21559093eea4061722a0c3b4fc76c", "size": "6070", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "aws-java-sdk-cloudfront/src/main/java/com/amazonaws/services/cloudfront/model/GetStreamingDistributionResult.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "270" }, { "name": "FreeMarker", "bytes": "173637" }, { "name": "Gherkin", "bytes": "25063" }, { "name": "Java", "bytes": "356214839" }, { "name": "Scilab", "bytes": "3924" }, { "name": "Shell", "bytes": "295" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <TITLE> Uses of Package org.apache.poi.xssf.usermodel.charts (POI API Documentation) </TITLE> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Package org.apache.poi.xssf.usermodel.charts (POI API Documentation)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/apache/poi/xssf/usermodel/charts/package-use.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Package<br>org.apache.poi.xssf.usermodel.charts</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Packages that use <A HREF="../../../../../../org/apache/poi/xssf/usermodel/charts/package-summary.html">org.apache.poi.xssf.usermodel.charts</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.apache.poi.xssf.usermodel"><B>org.apache.poi.xssf.usermodel</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#org.apache.poi.xssf.usermodel.charts"><B>org.apache.poi.xssf.usermodel.charts</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.apache.poi.xssf.usermodel"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Classes in <A HREF="../../../../../../org/apache/poi/xssf/usermodel/charts/package-summary.html">org.apache.poi.xssf.usermodel.charts</A> used by <A HREF="../../../../../../org/apache/poi/xssf/usermodel/package-summary.html">org.apache.poi.xssf.usermodel</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../../../../org/apache/poi/xssf/usermodel/charts/class-use/XSSFCategoryAxis.html#org.apache.poi.xssf.usermodel"><B>XSSFCategoryAxis</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Category axis type.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../../../../org/apache/poi/xssf/usermodel/charts/class-use/XSSFChartAxis.html#org.apache.poi.xssf.usermodel"><B>XSSFChartAxis</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Base class for all axis types.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../../../../org/apache/poi/xssf/usermodel/charts/class-use/XSSFChartDataFactory.html#org.apache.poi.xssf.usermodel"><B>XSSFChartDataFactory</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../../../../org/apache/poi/xssf/usermodel/charts/class-use/XSSFChartLegend.html#org.apache.poi.xssf.usermodel"><B>XSSFChartLegend</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents a SpreadsheetML chart legend</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../../../../org/apache/poi/xssf/usermodel/charts/class-use/XSSFManualLayout.html#org.apache.poi.xssf.usermodel"><B>XSSFManualLayout</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents a SpreadsheetML manual layout.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../../../../org/apache/poi/xssf/usermodel/charts/class-use/XSSFValueAxis.html#org.apache.poi.xssf.usermodel"><B>XSSFValueAxis</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Value axis type.</TD> </TR> </TABLE> &nbsp; <P> <A NAME="org.apache.poi.xssf.usermodel.charts"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Classes in <A HREF="../../../../../../org/apache/poi/xssf/usermodel/charts/package-summary.html">org.apache.poi.xssf.usermodel.charts</A> used by <A HREF="../../../../../../org/apache/poi/xssf/usermodel/charts/package-summary.html">org.apache.poi.xssf.usermodel.charts</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../../../../org/apache/poi/xssf/usermodel/charts/class-use/XSSFChartAxis.html#org.apache.poi.xssf.usermodel.charts"><B>XSSFChartAxis</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Base class for all axis types.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../../../../org/apache/poi/xssf/usermodel/charts/class-use/XSSFChartDataFactory.html#org.apache.poi.xssf.usermodel.charts"><B>XSSFChartDataFactory</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../../../../org/apache/poi/xssf/usermodel/charts/class-use/XSSFLineChartData.html#org.apache.poi.xssf.usermodel.charts"><B>XSSFLineChartData</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Holds data for a XSSF Line Chart</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../../../../org/apache/poi/xssf/usermodel/charts/class-use/XSSFManualLayout.html#org.apache.poi.xssf.usermodel.charts"><B>XSSFManualLayout</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents a SpreadsheetML manual layout.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><B><A HREF="../../../../../../org/apache/poi/xssf/usermodel/charts/class-use/XSSFScatterChartData.html#org.apache.poi.xssf.usermodel.charts"><B>XSSFScatterChartData</B></A></B> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Represents DrawingML scatter charts.</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?org/apache/poi/xssf/usermodel/charts/package-use.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> <i>Copyright 2015 The Apache Software Foundation or its licensors, as applicable.</i> </BODY> </HTML>
{ "content_hash": "442abf6fddb1e49775e80bb86d1d10ff", "timestamp": "", "source": "github", "line_count": 244, "max_line_length": 284, "avg_line_length": 45.795081967213115, "alnum_prop": 0.6245749060318597, "repo_name": "xiwan/xlsEditor", "id": "7b87712cb9443a2bb5dd2ccedf89a243654dfc2b", "size": "11174", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "lib/poi-3.13/docs/apidocs/org/apache/poi/xssf/usermodel/charts/package-use.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "42792" }, { "name": "Emacs Lisp", "bytes": "1320" }, { "name": "HTML", "bytes": "107233820" }, { "name": "Java", "bytes": "2866828" }, { "name": "Lex", "bytes": "9342" } ], "symlink_target": "" }
package hamlah.pin.complice; import android.content.Context; import android.support.v4.content.ContextCompat; import com.bluelinelabs.logansquare.annotation.JsonObject; import hamlah.pin.R; @JsonObject public class CompliceEditTask extends CompliceTask { CompliceEditTask() { } public CompliceEditTask(Context context, boolean isEmpty, boolean isMorning) { super(ContextCompat.getColor(context, R.color.complice_purple), context.getString(R.string.edit_simple), null, context.getString(isEmpty ? (isMorning ? R.string.enter_day_intentions_complice : R.string.enter_day_outcomes_complice) : R.string.edit_complice)); } @Override public boolean startAction(Context context) { Complice.get().launchEdit(context); return true; } }
{ "content_hash": "294c9f83eb0813cc7f3c17f12117652a", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 95, "avg_line_length": 30.096774193548388, "alnum_prop": 0.6302250803858521, "repo_name": "lahwran/pin", "id": "7740a334ca46d0a8c8e7ff4573e1e9e5668e8cb4", "size": "933", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/hamlah/pin/complice/CompliceEditTask.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "135319" } ], "symlink_target": "" }
#region File Description //----------------------------------------------------------------------------- // Enemy.cs // // Microsoft XNA Community Game Platform // Copyright (C) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- #endregion using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace ThePrincessBard { /// <summary> /// Facing direction along the X axis. /// </summary> enum FaceDirection { Left = -1, Right = 1, } /// <summary> /// A monster who is impeding the progress of our fearless adventurer. /// </summary> class Enemy { public Level Level { get { return level; } } Level level; /// <summary> /// Position in world space of the bottom center of this enemy. /// </summary> public Vector2 Position { get { return position; } } Vector2 position; private Rectangle localBounds; /// <summary> /// Gets a rectangle which bounds this enemy in world space. /// </summary> public Rectangle BoundingRectangle { get { int left = (int)Math.Round(Position.X - sprite.Origin.X) + localBounds.X; int top = (int)Math.Round(Position.Y - sprite.Origin.Y) + localBounds.Y; return new Rectangle(left, top, localBounds.Width, localBounds.Height); } } // Animations private Animation runAnimation; private Animation idleAnimation; private AnimationPlayer sprite; /// <summary> /// The direction this enemy is facing and moving along the X axis. /// </summary> private FaceDirection direction = FaceDirection.Left; /// <summary> /// How long this enemy has been waiting before turning around. /// </summary> private float waitTime; /// <summary> /// How long to wait before turning around. /// </summary> private const float MaxWaitTime = 0.5f; /// <summary> /// The speed at which this enemy moves along the X axis. /// </summary> private const float MoveSpeed = 64.0f; /// <summary> /// Constructs a new Enemy. /// </summary> public Enemy(Level level, Vector2 position, string spriteSet) { this.level = level; this.position = position; LoadContent(spriteSet); } /// <summary> /// Loads a particular enemy sprite sheet and sounds. /// </summary> public void LoadContent(string spriteSet) { // Load animations. spriteSet = "Sprites/" + spriteSet + "/"; runAnimation = new Animation(Level.Content.Load<Texture2D>(spriteSet + "Run"), 0.1f, true); idleAnimation = new Animation(Level.Content.Load<Texture2D>(spriteSet + "Idle"), 0.15f, true); sprite.PlayAnimation(idleAnimation); // Calculate bounds within texture size. int width = (int)(idleAnimation.FrameWidth * 0.35); int left = (idleAnimation.FrameWidth - width) / 2; int height = (int)(idleAnimation.FrameWidth * 0.7); int top = idleAnimation.FrameHeight - height; localBounds = new Rectangle(left, top, width, height); } /// <summary> /// Paces back and forth along a platform, waiting at either end. /// </summary> public void Update(GameTime gameTime) { float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds; // Calculate tile position based on the side we are walking towards. float posX = Position.X + localBounds.Width / 2 * (int)direction; int tileX = (int)Math.Floor(posX / Tile.Width) - (int)direction; int tileY = (int)Math.Floor(Position.Y / Tile.Height); if (waitTime > 0) { // Wait for some amount of time. waitTime = Math.Max(0.0f, waitTime - (float)gameTime.ElapsedGameTime.TotalSeconds); if (waitTime <= 0.0f) { // Then turn around. direction = (FaceDirection)(-(int)direction); } } else { // If we are about to run into a wall or off a cliff, start waiting. if (Level.GetCollision(tileX + (int)direction, tileY - 1) == TileCollision.Impassable || Level.GetCollision(tileX + (int)direction, tileY) == TileCollision.Passable) { waitTime = MaxWaitTime; } else { // Move in the current direction. Vector2 velocity = new Vector2((int)direction * MoveSpeed * elapsed, 0.0f); position = position + velocity; } } } /// <summary> /// Draws the animated enemy. /// </summary> public void Draw(GameTime gameTime, SpriteBatch spriteBatch) { // Stop running when the game is paused or before turning around. if (!Level.Player.IsAlive || Level.ReachedExit || Level.TimeRemaining == TimeSpan.Zero || waitTime > 0) { sprite.PlayAnimation(idleAnimation); } else { sprite.PlayAnimation(runAnimation); } // Draw facing the way the enemy is moving. SpriteEffects flip = direction > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; sprite.Draw(gameTime, spriteBatch, Position, flip); } } }
{ "content_hash": "e213d3a6cc4e6a565d81e512c2f6648f", "timestamp": "", "source": "github", "line_count": 179, "max_line_length": 106, "avg_line_length": 33.44692737430167, "alnum_prop": 0.5238015700684817, "repo_name": "HazardPath/GameJam1", "id": "d37b240fe968f0b155031c42e2dd83db4ed6aed1", "size": "5989", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ThePrincessBard/ThePrincessBard/Enemy.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "119495" } ], "symlink_target": "" }
import * as actionTypes from "./actionTypes"; // Simple actions related to UI state. export const setCurrentKernelName = (payload: string) => ({ type: actionTypes.SET_CURRENT_KERNEL_NAME, payload }); export const setCurrentServerId = (payload: { serverId: string }) => ({ type: actionTypes.SET_CURRENT_SERVER_ID, payload }); export const setPlatform = (payload: string) => ({ type: actionTypes.SET_PLATFORM, payload }); export const setShowPanel = (payload: boolean) => ({ type: actionTypes.SET_SHOW_PANEL, payload }); export const setSource = (payload: string) => ({ type: actionTypes.SET_SOURCE, payload }); export const submitBinderForm = (payload: { repo: string, gitref: string }) => ({ type: actionTypes.SUBMIT_BINDER_FORM, payload }); export const setCodeMirrorMode = (payload: string | Object) => ({ type: actionTypes.SET_CODE_MIRROR_MODE, payload }); // Actions related to servers. export const activateServer = (payload: { serverId: string, oldServerId: string, repo: string, gitref: string }) => ({ type: actionTypes.ACTIVATE_SERVER, payload }); export const activateServerFulfilled = (payload: { serverId: string, config: * }) => ({ type: actionTypes.ACTIVATE_SERVER_FULFILLED, payload }); export const activateServerFailed = (payload: { serverId: string, error: * }) => ({ type: actionTypes.ACTIVATE_SERVER_FAILED, payload }); export const killServer = (payload: { serverId: string }) => ({ type: actionTypes.KILL_SERVER, payload }); export const killServerFulfilled = (payload: { serverId: string }) => ({ type: actionTypes.KILL_SERVER_FULFILLED, payload }); export const killServerFailed = (payload: { serverId: string, error: * }) => ({ type: actionTypes.KILL_SERVER_FAILED, payload }); export const fetchKernelSpecs = (payload: { serverId: string }) => ({ type: actionTypes.FETCH_KERNEL_SPECS, payload }); export const fetchKernelSpecsFulfilled = (payload: { serverId: string, response: * }) => ({ type: actionTypes.FETCH_KERNEL_SPECS_FULFILLED, payload }); export const fetchKernelSpecsFailed = (payload: { serverId: string, error: * }) => ({ type: actionTypes.FETCH_KERNEL_SPECS_FAILED, payload }); export const addServerMessage = (payload: { serverId: string, message: string }) => ({ type: actionTypes.ADD_SERVER_MESSAGE, payload }); // Actions related to kernels. export const activateKernel = (payload: { serverId: string, kernelName: string }) => ({ type: actionTypes.ACTIVATE_KERNEL, payload }); export const activateKernelFulfilled = (payload: { serverId: string, kernelName: string, kernel: * }) => ({ type: actionTypes.ACTIVATE_KERNEL_FULFILLED, payload }); export const activateKernelFailed = (payload: { serverId: string, kernelName: string, error: * }) => ({ type: actionTypes.ACTIVATE_KERNEL_FAILED, payload }); export const interruptKernel = (payload: { serverId: string, kernelName: string }) => ({ type: actionTypes.INTERRUPT_KERNEL, payload }); export const interruptKernelFulfilled = (payload: { serverId: string, kernelName: string }) => ({ type: actionTypes.INTERRUPT_KERNEL_FULFILLED, payload }); export const interruptKernelFailed = (payload: { serverId: string, kernelName: string, error: * }) => ({ type: actionTypes.INTERRUPT_KERNEL_FAILED, payload }); export const killKernel = (payload: { serverId: string, kernelName: string }) => ({ type: actionTypes.KILL_KERNEL, payload }); export const killKernelFulfilled = (payload: { serverId: string, kernelName: string }) => ({ type: actionTypes.KILL_KERNEL_FULFILLED, payload }); export const killKernelFailed = (payload: { serverId: string, kernelName: string, error: * }) => ({ type: actionTypes.KILL_KERNEL_FAILED, payload }); export const addKernelMessage = (payload: { serverId: string, kernelName: string, message: * }) => ({ type: actionTypes.ADD_KERNEL_MESSAGE, payload }); export const addKernelOutput = (payload: { serverId: string, kernelName: string, output: * }) => ({ type: actionTypes.ADD_KERNEL_OUTPUT, payload }); export const clearKernelOutputs = (payload: { serverId: string, kernelName: string }) => ({ type: actionTypes.CLEAR_KERNEL_OUTPUTS, payload }); export const restartKernel = (payload: { serverId: string, kernelName: string }) => ({ type: actionTypes.RESTART_KERNEL, payload }); export const runSource = (payload: { serverId: string, kernelName: string, source: string }) => ({ type: actionTypes.RUN_SOURCE, payload }); export const setActiveKernel = (payload: { serverId: string, kernelName: string }) => ({ type: actionTypes.SET_ACTIVE_KERNEL, payload }); export const setActiveKernelLanguageInfo = (payload: { serverId: string, kernelName: string, languageInfo: * }) => ({ type: actionTypes.SET_ACTIVE_KERNEL_LANGUAGE_INFO, payload }); export const setKernelStatus = (payload: { serverId: string, kernelName: string }) => ({ type: actionTypes.SET_KERNEL_STATUS, payload }); export const initalizeFromQuery = ( payload: { repo?: string, gitref?: string } = {} ) => ({ type: actionTypes.INITIALIZE_FROM_QUERY, payload });
{ "content_hash": "6251bcccce1dc62832b60ef64c89ec60", "timestamp": "", "source": "github", "line_count": 243, "max_line_length": 79, "avg_line_length": 21.48971193415638, "alnum_prop": 0.6851780926847951, "repo_name": "jdetle/nteract", "id": "646af52654e24346a3ca577579c1e93615c807b5", "size": "5231", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "applications/play/redux/actions.js", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "472" }, { "name": "CSS", "bytes": "7720" }, { "name": "HTML", "bytes": "10111" }, { "name": "JavaScript", "bytes": "850231" }, { "name": "Jupyter Notebook", "bytes": "441247" }, { "name": "Python", "bytes": "38938" }, { "name": "Shell", "bytes": "5863" } ], "symlink_target": "" }
<TS language="en_GB" version="2.1"> <context> <name>AddressBookPage</name> <message> <source>Right-click to edit address or label</source> <translation>Right-click to edit address or label</translation> </message> <message> <source>Create a new address</source> <translation>Create a new address</translation> </message> <message> <source>&amp;New</source> <translation>&amp;New</translation> </message> <message> <source>Copy the currently selected address to the system clipboard</source> <translation>Copy the currently selected address to the system clipboard</translation> </message> <message> <source>&amp;Copy</source> <translation>&amp;Copy</translation> </message> <message> <source>C&amp;lose</source> <translation>C&amp;lose</translation> </message> <message> <source>&amp;Copy Address</source> <translation>&amp;Copy Address</translation> </message> <message> <source>Delete the currently selected address from the list</source> <translation>Delete the currently selected address from the list</translation> </message> <message> <source>Export the data in the current tab to a file</source> <translation>Export the data in the current tab to a file</translation> </message> <message> <source>&amp;Export</source> <translation>&amp;Export</translation> </message> <message> <source>&amp;Delete</source> <translation>&amp;Delete</translation> </message> <message> <source>Choose the address to send coins to</source> <translation>Choose the address to send coins to</translation> </message> <message> <source>Choose the address to receive coins with</source> <translation>Choose the address to receive coins with</translation> </message> <message> <source>C&amp;hoose</source> <translation>C&amp;hoose</translation> </message> <message> <source>Sending addresses</source> <translation>Sending addresses</translation> </message> <message> <source>Receiving addresses</source> <translation>Receiving addresses</translation> </message> <message> <source>These are your VCoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source> <translation>These are your VCoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</translation> </message> <message> <source>These are your VCoin addresses for receiving payments. It is recommended to use a new receiving address for each transaction.</source> <translation>These are your VCoin addresses for receiving payments. It is recommended to use a new receiving address for each transaction.</translation> </message> <message> <source>Copy &amp;Label</source> <translation>Copy &amp;Label</translation> </message> <message> <source>&amp;Edit</source> <translation>&amp;Edit</translation> </message> <message> <source>Export Address List</source> <translation>Export Address List</translation> </message> <message> <source>Comma separated file (*.csv)</source> <translation>Comma separated file (*.csv)</translation> </message> <message> <source>Exporting Failed</source> <translation>Exporting Failed</translation> </message> <message> <source>There was an error trying to save the address list to %1. Please try again.</source> <translation>There was an error trying to save the address list to %1. Please try again.</translation> </message> </context> <context> <name>AddressTableModel</name> <message> <source>Label</source> <translation>Label</translation> </message> <message> <source>Address</source> <translation>Address</translation> </message> <message> <source>(no label)</source> <translation>(no label)</translation> </message> </context> <context> <name>AskPassphraseDialog</name> <message> <source>Passphrase Dialog</source> <translation>Passphrase Dialog</translation> </message> <message> <source>Enter passphrase</source> <translation>Enter passphrase</translation> </message> <message> <source>New passphrase</source> <translation>New passphrase</translation> </message> <message> <source>Repeat new passphrase</source> <translation>Repeat new passphrase</translation> </message> <message> <source>Encrypt wallet</source> <translation>Encrypt wallet</translation> </message> <message> <source>This operation needs your wallet passphrase to unlock the wallet.</source> <translation>This operation needs your wallet passphrase to unlock the wallet.</translation> </message> <message> <source>Unlock wallet</source> <translation>Unlock wallet</translation> </message> <message> <source>This operation needs your wallet passphrase to decrypt the wallet.</source> <translation>This operation needs your wallet passphrase to decrypt the wallet.</translation> </message> <message> <source>Decrypt wallet</source> <translation>Decrypt wallet</translation> </message> <message> <source>Change passphrase</source> <translation>Change passphrase</translation> </message> <message> <source>Confirm wallet encryption</source> <translation>Confirm wallet encryption</translation> </message> <message> <source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR VCOINS&lt;/b&gt;!</source> <translation>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR VCOINS&lt;/b&gt;!</translation> </message> <message> <source>Are you sure you wish to encrypt your wallet?</source> <translation>Are you sure you wish to encrypt your wallet?</translation> </message> <message> <source>VCoin Core will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your vcoins from being stolen by malware infecting your computer.</source> <translation>VCoin Core will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your vcoins from being stolen by malware infecting your computer.</translation> </message> <message> <source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source> <translation>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</translation> </message> <message> <source>Warning: The Caps Lock key is on!</source> <translation>Warning: The Caps Lock key is on!</translation> </message> <message> <source>Wallet encrypted</source> <translation>Wallet encrypted</translation> </message> <message> <source>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;ten or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source> <translation>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;ten or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</translation> </message> <message> <source>Enter the old passphrase and new passphrase to the wallet.</source> <translation>Enter the old passphrase and new passphrase to the wallet.</translation> </message> <message> <source>Wallet encryption failed</source> <translation>Wallet encryption failed</translation> </message> <message> <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source> <translation>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</translation> </message> <message> <source>The supplied passphrases do not match.</source> <translation>The supplied passphrases do not match.</translation> </message> <message> <source>Wallet unlock failed</source> <translation>Wallet unlock failed</translation> </message> <message> <source>The passphrase entered for the wallet decryption was incorrect.</source> <translation>The passphrase entered for the wallet decryption was incorrect.</translation> </message> <message> <source>Wallet decryption failed</source> <translation>Wallet decryption failed</translation> </message> <message> <source>Wallet passphrase was successfully changed.</source> <translation>Wallet passphrase was successfully changed.</translation> </message> </context> <context> <name>BanTableModel</name> <message> <source>IP/Netmask</source> <translation>IP/Netmask</translation> </message> <message> <source>Banned Until</source> <translation>Banned Until</translation> </message> </context> <context> <name>VCoinGUI</name> <message> <source>Sign &amp;message...</source> <translation>Sign &amp;message...</translation> </message> <message> <source>Synchronizing with network...</source> <translation>Synchronising with network...</translation> </message> <message> <source>&amp;Overview</source> <translation>&amp;Overview</translation> </message> <message> <source>Node</source> <translation>Node</translation> </message> <message> <source>Show general overview of wallet</source> <translation>Show general overview of wallet</translation> </message> <message> <source>&amp;Transactions</source> <translation>&amp;Transactions</translation> </message> <message> <source>Browse transaction history</source> <translation>Browse transaction history</translation> </message> <message> <source>E&amp;xit</source> <translation>E&amp;xit</translation> </message> <message> <source>Quit application</source> <translation>Quit application</translation> </message> <message> <source>About &amp;Qt</source> <translation>About &amp;Qt</translation> </message> <message> <source>Show information about Qt</source> <translation>Show information about Qt</translation> </message> <message> <source>&amp;Options...</source> <translation>&amp;Options...</translation> </message> <message> <source>&amp;Encrypt Wallet...</source> <translation>&amp;Encrypt Wallet...</translation> </message> <message> <source>&amp;Backup Wallet...</source> <translation>&amp;Backup Wallet...</translation> </message> <message> <source>&amp;Change Passphrase...</source> <translation>&amp;Change Passphrase...</translation> </message> <message> <source>&amp;Sending addresses...</source> <translation>&amp;Sending addresses...</translation> </message> <message> <source>&amp;Receiving addresses...</source> <translation>&amp;Receiving addresses...</translation> </message> <message> <source>Open &amp;URI...</source> <translation>Open &amp;URI...</translation> </message> <message> <source>VCoin Core client</source> <translation>VCoin Core client</translation> </message> <message> <source>Importing blocks from disk...</source> <translation>Importing blocks from disk...</translation> </message> <message> <source>Reindexing blocks on disk...</source> <translation>Reindexing blocks on disk...</translation> </message> <message> <source>Send coins to a VCoin address</source> <translation>Send coins to a VCoin address</translation> </message> <message> <source>Backup wallet to another location</source> <translation>Backup wallet to another location</translation> </message> <message> <source>Change the passphrase used for wallet encryption</source> <translation>Change the passphrase used for wallet encryption</translation> </message> <message> <source>&amp;Debug window</source> <translation>&amp;Debug window</translation> </message> <message> <source>Open debugging and diagnostic console</source> <translation>Open debugging and diagnostic console</translation> </message> <message> <source>&amp;Verify message...</source> <translation>&amp;Verify message...</translation> </message> <message> <source>VCoin</source> <translation>VCoin</translation> </message> <message> <source>Wallet</source> <translation>Wallet</translation> </message> <message> <source>&amp;Send</source> <translation>&amp;Send</translation> </message> <message> <source>&amp;Receive</source> <translation>&amp;Receive</translation> </message> <message> <source>Show information about VCoin Core</source> <translation>Show information about VCoin Core</translation> </message> <message> <source>&amp;Show / Hide</source> <translation>&amp;Show / Hide</translation> </message> <message> <source>Show or hide the main Window</source> <translation>Show or hide the main Window</translation> </message> <message> <source>Encrypt the private keys that belong to your wallet</source> <translation>Encrypt the private keys that belong to your wallet</translation> </message> <message> <source>Sign messages with your VCoin addresses to prove you own them</source> <translation>Sign messages with your VCoin addresses to prove you own them</translation> </message> <message> <source>Verify messages to ensure they were signed with specified VCoin addresses</source> <translation>Verify messages to ensure they were signed with specified VCoin addresses</translation> </message> <message> <source>&amp;File</source> <translation>&amp;File</translation> </message> <message> <source>&amp;Settings</source> <translation>&amp;Settings</translation> </message> <message> <source>&amp;Help</source> <translation>&amp;Help</translation> </message> <message> <source>Tabs toolbar</source> <translation>Tabs toolbar</translation> </message> <message> <source>VCoin Core</source> <translation>VCoin Core</translation> </message> <message> <source>Request payments (generates QR codes and vcoin: URIs)</source> <translation>Request payments (generates QR codes and vcoin: URIs)</translation> </message> <message> <source>&amp;About VCoin Core</source> <translation>&amp;About VCoin Core</translation> </message> <message> <source>Modify configuration options for VCoin Core</source> <translation>Modify configuration options for VCoin Core</translation> </message> <message> <source>Show the list of used sending addresses and labels</source> <translation>Show the list of used sending addresses and labels</translation> </message> <message> <source>Show the list of used receiving addresses and labels</source> <translation>Show the list of used receiving addresses and labels</translation> </message> <message> <source>Open a vcoin: URI or payment request</source> <translation>Open a vcoin: URI or payment request</translation> </message> <message> <source>&amp;Command-line options</source> <translation>&amp;Command-line options</translation> </message> <message> <source>Show the VCoin Core help message to get a list with possible VCoin command-line options</source> <translation>Show the VCoin Core help message to get a list with possible VCoin command-line options</translation> </message> <message numerus="yes"> <source>%n active connection(s) to VCoin network</source> <translation><numerusform>%n active connection to VCoin network</numerusform><numerusform>%n active connections to VCoin network</numerusform></translation> </message> <message> <source>No block source available...</source> <translation>No block source available...</translation> </message> <message numerus="yes"> <source>Processed %n block(s) of transaction history.</source> <translation><numerusform>Processed %n block of transaction history.</numerusform><numerusform>Processed %n blocks of transaction history.</numerusform></translation> </message> <message numerus="yes"> <source>%n hour(s)</source> <translation><numerusform>%n hour</numerusform><numerusform>%n hours</numerusform></translation> </message> <message numerus="yes"> <source>%n day(s)</source> <translation><numerusform>%n day</numerusform><numerusform>%n days</numerusform></translation> </message> <message numerus="yes"> <source>%n week(s)</source> <translation><numerusform>%n week</numerusform><numerusform>%n weeks</numerusform></translation> </message> <message> <source>%1 and %2</source> <translation>%1 and %2</translation> </message> <message numerus="yes"> <source>%n year(s)</source> <translation><numerusform>%n year</numerusform><numerusform>%n years</numerusform></translation> </message> <message> <source>%1 behind</source> <translation>%1 behind</translation> </message> <message> <source>Last received block was generated %1 ago.</source> <translation>Last received block was generated %1 ago.</translation> </message> <message> <source>Transactions after this will not yet be visible.</source> <translation>Transactions after this will not yet be visible.</translation> </message> <message> <source>Error</source> <translation>Error</translation> </message> <message> <source>Warning</source> <translation>Warning</translation> </message> <message> <source>Information</source> <translation>Information</translation> </message> <message> <source>Up to date</source> <translation>Up to date</translation> </message> <message> <source>Catching up...</source> <translation>Catching up...</translation> </message> <message> <source>Date: %1 </source> <translation>Date: %1 </translation> </message> <message> <source>Amount: %1 </source> <translation>Amount: %1 </translation> </message> <message> <source>Type: %1 </source> <translation>Type: %1 </translation> </message> <message> <source>Label: %1 </source> <translation>Label: %1 </translation> </message> <message> <source>Address: %1 </source> <translation>Address: %1 </translation> </message> <message> <source>Sent transaction</source> <translation>Sent transaction</translation> </message> <message> <source>Incoming transaction</source> <translation>Incoming transaction</translation> </message> <message> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</source> <translation>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;unlocked&lt;/b&gt;</translation> </message> <message> <source>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</source> <translation>Wallet is &lt;b&gt;encrypted&lt;/b&gt; and currently &lt;b&gt;locked&lt;/b&gt;</translation> </message> </context> <context> <name>ClientModel</name> <message> <source>Network Alert</source> <translation>Network Alert</translation> </message> </context> <context> <name>CoinControlDialog</name> <message> <source>Coin Selection</source> <translation>Coin Selection</translation> </message> <message> <source>Quantity:</source> <translation>Quantity:</translation> </message> <message> <source>Bytes:</source> <translation>Bytes:</translation> </message> <message> <source>Amount:</source> <translation>Amount:</translation> </message> <message> <source>Priority:</source> <translation>Priority:</translation> </message> <message> <source>Fee:</source> <translation>Fee:</translation> </message> <message> <source>Dust:</source> <translation>Dust:</translation> </message> <message> <source>After Fee:</source> <translation>After Fee:</translation> </message> <message> <source>Change:</source> <translation>Change:</translation> </message> <message> <source>(un)select all</source> <translation>(un)select all</translation> </message> <message> <source>Tree mode</source> <translation>Tree mode</translation> </message> <message> <source>List mode</source> <translation>List mode</translation> </message> <message> <source>Amount</source> <translation>Amount</translation> </message> <message> <source>Received with label</source> <translation>Received with label</translation> </message> <message> <source>Received with address</source> <translation>Received with address</translation> </message> <message> <source>Date</source> <translation>Date</translation> </message> <message> <source>Confirmations</source> <translation>Confirmations</translation> </message> <message> <source>Confirmed</source> <translation>Confirmed</translation> </message> <message> <source>Priority</source> <translation>Priority</translation> </message> <message> <source>Copy address</source> <translation>Copy address</translation> </message> <message> <source>Copy label</source> <translation>Copy label</translation> </message> <message> <source>Copy amount</source> <translation>Copy amount</translation> </message> <message> <source>Copy transaction ID</source> <translation>Copy transaction ID</translation> </message> <message> <source>Lock unspent</source> <translation>Lock unspent</translation> </message> <message> <source>Unlock unspent</source> <translation>Unlock unspent</translation> </message> <message> <source>Copy quantity</source> <translation>Copy quantity</translation> </message> <message> <source>Copy fee</source> <translation>Copy fee</translation> </message> <message> <source>Copy after fee</source> <translation>Copy after fee</translation> </message> <message> <source>Copy bytes</source> <translation>Copy bytes</translation> </message> <message> <source>Copy priority</source> <translation>Copy priority</translation> </message> <message> <source>Copy dust</source> <translation>Copy dust</translation> </message> <message> <source>Copy change</source> <translation>Copy change</translation> </message> <message> <source>highest</source> <translation>highest</translation> </message> <message> <source>higher</source> <translation>higher</translation> </message> <message> <source>high</source> <translation>high</translation> </message> <message> <source>medium-high</source> <translation>medium-high</translation> </message> <message> <source>medium</source> <translation>medium</translation> </message> <message> <source>low-medium</source> <translation>low-medium</translation> </message> <message> <source>low</source> <translation>low</translation> </message> <message> <source>lower</source> <translation>lower</translation> </message> <message> <source>lowest</source> <translation>lowest</translation> </message> <message> <source>(%1 locked)</source> <translation>(%1 locked)</translation> </message> <message> <source>none</source> <translation>none</translation> </message> <message> <source>This label turns red if the transaction size is greater than 1000 bytes.</source> <translation>This label turns red if the transaction size is greater than 1000 bytes.</translation> </message> <message> <source>This label turns red if the priority is smaller than "medium".</source> <translation>This label turns red if the priority is smaller than "medium".</translation> </message> <message> <source>This label turns red if any recipient receives an amount smaller than %1.</source> <translation>This label turns red if any recipient receives an amount smaller than %1.</translation> </message> <message> <source>Can vary +/- %1 satoshi(s) per input.</source> <translation>Can vary +/- %1 satoshi(s) per input.</translation> </message> <message> <source>yes</source> <translation>yes</translation> </message> <message> <source>no</source> <translation>no</translation> </message> <message> <source>This means a fee of at least %1 per kB is required.</source> <translation>This means a fee of at least %1 per kB is required.</translation> </message> <message> <source>Can vary +/- 1 byte per input.</source> <translation>Can vary +/- 1 byte per input.</translation> </message> <message> <source>Transactions with higher priority are more likely to get included into a block.</source> <translation>Transactions with higher priority are more likely to get included into a block.</translation> </message> <message> <source>(no label)</source> <translation>(no label)</translation> </message> <message> <source>change from %1 (%2)</source> <translation>change from %1 (%2)</translation> </message> <message> <source>(change)</source> <translation>(change)</translation> </message> </context> <context> <name>EditAddressDialog</name> <message> <source>Edit Address</source> <translation>Edit Address</translation> </message> <message> <source>&amp;Label</source> <translation>&amp;Label</translation> </message> <message> <source>The label associated with this address list entry</source> <translation>The label associated with this address list entry</translation> </message> <message> <source>The address associated with this address list entry. This can only be modified for sending addresses.</source> <translation>The address associated with this address list entry. This can only be modified for sending addresses.</translation> </message> <message> <source>&amp;Address</source> <translation>&amp;Address</translation> </message> <message> <source>New receiving address</source> <translation>New receiving address</translation> </message> <message> <source>New sending address</source> <translation>New sending address</translation> </message> <message> <source>Edit receiving address</source> <translation>Edit receiving address</translation> </message> <message> <source>Edit sending address</source> <translation>Edit sending address</translation> </message> <message> <source>The entered address "%1" is already in the address book.</source> <translation>The entered address "%1" is already in the address book.</translation> </message> <message> <source>The entered address "%1" is not a valid VCoin address.</source> <translation>The entered address "%1" is not a valid VCoin address.</translation> </message> <message> <source>Could not unlock wallet.</source> <translation>Could not unlock wallet.</translation> </message> <message> <source>New key generation failed.</source> <translation>New key generation failed.</translation> </message> </context> <context> <name>FreespaceChecker</name> <message> <source>A new data directory will be created.</source> <translation>A new data directory will be created.</translation> </message> <message> <source>name</source> <translation>name</translation> </message> <message> <source>Directory already exists. Add %1 if you intend to create a new directory here.</source> <translation>Directory already exists. Add %1 if you intend to create a new directory here.</translation> </message> <message> <source>Path already exists, and is not a directory.</source> <translation>Path already exists, and is not a directory.</translation> </message> <message> <source>Cannot create data directory here.</source> <translation>Cannot create data directory here.</translation> </message> </context> <context> <name>HelpMessageDialog</name> <message> <source>VCoin Core</source> <translation>VCoin Core</translation> </message> <message> <source>version</source> <translation>version</translation> </message> <message> <source>(%1-bit)</source> <translation>(%1-bit)</translation> </message> <message> <source>About VCoin Core</source> <translation>About VCoin Core</translation> </message> <message> <source>Command-line options</source> <translation>Command-line options</translation> </message> <message> <source>Usage:</source> <translation>Usage:</translation> </message> <message> <source>command-line options</source> <translation>command-line options</translation> </message> <message> <source>UI Options:</source> <translation>UI Options:</translation> </message> <message> <source>Choose data directory on startup (default: %u)</source> <translation>Choose data directory on startup (default: %u)</translation> </message> <message> <source>Set language, for example "de_DE" (default: system locale)</source> <translation>Set language, for example "de_DE" (default: system locale)</translation> </message> <message> <source>Start minimized</source> <translation>Start minimised</translation> </message> <message> <source>Set SSL root certificates for payment request (default: -system-)</source> <translation>Set SSL root certificates for payment request (default: -system-)</translation> </message> <message> <source>Show splash screen on startup (default: %u)</source> <translation>Show splash screen on startup (default: %u)</translation> </message> <message> <source>Reset all settings changes made over the GUI</source> <translation>Reset all settings changes made over the GUI</translation> </message> </context> <context> <name>Intro</name> <message> <source>Welcome</source> <translation>Welcome</translation> </message> <message> <source>Welcome to VCoin Core.</source> <translation>Welcome to VCoin Core.</translation> </message> <message> <source>As this is the first time the program is launched, you can choose where VCoin Core will store its data.</source> <translation>As this is the first time the program is launched, you can choose where VCoin Core will store its data.</translation> </message> <message> <source>VCoin Core will download and store a copy of the VCoin block chain. At least %1GB of data will be stored in this directory, and it will grow over time. The wallet will also be stored in this directory.</source> <translation>VCoin Core will download and store a copy of the VCoin block chain. At least %1GB of data will be stored in this directory, and it will grow over time. The wallet will also be stored in this directory.</translation> </message> <message> <source>Use the default data directory</source> <translation>Use the default data directory</translation> </message> <message> <source>Use a custom data directory:</source> <translation>Use a custom data directory:</translation> </message> <message> <source>VCoin Core</source> <translation>VCoin Core</translation> </message> <message> <source>Error: Specified data directory "%1" cannot be created.</source> <translation>Error: Specified data directory "%1" cannot be created.</translation> </message> <message> <source>Error</source> <translation>Error</translation> </message> <message numerus="yes"> <source>%n GB of free space available</source> <translation><numerusform>%n GB of free space available</numerusform><numerusform>%n GB of free space available</numerusform></translation> </message> <message numerus="yes"> <source>(of %n GB needed)</source> <translation><numerusform>(of %n GB needed)</numerusform><numerusform>(of %n GB needed)</numerusform></translation> </message> </context> <context> <name>OpenURIDialog</name> <message> <source>Open URI</source> <translation>Open URI</translation> </message> <message> <source>Open payment request from URI or file</source> <translation>Open payment request from URI or file</translation> </message> <message> <source>URI:</source> <translation>URI:</translation> </message> <message> <source>Select payment request file</source> <translation>Select payment request file</translation> </message> <message> <source>Select payment request file to open</source> <translation>Select payment request file to open</translation> </message> </context> <context> <name>OptionsDialog</name> <message> <source>Options</source> <translation>Options</translation> </message> <message> <source>&amp;Main</source> <translation>&amp;Main</translation> </message> <message> <source>Size of &amp;database cache</source> <translation>Size of &amp;database cache</translation> </message> <message> <source>MB</source> <translation>MB</translation> </message> <message> <source>Number of script &amp;verification threads</source> <translation>Number of script &amp;verification threads</translation> </message> <message> <source>Accept connections from outside</source> <translation>Accept connections from outside</translation> </message> <message> <source>Allow incoming connections</source> <translation>Allow incoming connections</translation> </message> <message> <source>IP address of the proxy (e.g. IPv4: 127.0.0.1 / IPv6: ::1)</source> <translation>IP address of the proxy (e.g. IPv4: 127.0.0.1 / IPv6: ::1)</translation> </message> <message> <source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Exit in the menu.</source> <translation>Minimise instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Exit in the menu.</translation> </message> <message> <source>The user interface language can be set here. This setting will take effect after restarting VCoin Core.</source> <translation>The user interface language can be set here. This setting will take effect after restarting VCoin Core.</translation> </message> <message> <source>Third party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |.</source> <translation>Third party URLs (e.g. a block explorer) that appear in the transactions tab as context menu items. %s in the URL is replaced by transaction hash. Multiple URLs are separated by vertical bar |.</translation> </message> <message> <source>Third party transaction URLs</source> <translation>Third party transaction URLs</translation> </message> <message> <source>Active command-line options that override above options:</source> <translation>Active command-line options that override above options:</translation> </message> <message> <source>Reset all client options to default.</source> <translation>Reset all client options to default.</translation> </message> <message> <source>&amp;Reset Options</source> <translation>&amp;Reset Options</translation> </message> <message> <source>&amp;Network</source> <translation>&amp;Network</translation> </message> <message> <source>Automatically start VCoin Core after logging in to the system.</source> <translation>Automatically start VCoin Core after logging in to the system.</translation> </message> <message> <source>&amp;Start VCoin Core on system login</source> <translation>&amp;Start VCoin Core on system login</translation> </message> <message> <source>(0 = auto, &lt;0 = leave that many cores free)</source> <translation>(0 = auto, &lt;0 = leave that many cores free)</translation> </message> <message> <source>W&amp;allet</source> <translation>W&amp;allet</translation> </message> <message> <source>Expert</source> <translation>Expert</translation> </message> <message> <source>Enable coin &amp;control features</source> <translation>Enable coin &amp;control features</translation> </message> <message> <source>If you disable the spending of unconfirmed change, the change from a transaction cannot be used until that transaction has at least one confirmation. This also affects how your balance is computed.</source> <translation>If you disable the spending of unconfirmed change, the change from a transaction cannot be used until that transaction has at least one confirmation. This also affects how your balance is computed.</translation> </message> <message> <source>&amp;Spend unconfirmed change</source> <translation>&amp;Spend unconfirmed change</translation> </message> <message> <source>Automatically open the VCoin client port on the router. This only works when your router supports UPnP and it is enabled.</source> <translation>Automatically open the VCoin client port on the router. This only works when your router supports UPnP and it is enabled.</translation> </message> <message> <source>Map port using &amp;UPnP</source> <translation>Map port using &amp;UPnP</translation> </message> <message> <source>Connect to the VCoin network through a SOCKS5 proxy.</source> <translation>Connect to the VCoin network through a SOCKS5 proxy.</translation> </message> <message> <source>&amp;Connect through SOCKS5 proxy (default proxy):</source> <translation>&amp;Connect through SOCKS5 proxy (default proxy):</translation> </message> <message> <source>Proxy &amp;IP:</source> <translation>Proxy &amp;IP:</translation> </message> <message> <source>&amp;Port:</source> <translation>&amp;Port:</translation> </message> <message> <source>Port of the proxy (e.g. 9050)</source> <translation>Port of the proxy (e.g. 9050)</translation> </message> <message> <source>Used for reaching peers via:</source> <translation>Used for reaching peers via:</translation> </message> <message> <source>Shows, if the supplied default SOCKS5 proxy is used to reach peers via this network type.</source> <translation>Shows, if the supplied default SOCKS5 proxy is used to reach peers via this network type.</translation> </message> <message> <source>IPv4</source> <translation>IPv4</translation> </message> <message> <source>IPv6</source> <translation>IPv6</translation> </message> <message> <source>Tor</source> <translation>Tor</translation> </message> <message> <source>Connect to the VCoin network through a separate SOCKS5 proxy for Tor hidden services.</source> <translation>Connect to the VCoin network through a separate SOCKS5 proxy for Tor hidden services.</translation> </message> <message> <source>Use separate SOCKS5 proxy to reach peers via Tor hidden services:</source> <translation>Use separate SOCKS5 proxy to reach peers via Tor hidden services:</translation> </message> <message> <source>&amp;Window</source> <translation>&amp;Window</translation> </message> <message> <source>Show only a tray icon after minimizing the window.</source> <translation>Show on a tray icon after minimising the window.</translation> </message> <message> <source>&amp;Minimize to the tray instead of the taskbar</source> <translation>&amp;Minimise to the tray instead of the task bar</translation> </message> <message> <source>M&amp;inimize on close</source> <translation>M&amp;inimise on close</translation> </message> <message> <source>&amp;Display</source> <translation>&amp;Display</translation> </message> <message> <source>User Interface &amp;language:</source> <translation>User Interface &amp;language:</translation> </message> <message> <source>&amp;Unit to show amounts in:</source> <translation>&amp;Unit to show amounts in:</translation> </message> <message> <source>Choose the default subdivision unit to show in the interface and when sending coins.</source> <translation>Choose the default subdivision unit to show in the interface and when sending coins.</translation> </message> <message> <source>Whether to show coin control features or not.</source> <translation>Whether to show coin control features or not.</translation> </message> <message> <source>&amp;OK</source> <translation>&amp;OK</translation> </message> <message> <source>&amp;Cancel</source> <translation>&amp;Cancel</translation> </message> <message> <source>default</source> <translation>default</translation> </message> <message> <source>none</source> <translation>none</translation> </message> <message> <source>Confirm options reset</source> <translation>Confirm options reset</translation> </message> <message> <source>Client restart required to activate changes.</source> <translation>Client restart required to activate changes.</translation> </message> <message> <source>Client will be shut down. Do you want to proceed?</source> <translation>Client will be shut down. Do you want to proceed?</translation> </message> <message> <source>This change would require a client restart.</source> <translation>This change would require a client restart.</translation> </message> <message> <source>The supplied proxy address is invalid.</source> <translation>The supplied proxy address is invalid.</translation> </message> </context> <context> <name>OverviewPage</name> <message> <source>Form</source> <translation>Form</translation> </message> <message> <source>The displayed information may be out of date. Your wallet automatically synchronizes with the VCoin network after a connection is established, but this process has not completed yet.</source> <translation>The displayed information may be out of date. Your Wallet automatically synchronises with the VCoin Network after a connection is established, but this process has not been completed yet.</translation> </message> <message> <source>Watch-only:</source> <translation>Watch-only:</translation> </message> <message> <source>Available:</source> <translation>Available:</translation> </message> <message> <source>Your current spendable balance</source> <translation>Your current spendable balance</translation> </message> <message> <source>Pending:</source> <translation>Pending:</translation> </message> <message> <source>Total of transactions that have yet to be confirmed, and do not yet count toward the spendable balance</source> <translation>Total of transactions that have yet to be confirmed, and do not yet count toward the spendable balance</translation> </message> <message> <source>Immature:</source> <translation>Immature:</translation> </message> <message> <source>Mined balance that has not yet matured</source> <translation>Mined balance that has not yet matured</translation> </message> <message> <source>Balances</source> <translation>Balances</translation> </message> <message> <source>Total:</source> <translation>Total:</translation> </message> <message> <source>Your current total balance</source> <translation>Your current total balance</translation> </message> <message> <source>Your current balance in watch-only addresses</source> <translation>Your current balance in watch-only addresses</translation> </message> <message> <source>Spendable:</source> <translation>Spendable:</translation> </message> <message> <source>Recent transactions</source> <translation>Recent transactions</translation> </message> <message> <source>Unconfirmed transactions to watch-only addresses</source> <translation>Unconfirmed transactions to watch-only addresses</translation> </message> <message> <source>Mined balance in watch-only addresses that has not yet matured</source> <translation>Mined balance in watch-only addresses that has not yet matured</translation> </message> <message> <source>Current total balance in watch-only addresses</source> <translation>Current total balance in watch-only addresses</translation> </message> </context> <context> <name>PaymentServer</name> <message> <source>URI handling</source> <translation>URI handling</translation> </message> <message> <source>Invalid payment address %1</source> <translation>Invalid payment address %1</translation> </message> <message> <source>Payment request rejected</source> <translation>Payment request rejected</translation> </message> <message> <source>Payment request network doesn't match client network.</source> <translation>Payment request network doesn't match client network.</translation> </message> <message> <source>Payment request is not initialized.</source> <translation>Payment request is not initialised.</translation> </message> <message> <source>Requested payment amount of %1 is too small (considered dust).</source> <translation>Requested payment amount of %1 is too small (considered dust).</translation> </message> <message> <source>Payment request error</source> <translation>Payment request error</translation> </message> <message> <source>Cannot start vcoin: click-to-pay handler</source> <translation>Cannot start vcoin: click-to-pay handler</translation> </message> <message> <source>Payment request fetch URL is invalid: %1</source> <translation>Payment request fetch URL is invalid: %1</translation> </message> <message> <source>URI cannot be parsed! This can be caused by an invalid VCoin address or malformed URI parameters.</source> <translation>URI cannot be parsed! This can be caused by an invalid VCoin address or malformed URI parameters.</translation> </message> <message> <source>Payment request file handling</source> <translation>Payment request file handling</translation> </message> <message> <source>Payment request file cannot be read! This can be caused by an invalid payment request file.</source> <translation>Payment request file cannot be read! This can be caused by an invalid payment request file.</translation> </message> <message> <source>Payment request expired.</source> <translation>Payment request expired.</translation> </message> <message> <source>Unverified payment requests to custom payment scripts are unsupported.</source> <translation>Unverified payment requests to custom payment scripts are unsupported.</translation> </message> <message> <source>Invalid payment request.</source> <translation>Invalid payment request.</translation> </message> <message> <source>Refund from %1</source> <translation>Refund from %1</translation> </message> <message> <source>Payment request %1 is too large (%2 bytes, allowed %3 bytes).</source> <translation>Payment request %1 is too large (%2 bytes, allowed %3 bytes).</translation> </message> <message> <source>Error communicating with %1: %2</source> <translation>Error communicating with %1: %2</translation> </message> <message> <source>Payment request cannot be parsed!</source> <translation>Payment request cannot be parsed!</translation> </message> <message> <source>Bad response from server %1</source> <translation>Bad response from server %1</translation> </message> <message> <source>Payment acknowledged</source> <translation>Payment acknowledged</translation> </message> <message> <source>Network request error</source> <translation>Network request error</translation> </message> </context> <context> <name>PeerTableModel</name> <message> <source>User Agent</source> <translation>User Agent</translation> </message> <message> <source>Node/Service</source> <translation>Node/Service</translation> </message> <message> <source>Ping Time</source> <translation>Ping Time</translation> </message> </context> <context> <name>QObject</name> <message> <source>Amount</source> <translation>Amount</translation> </message> <message> <source>Enter a VCoin address (e.g. %1)</source> <translation>Enter a VCoin address (e.g. %1)</translation> </message> <message> <source>%1 d</source> <translation>%1 d</translation> </message> <message> <source>%1 h</source> <translation>%1 h</translation> </message> <message> <source>%1 m</source> <translation>%1 m</translation> </message> <message> <source>%1 s</source> <translation>%1 s</translation> </message> <message> <source>None</source> <translation>None</translation> </message> <message> <source>N/A</source> <translation>N/A</translation> </message> <message> <source>%1 ms</source> <translation>%1 ms</translation> </message> </context> <context> <name>QRImageWidget</name> <message> <source>&amp;Save Image...</source> <translation>&amp;Save Image...</translation> </message> <message> <source>&amp;Copy Image</source> <translation>&amp;Copy Image</translation> </message> <message> <source>Save QR Code</source> <translation>Save QR Code</translation> </message> <message> <source>PNG Image (*.png)</source> <translation>PNG Image (*.png)</translation> </message> </context> <context> <name>RPCConsole</name> <message> <source>Client name</source> <translation>Client name</translation> </message> <message> <source>N/A</source> <translation>N/A</translation> </message> <message> <source>Client version</source> <translation>Client version</translation> </message> <message> <source>&amp;Information</source> <translation>&amp;Information</translation> </message> <message> <source>Debug window</source> <translation>Debug window</translation> </message> <message> <source>General</source> <translation>General</translation> </message> <message> <source>Using OpenSSL version</source> <translation>Using OpenSSL version</translation> </message> <message> <source>Using BerkeleyDB version</source> <translation>Using BerkeleyDB version</translation> </message> <message> <source>Startup time</source> <translation>Startup time</translation> </message> <message> <source>Network</source> <translation>Network</translation> </message> <message> <source>Name</source> <translation>Name</translation> </message> <message> <source>Number of connections</source> <translation>Number of connections</translation> </message> <message> <source>Block chain</source> <translation>Block chain</translation> </message> <message> <source>Current number of blocks</source> <translation>Current number of blocks</translation> </message> <message> <source>Memory Pool</source> <translation>Memory Pool</translation> </message> <message> <source>Current number of transactions</source> <translation>Current number of transactions</translation> </message> <message> <source>Memory usage</source> <translation>Memory usage</translation> </message> <message> <source>Open the VCoin Core debug log file from the current data directory. This can take a few seconds for large log files.</source> <translation>Open the VCoin Core debug log file from the current data directory. This can take a few seconds for large log files.</translation> </message> <message> <source>Received</source> <translation>Received</translation> </message> <message> <source>Sent</source> <translation>Sent</translation> </message> <message> <source>&amp;Peers</source> <translation>&amp;Peers</translation> </message> <message> <source>Banned peers</source> <translation>Banned peers</translation> </message> <message> <source>Select a peer to view detailed information.</source> <translation>Select a peer to view detailed information.</translation> </message> <message> <source>Whitelisted</source> <translation>Whitelisted</translation> </message> <message> <source>Direction</source> <translation>Direction</translation> </message> <message> <source>Version</source> <translation>Version</translation> </message> <message> <source>Starting Block</source> <translation>Starting Block</translation> </message> <message> <source>Synced Headers</source> <translation>Synced Headers</translation> </message> <message> <source>Synced Blocks</source> <translation>Synced Blocks</translation> </message> <message> <source>User Agent</source> <translation>User Agent</translation> </message> <message> <source>Services</source> <translation>Services</translation> </message> <message> <source>Ban Score</source> <translation>Ban Score</translation> </message> <message> <source>Connection Time</source> <translation>Connection Time</translation> </message> <message> <source>Last Send</source> <translation>Last Send</translation> </message> <message> <source>Last Receive</source> <translation>Last Receive</translation> </message> <message> <source>Ping Time</source> <translation>Ping Time</translation> </message> <message> <source>The duration of a currently outstanding ping.</source> <translation>The duration of a currently outstanding ping.</translation> </message> <message> <source>Ping Wait</source> <translation>Ping Wait</translation> </message> <message> <source>Time Offset</source> <translation>Time Offset</translation> </message> <message> <source>Last block time</source> <translation>Last block time</translation> </message> <message> <source>&amp;Open</source> <translation>&amp;Open</translation> </message> <message> <source>&amp;Console</source> <translation>&amp;Console</translation> </message> <message> <source>&amp;Network Traffic</source> <translation>&amp;Network Traffic</translation> </message> <message> <source>&amp;Clear</source> <translation>&amp;Clear</translation> </message> <message> <source>Totals</source> <translation>Totals</translation> </message> <message> <source>In:</source> <translation>In:</translation> </message> <message> <source>Out:</source> <translation>Out:</translation> </message> <message> <source>Build date</source> <translation>Build date</translation> </message> <message> <source>Debug log file</source> <translation>Debug log file</translation> </message> <message> <source>Clear console</source> <translation>Clear console</translation> </message> <message> <source>&amp;Disconnect Node</source> <translation>&amp;Disconnect Node</translation> </message> <message> <source>Ban Node for</source> <translation>Ban Node for</translation> </message> <message> <source>1 &amp;hour</source> <translation>1 &amp;hour</translation> </message> <message> <source>1 &amp;day</source> <translation>1 &amp;day</translation> </message> <message> <source>1 &amp;week</source> <translation>1 &amp;week</translation> </message> <message> <source>1 &amp;year</source> <translation>1 &amp;year</translation> </message> <message> <source>&amp;Unban Node</source> <translation>&amp;Unban Node</translation> </message> <message> <source>Welcome to the VCoin Core RPC console.</source> <translation>Welcome to the VCoin Core RPC console.</translation> </message> <message> <source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source> <translation>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</translation> </message> <message> <source>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</source> <translation>Type &lt;b&gt;help&lt;/b&gt; for an overview of available commands.</translation> </message> <message> <source>%1 B</source> <translation>%1 B</translation> </message> <message> <source>%1 KB</source> <translation>%1 KB</translation> </message> <message> <source>%1 MB</source> <translation>%1 MB</translation> </message> <message> <source>%1 GB</source> <translation>%1 GB</translation> </message> <message> <source>(node id: %1)</source> <translation>(node id: %1)</translation> </message> <message> <source>via %1</source> <translation>via %1</translation> </message> <message> <source>never</source> <translation>never</translation> </message> <message> <source>Inbound</source> <translation>Inbound</translation> </message> <message> <source>Outbound</source> <translation>Outbound</translation> </message> <message> <source>Yes</source> <translation>Yes</translation> </message> <message> <source>No</source> <translation>No</translation> </message> <message> <source>Unknown</source> <translation>Unknown</translation> </message> </context> <context> <name>ReceiveCoinsDialog</name> <message> <source>&amp;Amount:</source> <translation>&amp;Amount:</translation> </message> <message> <source>&amp;Label:</source> <translation>&amp;Label:</translation> </message> <message> <source>&amp;Message:</source> <translation>&amp;Message:</translation> </message> <message> <source>Reuse one of the previously used receiving addresses. Reusing addresses has security and privacy issues. Do not use this unless re-generating a payment request made before.</source> <translation>Reuse one of the previously used receiving addresses. Reusing addresses has security and privacy issues. Do not use this unless re-generating a payment request made before.</translation> </message> <message> <source>R&amp;euse an existing receiving address (not recommended)</source> <translation>R&amp;euse an existing receiving address (not recommended)</translation> </message> <message> <source>An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the VCoin network.</source> <translation>An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the VCoin network.</translation> </message> <message> <source>An optional label to associate with the new receiving address.</source> <translation>An optional label to associate with the new receiving address.</translation> </message> <message> <source>Use this form to request payments. All fields are &lt;b&gt;optional&lt;/b&gt;.</source> <translation>Use this form to request payments. All fields are &lt;b&gt;optional&lt;/b&gt;.</translation> </message> <message> <source>An optional amount to request. Leave this empty or zero to not request a specific amount.</source> <translation>An optional amount to request. Leave this empty or zero to not request a specific amount.</translation> </message> <message> <source>Clear all fields of the form.</source> <translation>Clear all fields of the form.</translation> </message> <message> <source>Clear</source> <translation>Clear</translation> </message> <message> <source>Requested payments history</source> <translation>Requested payments history</translation> </message> <message> <source>&amp;Request payment</source> <translation>&amp;Request payment</translation> </message> <message> <source>Show the selected request (does the same as double clicking an entry)</source> <translation>Show the selected request (does the same as double clicking an entry)</translation> </message> <message> <source>Show</source> <translation>Show</translation> </message> <message> <source>Remove the selected entries from the list</source> <translation>Remove the selected entries from the list</translation> </message> <message> <source>Remove</source> <translation>Remove</translation> </message> <message> <source>Copy label</source> <translation>Copy label</translation> </message> <message> <source>Copy message</source> <translation>Copy message</translation> </message> <message> <source>Copy amount</source> <translation>Copy amount</translation> </message> </context> <context> <name>ReceiveRequestDialog</name> <message> <source>QR Code</source> <translation>QR Code</translation> </message> <message> <source>Copy &amp;URI</source> <translation>Copy &amp;URI</translation> </message> <message> <source>Copy &amp;Address</source> <translation>Copy &amp;Address</translation> </message> <message> <source>&amp;Save Image...</source> <translation>&amp;Save Image...</translation> </message> <message> <source>Request payment to %1</source> <translation>Request payment to %1</translation> </message> <message> <source>Payment information</source> <translation>Payment information</translation> </message> <message> <source>URI</source> <translation>URI</translation> </message> <message> <source>Address</source> <translation>Address</translation> </message> <message> <source>Amount</source> <translation>Amount</translation> </message> <message> <source>Label</source> <translation>Label</translation> </message> <message> <source>Message</source> <translation>Message</translation> </message> <message> <source>Resulting URI too long, try to reduce the text for label / message.</source> <translation>Resulting URI too long, try to reduce the text for label / message.</translation> </message> <message> <source>Error encoding URI into QR Code.</source> <translation>Error encoding URI into QR Code.</translation> </message> </context> <context> <name>RecentRequestsTableModel</name> <message> <source>Date</source> <translation>Date</translation> </message> <message> <source>Label</source> <translation>Label</translation> </message> <message> <source>Message</source> <translation>Message</translation> </message> <message> <source>Amount</source> <translation>Amount</translation> </message> <message> <source>(no label)</source> <translation>(no label)</translation> </message> <message> <source>(no message)</source> <translation>(no message)</translation> </message> <message> <source>(no amount)</source> <translation>(no amount)</translation> </message> </context> <context> <name>SendCoinsDialog</name> <message> <source>Send Coins</source> <translation>Send Coins</translation> </message> <message> <source>Coin Control Features</source> <translation>Coin Control Features</translation> </message> <message> <source>Inputs...</source> <translation>Inputs...</translation> </message> <message> <source>automatically selected</source> <translation>automatically selected</translation> </message> <message> <source>Insufficient funds!</source> <translation>Insufficient funds!</translation> </message> <message> <source>Quantity:</source> <translation>Quantity:</translation> </message> <message> <source>Bytes:</source> <translation>Bytes:</translation> </message> <message> <source>Amount:</source> <translation>Amount:</translation> </message> <message> <source>Priority:</source> <translation>Priority:</translation> </message> <message> <source>Fee:</source> <translation>Fee:</translation> </message> <message> <source>After Fee:</source> <translation>After Fee:</translation> </message> <message> <source>Change:</source> <translation>Change:</translation> </message> <message> <source>If this is activated, but the change address is empty or invalid, change will be sent to a newly generated address.</source> <translation>If this is activated, but the change address is empty or invalid, change will be sent to a newly generated address.</translation> </message> <message> <source>Custom change address</source> <translation>Custom change address</translation> </message> <message> <source>Transaction Fee:</source> <translation>Transaction Fee:</translation> </message> <message> <source>Choose...</source> <translation>Choose...</translation> </message> <message> <source>collapse fee-settings</source> <translation>collapse fee-settings</translation> </message> <message> <source>per kilobyte</source> <translation>per kilobyte</translation> </message> <message> <source>If the custom fee is set to 1000 satoshis and the transaction is only 250 bytes, then "per kilobyte" only pays 250 satoshis in fee, while "total at least" pays 1000 satoshis. For transactions bigger than a kilobyte both pay by kilobyte.</source> <translation>If the custom fee is set to 1000 satoshis and the transaction is only 250 bytes, then "per kilobyte" only pays 250 satoshis in fee, while "total at least" pays 1000 satoshis. For transactions bigger than a kilobyte both pay by kilobyte.</translation> </message> <message> <source>Hide</source> <translation>Hide</translation> </message> <message> <source>total at least</source> <translation>total at least</translation> </message> <message> <source>Paying only the minimum fee is just fine as long as there is less transaction volume than space in the blocks. But be aware that this can end up in a never confirming transaction once there is more demand for vcoin transactions than the network can process.</source> <translation>Paying only the minimum fee is just fine as long as there is less transaction volume than space in the blocks. But be aware that this can end up in a never confirming transaction once there is more demand for vcoin transactions than the network can process.</translation> </message> <message> <source>(read the tooltip)</source> <translation>(read the tooltip)</translation> </message> <message> <source>Recommended:</source> <translation>Recommended:</translation> </message> <message> <source>Custom:</source> <translation>Custom:</translation> </message> <message> <source>(Smart fee not initialized yet. This usually takes a few blocks...)</source> <translation>(Smart fee not initialised yet. This usually takes a few blocks...)</translation> </message> <message> <source>Confirmation time:</source> <translation>Confirmation time:</translation> </message> <message> <source>normal</source> <translation>normal</translation> </message> <message> <source>fast</source> <translation>fast</translation> </message> <message> <source>Send as zero-fee transaction if possible</source> <translation>Send as zero-fee transaction if possible</translation> </message> <message> <source>(confirmation may take longer)</source> <translation>(confirmation may take longer)</translation> </message> <message> <source>Send to multiple recipients at once</source> <translation>Send to multiple recipients at once</translation> </message> <message> <source>Add &amp;Recipient</source> <translation>Add &amp;Recipient</translation> </message> <message> <source>Clear all fields of the form.</source> <translation>Clear all fields of the form.</translation> </message> <message> <source>Dust:</source> <translation>Dust:</translation> </message> <message> <source>Clear &amp;All</source> <translation>Clear &amp;All</translation> </message> <message> <source>Balance:</source> <translation>Balance:</translation> </message> <message> <source>Confirm the send action</source> <translation>Confirm the send action</translation> </message> <message> <source>S&amp;end</source> <translation>S&amp;end</translation> </message> <message> <source>Confirm send coins</source> <translation>Confirm send coins</translation> </message> <message> <source>%1 to %2</source> <translation>%1 to %2</translation> </message> <message> <source>Copy quantity</source> <translation>Copy quantity</translation> </message> <message> <source>Copy amount</source> <translation>Copy amount</translation> </message> <message> <source>Copy fee</source> <translation>Copy fee</translation> </message> <message> <source>Copy after fee</source> <translation>Copy after fee</translation> </message> <message> <source>Copy bytes</source> <translation>Copy bytes</translation> </message> <message> <source>Copy priority</source> <translation>Copy priority</translation> </message> <message> <source>Copy change</source> <translation>Copy change</translation> </message> <message> <source>Total Amount %1</source> <translation>Total Amount %1</translation> </message> <message> <source>or</source> <translation>or</translation> </message> <message> <source>The amount to pay must be larger than 0.</source> <translation>The amount to pay must be larger than 0.</translation> </message> <message> <source>The amount exceeds your balance.</source> <translation>The amount exceeds your balance.</translation> </message> <message> <source>The total exceeds your balance when the %1 transaction fee is included.</source> <translation>The total exceeds your balance when the %1 transaction fee is included.</translation> </message> <message> <source>Transaction creation failed!</source> <translation>Transaction creation failed!</translation> </message> <message> <source>The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source> <translation>The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</translation> </message> <message> <source>A fee higher than %1 is considered an absurdly high fee.</source> <translation>A fee higher than %1 is considered an absurdly high fee.</translation> </message> <message> <source>Payment request expired.</source> <translation>Payment request expired.</translation> </message> <message> <source>Pay only the required fee of %1</source> <translation>Pay only the required fee of %1</translation> </message> <message numerus="yes"> <source>Estimated to begin confirmation within %n block(s).</source> <translation><numerusform>Estimated to begin confirmation within %n block.</numerusform><numerusform>Estimated to begin confirmation within %n blocks.</numerusform></translation> </message> <message> <source>The recipient address is not valid. Please recheck.</source> <translation>The recipient address is not valid. Please recheck.</translation> </message> <message> <source>Duplicate address found: addresses should only be used once each.</source> <translation>Duplicate address found: addresses should only be used once each.</translation> </message> <message> <source>Warning: Invalid VCoin address</source> <translation>Warning: Invalid VCoin address</translation> </message> <message> <source>(no label)</source> <translation>(no label)</translation> </message> <message> <source>Warning: Unknown change address</source> <translation>Warning: Unknown change address</translation> </message> <message> <source>Copy dust</source> <translation>Copy dust</translation> </message> <message> <source>Are you sure you want to send?</source> <translation>Are you sure you want to send?</translation> </message> <message> <source>added as transaction fee</source> <translation>added as transaction fee</translation> </message> </context> <context> <name>SendCoinsEntry</name> <message> <source>A&amp;mount:</source> <translation>A&amp;mount:</translation> </message> <message> <source>Pay &amp;To:</source> <translation>Pay &amp;To:</translation> </message> <message> <source>Enter a label for this address to add it to your address book</source> <translation>Enter a label for this address to add it to your address book</translation> </message> <message> <source>&amp;Label:</source> <translation>&amp;Label:</translation> </message> <message> <source>Choose previously used address</source> <translation>Choose previously used address</translation> </message> <message> <source>This is a normal payment.</source> <translation>This is a normal payment.</translation> </message> <message> <source>The VCoin address to send the payment to</source> <translation>The VCoin address to send the payment to</translation> </message> <message> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <source>Paste address from clipboard</source> <translation>Paste address from clipboard</translation> </message> <message> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <source>Remove this entry</source> <translation>Remove this entry</translation> </message> <message> <source>The fee will be deducted from the amount being sent. The recipient will receive less vcoins than you enter in the amount field. If multiple recipients are selected, the fee is split equally.</source> <translation>The fee will be deducted from the amount being sent. The recipient will receive less vcoins than you enter in the amount field. If multiple recipients are selected, the fee is split equally.</translation> </message> <message> <source>S&amp;ubtract fee from amount</source> <translation>S&amp;ubtract fee from amount</translation> </message> <message> <source>Message:</source> <translation>Message:</translation> </message> <message> <source>This is an unauthenticated payment request.</source> <translation>This is an unauthenticated payment request.</translation> </message> <message> <source>This is an authenticated payment request.</source> <translation>This is an authenticated payment request.</translation> </message> <message> <source>Enter a label for this address to add it to the list of used addresses</source> <translation>Enter a label for this address to add it to the list of used addresses</translation> </message> <message> <source>A message that was attached to the vcoin: URI which will be stored with the transaction for your reference. Note: This message will not be sent over the VCoin network.</source> <translation>A message that was attached to the vcoin: URI which will be stored with the transaction for your reference. Note: This message will not be sent over the VCoin network.</translation> </message> <message> <source>Pay To:</source> <translation>Pay To:</translation> </message> <message> <source>Memo:</source> <translation>Memo:</translation> </message> </context> <context> <name>ShutdownWindow</name> <message> <source>VCoin Core is shutting down...</source> <translation>VCoin Core is shutting down...</translation> </message> <message> <source>Do not shut down the computer until this window disappears.</source> <translation>Do not shut down the computer until this window disappears.</translation> </message> </context> <context> <name>SignVerifyMessageDialog</name> <message> <source>Signatures - Sign / Verify a Message</source> <translation>Signatures - Sign / Verify a Message</translation> </message> <message> <source>&amp;Sign Message</source> <translation>&amp;Sign Message</translation> </message> <message> <source>You can sign messages/agreements with your addresses to prove you can receive vcoins sent to them. Be careful not to sign anything vague or random, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source> <translation>You can sign messages/agreements with your addresses to prove you can receive vcoins sent to them. Be careful not to sign anything vague or random, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</translation> </message> <message> <source>The VCoin address to sign the message with</source> <translation>The VCoin address to sign the message with</translation> </message> <message> <source>Choose previously used address</source> <translation>Choose previously used address</translation> </message> <message> <source>Alt+A</source> <translation>Alt+A</translation> </message> <message> <source>Paste address from clipboard</source> <translation>Paste address from clipboard</translation> </message> <message> <source>Alt+P</source> <translation>Alt+P</translation> </message> <message> <source>Enter the message you want to sign here</source> <translation>Enter the message you want to sign here</translation> </message> <message> <source>Signature</source> <translation>Signature</translation> </message> <message> <source>Copy the current signature to the system clipboard</source> <translation>Copy the current signature to the system clipboard</translation> </message> <message> <source>Sign the message to prove you own this VCoin address</source> <translation>Sign the message to prove you own this VCoin address</translation> </message> <message> <source>Sign &amp;Message</source> <translation>Sign &amp;Message</translation> </message> <message> <source>Reset all sign message fields</source> <translation>Reset all sign message fields</translation> </message> <message> <source>Clear &amp;All</source> <translation>Clear &amp;All</translation> </message> <message> <source>&amp;Verify Message</source> <translation>&amp;Verify Message</translation> </message> <message> <source>Enter the receiver's address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack. Note that this only proves the signing party receives with the address, it cannot prove sendership of any transaction!</source> <translation>Enter the receiver's address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack. Note that this only proves the signing party receives with the address, it cannot prove sendership of any transaction!</translation> </message> <message> <source>The VCoin address the message was signed with</source> <translation>The VCoin address the message was signed with</translation> </message> <message> <source>Verify the message to ensure it was signed with the specified VCoin address</source> <translation>Verify the message to ensure it was signed with the specified VCoin address</translation> </message> <message> <source>Verify &amp;Message</source> <translation>Verify &amp;Message</translation> </message> <message> <source>Reset all verify message fields</source> <translation>Reset all verify message fields</translation> </message> <message> <source>Click "Sign Message" to generate signature</source> <translation>Click "Sign Message" to generate signature</translation> </message> <message> <source>The entered address is invalid.</source> <translation>The entered address is invalid.</translation> </message> <message> <source>Please check the address and try again.</source> <translation>Please check the address and try again.</translation> </message> <message> <source>The entered address does not refer to a key.</source> <translation>The entered address does not refer to a key.</translation> </message> <message> <source>Wallet unlock was cancelled.</source> <translation>Wallet unlock was cancelled.</translation> </message> <message> <source>Private key for the entered address is not available.</source> <translation>Private key for the entered address is not available.</translation> </message> <message> <source>Message signing failed.</source> <translation>Message signing failed.</translation> </message> <message> <source>Message signed.</source> <translation>Message signed.</translation> </message> <message> <source>The signature could not be decoded.</source> <translation>The signature could not be decoded.</translation> </message> <message> <source>Please check the signature and try again.</source> <translation>Please check the signature and try again.</translation> </message> <message> <source>The signature did not match the message digest.</source> <translation>The signature did not match the message digest.</translation> </message> <message> <source>Message verification failed.</source> <translation>Message verification failed.</translation> </message> <message> <source>Message verified.</source> <translation>Message verified.</translation> </message> </context> <context> <name>SplashScreen</name> <message> <source>VCoin Core</source> <translation>VCoin Core</translation> </message> <message> <source>The VCoin Core developers</source> <translation>The VCoin Core developers</translation> </message> <message> <source>[testnet]</source> <translation>[testnet]</translation> </message> </context> <context> <name>TrafficGraphWidget</name> <message> <source>KB/s</source> <translation>KB/s</translation> </message> </context> <context> <name>TransactionDesc</name> <message> <source>Open until %1</source> <translation>Open until %1</translation> </message> <message> <source>conflicted</source> <translation>conflicted</translation> </message> <message> <source>%1/offline</source> <translation>%1/offline</translation> </message> <message> <source>%1/unconfirmed</source> <translation>%1/unconfirmed</translation> </message> <message> <source>%1 confirmations</source> <translation>%1 confirmations</translation> </message> <message> <source>Status</source> <translation>Status</translation> </message> <message numerus="yes"> <source>, broadcast through %n node(s)</source> <translation><numerusform>, broadcast through %n node</numerusform><numerusform>, broadcast through %n nodes</numerusform></translation> </message> <message> <source>Date</source> <translation>Date</translation> </message> <message> <source>Source</source> <translation>Source</translation> </message> <message> <source>Generated</source> <translation>Generated</translation> </message> <message> <source>From</source> <translation>From</translation> </message> <message> <source>To</source> <translation>To</translation> </message> <message> <source>own address</source> <translation>own address</translation> </message> <message> <source>watch-only</source> <translation>watch-only</translation> </message> <message> <source>label</source> <translation>label</translation> </message> <message> <source>Credit</source> <translation>Credit</translation> </message> <message numerus="yes"> <source>matures in %n more block(s)</source> <translation><numerusform>matures in %n more block</numerusform><numerusform>matures in %n more blocks</numerusform></translation> </message> <message> <source>not accepted</source> <translation>not accepted</translation> </message> <message> <source>Debit</source> <translation>Debit</translation> </message> <message> <source>Total debit</source> <translation>Total debit</translation> </message> <message> <source>Total credit</source> <translation>Total credit</translation> </message> <message> <source>Transaction fee</source> <translation>Transaction fee</translation> </message> <message> <source>Net amount</source> <translation>Net amount</translation> </message> <message> <source>Message</source> <translation>Message</translation> </message> <message> <source>Comment</source> <translation>Comment</translation> </message> <message> <source>Transaction ID</source> <translation>Transaction ID</translation> </message> <message> <source>Merchant</source> <translation>Merchant</translation> </message> <message> <source>Generated coins must mature %1 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source> <translation>Generated coins must mature %1 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</translation> </message> <message> <source>Debug information</source> <translation>Debug information</translation> </message> <message> <source>Transaction</source> <translation>Transaction</translation> </message> <message> <source>Inputs</source> <translation>Inputs</translation> </message> <message> <source>Amount</source> <translation>Amount</translation> </message> <message> <source>true</source> <translation>true</translation> </message> <message> <source>false</source> <translation>false</translation> </message> <message> <source>, has not been successfully broadcast yet</source> <translation>, has not been successfully broadcast yet</translation> </message> <message numerus="yes"> <source>Open for %n more block(s)</source> <translation><numerusform>Open for %n more block</numerusform><numerusform>Open for %n more blocks</numerusform></translation> </message> <message> <source>unknown</source> <translation>unknown</translation> </message> </context> <context> <name>TransactionDescDialog</name> <message> <source>Transaction details</source> <translation>Transaction details</translation> </message> <message> <source>This pane shows a detailed description of the transaction</source> <translation>This pane shows a detailed description of the transaction</translation> </message> </context> <context> <name>TransactionTableModel</name> <message> <source>Date</source> <translation>Date</translation> </message> <message> <source>Type</source> <translation>Type</translation> </message> <message> <source>Immature (%1 confirmations, will be available after %2)</source> <translation>Immature (%1 confirmations, will be available after %2)</translation> </message> <message numerus="yes"> <source>Open for %n more block(s)</source> <translation><numerusform>Open for %n more block</numerusform><numerusform>Open for %n more blocks</numerusform></translation> </message> <message> <source>Open until %1</source> <translation>Open until %1</translation> </message> <message> <source>Confirmed (%1 confirmations)</source> <translation>Confirmed (%1 confirmations)</translation> </message> <message> <source>This block was not received by any other nodes and will probably not be accepted!</source> <translation>This block was not received by any other nodes and will probably not be accepted!</translation> </message> <message> <source>Generated but not accepted</source> <translation>Generated but not accepted</translation> </message> <message> <source>Offline</source> <translation>Offline</translation> </message> <message> <source>Label</source> <translation>Label</translation> </message> <message> <source>Unconfirmed</source> <translation>Unconfirmed</translation> </message> <message> <source>Confirming (%1 of %2 recommended confirmations)</source> <translation>Confirming (%1 of %2 recommended confirmations)</translation> </message> <message> <source>Conflicted</source> <translation>Conflicted</translation> </message> <message> <source>Received with</source> <translation>Received with</translation> </message> <message> <source>Received from</source> <translation>Received from</translation> </message> <message> <source>Sent to</source> <translation>Sent to</translation> </message> <message> <source>Payment to yourself</source> <translation>Payment to yourself</translation> </message> <message> <source>Mined</source> <translation>Mined</translation> </message> <message> <source>watch-only</source> <translation>watch-only</translation> </message> <message> <source>(n/a)</source> <translation>(n/a)</translation> </message> <message> <source>Transaction status. Hover over this field to show number of confirmations.</source> <translation>Transaction status. Hover over this field to show number of confirmations.</translation> </message> <message> <source>Date and time that the transaction was received.</source> <translation>Date and time that the transaction was received.</translation> </message> <message> <source>Type of transaction.</source> <translation>Type of transaction.</translation> </message> <message> <source>Whether or not a watch-only address is involved in this transaction.</source> <translation>Whether or not a watch-only address is involved in this transaction.</translation> </message> <message> <source>User-defined intent/purpose of the transaction.</source> <translation>User-defined intent/purpose of the transaction.</translation> </message> <message> <source>Amount removed from or added to balance.</source> <translation>Amount removed from or added to balance.</translation> </message> </context> <context> <name>TransactionView</name> <message> <source>All</source> <translation>All</translation> </message> <message> <source>Today</source> <translation>Today</translation> </message> <message> <source>This week</source> <translation>This week</translation> </message> <message> <source>This month</source> <translation>This month</translation> </message> <message> <source>Last month</source> <translation>Last month</translation> </message> <message> <source>This year</source> <translation>This year</translation> </message> <message> <source>Range...</source> <translation>Range...</translation> </message> <message> <source>Received with</source> <translation>Received with</translation> </message> <message> <source>Sent to</source> <translation>Sent to</translation> </message> <message> <source>To yourself</source> <translation>To yourself</translation> </message> <message> <source>Mined</source> <translation>Mined</translation> </message> <message> <source>Other</source> <translation>Other</translation> </message> <message> <source>Enter address or label to search</source> <translation>Enter address or label to search</translation> </message> <message> <source>Min amount</source> <translation>Min amount</translation> </message> <message> <source>Copy address</source> <translation>Copy address</translation> </message> <message> <source>Copy label</source> <translation>Copy label</translation> </message> <message> <source>Copy amount</source> <translation>Copy amount</translation> </message> <message> <source>Copy transaction ID</source> <translation>Copy transaction ID</translation> </message> <message> <source>Copy raw transaction</source> <translation>Copy raw transaction</translation> </message> <message> <source>Edit label</source> <translation>Edit label</translation> </message> <message> <source>Show transaction details</source> <translation>Show transaction details</translation> </message> <message> <source>Export Transaction History</source> <translation>Export Transaction History</translation> </message> <message> <source>Watch-only</source> <translation>Watch-only</translation> </message> <message> <source>Exporting Failed</source> <translation>Exporting Failed</translation> </message> <message> <source>There was an error trying to save the transaction history to %1.</source> <translation>There was an error trying to save the transaction history to %1.</translation> </message> <message> <source>Exporting Successful</source> <translation>Exporting Successful</translation> </message> <message> <source>The transaction history was successfully saved to %1.</source> <translation>The transaction history was successfully saved to %1.</translation> </message> <message> <source>Comma separated file (*.csv)</source> <translation>Comma separated file (*.csv)</translation> </message> <message> <source>Confirmed</source> <translation>Confirmed</translation> </message> <message> <source>Date</source> <translation>Date</translation> </message> <message> <source>Type</source> <translation>Type</translation> </message> <message> <source>Label</source> <translation>Label</translation> </message> <message> <source>Address</source> <translation>Address</translation> </message> <message> <source>ID</source> <translation>ID</translation> </message> <message> <source>Range:</source> <translation>Range:</translation> </message> <message> <source>to</source> <translation>to</translation> </message> </context> <context> <name>UnitDisplayStatusBarControl</name> <message> <source>Unit to show amounts in. Click to select another unit.</source> <translation>Unit to show amounts in. Click to select another unit.</translation> </message> </context> <context> <name>WalletFrame</name> <message> <source>No wallet has been loaded.</source> <translation>No wallet has been loaded.</translation> </message> </context> <context> <name>WalletModel</name> <message> <source>Send Coins</source> <translation>Send Coins</translation> </message> </context> <context> <name>WalletView</name> <message> <source>&amp;Export</source> <translation>&amp;Export</translation> </message> <message> <source>Export the data in the current tab to a file</source> <translation>Export the data in the current tab to a file</translation> </message> <message> <source>Backup Wallet</source> <translation>Backup Wallet</translation> </message> <message> <source>Wallet Data (*.dat)</source> <translation>Wallet Data (*.dat)</translation> </message> <message> <source>Backup Failed</source> <translation>Backup Failed</translation> </message> <message> <source>There was an error trying to save the wallet data to %1.</source> <translation>There was an error trying to save the wallet data to %1.</translation> </message> <message> <source>The wallet data was successfully saved to %1.</source> <translation>The wallet data was successfully saved to %1.</translation> </message> <message> <source>Backup Successful</source> <translation>Backup Successful</translation> </message> </context> <context> <name>vcoin-core</name> <message> <source>Options:</source> <translation>Options:</translation> </message> <message> <source>Specify data directory</source> <translation>Specify data directory</translation> </message> <message> <source>Connect to a node to retrieve peer addresses, and disconnect</source> <translation>Connect to a node to retrieve peer addresses, and disconnect</translation> </message> <message> <source>Specify your own public address</source> <translation>Specify your own public address</translation> </message> <message> <source>Accept command line and JSON-RPC commands</source> <translation>Accept command line and JSON-RPC commands</translation> </message> <message> <source>If &lt;category&gt; is not supplied or if &lt;category&gt; = 1, output all debugging information.</source> <translation>If &lt;category&gt; is not supplied or if &lt;category&gt; = 1, output all debugging information.</translation> </message> <message> <source>Maximum total fees (in %s) to use in a single wallet transaction; setting this too low may abort large transactions (default: %s)</source> <translation>Maximum total fees (in %s) to use in a single wallet transaction; setting this too low may abort large transactions (default: %s)</translation> </message> <message> <source>Please check that your computer's date and time are correct! If your clock is wrong VCoin Core will not work properly.</source> <translation>Please check that your computer's date and time are correct! If your clock is wrong VCoin Core will not work properly.</translation> </message> <message> <source>Prune configured below the minimum of %d MiB. Please use a higher number.</source> <translation>Prune configured below the minimum of %d MiB. Please use a higher number.</translation> </message> <message> <source>Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of pruned node)</source> <translation>Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of pruned node)</translation> </message> <message> <source>Reduce storage requirements by pruning (deleting) old blocks. This mode is incompatible with -txindex and -rescan. Warning: Reverting this setting requires re-downloading the entire blockchain. (default: 0 = disable pruning blocks, &gt;%u = target size in MiB to use for block files)</source> <translation>Reduce storage requirements by pruning (deleting) old blocks. This mode is incompatible with -txindex and -rescan. Warning: Reverting this setting requires re-downloading the entire blockchain. (default: 0 = disable pruning blocks, &gt;%u = target size in MiB to use for block files)</translation> </message> <message> <source>Rescans are not possible in pruned mode. You will need to use -reindex which will download the whole blockchain again.</source> <translation>Rescans are not possible in pruned mode. You will need to use -reindex which will download the whole blockchain again.</translation> </message> <message> <source>Error: A fatal internal error occurred, see debug.log for details</source> <translation>Error: A fatal internal error occurred, see debug.log for details</translation> </message> <message> <source>Fee (in %s/kB) to add to transactions you send (default: %s)</source> <translation>Fee (in %s/kB) to add to transactions you send (default: %s)</translation> </message> <message> <source>Pruning blockstore...</source> <translation>Pruning blockstore...</translation> </message> <message> <source>Run in the background as a daemon and accept commands</source> <translation>Run in the background as a daemon and accept commands</translation> </message> <message> <source>Unable to start HTTP server. See debug log for details.</source> <translation>Unable to start HTTP server. See debug log for details.</translation> </message> <message> <source>Accept connections from outside (default: 1 if no -proxy or -connect)</source> <translation>Accept connections from outside (default: 1 if no -proxy or -connect)</translation> </message> <message> <source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source> <translation>Bind to given address and always listen on it. Use [host]:port notation for IPv6</translation> </message> <message> <source>Delete all wallet transactions and only recover those parts of the blockchain through -rescan on startup</source> <translation>Delete all wallet transactions and only recover those parts of the blockchain through -rescan on startup</translation> </message> <message> <source>Distributed under the MIT software license, see the accompanying file COPYING or &lt;http://www.opensource.org/licenses/mit-license.php&gt;.</source> <translation>Distributed under the MIT software license, see the accompanying file COPYING or &lt;http://www.opensource.org/licenses/mit-license.php&gt;.</translation> </message> <message> <source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source> <translation>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</translation> </message> <message> <source>Set the number of script verification threads (%u to %d, 0 = auto, &lt;0 = leave that many cores free, default: %d)</source> <translation>Set the number of script verification threads (%u to %d, 0 = auto, &lt;0 = leave that many cores free, default: %d)</translation> </message> <message> <source>The block database contains a block which appears to be from the future. This may be due to your computer's date and time being set incorrectly. Only rebuild the block database if you are sure that your computer's date and time are correct</source> <translation>The block database contains a block which appears to be from the future. This may be due to your computer's date and time being set incorrectly. Only rebuild the block database if you are sure that your computer's date and time are correct</translation> </message> <message> <source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source> <translation>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</translation> </message> <message> <source>Unable to bind to %s on this computer. VCoin Core is probably already running.</source> <translation>Unable to bind to %s on this computer. VCoin Core is probably already running.</translation> </message> <message> <source>Use UPnP to map the listening port (default: 1 when listening and no -proxy)</source> <translation>Use UPnP to map the listening port (default: 1 when listening and no -proxy)</translation> </message> <message> <source>WARNING: abnormally high number of blocks generated, %d blocks received in the last %d hours (%d expected)</source> <translation>WARNING: abnormally high number of blocks generated, %d blocks received in the last %d hours (%d expected)</translation> </message> <message> <source>WARNING: check your network connection, %d blocks received in the last %d hours (%d expected)</source> <translation>WARNING: check your network connection, %d blocks received in the last %d hours (%d expected)</translation> </message> <message> <source>Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.</source> <translation>Warning: The network does not appear to fully agree! Some miners appear to be experiencing issues.</translation> </message> <message> <source>Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade.</source> <translation>Warning: We do not appear to fully agree with our peers! You may need to upgrade, or other nodes may need to upgrade.</translation> </message> <message> <source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source> <translation>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</translation> </message> <message> <source>Whitelist peers connecting from the given netmask or IP address. Can be specified multiple times.</source> <translation>Whitelist peers connecting from the given netmask or IP address. Can be specified multiple times.</translation> </message> <message> <source>-maxmempool must be at least %d MB</source> <translation>-maxmempool must be at least %d MB</translation> </message> <message> <source>&lt;category&gt; can be:</source> <translation>&lt;category&gt; can be:</translation> </message> <message> <source>Block creation options:</source> <translation>Block creation options:</translation> </message> <message> <source>Connect only to the specified node(s)</source> <translation>Connect only to the specified node(s)</translation> </message> <message> <source>Connection options:</source> <translation>Connection options:</translation> </message> <message> <source>Corrupted block database detected</source> <translation>Corrupted block database detected</translation> </message> <message> <source>Debugging/Testing options:</source> <translation>Debugging/Testing options:</translation> </message> <message> <source>Do not load the wallet and disable wallet RPC calls</source> <translation>Do not load the wallet and disable wallet RPC calls</translation> </message> <message> <source>Do you want to rebuild the block database now?</source> <translation>Do you want to rebuild the block database now?</translation> </message> <message> <source>Enable publish hash block in &lt;address&gt;</source> <translation>Enable publish hash block in &lt;address&gt;</translation> </message> <message> <source>Enable publish hash transaction in &lt;address&gt;</source> <translation>Enable publish hash transaction in &lt;address&gt;</translation> </message> <message> <source>Enable publish raw block in &lt;address&gt;</source> <translation>Enable publish raw block in &lt;address&gt;</translation> </message> <message> <source>Enable publish raw transaction in &lt;address&gt;</source> <translation>Enable publish raw transaction in &lt;address&gt;</translation> </message> <message> <source>Error initializing block database</source> <translation>Error initialising block database</translation> </message> <message> <source>Error initializing wallet database environment %s!</source> <translation>Error initialising wallet database environment %s!</translation> </message> <message> <source>Error loading block database</source> <translation>Error loading block database</translation> </message> <message> <source>Error opening block database</source> <translation>Error opening block database</translation> </message> <message> <source>Error: Disk space is low!</source> <translation>Error: Disk space is low!</translation> </message> <message> <source>Failed to listen on any port. Use -listen=0 if you want this.</source> <translation>Failed to listen on any port. Use -listen=0 if you want this.</translation> </message> <message> <source>Importing...</source> <translation>Importing...</translation> </message> <message> <source>Incorrect or no genesis block found. Wrong datadir for network?</source> <translation>Incorrect or no genesis block found. Wrong datadir for network?</translation> </message> <message> <source>Invalid -onion address: '%s'</source> <translation>Invalid -onion address: '%s'</translation> </message> <message> <source>Keep the transaction memory pool below &lt;n&gt; megabytes (default: %u)</source> <translation>Keep the transaction memory pool below &lt;n&gt; megabytes (default: %u)</translation> </message> <message> <source>Not enough file descriptors available.</source> <translation>Not enough file descriptors available.</translation> </message> <message> <source>Only connect to nodes in network &lt;net&gt; (ipv4, ipv6 or onion)</source> <translation>Only connect to nodes in network &lt;net&gt; (ipv4, ipv6 or onion)</translation> </message> <message> <source>Prune cannot be configured with a negative value.</source> <translation>Prune cannot be configured with a negative value.</translation> </message> <message> <source>Prune mode is incompatible with -txindex.</source> <translation>Prune mode is incompatible with -txindex.</translation> </message> <message> <source>Set database cache size in megabytes (%d to %d, default: %d)</source> <translation>Set database cache size in megabytes (%d to %d, default: %d)</translation> </message> <message> <source>Set maximum block size in bytes (default: %d)</source> <translation>Set maximum block size in bytes (default: %d)</translation> </message> <message> <source>Specify wallet file (within data directory)</source> <translation>Specify wallet file (within data directory)</translation> </message> <message> <source>Unsupported argument -benchmark ignored, use -debug=bench.</source> <translation>Unsupported argument -benchmark ignored, use -debug=bench.</translation> </message> <message> <source>Unsupported argument -debugnet ignored, use -debug=net.</source> <translation>Unsupported argument -debugnet ignored, use -debug=net.</translation> </message> <message> <source>Unsupported argument -tor found, use -onion.</source> <translation>Unsupported argument -tor found, use -onion.</translation> </message> <message> <source>Use UPnP to map the listening port (default: %u)</source> <translation>Use UPnP to map the listening port (default: %u)</translation> </message> <message> <source>User Agent comment (%s) contains unsafe characters.</source> <translation>User Agent comment (%s) contains unsafe characters.</translation> </message> <message> <source>Verifying blocks...</source> <translation>Verifying blocks...</translation> </message> <message> <source>Verifying wallet...</source> <translation>Verifying wallet...</translation> </message> <message> <source>Wallet %s resides outside data directory %s</source> <translation>Wallet %s resides outside data directory %s</translation> </message> <message> <source>Wallet options:</source> <translation>Wallet options:</translation> </message> <message> <source>Warning: This version is obsolete; upgrade required!</source> <translation>Warning: This version is obsolete; upgrade required!</translation> </message> <message> <source>You need to rebuild the database using -reindex to change -txindex</source> <translation>You need to rebuild the database using -reindex to change -txindex</translation> </message> <message> <source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source> <translation>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</translation> </message> <message> <source>Bind to given address and whitelist peers connecting to it. Use [host]:port notation for IPv6</source> <translation>Bind to given address and whitelist peers connecting to it. Use [host]:port notation for IPv6</translation> </message> <message> <source>Bind to given address to listen for JSON-RPC connections. Use [host]:port notation for IPv6. This option can be specified multiple times (default: bind to all interfaces)</source> <translation>Bind to given address to listen for JSON-RPC connections. Use [host]:port notation for IPv6. This option can be specified multiple times (default: bind to all interfaces)</translation> </message> <message> <source>Cannot obtain a lock on data directory %s. VCoin Core is probably already running.</source> <translation>Cannot obtain a lock on data directory %s. VCoin Core is probably already running.</translation> </message> <message> <source>Create new files with system default permissions, instead of umask 077 (only effective with disabled wallet functionality)</source> <translation>Create new files with system default permissions, instead of umask 077 (only effective with disabled wallet functionality)</translation> </message> <message> <source>Discover own IP addresses (default: 1 when listening and no -externalip or -proxy)</source> <translation>Discover own IP addresses (default: 1 when listening and no -externalip or -proxy)</translation> </message> <message> <source>Error: Listening for incoming connections failed (listen returned error %s)</source> <translation>Error: Listening for incoming connections failed (listen returned error %s)</translation> </message> <message> <source>Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)</source> <translation>Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)</translation> </message> <message> <source>Fees (in %s/kB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)</source> <translation>Fees (in %s/kB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)</translation> </message> <message> <source>If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)</source> <translation>If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)</translation> </message> <message> <source>Invalid amount for -maxtxfee=&lt;amount&gt;: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)</source> <translation>Invalid amount for -maxtxfee=&lt;amount&gt;: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)</translation> </message> <message> <source>Maximum size of data in data carrier transactions we relay and mine (default: %u)</source> <translation>Maximum size of data in data carrier transactions we relay and mine (default: %u)</translation> </message> <message> <source>Query for peer addresses via DNS lookup, if low on addresses (default: 1 unless -connect)</source> <translation>Query for peer addresses via DNS lookup, if low on addresses (default: 1 unless -connect)</translation> </message> <message> <source>Randomize credentials for every proxy connection. This enables Tor stream isolation (default: %u)</source> <translation>Randomise credentials for every proxy connection. This enables Tor stream isolation (default: %u)</translation> </message> <message> <source>Set maximum size of high-priority/low-fee transactions in bytes (default: %d)</source> <translation>Set maximum size of high-priority/low-fee transactions in bytes (default: %d)</translation> </message> <message> <source>Set the number of threads for coin generation if enabled (-1 = all cores, default: %d)</source> <translation>Set the number of threads for coin generation if enabled (-1 = all cores, default: %d)</translation> </message> <message> <source>The transaction amount is too small to send after the fee has been deducted</source> <translation>The transaction amount is too small to send after the fee has been deducted</translation> </message> <message> <source>This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit &lt;https://www.openssl.org/&gt; and cryptographic software written by Eric Young and UPnP software written by Thomas Bernard.</source> <translation>This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit &lt;https://www.openssl.org/&gt; and cryptographic software written by Eric Young and UPnP software written by Thomas Bernard.</translation> </message> <message> <source>Whitelisted peers cannot be DoS banned and their transactions are always relayed, even if they are already in the mempool, useful e.g. for a gateway</source> <translation>Whitelisted peers cannot be DoS banned and their transactions are always relayed, even if they are already in the mempool, useful e.g. for a gateway</translation> </message> <message> <source>You need to rebuild the database using -reindex to go back to unpruned mode. This will redownload the entire blockchain</source> <translation>You need to rebuild the database using -reindex to go back to unpruned mode. This will redownload the entire blockchain</translation> </message> <message> <source>(default: %u)</source> <translation>(default: %u)</translation> </message> <message> <source>Accept public REST requests (default: %u)</source> <translation>Accept public REST requests (default: %u)</translation> </message> <message> <source>Activating best chain...</source> <translation>Activating best chain...</translation> </message> <message> <source>Always relay transactions received from whitelisted peers (default: %d)</source> <translation>Always relay transactions received from whitelisted peers (default: %d)</translation> </message> <message> <source>Attempt to recover private keys from a corrupt wallet.dat on startup</source> <translation>Attempt to recover private keys from a corrupt wallet.dat on startup</translation> </message> <message> <source>Automatically create Tor hidden service (default: %d)</source> <translation>Automatically create Tor hidden service (default: %d)</translation> </message> <message> <source>Cannot resolve -whitebind address: '%s'</source> <translation>Cannot resolve -whitebind address: '%s'</translation> </message> <message> <source>Connect through SOCKS5 proxy</source> <translation>Connect through SOCKS5 proxy</translation> </message> <message> <source>Copyright (C) 2009-%i The VCoin Core Developers</source> <translation>Copyright (C) 2009-%i The VCoin Core Developers</translation> </message> <message> <source>Error loading wallet.dat: Wallet requires newer version of VCoin Core</source> <translation>Error loading wallet.dat: Wallet requires newer version of VCoin Core</translation> </message> <message> <source>Error reading from database, shutting down.</source> <translation>Error reading from database, shutting down.</translation> </message> <message> <source>Imports blocks from external blk000??.dat file on startup</source> <translation>Imports blocks from external blk000??.dat file on startup</translation> </message> <message> <source>Information</source> <translation>Information</translation> </message> <message> <source>Initialization sanity check failed. VCoin Core is shutting down.</source> <translation>Initialisation sanity check failed. VCoin Core is shutting down.</translation> </message> <message> <source>Invalid amount for -maxtxfee=&lt;amount&gt;: '%s'</source> <translation>Invalid amount for -maxtxfee=&lt;amount&gt;: '%s'</translation> </message> <message> <source>Invalid amount for -minrelaytxfee=&lt;amount&gt;: '%s'</source> <translation>Invalid amount for -minrelaytxfee=&lt;amount&gt;: '%s'</translation> </message> <message> <source>Invalid amount for -mintxfee=&lt;amount&gt;: '%s'</source> <translation>Invalid amount for -mintxfee=&lt;amount&gt;: '%s'</translation> </message> <message> <source>Invalid amount for -paytxfee=&lt;amount&gt;: '%s' (must be at least %s)</source> <translation>Invalid amount for -paytxfee=&lt;amount&gt;: '%s' (must be at least %s)</translation> </message> <message> <source>Invalid netmask specified in -whitelist: '%s'</source> <translation>Invalid netmask specified in -whitelist: '%s'</translation> </message> <message> <source>Keep at most &lt;n&gt; unconnectable transactions in memory (default: %u)</source> <translation>Keep at most &lt;n&gt; unconnectable transactions in memory (default: %u)</translation> </message> <message> <source>Need to specify a port with -whitebind: '%s'</source> <translation>Need to specify a port with -whitebind: '%s'</translation> </message> <message> <source>Node relay options:</source> <translation>Node relay options:</translation> </message> <message> <source>RPC server options:</source> <translation>RPC server options:</translation> </message> <message> <source>Rebuild block chain index from current blk000??.dat files on startup</source> <translation>Rebuild block chain index from current blk000??.dat files on startup</translation> </message> <message> <source>Receive and display P2P network alerts (default: %u)</source> <translation>Receive and display P2P network alerts (default: %u)</translation> </message> <message> <source>Reducing -maxconnections from %d to %d, because of system limitations.</source> <translation>Reducing -maxconnections from %d to %d, because of system limitations.</translation> </message> <message> <source>Rescan the block chain for missing wallet transactions on startup</source> <translation>Rescan the block chain for missing wallet transactions on startup</translation> </message> <message> <source>Send trace/debug info to console instead of debug.log file</source> <translation>Send trace/debug info to console instead of debug.log file</translation> </message> <message> <source>Send transactions as zero-fee transactions if possible (default: %u)</source> <translation>Send transactions as zero-fee transactions if possible (default: %u)</translation> </message> <message> <source>Show all debugging options (usage: --help -help-debug)</source> <translation>Show all debugging options (usage: --help -help-debug)</translation> </message> <message> <source>Shrink debug.log file on client startup (default: 1 when no -debug)</source> <translation>Shrink debug.log file on client startup (default: 1 when no -debug)</translation> </message> <message> <source>Signing transaction failed</source> <translation>Signing transaction failed</translation> </message> <message> <source>The transaction amount is too small to pay the fee</source> <translation>The transaction amount is too small to pay the fee</translation> </message> <message> <source>This is experimental software.</source> <translation>This is experimental software.</translation> </message> <message> <source>Tor control port password (default: empty)</source> <translation>Tor control port password (default: empty)</translation> </message> <message> <source>Tor control port to use if onion listening enabled (default: %s)</source> <translation>Tor control port to use if onion listening enabled (default: %s)</translation> </message> <message> <source>Transaction amount too small</source> <translation>Transaction amount too small</translation> </message> <message> <source>Transaction amounts must be positive</source> <translation>Transaction amounts must be positive</translation> </message> <message> <source>Transaction too large for fee policy</source> <translation>Transaction too large for fee policy</translation> </message> <message> <source>Transaction too large</source> <translation>Transaction too large</translation> </message> <message> <source>Unable to bind to %s on this computer (bind returned error %s)</source> <translation>Unable to bind to %s on this computer (bind returned error %s)</translation> </message> <message> <source>Upgrade wallet to latest format on startup</source> <translation>Upgrade wallet to latest format on startup</translation> </message> <message> <source>Username for JSON-RPC connections</source> <translation>Username for JSON-RPC connections</translation> </message> <message> <source>Wallet needed to be rewritten: restart VCoin Core to complete</source> <translation>Wallet needed to be rewritten: restart VCoin Core to complete</translation> </message> <message> <source>Warning</source> <translation>Warning</translation> </message> <message> <source>Whether to operate in a blocks only mode (default: %u)</source> <translation>Whether to operate in a blocks only mode (default: %u)</translation> </message> <message> <source>Zapping all transactions from wallet...</source> <translation>Zapping all transactions from wallet...</translation> </message> <message> <source>ZeroMQ notification options:</source> <translation>ZeroMQ notification options:</translation> </message> <message> <source>wallet.dat corrupt, salvage failed</source> <translation>wallet.dat corrupt, salvage failed</translation> </message> <message> <source>Password for JSON-RPC connections</source> <translation>Password for JSON-RPC connections</translation> </message> <message> <source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source> <translation>Execute command when the best block changes (%s in cmd is replaced by block hash)</translation> </message> <message> <source>This help message</source> <translation>This help message</translation> </message> <message> <source>Allow DNS lookups for -addnode, -seednode and -connect</source> <translation>Allow DNS lookups for -addnode, -seednode and -connect</translation> </message> <message> <source>Loading addresses...</source> <translation>Loading addresses...</translation> </message> <message> <source>Error loading wallet.dat: Wallet corrupted</source> <translation>Error loading wallet.dat: Wallet corrupted</translation> </message> <message> <source>(1 = keep tx meta data e.g. account owner and payment request information, 2 = drop tx meta data)</source> <translation>(1 = keep tx meta data e.g. account owner and payment request information, 2 = drop tx meta data)</translation> </message> <message> <source>-maxtxfee is set very high! Fees this large could be paid on a single transaction.</source> <translation>-maxtxfee is set very high! Fees this large could be paid on a single transaction.</translation> </message> <message> <source>-paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source> <translation>-paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</translation> </message> <message> <source>Do not keep transactions in the mempool longer than &lt;n&gt; hours (default: %u)</source> <translation>Do not keep transactions in the mempool longer than &lt;n&gt; hours (default: %u)</translation> </message> <message> <source>Error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source> <translation>Error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</translation> </message> <message> <source>Fees (in %s/kB) smaller than this are considered zero fee for transaction creation (default: %s)</source> <translation>Fees (in %s/kB) smaller than this are considered zero fee for transaction creation (default: %s)</translation> </message> <message> <source>How thorough the block verification of -checkblocks is (0-4, default: %u)</source> <translation>How thorough the block verification of -checkblocks is (0-4, default: %u)</translation> </message> <message> <source>Maintain a full transaction index, used by the getrawtransaction rpc call (default: %u)</source> <translation>Maintain a full transaction index, used by the getrawtransaction rpc call (default: %u)</translation> </message> <message> <source>Number of seconds to keep misbehaving peers from reconnecting (default: %u)</source> <translation>Number of seconds to keep misbehaving peers from reconnecting (default: %u)</translation> </message> <message> <source>Output debugging information (default: %u, supplying &lt;category&gt; is optional)</source> <translation>Output debugging information (default: %u, supplying &lt;category&gt; is optional)</translation> </message> <message> <source>Support filtering of blocks and transaction with bloom filters (default: %u)</source> <translation>Support filtering of blocks and transaction with bloom filters (default: %u)</translation> </message> <message> <source>Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of uacomments.</source> <translation>Total length of network version string (%i) exceeds maximum length (%i). Reduce the number or size of uacomments.</translation> </message> <message> <source>Tries to keep outbound traffic under the given target (in MiB per 24h), 0 = no limit (default: %d)</source> <translation>Tries to keep outbound traffic under the given target (in MiB per 24h), 0 = no limit (default: %d)</translation> </message> <message> <source>Unsupported argument -socks found. Setting SOCKS version isn't possible anymore, only SOCKS5 proxies are supported.</source> <translation>Unsupported argument -socks found. Setting SOCKS version isn't possible anymore, only SOCKS5 proxies are supported.</translation> </message> <message> <source>Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: %s)</source> <translation>Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: %s)</translation> </message> <message> <source>Username and hashed password for JSON-RPC connections. The field &lt;userpw&gt; comes in the format: &lt;USERNAME&gt;:&lt;SALT&gt;$&lt;HASH&gt;. A canonical python script is included in share/rpcuser. This option can be specified multiple times</source> <translation>Username and hashed password for JSON-RPC connections. The field &lt;userpw&gt; comes in the format: &lt;USERNAME&gt;:&lt;SALT&gt;$&lt;HASH&gt;. A canonical python script is included in share/rpcuser. This option can be specified multiple times</translation> </message> <message> <source>(default: %s)</source> <translation>(default: %s)</translation> </message> <message> <source>Always query for peer addresses via DNS lookup (default: %u)</source> <translation>Always query for peer addresses via DNS lookup (default: %u)</translation> </message> <message> <source>Error loading wallet.dat</source> <translation>Error loading wallet.dat</translation> </message> <message> <source>Generate coins (default: %u)</source> <translation>Generate coins (default: %u)</translation> </message> <message> <source>How many blocks to check at startup (default: %u, 0 = all)</source> <translation>How many blocks to check at startup (default: %u, 0 = all)</translation> </message> <message> <source>Include IP addresses in debug output (default: %u)</source> <translation>Include IP addresses in debug output (default: %u)</translation> </message> <message> <source>Invalid -proxy address: '%s'</source> <translation>Invalid -proxy address: '%s'</translation> </message> <message> <source>Listen for JSON-RPC connections on &lt;port&gt; (default: %u or testnet: %u)</source> <translation>Listen for JSON-RPC connections on &lt;port&gt; (default: %u or testnet: %u)</translation> </message> <message> <source>Listen for connections on &lt;port&gt; (default: %u or testnet: %u)</source> <translation>Listen for connections on &lt;port&gt; (default: %u or testnet: %u)</translation> </message> <message> <source>Maintain at most &lt;n&gt; connections to peers (default: %u)</source> <translation>Maintain at most &lt;n&gt; connections to peers (default: %u)</translation> </message> <message> <source>Make the wallet broadcast transactions</source> <translation>Make the wallet broadcast transactions</translation> </message> <message> <source>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: %u)</source> <translation>Maximum per-connection receive buffer, &lt;n&gt;*1000 bytes (default: %u)</translation> </message> <message> <source>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: %u)</source> <translation>Maximum per-connection send buffer, &lt;n&gt;*1000 bytes (default: %u)</translation> </message> <message> <source>Prepend debug output with timestamp (default: %u)</source> <translation>Prepend debug output with timestamp (default: %u)</translation> </message> <message> <source>Relay and mine data carrier transactions (default: %u)</source> <translation>Relay and mine data carrier transactions (default: %u)</translation> </message> <message> <source>Relay non-P2SH multisig (default: %u)</source> <translation>Relay non-P2SH multisig (default: %u)</translation> </message> <message> <source>Set key pool size to &lt;n&gt; (default: %u)</source> <translation>Set key pool size to &lt;n&gt; (default: %u)</translation> </message> <message> <source>Set minimum block size in bytes (default: %u)</source> <translation>Set minimum block size in bytes (default: %u)</translation> </message> <message> <source>Set the number of threads to service RPC calls (default: %d)</source> <translation>Set the number of threads to service RPC calls (default: %d)</translation> </message> <message> <source>Specify configuration file (default: %s)</source> <translation>Specify configuration file (default: %s)</translation> </message> <message> <source>Specify connection timeout in milliseconds (minimum: 1, default: %d)</source> <translation>Specify connection timeout in milliseconds (minimum: 1, default: %d)</translation> </message> <message> <source>Specify pid file (default: %s)</source> <translation>Specify pid file (default: %s)</translation> </message> <message> <source>Spend unconfirmed change when sending transactions (default: %u)</source> <translation>Spend unconfirmed change when sending transactions (default: %u)</translation> </message> <message> <source>Threshold for disconnecting misbehaving peers (default: %u)</source> <translation>Threshold for disconnecting misbehaving peers (default: %u)</translation> </message> <message> <source>Unknown network specified in -onlynet: '%s'</source> <translation>Unknown network specified in -onlynet: '%s'</translation> </message> <message> <source>Cannot resolve -bind address: '%s'</source> <translation>Cannot resolve -bind address: '%s'</translation> </message> <message> <source>Cannot resolve -externalip address: '%s'</source> <translation>Cannot resolve -externalip address: '%s'</translation> </message> <message> <source>Invalid amount for -paytxfee=&lt;amount&gt;: '%s'</source> <translation>Invalid amount for -paytxfee=&lt;amount&gt;: '%s'</translation> </message> <message> <source>Insufficient funds</source> <translation>Insufficient funds</translation> </message> <message> <source>Loading block index...</source> <translation>Loading block index...</translation> </message> <message> <source>Add a node to connect to and attempt to keep the connection open</source> <translation>Add a node to connect to and attempt to keep the connection open</translation> </message> <message> <source>Loading wallet...</source> <translation>Loading wallet...</translation> </message> <message> <source>Cannot downgrade wallet</source> <translation>Cannot downgrade wallet</translation> </message> <message> <source>Cannot write default address</source> <translation>Cannot write default address</translation> </message> <message> <source>Rescanning...</source> <translation>Rescanning...</translation> </message> <message> <source>Done loading</source> <translation>Done loading</translation> </message> <message> <source>Error</source> <translation>Error</translation> </message> </context> </TS>
{ "content_hash": "00c0f3ef52df3fcd60ac9ee6695b5a88", "timestamp": "", "source": "github", "line_count": 3719, "max_line_length": 436, "avg_line_length": 40.553643452541, "alnum_prop": 0.6568933622421578, "repo_name": "vcoin-project/v", "id": "4f5b5446e68221f686285e2c4e6d34870e9b6e11", "size": "150819", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/qt/locale/vcoin_en_GB.ts", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "708021" }, { "name": "C++", "bytes": "4107591" }, { "name": "CSS", "bytes": "1127" }, { "name": "Groff", "bytes": "543539" }, { "name": "HTML", "bytes": "50621" }, { "name": "M4", "bytes": "146937" }, { "name": "Makefile", "bytes": "1093629" }, { "name": "NSIS", "bytes": "6503" }, { "name": "Objective-C", "bytes": "2156" }, { "name": "Objective-C++", "bytes": "7232" }, { "name": "Protocol Buffer", "bytes": "2300" }, { "name": "Python", "bytes": "613863" }, { "name": "Shell", "bytes": "1762241" } ], "symlink_target": "" }
package de.motivational.stairs.database.service; import de.motivational.stairs.database.entity.OffsetEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; /** * Created by Florian on 29.08.2016. */ @Repository interface OffsetRepository extends JpaRepository<OffsetEntity, Integer> { }
{ "content_hash": "ec095f4049485e694b7d2e4dbb2da046", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 73, "avg_line_length": 27.46153846153846, "alnum_prop": 0.8179271708683473, "repo_name": "FlorianDe/MotivationalStairs", "id": "9b734dffac59ef8bcf9888a826299d41d56bd345", "size": "357", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/de/motivational/stairs/database/service/OffsetRepository.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "404" }, { "name": "GLSL", "bytes": "532" }, { "name": "HTML", "bytes": "1292" }, { "name": "Java", "bytes": "245876" }, { "name": "JavaScript", "bytes": "47008" } ], "symlink_target": "" }
import React from "react" let CoderEstimateCompleted = React.createClass({ propTypes: { coder: React.PropTypes.string, points: React.PropTypes.number, onClick: React.PropTypes.func }, render() { return( <div className="estimate"> <div className="estimate-card estimate-completed" onClick={this.handleClick}> <div className="coder">{this.props.coder}</div> <div className="estimate-value blue-grey-text"> {this.props.points} </div> </div> </div> ) }, handleClick() { this.props.onClick(this.props.coder, 0) } }) module.exports = CoderEstimateCompleted
{ "content_hash": "5f600efbfe0c669fa0c8e6843f3c1cc2", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 85, "avg_line_length": 23.03448275862069, "alnum_prop": 0.6182634730538922, "repo_name": "digitalronin/ticket-poker", "id": "7bd6d2118d14f0f0e14b34acab963a752ef253cd", "size": "668", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "web/static/js/components/coder_estimate_completed.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "141476" }, { "name": "Elixir", "bytes": "45671" }, { "name": "HTML", "bytes": "16619" }, { "name": "JavaScript", "bytes": "9461" }, { "name": "Makefile", "bytes": "249" }, { "name": "Ruby", "bytes": "4495" }, { "name": "Shell", "bytes": "461" } ], "symlink_target": "" }
{% extends 'store_admin/inventory/base_auctions.html' %} {% load i18n %} {% load sell_tags %} {% block title_sub_menu %} {% trans "Auction Details" %}: {{ auction.title|title }} {% endblock %} {% block main %} <h3>{{ auction.title|title }}</h3> <p>{% trans "Status" %}: {{ auction.status }}</p> <p>{% trans "Start" %}: {{ auction.start|date:"d F Y H:i" }}</p> <p>{% trans "End" %}: {{ auction.end|date:"d F Y H:i" }}</p> <p>{% trans "Description" %}: {{ auction.description|safe }}</p> <br/> {% if auction.lot_set.all %} <div class="bar_title"> <div class="grid_2 alpha omega bar_column"><span>{% trans "Lot #" %}</span></div> <div class="grid_5 alpha omega bar_column"><span>{% trans "Title" %}</span></div> <div class="grid_3 alpha omega bar_column"><span>{% trans "Status" %}</span></div> <div class="grid_2 alpha omega bar_column"><span>{% trans "Price" %}</span></div> <div class="clear"></div> </div> {% endif %} {% for lot in auction.lot_set.all %} <div class="{% cycle 'row_1' 'row_2' %} row_small"> <div class="grid_2 alpha omega column"><a rel="{{ lot.image.url_100x100 }}" href="{% url lot_details lot.id %}" class="aa" title="{{ lot.title }}"># {{ lot.id }}</a></div> <div class="grid_5 alpha omega column"><span>{{ lot.title }}</span></div> <div class="grid_3 alpha omega column"><span>{{ lot.get_state_display }}</span></div> <div class="grid_2 alpha omega column"><span>{{ lot.current_bid|money_format:shop }}</span></div> <div class="clear"></div> </div> {% empty %} <h4>{% trans "No lots in this session" %}</h4> {% endfor %} <script type="text/javascript"> $(".list a").imgPreview({ containerID: 'imgPreviewWithStyles', /* Change srcAttr to rel: */ srcAttr: 'rel', imgCSS: { // Limit preview size: height: 100 }, // When container hides: onHide: function(link){ $('span', this).remove(); } }); </script> {% endblock %} {% block menu %} {% include 'auctions/auctions_menu.html' %} {% endblock %}
{ "content_hash": "25ffe220fd71dfd866f3fef58967a085", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 174, "avg_line_length": 32.904761904761905, "alnum_prop": 0.5692233478051134, "repo_name": "StephenPower/CollectorCity-Market-Place", "id": "3a983df9bf9ddf6441cb8a1405cccedaa86a9827", "size": "2073", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "stores/templates/auctions/auction_details.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "JavaScript", "bytes": "796501" }, { "name": "Python", "bytes": "1860719" }, { "name": "Shell", "bytes": "1174" } ], "symlink_target": "" }
// Compress list of all Unicode letters to less than 2kB // Credit goes to gagern, https://gist.github.com/gagern/89db1179766a702c564d var lo = require('lodash'); //var categories = [ //"Cased_Letter","Close_Punctuation","Connector_Punctuation","Control", //"Currency_Symbol","Dash_Punctuation","Decimal_Number","Enclosing_Mark", //"Final_Punctuation","Format","Initial_Punctuation","Letter","Letter_Number", //"Line_Separator","Lowercase_Letter","Mark","Math_Symbol","Modifier_Letter", //"Modifier_Symbol","Nonspacing_Mark","Number","Open_Punctuation","Other", //"Other_Letter","Other_Number","Other_Punctuation","Other_Symbol", //"Paragraph_Separator","Private_Use","Punctuation","Separator", //"Space_Separator","Spacing_Mark","Surrogate","Symbol","Titlecase_Letter", //"Unassigned","Uppercase_Letter" //]; var categories = [ "Other","Private_Use","Unassigned","Control","Format","Surrogate", "Letter","Uppercase_Letter","Lowercase_Letter","Titlecase_Letter","Modifier_Letter","Other_Letter","Cased_Letter", "Mark","Nonspacing_Mark","Enclosing_Mark","Spacing_Mark", "Number","Decimal_Number","Letter_Number","Other_Number", "Separator","Space_Separator","Line_Separator","Paragraph_Separator", "Punctuation","Dash_Punctuation","Open_Punctuation","Initial_Punctuation","Close_Punctuation","Final_Punctuation","Connector_Punctuation","Other_Punctuation", "Symbol","Math_Symbol","Currency_Symbol","Modifier_Symbol","Other_Symbol", ]; var abbr = [ "C","Co","Cn","Cc","Cf","Cs", "L","Lu","Ll","Lt","Lm","Lo","Lc", "M","Mn","Me","Mc", "N","Nd","Nl","No", "Z","Zs","Zl","Zp", "P","Pd","Ps","Pi","Pe","Pf","Pc","Po", "S","Sm","Sc","Sk","So" ]; var cats = function() { var ct = "C"; var aidx = 0; for (ct of categories) { var cps = require("@unicode/unicode-13.0.0/General_Category/"+ ct + "/code-points"); var dict, str; var dictSrc, strSrc; function compress() { var cps1 = cps.slice(); var i = 0; var deltas = []; while (cps1.length) { var j = cps1.shift(); if(j > 65535) { deltas.push(65535 - i); break; } deltas.push(j - i); i = j; while (cps1[0] === j + 1) j = cps1.shift(); if(j > 65535) { deltas.push(65535 - i); break; } deltas.push(j - i); i = j; } var hist = {}; for (i of deltas) { hist[i] = (hist[i] || 0) + 1; } dict = Object.keys(hist).map(Number); dict.sort((a, b) => hist[a] !== hist[b] ? hist[b] - hist[a] : a - b); dictSrc = JSON.stringify(dict).replace(/\]/, '},').replace(/\[/, '{'); var bytes = deltas.map(d => dict.indexOf(d) + 0x20); strSrc = bytes.map( b => b === 0x22 ? '\\"' : b === 0x5c ? '\\\\' : b < 0x7f ? String.fromCharCode(b) : "\\x" + b.toString(16) ).join(""); strSrc = '"' + strSrc + '"'; str = new Function('return ' + strSrc)(); } var decompress = function(d, s) { var i, j = 0, c = [], p = [], n = s.length; for (i = 0; i < n; ++i) c[i] = j = d[s.charCodeAt(i) - 32] + j; for (i = 0; i < n; i += 2) { for (j = c[i]; j <= c[i + 1]; ++j) p.push(j); } return p; } compress(); console.log("public static final Category " + abbr[aidx++] + "=new Category(new int[]" + dictSrc + strSrc + ");\n"); } } cats(); var cpses = [["IdentifierStart", require("@unicode/unicode-13.0.0/General_Category/Letter/code-points").concat( require("@unicode/unicode-13.0.0/General_Category/Letter_Number/code-points"), require("@unicode/unicode-13.0.0/General_Category/Connector_Punctuation/code-points"), require("@unicode/unicode-13.0.0/General_Category/Currency_Symbol/code-points") ).sort(function(a,b){return a - b;})], ["IdentifierPart", require("@unicode/unicode-13.0.0/General_Category/Letter/code-points").concat( require("@unicode/unicode-13.0.0/General_Category/Number/code-points"), require("@unicode/unicode-13.0.0/General_Category/Nonspacing_Mark/code-points"), require("@unicode/unicode-13.0.0/General_Category/Spacing_Mark/code-points"), require("@unicode/unicode-13.0.0/General_Category/Connector_Punctuation/code-points"), require("@unicode/unicode-13.0.0/General_Category/Currency_Symbol/code-points"), lo.range(0, 9),lo.range(0xE, 0x1C),lo.range(0x7F, 0xA0)).sort(function(a,b){return a - b;})]]; var word = function (cpsGroup){ /* var cps = require("@unicode/unicode-13.0.0/General_Category/Number/code-points").concat( require("@unicode/unicode-13.0.0/General_Category/Letter/code-points"), require("@unicode/unicode-13.0.0/General_Category/Nonspacing_Mark/code-points"), require("@unicode/unicode-13.0.0/General_Category/Spacing_Mark/code-points"), ["_".charCodeAt(0)]).sort(function(a,b){return a - b;}); */ //Identifier Start /* var cps = require("@unicode/unicode-13.0.0/General_Category/Letter/code-points").concat( require("@unicode/unicode-13.0.0/General_Category/Letter_Number/code-points"), require("@unicode/unicode-13.0.0/General_Category/Connector_Punctuation/code-points"), require("@unicode/unicode-13.0.0/General_Category/Currency_Symbol/code-points") ).sort(function(a,b){return a - b;}); */ //Identifier Part /* var cps = require("@unicode/unicode-13.0.0/General_Category/Letter/code-points").concat( require("@unicode/unicode-13.0.0/General_Category/Number/code-points"), require("@unicode/unicode-13.0.0/General_Category/Nonspacing_Mark/code-points"), require("@unicode/unicode-13.0.0/General_Category/Spacing_Mark/code-points"), require("@unicode/unicode-13.0.0/General_Category/Connector_Punctuation/code-points"), require("@unicode/unicode-13.0.0/General_Category/Currency_Symbol/code-points"), lo.range(0, 9),lo.range(0xE, 0x1C),lo.range(0x7F, 0xA0)).sort(function(a,b){return a - b;}); */ //Vertical Space //var cps = [10, 11, 12, 13, 133, 8232, 8233]; //var cps = require("@unicode/unicode-13.0.0/General_Category/Space_Separator/code-points").concat( //["\t".charCodeAt(0)]).sort(function(a,b){return a - b;}); //var cps = require("@unicode/unicode-13.0.0/General_Category/Space_Separator/code-points").concat( // ["\t".charCodeAt(0), 10, 11, 12, 13, 133, 8232, 8233]).sort(function(a,b){return a - b;}); var cps = cpsGroup[1]; var dict, str; var dictSrc, strSrc; function compress() { var cps1 = cps.slice(); var i = 0, pushed = 0; var deltas = []; while (cps1.length) { var j = cps1.shift(); if(j > 65535) { deltas.push(65535 - i); break; } //deltas.push(65535 - i); pushed = deltas.push(j - i); i = j; while (cps1[0] === j + 1) j = cps1.shift(); if(j > 65535) { deltas.push(65535 - i); break; } pushed = deltas.push(j - i); i = j; } var hist = {}; for (i of deltas) { hist[i] = (hist[i] || 0) + 1; } dict = Object.keys(hist).map(Number); dict.sort((a, b) => hist[a] !== hist[b] ? hist[b] - hist[a] : a - b); dictSrc = JSON.stringify(dict).replace(/\]/, '},').replace(/\[/, '{'); var bytes = deltas.map(d => dict.indexOf(d) + 0x20); strSrc = bytes.map( b => b === 0x22 ? '\\"' : b === 0x5c ? '\\\\' : b < 0x7f ? String.fromCharCode(b) : "\\" + lo.padStart(b.toString(8), 3, '0') ).join(""); strSrc = '"' + strSrc + '"'; str = new Function('return ' + strSrc)(); } var decompress = function(d, s) { var i, j = 0, c = [], p = [], n = s.length; for (i = 0; i < n; ++i) c[i] = j = d[s.charCodeAt(i) - 32] + j; for (i = 0; i < n; i += 2) { for (j = c[i]; j <= c[i + 1]; ++j) p.push(j); } return p; } compress(); var cps2 = decompress(dict, str); //console.log("public static final Category IdentifierStart=new Category(new int[]" + dictSrc + strSrc + ");\n"); console.log("public static final Category "+cpsGroup[0]+"=new Category(new int[]" + dictSrc + strSrc + ");\n"); //console.log("public static final Category Space=new Category(new int[]" + dictSrc + strSrc + ");\n"); //console.log("public static final Category Space=new Category(new int[]" + dictSrc + strSrc + ");\n"); } word(["Word", require("@unicode/unicode-13.0.0/General_Category/Number/code-points").concat( require("@unicode/unicode-13.0.0/General_Category/Letter/code-points"), require("@unicode/unicode-13.0.0/General_Category/Nonspacing_Mark/code-points"), require("@unicode/unicode-13.0.0/General_Category/Spacing_Mark/code-points"), ["_".charCodeAt(0)]).sort(function(a,b){return a - b;})]) for(cps of cpses) { word(cps); } var cases = function() { //console.log(cps); //console.log(typeof cps); var keySrc = JSON.stringify(lo.union(Array.from(require('@unicode/unicode-13.0.0/Case_Folding/C/symbols.js').keys()), Array.from(require('@unicode/unicode-13.0.0/Case_Folding/S/symbols.js').keys()))); //console.log(lo.keys(cps)); keySrc = keySrc.replace(/["]/g, "'").replace(/\]/, '},').replace(/\[/, '{'); var valSrc = JSON.stringify(Array.from(require('@unicode/unicode-13.0.0/Case_Folding/C/symbols.js').values()).concat(Array.from(require('@unicode/unicode-13.0.0/Case_Folding/S/symbols.js').values()))); //console.log(valSrc.length); valSrc = valSrc.replace(/["]/g, "'").replace(/\]/, '}').replace(/\[/, '{'); console.log('static final CharCharMap cases = new CharCharMap(new int[]'+keySrc+'new int[]'+valSrc+');\n'); } cases(); var brackets = function() { var starts = require('@unicode/unicode-13.0.0/General_Category/Open_Punctuation/symbols'); var ends = require('@unicode/unicode-13.0.0/General_Category/Close_Punctuation/symbols'); var startStr = JSON.stringify(starts).replace(/["]/g, "'").replace(/[\r\n]+/g, ''); var endStr = JSON.stringify(ends).replace(/["]/g, "'").replace(/[\r\n]+/g, ''); console.log(startStr); console.log(endStr); } brackets();
{ "content_hash": "dadad2824ff255cfd6b5325af205bf91", "timestamp": "", "source": "github", "line_count": 231, "max_line_length": 205, "avg_line_length": 46.28138528138528, "alnum_prop": 0.568983256945094, "repo_name": "tommyettinger/RegExodus", "id": "955414f321c50e6c880270b4b6a2d5075a2275f9", "size": "10691", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "etc/generator.js", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Java", "bytes": "955073" }, { "name": "JavaScript", "bytes": "10691" } ], "symlink_target": "" }
<!-- *************************************************************************** * Copyright (c) 2013 IBM Corp. * * 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. **************************************************************************** --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.acmeair</groupId> <artifactId>acmeair</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging> <properties> <objectgrid.version>8.6.0.2</objectgrid.version> <spring.version>3.1.2.RELEASE</spring.version> <jmeter.version>2.7</jmeter.version> </properties> <modules> <module>acmeair-common</module> <module>acmeair-loader</module> <module>acmeair-services</module> <module>acmeair-services-wxs</module> <module>acmeair-webapp</module> <module>acmeair-driver</module> </modules> <dependencies> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.0.6</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.5.1</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build> <!--<distributionManagement> --> <!-- <snapshotRepository> --> <!-- <id>domU-12-31-39-0A-11-D1.compute-1.internal</id> --> <!-- <name>domU-12-31-39-0A-11-D1.compute-1.internal-snapshots</name> --> <!-- <uniqueVersion>false</uniqueVersion> --> <!-- <url>http://129.35.212.207:8081/artifactory/libs-snapshot-local</url>--> <!-- </snapshotRepository> --> <!--</distributionManagement> --> <distributionManagement> <snapshotRepository> <id>ArtifactoryLocalHost</id> <name>ArtifactoryLocalHost</name> <uniqueVersion>false</uniqueVersion> <url>http://129.35.212.207:8081/artifactory/libs-snapshot-local</url> </snapshotRepository> </distributionManagement> </project>
{ "content_hash": "c757bfbc8117ef27d73b03a212a03169", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 226, "avg_line_length": 42.58441558441559, "alnum_prop": 0.54193351631595, "repo_name": "wuhais/acmeair-netflixoss-weave", "id": "eb542d3cb8c40f1a823b3cd0e6ff61eb550bc3f1", "size": "3279", "binary": false, "copies": "1", "ref": "refs/heads/weave", "path": "workspace/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "3463" }, { "name": "Groovy", "bytes": "567" }, { "name": "HTML", "bytes": "42720" }, { "name": "Java", "bytes": "151836" }, { "name": "JavaScript", "bytes": "4596" }, { "name": "Ruby", "bytes": "182564" }, { "name": "Shell", "bytes": "30404" } ], "symlink_target": "" }
using System; namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Idempotency { public class ClientRequest { public Guid Id { get; set; } public string Name { get; set; } public DateTime Time { get; set; } } }
{ "content_hash": "50e115f84a234d08596424a94b5fa89e", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 82, "avg_line_length": 24.272727272727273, "alnum_prop": 0.6554307116104869, "repo_name": "fmustaf/Samples", "id": "7ca49fa41b8823ae7b74f7057146f2d8940b5855", "size": "269", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "eShopOnContainers-dev/src/Services/Ordering/Ordering.Infrastructure/Idempotency/ClientRequest.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "479" }, { "name": "Batchfile", "bytes": "1196" }, { "name": "C#", "bytes": "1429304" }, { "name": "CSS", "bytes": "74163" }, { "name": "HTML", "bytes": "26753" }, { "name": "JavaScript", "bytes": "553975" }, { "name": "PowerShell", "bytes": "205243" }, { "name": "Shell", "bytes": "3059" }, { "name": "TypeScript", "bytes": "66496" } ], "symlink_target": "" }
 using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization.Formatters.Binary; namespace PasswordFormat { [Serializable] public class SiteFormat { public Group Favorite { get; set; } public Group Default { get; set; } public List<Group> CustomGroups { get; set; } public SiteFormat() { Favorite = new Group("groupFavorite", true); Default = new Group("groupDefault", true); CustomGroups = new List<Group>(); } public static SiteFormat Open(string path) { SiteFormat Sites = new SiteFormat(); if (!File.Exists(path)) return Sites; using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read)) { BinaryFormatter bf = new BinaryFormatter(); Sites = bf.Deserialize(fs) as SiteFormat; } return Sites; } public void Save(string path) { try { if (File.Exists(path)) File.Delete(path); } catch { return; } using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write)) { BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(fs, this); } } } }
{ "content_hash": "d30205e9897dbfb259afcfd45888cf98", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 91, "avg_line_length": 29.58695652173913, "alnum_prop": 0.5540044085231447, "repo_name": "ogycode/JesusPassword", "id": "83f298a447914e7900f70a1e412415cc518a0e1a", "size": "2021", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Windows/Unsupported projects/PasswordFormat/SiteFormat.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "645803" } ], "symlink_target": "" }
@interface SoundPlayer () { } @property(nonatomic,strong) SoundEngine *soundEngine; @end @implementation SoundPlayer +(id)sharedSoundPlayer { static dispatch_once_t once; static id sharedInstance; dispatch_once(&once, ^{ sharedInstance = [[self alloc] init]; }); return sharedInstance; } #pragma mark Loading -(void)loadCategory:(NSString *)audioCategory mixWithOthers:(BOOL)mixWithOthers { // Initialize audio session AVAudioSession *audioSession = [AVAudioSession sharedInstance]; // Active your audio session [audioSession setActive: NO error: nil]; // Set audio session category [audioSession setCategory:audioCategory error:nil]; if(mixWithOthers) { // Modifying Playback Mixing Behavior, allow playing music in other apps OSStatus propertySetError = 0; UInt32 allowMixing = true; propertySetError = AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryMixWithOthers, sizeof (allowMixing), &allowMixing); } // Active your audio session [audioSession setActive: YES error: nil]; } -(void)loadSound:(NSString *)soundFile forID:(NSString *)soundID { [self.soundEngine preloadSound:soundFile withKey:soundID]; } -(id)init { self = [super init]; if(self != nil) { NSLog(@"Initializing sounds player..."); //Init sound engine _soundEngine = [[SoundEngine alloc] init]; } return self; } #pragma mark Playing -(void)stopSound:(NSString *)soundID { [self.soundEngine stopSound:soundID]; } -(void)playSound:(NSString *)soundID { if([[NSUserDefaults standardUserDefaults] boolForKey:kSound]) { [self.soundEngine playSound:soundID]; } } -(BOOL)isSoundPlaying:(NSString *)soundID { return [self.soundEngine isSoundPlaying:soundID]; } -(void)changeGainTo:(float)gain forSound:(NSString *)soundID { [self.soundEngine changeGainTo:gain ForSound:soundID]; } -(void)setLoop:(BOOL)loop forSound:(NSString *)soundID { [self.soundEngine loop:loop sound:soundID]; } -(void)changePitchTo:(float)pitch forSound:(NSString *)soundID { [self.soundEngine changePitchTo:pitch ForSound:soundID]; } @end
{ "content_hash": "e09c67a9eb004e7d16032b3b022d8e76", "timestamp": "", "source": "github", "line_count": 143, "max_line_length": 140, "avg_line_length": 15.951048951048952, "alnum_prop": 0.6742656729504604, "repo_name": "BobDG/BDGUtilities", "id": "3d229d1b26efeacc877bedb51005364c9ca35f55", "size": "2459", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "SoundPlayer/SoundPlayer.m", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "122771" }, { "name": "Ruby", "bytes": "655" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <section name="Workbench"> <item value="true" key="CommitDialog.showUntracked"/> <list key="RepositorySelectionPage.UsedUris"> <item value="https://github.com/josecgil/SoftwareCraftsmanship.git"/> </list> <list key="CommitDialog.authorValues"> <item value="José Carlos Gil Zambrana &lt;[email protected]&gt;"/> </list> <list key="CommitDialog.committerValues"> <item value="José Carlos Gil Zambrana &lt;[email protected]&gt;"/> </list> <section name="org.eclipse.egit.ui.internal.dialogs.ResetTargetSelectionDialog.dialogBounds"> <item value="525" key="DIALOG_WIDTH"/> <item value="1|Lucida Grande|11.0|0|COCOA|1|LucidaGrande" key="DIALOG_FONT_NAME"/> <item value="728" key="DIALOG_HEIGHT"/> <item value="578" key="DIALOG_X_ORIGIN"/> <item value="27" key="DIALOG_Y_ORIGIN"/> </section> <section name="org.eclipse.egit.ui.internal.push.PushResultDialog.dialogBounds"> <item value="650" key="DIALOG_WIDTH"/> <item value="1|Lucida Grande|11.0|0|COCOA|1|LucidaGrande" key="DIALOG_FONT_NAME"/> <item value="440" key="DIALOG_HEIGHT"/> <item value="150" key="DIALOG_X_ORIGIN"/> <item value="134" key="DIALOG_Y_ORIGIN"/> <list key="sashWeights"> <item value="600"/> <item value="400"/> </list> </section> <section name="org.eclipse.egit.ui.internal.pull.PullResultDialog.dialogBounds"> <item value="595" key="DIALOG_WIDTH"/> <item value="1|Lucida Grande|11.0|0|COCOA|1|LucidaGrande" key="DIALOG_FONT_NAME"/> <item value="389" key="DIALOG_HEIGHT"/> <item value="543" key="DIALOG_X_ORIGIN"/> <item value="253" key="DIALOG_Y_ORIGIN"/> </section> <section name="org.eclipse.egit.ui.COMMIT_DIALOG_SECTION"> <item value="626" key="DIALOG_WIDTH"/> <item value="1|Lucida Grande|11.0|0|COCOA|1|LucidaGrande" key="DIALOG_FONT_NAME"/> <item value="574" key="DIALOG_HEIGHT"/> <item value="174" key="DIALOG_X_ORIGIN"/> <item value="0" key="DIALOG_Y_ORIGIN"/> </section> <section name="GitCommitMessageComponent"> </section> </section>
{ "content_hash": "45f04a9d0ecda54f75e13226b55c2b47", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 94, "avg_line_length": 43.148936170212764, "alnum_prop": 0.6982248520710059, "repo_name": "josecgil/SoftwareCraftsmanship", "id": "34014426bb7d2c5af757091b7fa53723a464bc1a", "size": "2030", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": ".metadata/.plugins/org.eclipse.egit.ui/dialog_settings.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Cucumber", "bytes": "493" }, { "name": "Java", "bytes": "15107" }, { "name": "JavaScript", "bytes": "237778" } ], "symlink_target": "" }
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // 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. // ---------------------------------------------------------------------------------- using System; using System.IO; using System.Management.Automation; using System.Management.Automation.Host; using System.Threading; using Microsoft.Azure.Commands.ResourceManager.Common.Properties; using Microsoft.Azure.Common.Authentication; using Microsoft.Azure.Common.Authentication.Models; using Microsoft.Azure.Management.Internal.Resources; using Microsoft.WindowsAzure.Commands.Common; using Microsoft.WindowsAzure.Commands.Utilities.Common; using Newtonsoft.Json; namespace Microsoft.Azure.Commands.ResourceManager.Common { /// <summary> /// Represents base class for Resource Manager cmdlets /// </summary> public abstract class AzureRMCmdlet : AzurePSCmdlet { /// <summary> /// Static constructor for AzureRMCmdlet. /// </summary> static AzureRMCmdlet() { if (!TestMockSupport.RunningMocked) { AzureSession.DataStore = new DiskDataStore(); } } public AzureRMCmdlet() { AzureSession.ClientFactory.RemoveHandler(typeof(RPRegistrationDelegatingHandler)); AzureSession.ClientFactory.AddHandler(new RPRegistrationDelegatingHandler( () => AzureSession.ClientFactory.CreateClient<ResourceManagementClient>(DefaultContext, AzureEnvironment.Endpoint.ResourceManager), s => _debugMessages.Enqueue(s))); } /// <summary> /// Gets or sets the global profile for ARM cmdlets. /// </summary> public AzureRMProfile DefaultProfile { get { return AzureRmProfileProvider.Instance.Profile; } set { AzureRmProfileProvider.Instance.Profile = value; } } /// <summary> /// Gets the current default context. /// </summary> protected override AzureContext DefaultContext { get { if (DefaultProfile == null || DefaultProfile.Context == null) { throw new PSInvalidOperationException("Run Login-AzureRmAccount to login."); } return DefaultProfile.Context; } } protected override void SaveDataCollectionProfile() { if (_dataCollectionProfile == null) { InitializeDataCollectionProfile(); } string fileFullPath = Path.Combine(AzureSession.ProfileDirectory, AzurePSDataCollectionProfile.DefaultFileName); var contents = JsonConvert.SerializeObject(_dataCollectionProfile); if (!AzureSession.DataStore.DirectoryExists(AzureSession.ProfileDirectory)) { AzureSession.DataStore.CreateDirectory(AzureSession.ProfileDirectory); } AzureSession.DataStore.WriteFile(fileFullPath, contents); WriteWarning(string.Format(Resources.DataCollectionSaveFileInformation, fileFullPath)); } protected override void PromptForDataCollectionProfileIfNotExists() { // Initialize it from the environment variable or profile file. InitializeDataCollectionProfile(); if (!_dataCollectionProfile.EnableAzureDataCollection.HasValue && CheckIfInteractive()) { WriteWarning(Resources.DataCollectionPrompt); const double timeToWaitInSeconds = 60; var status = string.Format(Resources.DataCollectionConfirmTime, timeToWaitInSeconds); ProgressRecord record = new ProgressRecord(0, Resources.DataCollectionActivity, status); var startTime = DateTime.Now; var endTime = DateTime.Now; double elapsedSeconds = 0; while (!this.Host.UI.RawUI.KeyAvailable && elapsedSeconds < timeToWaitInSeconds) { Thread.Sleep(TimeSpan.FromMilliseconds(10)); endTime = DateTime.Now; elapsedSeconds = (endTime - startTime).TotalSeconds; record.PercentComplete = ((int)elapsedSeconds * 100 / (int)timeToWaitInSeconds); WriteProgress(record); } bool enabled = false; if (this.Host.UI.RawUI.KeyAvailable) { KeyInfo keyInfo = this.Host.UI.RawUI.ReadKey(ReadKeyOptions.NoEcho | ReadKeyOptions.AllowCtrlC | ReadKeyOptions.IncludeKeyDown); enabled = (keyInfo.Character == 'Y' || keyInfo.Character == 'y'); } _dataCollectionProfile.EnableAzureDataCollection = enabled; WriteWarning(enabled ? Resources.DataCollectionConfirmYes : Resources.DataCollectionConfirmNo); SaveDataCollectionProfile(); } } protected override void InitializeQosEvent() { //QosEvent = new AzurePSQoSEvent() //{ // CmdletType = this.GetType().Name, // IsSuccess = true, //}; //if (this.Context != null && this.Context.Subscription != null) //{ // QosEvent.Uid = MetricHelper.GenerateSha256HashString( // this.Context.Subscription.Id.ToString()); //} //else //{ // QosEvent.Uid = "defaultid"; //} } } }
{ "content_hash": "68c298157ae6d8bb763b9f0f781265fd", "timestamp": "", "source": "github", "line_count": 157, "max_line_length": 148, "avg_line_length": 39.43312101910828, "alnum_prop": 0.6002261347116783, "repo_name": "dominiqa/azure-powershell", "id": "534e719037ac42fdfe7cc9949fe3cb05f035e443", "size": "6193", "binary": false, "copies": "1", "ref": "refs/heads/dev", "path": "src/ResourceManager/Common/Commands.ResourceManager.Common/AzureRMCmdlet.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "15822" }, { "name": "C#", "bytes": "24416964" }, { "name": "HTML", "bytes": "209" }, { "name": "JavaScript", "bytes": "4979" }, { "name": "PHP", "bytes": "41" }, { "name": "PowerShell", "bytes": "2011078" }, { "name": "Shell", "bytes": "50" } ], "symlink_target": "" }
#include "tensorflow/core/grappler/optimizers/arithmetic_optimizer.h" #include "absl/strings/str_cat.h" #include "tensorflow/cc/ops/array_ops.h" #include "tensorflow/cc/ops/math_ops.h" #include "tensorflow/cc/ops/standard_ops.h" #include "tensorflow/core/framework/node_def.pb.h" #include "tensorflow/core/framework/tensor_testutil.h" #include "tensorflow/core/grappler/grappler_item.h" #include "tensorflow/core/grappler/inputs/trivial_test_graph_input_yielder.h" #include "tensorflow/core/grappler/optimizers/arithmetic_optimizer_test_utils.h" #include "tensorflow/core/grappler/optimizers/model_pruner.h" #include "tensorflow/core/grappler/utils.h" #include "tensorflow/core/lib/core/status_test_util.h" #include "tensorflow/core/platform/test.h" namespace tensorflow { namespace grappler { namespace { constexpr char kHoistFactorOptimizerDiv[] = "ArithmeticOptimizer/HoistCommonFactor_Div_"; constexpr char kHoistFactorOptimizerMul[] = "ArithmeticOptimizer/HoistCommonFactor_Mul_"; constexpr char kHoistFactorOptimizerAdd[] = "ArithmeticOptimizer/HoistCommonFactor_Add_"; constexpr char kSimplifyAggregationConst[] = "ArithmeticOptimizer/SimplifyAggregation_Const_"; constexpr char kSimplifyAggregationMul[] = "ArithmeticOptimizer/SimplifyAggregation_Mul_"; // Optimized name of outer Mul node by HoistCommonFactorOutOfAggregation. string HoistMulName(const string& name) { return AddPrefixToNodeName(name, kHoistFactorOptimizerMul, ""); } // Optimized name of outer Div node by HoistCommonFactorOutOfAggregation. string HoistDivName(const string& name) { return AddPrefixToNodeName(name, kHoistFactorOptimizerDiv, ""); } // Optimized name of inner Add node by HoistCommonFactorOutOfAggregation. string HoistAddName(const string& name) { return AddPrefixToNodeName(name, kHoistFactorOptimizerAdd, ""); } // Optimized name of Const node by SimplifyAggregation. string AggregationConstName(const string& name) { return AddPrefixToNodeName(name, kSimplifyAggregationConst, ""); } // Optimized name of Mul node by SimplifyAggregation. string AggregationMulName(const string& name) { return AddPrefixToNodeName(name, kSimplifyAggregationMul, ""); } void VerifyGraphsMatch(const GraphDef& original_graph, const GraphDef& optimized_graph, int line) { EXPECT_EQ(original_graph.node_size(), optimized_graph.node_size()) << line; for (int i = 0; i < original_graph.node_size(); ++i) { const NodeDef& original = original_graph.node(i); const NodeDef& optimized = optimized_graph.node(i); EXPECT_EQ(original.name(), optimized.name()) << line; EXPECT_EQ(original.op(), optimized.op()) << line; EXPECT_EQ(original.input_size(), optimized.input_size()) << line; for (int j = 0; j < original.input_size(); ++j) { EXPECT_EQ(original.input(j), optimized.input(j)) << line; } } } } // namespace TEST_F(ArithmeticOptimizerTest, NoOp) { // This trivial graph is so basic there's nothing to optimize. TrivialTestGraphInputYielder fake_input(4, 1, 10, false, {"CPU:0"}); GrapplerItem item; CHECK(fake_input.NextItem(&item)); ArithmeticOptimizer optimizer; GraphDef output; Status status = optimizer.Optimize(nullptr, item, &output); TF_EXPECT_OK(status); VerifyGraphsMatch(item.graph, output, __LINE__); } TEST_F(ArithmeticOptimizerTest, OpDedupping) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output c1 = ops::Const(s.WithOpName("c1"), {3.14, 2.7}, {1, 2}); Output c2 = ops::Const(s.WithOpName("c2"), {3.14, 2.7}, {1, 2}); Output div = ops::Div(s.WithOpName("div"), c1, c2); GrapplerItem item; TF_CHECK_OK(s.ToGraphDef(&item.graph)); item.fetch = {"div"}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); ArithmeticOptimizer optimizer; GraphDef output; OptimizeTwice(&optimizer, &item, &output); NodeMap node_map(&output); EXPECT_EQ(output.node_size(), 2); const NodeDef* new_c1 = node_map.GetNode("c1"); ASSERT_NE(new_c1, nullptr); const NodeDef* new_div = node_map.GetNode("div"); ASSERT_NE(new_div, nullptr); ASSERT_EQ(new_div->input_size(), 2); EXPECT_EQ(new_div->input(0), "c1"); EXPECT_EQ(new_div->input(1), "c1"); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<double>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, OpDeduppingAssertAndCheckNumerics) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output p = ops::Placeholder(s, DT_BOOL, ops::Placeholder::Shape({})); Output c = ops::Const(s.WithOpName("c"), {3.14, 2.7}, {1, 2}); auto check1 = ops::CheckNumerics(s.WithOpName("check1"), c, "foo"); auto check2 = ops::CheckNumerics(s.WithOpName("check2"), c, "foo"); auto assert1 = ops::Assert(s.WithOpName("assert1"), p, {c}); auto assert2 = ops::Assert(s.WithOpName("assert2"), p, {c}); Output div = ops::Div(s.WithOpName("div").WithControlDependencies( {assert1.operation, assert2.operation}), check1, check2); GrapplerItem item; TF_CHECK_OK(s.ToGraphDef(&item.graph)); item.fetch = {"div"}; Tensor bool_t(DT_BOOL, TensorShape({})); bool_t.scalar<bool>().setConstant(true); auto tensors_expected = EvaluateNodes(item.graph, item.fetch, {{"Placeholder", bool_t}}); ASSERT_EQ(tensors_expected.size(), 1); ArithmeticOptimizer optimizer; GraphDef output; OptimizeTwice(&optimizer, &item, &output); NodeMap node_map(&output); EXPECT_EQ(output.node_size(), 6); const NodeDef* new_div = node_map.GetNode("div"); ASSERT_NE(new_div, nullptr); ASSERT_EQ(new_div->input_size(), 3); EXPECT_EQ(new_div->input(0), "check1"); EXPECT_EQ(new_div->input(1), "check2"); EXPECT_EQ(new_div->input(2), "^assert1"); auto tensors = EvaluateNodes(output, item.fetch, {{"Placeholder", bool_t}}); EXPECT_EQ(tensors.size(), 1); test::ExpectTensorNear<double>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, OpDedupCommutative) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output c1 = ops::Const(s.WithOpName("c1"), {1.0f, 2.0f}, {1, 2}); Output c2 = ops::Const(s.WithOpName("c2"), {3.0f, 4.0f}, {1, 2}); Output mul1 = ops::Mul(s.WithOpName("mul1"), c1, c2); Output mul2 = ops::Mul(s.WithOpName("mul2"), c2, c1); Output div1 = ops::Div(s.WithOpName("div1"), mul1, mul2); GrapplerItem item; TF_CHECK_OK(s.ToGraphDef(&item.graph)); item.fetch = {"div1"}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); ArithmeticOptimizer optimizer; GraphDef output; OptimizeTwice(&optimizer, &item, &output); NodeMap node_map(&output); EXPECT_EQ(output.node_size(), 4); const NodeDef* new_c1 = node_map.GetNode("c1"); ASSERT_NE(new_c1, nullptr); const NodeDef* new_c2 = node_map.GetNode("c2"); ASSERT_NE(new_c2, nullptr); const NodeDef* new_mul1 = node_map.GetNode("mul1"); ASSERT_NE(new_mul1, nullptr); ASSERT_EQ(new_mul1->input_size(), 2); EXPECT_EQ(new_mul1->input(0), "c1"); EXPECT_EQ(new_mul1->input(1), "c2"); const NodeDef* new_div1 = node_map.GetNode("div1"); ASSERT_NE(new_div1, nullptr); ASSERT_EQ(new_div1->input_size(), 2); EXPECT_EQ(new_div1->input(0), "mul1"); EXPECT_EQ(new_div1->input(1), "mul1"); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, ReplaceMulWithSquare) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output c = ops::Const(s.WithOpName("c"), {1.0f, 2.0f}, {1, 2}); Output d = ops::Const(s.WithOpName("d"), {3.0f, 4.0f}, {1, 2}); Output mul = ops::Mul(s.WithControlDependencies(d).WithOpName("mul"), c, c); Output mul_no_nan = ops::MulNoNan(s.WithOpName("mul_no_nan"), d, d); Output id = ops::Identity(s.WithOpName("id"), mul); Output id2 = ops::Identity(s.WithOpName("id2"), mul_no_nan); GrapplerItem item; item.fetch = {"id", "id2"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 2); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyReplaceMulWithSquare(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); EXPECT_EQ(output.node_size(), 6); NodeMap node_map(&output); const string p = "ArithmeticOptimizer/ReplaceMulWithSquare"; const NodeDef* square_node = node_map.GetNode(absl::StrCat(p, "_", "mul")); ASSERT_NE(square_node, nullptr); EXPECT_EQ(square_node->op(), "Square"); ASSERT_EQ(square_node->input_size(), 2); EXPECT_EQ(square_node->input(0), "c"); EXPECT_EQ(square_node->input(1), "^d"); const NodeDef* square_node2 = node_map.GetNode(absl::StrCat(p, "_", "mul_no_nan")); ASSERT_NE(square_node2, nullptr); EXPECT_EQ(square_node2->op(), "Square"); ASSERT_EQ(square_node2->input_size(), 1); EXPECT_EQ(square_node2->input(0), "d"); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 2); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, RemoveInvolutionAdjacentNodes) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto c = ops::Const(s.WithOpName("c"), {1.0f, 2.0f}, {1, 2}); auto neg1 = ops::Neg(s.WithOpName("neg1"), c); auto neg2 = ops::Neg(s.WithOpName("neg2"), neg1); auto recip1 = ops::Reciprocal(s.WithOpName("recip1"), neg2); auto recip2 = ops::Reciprocal(s.WithOpName("recip2"), recip1); auto id = ops::Identity(s.WithOpName("id"), recip2); GrapplerItem item; item.fetch = {"id"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveInvolution(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); // Negation and Reciprocal nodes cancelled each other. ASSERT_EQ(output.node_size(), 2); EXPECT_EQ(output.node(1).name(), "id"); ASSERT_EQ(output.node(1).input_size(), 1); EXPECT_EQ(output.node(1).input(0), "c"); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, RemoveInvolutionAroundValuePreservingChain) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto c = ops::Const(s.WithOpName("c"), {1.0f, 2.0f}, {1, 2}); auto recip1 = ops::Reciprocal(s.WithOpName("recip1"), c); auto id1 = ops::Identity(s.WithOpName("id1"), recip1); auto squeeze = ops::Squeeze(s.WithOpName("squeeze"), id1); auto recip2 = ops::Reciprocal(s.WithOpName("recip2"), squeeze); auto id2 = ops::Identity(s.WithOpName("id2"), recip2); std::vector<string> fetch = {"id2"}; GrapplerItem item; item.fetch = fetch; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveInvolution(&optimizer); OptimizeTwiceAndPrune(&optimizer, &item, &output); // Check that Reciprocal nodes were removed from the graph. EXPECT_EQ(output.node_size(), 3); // And const directly flows into squeeze. int found = 0; for (const NodeDef& node : output.node()) { if (node.name() == "squeeze") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "c"); found++; } else if (node.name() == "id2") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "squeeze"); found++; } } EXPECT_EQ(found, 2); auto tensors = EvaluateNodes(output, fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, RemoveInvolutionSkipControlDependencies) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto c = ops::Const(s.WithOpName("c"), {1.0f, 2.0f}, {1, 2}); auto recip1 = ops::Reciprocal(s.WithOpName("recip1"), c); auto id1 = ops::Identity(s.WithOpName("id1"), recip1); auto squeeze = ops::Squeeze(s.WithOpName("squeeze"), id1); auto recip2 = ops::Reciprocal( s.WithOpName("recip2").WithControlDependencies(squeeze), c); auto id2 = ops::Identity(s.WithOpName("id2"), recip2); std::vector<string> fetch = {"id2"}; GrapplerItem item; item.fetch = fetch; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveInvolution(&optimizer); OptimizeTwice(&optimizer, &item, &output); // do not prune in this test // The optimizer should be a noop. VerifyGraphsMatch(item.graph, output, __LINE__); auto tensors = EvaluateNodes(output, fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, TrivialSumsSimple) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output x = ops::Const(s.WithOpName("x"), {1.0f, 2.0f}, {1, 2}); Output add = ops::Add(s.WithOpName("add"), x, x); Output id = ops::Identity(s.WithOpName("id"), add); GrapplerItem item; item.fetch = {"id"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); ArithmeticOptimizer optimizer; GraphDef output; OptimizeTwice(&optimizer, &item, &output); NodeMap node_map(&output); EXPECT_EQ(output.node_size(), 5); const string optimized_const_name = AggregationConstName("add"); const string optimized_mul_name = AggregationMulName("add"); const NodeDef* new_const = node_map.GetNode(optimized_const_name); ASSERT_NE(new_const, nullptr); ASSERT_EQ(new_const->input_size(), 1); EXPECT_EQ(new_const->input(0), "^x"); EXPECT_EQ(new_const->attr().at("value").tensor().tensor_content(), string("\0\0\0@", 4)); const NodeDef* new_mul = node_map.GetNode(optimized_mul_name); ASSERT_NE(new_mul, nullptr); ASSERT_EQ(new_mul->input_size(), 2); EXPECT_EQ(new_mul->input(0), optimized_const_name); EXPECT_EQ(new_mul->input(1), "x"); const NodeDef* new_id = node_map.GetNode("id"); ASSERT_NE(new_id, nullptr); ASSERT_EQ(new_id->input_size(), 1); EXPECT_EQ(new_id->input(0), optimized_mul_name); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, TrivialSumsSimpleWithControlDep) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output y = ops::Const(s.WithOpName("y"), {1.0f, 2.0f}, {1, 2}); Output x = ops::Const(s.WithOpName("x"), {3.0f, 4.0f}, {1, 2}); Output add = ops::Add(s.WithOpName("add").WithControlDependencies(y), x, x); Output id = ops::Identity(s.WithOpName("id"), add); GrapplerItem item; TF_CHECK_OK(s.ToGraphDef(&item.graph)); std::vector<string> fetch = {"id"}; auto tensors_expected = EvaluateNodes(item.graph, fetch); ASSERT_EQ(tensors_expected.size(), 1); ArithmeticOptimizer optimizer; GraphDef output; OptimizeTwice(&optimizer, &item, &output); NodeMap node_map(&output); EXPECT_EQ(output.node_size(), 6); const string optimized_const_name = AggregationConstName("add"); const string optimized_mul_name = AggregationMulName("add"); const NodeDef* new_const = node_map.GetNode(optimized_const_name); ASSERT_NE(new_const, nullptr); ASSERT_EQ(new_const->input_size(), 1); EXPECT_EQ(new_const->input(0), "^x"); EXPECT_EQ(new_const->attr().at("value").tensor().tensor_content(), string("\0\0\0@", 4)); const NodeDef* new_mul = node_map.GetNode(optimized_mul_name); ASSERT_NE(new_mul, nullptr); ASSERT_EQ(new_mul->input_size(), 3); EXPECT_EQ(new_mul->input(0), optimized_const_name); EXPECT_EQ(new_mul->input(1), "x"); EXPECT_EQ(new_mul->input(2), "^y"); const NodeDef* new_id = node_map.GetNode("id"); ASSERT_NE(new_id, nullptr); ASSERT_EQ(new_id->input_size(), 1); EXPECT_EQ(new_id->input(0), optimized_mul_name); auto tensors = EvaluateNodes(output, fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, TrivialSumsRepeatedAdd) { // Test case from b/69059093. tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output p = ops::Placeholder(s, DT_FLOAT, ops::Placeholder::Shape({10, 10})); Output add = ops::Add(s.WithOpName("Add"), p, p); Output add1 = ops::Add(s.WithOpName("Add_1"), p, p); Output add4 = ops::Add(s.WithOpName("Add_4"), add, add1); Output add5 = ops::Add(s.WithOpName("Add_5"), add, add1); Output add6 = ops::Add(s.WithOpName("Add_6"), add4, add5); Output id = ops::Identity(s.WithOpName("id"), add6); GrapplerItem item; TF_CHECK_OK(s.ToGraphDef(&item.graph)); const std::vector<string> devices{ "/device:CPU:0", "/device:GPU:0", "/device:CPU:0", "/device:GPU:1", "/device:CPU:0", "/device:CPU:0", "/device:CPU:0", }; for (int i = 0; i < item.graph.node_size(); ++i) { item.graph.mutable_node(i)->set_device(devices[i]); } ArithmeticOptimizer optimizer; DisableAddToAddNCombining(&optimizer); GraphDef output; OptimizeTwice(&optimizer, &item, &output); // We expect the following rewrite(s) to occur: // // Mul(p, // Add_6(Add_4(Const(2), Const(2)), // Add_5(Const(2), Const(2)))) NodeMap node_map(&output); EXPECT_EQ(output.node_size(), 17); const NodeDef* id_node = node_map.GetNode("id"); ASSERT_NE(id_node, nullptr); ASSERT_EQ(id_node->input_size(), 1); EXPECT_EQ(id_node->input(0), HoistMulName("Add_6")); const NodeDef* mul_node = node_map.GetNode(HoistMulName("Add_6")); ASSERT_NE(mul_node, nullptr); ASSERT_EQ(mul_node->input_size(), 2); EXPECT_EQ(mul_node->input(0), HoistAddName("Add_6")); EXPECT_EQ(mul_node->input(1), "Placeholder"); const NodeDef* add_6_node = node_map.GetNode(HoistAddName("Add_6")); ASSERT_NE(add_6_node, nullptr); ASSERT_EQ(add_6_node->input_size(), 2); EXPECT_EQ(add_6_node->input(0), HoistAddName("Add_4")); EXPECT_EQ(add_6_node->input(1), HoistAddName("Add_5")); const NodeDef* add_4_node = node_map.GetNode(HoistAddName("Add_4")); ASSERT_NE(add_4_node, nullptr); EXPECT_EQ(add_4_node->op(), "Add"); ASSERT_EQ(2, add_4_node->input_size()); EXPECT_EQ(add_4_node->input(0), AggregationConstName("Add")); EXPECT_EQ(add_4_node->input(1), AggregationConstName("Add_1")); const NodeDef* add_5_node = node_map.GetNode(HoistAddName("Add_5")); ASSERT_NE(add_5_node, nullptr); EXPECT_EQ(add_5_node->op(), "Add"); ASSERT_EQ(add_5_node->input_size(), 2); EXPECT_EQ(add_5_node->input(0), AggregationConstName("Add")); EXPECT_EQ(add_5_node->input(1), AggregationConstName("Add_1")); const NodeDef* add_const_node = node_map.GetNode(AggregationConstName("Add")); ASSERT_NE(add_const_node, nullptr); EXPECT_EQ(add_const_node->op(), "Const"); ASSERT_EQ(add_const_node->input_size(), 1); EXPECT_EQ(add_const_node->input(0), "^Placeholder"); const NodeDef* add_1_const_node = node_map.GetNode(AggregationConstName("Add_1")); ASSERT_NE(add_1_const_node, nullptr); EXPECT_EQ(add_1_const_node->op(), "Const"); ASSERT_EQ(add_1_const_node->input_size(), 1); EXPECT_EQ(add_1_const_node->input(0), "^Placeholder"); } TEST_F(ArithmeticOptimizerTest, HoistFactorMul) { for (bool matching_shapes : {true, false}) { for (bool use_addn : {true, false}) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output x = ops::Const(s.WithOpName("x"), {1.0f, 2.0f}, {1, 2}); Output y1 = ops::Const(s.WithOpName("y1"), {3.0f, 4.0f}, {1, 2}); Output y2 = matching_shapes ? ops::Const(s.WithOpName("y2"), {5.0f, 6.0f}, {1, 2}) : ops::Const(s.WithOpName("y2"), {5.0f}, {1, 1}); Output mul1 = ops::Mul(s.WithOpName("mul1"), x, y1); Output mul2 = ops::Mul(s.WithOpName("mul2"), y2, x); Output id = use_addn ? ops::Identity(s.WithOpName("id"), ops::AddN(s.WithOpName("add"), {mul1, mul2})) : ops::Identity(s.WithOpName("id"), ops::Add(s.WithOpName("add"), mul1, mul2)); GrapplerItem item; item.fetch = {"id"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); ArithmeticOptimizer optimizer; EnableOnlyHoistCommonFactor(&optimizer); GraphDef output; OptimizeTwice(&optimizer, &item, &output); // We expect the following rewrite(s) to occur: // // Add Mul // / \ / \ // Mul Mul -> x Add // / \ / \ / \ // x y1 y2 x y1 y2 // // If "root" op is AddN and shapes does not match, this rewrite is not // possible and graph should stay intact. NodeMap node_map(&output); if (use_addn && !matching_shapes) { VerifyGraphsMatch(item.graph, output, __LINE__); } else { EXPECT_EQ(output.node_size(), 9); const NodeDef* new_add_node = node_map.GetNode(HoistAddName("add")); ASSERT_NE(new_add_node, nullptr) << "Hoisted Add node not found"; ASSERT_EQ(new_add_node->input_size(), 2); EXPECT_EQ(new_add_node->input(0), "y1"); EXPECT_EQ(new_add_node->input(1), "y2"); const NodeDef* new_mul_node = node_map.GetNode(HoistMulName("add")); ASSERT_NE(new_mul_node, nullptr) << "Hoisted Mul node not found"; ASSERT_EQ(new_mul_node->input_size(), 2); EXPECT_EQ(new_mul_node->input(0), "x"); EXPECT_EQ(new_mul_node->input(1), new_add_node->name()); const NodeDef* id_node = node_map.GetNode("id"); ASSERT_NE(id_node, nullptr) << "Id node not found"; EXPECT_EQ(id_node->name(), "id"); ASSERT_EQ(id_node->input_size(), 1); EXPECT_EQ(id_node->input(0), HoistMulName("add")); } auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } } } TEST_F(ArithmeticOptimizerTest, HoistFactorDiv) { for (bool matching_shapes : {true, false}) { for (bool use_addn : {true, false}) { for (bool use_ints : {true, false}) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output x = use_ints ? ops::Const(s.WithOpName("x"), {1, 2}, {1, 2}) : ops::Const(s.WithOpName("x"), {1.0f, 2.0f}, {1, 2}); Output y1 = use_ints ? ops::Const(s.WithOpName("y1"), {3, 4}, {1, 2}) : ops::Const(s.WithOpName("y1"), {3.0f, 4.0f}, {1, 2}); Output y2; if (matching_shapes) { y2 = use_ints ? ops::Const(s.WithOpName("y2"), {5, 6}, {1, 2}) : ops::Const(s.WithOpName("y2"), {5.0f, 6.0f}, {1, 2}); } else { y2 = use_ints ? ops::Const(s.WithOpName("y2"), {5}, {1, 1}) : ops::Const(s.WithOpName("y2"), {5.0f}, {1, 1}); } Output div1 = ops::Div(s.WithOpName("div1"), y1, x); Output div2 = ops::Div(s.WithOpName("div2"), y2, x); Output id = use_addn ? ops::Identity(s.WithOpName("id"), ops::AddN(s.WithOpName("add"), {div1, div2})) : ops::Identity(s.WithOpName("id"), ops::Add(s.WithOpName("add"), div1, div2)); GrapplerItem item; item.fetch = {"id"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); ArithmeticOptimizer optimizer; EnableOnlyHoistCommonFactor(&optimizer); GraphDef output; OptimizeTwice(&optimizer, &item, &output); // We expect the following rewrite(s) to occur: // // Add Div // / \ / \ // Div Div -> Add x // / \ / \ / \ // y1 x y2 x y1 y2 // // If "root" op is AddN and shapes does not match, this rewrite is not // possible and graph should stay intact. NodeMap node_map(&output); if ((use_addn && !matching_shapes) || use_ints) { VerifyGraphsMatch(item.graph, output, __LINE__); } else { EXPECT_EQ(output.node_size(), 9); const NodeDef* new_add_node = node_map.GetNode(HoistAddName("add")); ASSERT_TRUE(new_add_node != nullptr) << "Hoisted Add node not found"; ASSERT_EQ(new_add_node->input_size(), 2); EXPECT_EQ(new_add_node->input(0), "y1"); EXPECT_EQ(new_add_node->input(1), "y2"); const NodeDef* new_div_node = node_map.GetNode(HoistDivName("add")); ASSERT_TRUE(new_div_node != nullptr) << "Hoisted Div node not found"; ASSERT_EQ(new_div_node->input_size(), 2); EXPECT_EQ(new_div_node->input(0), new_add_node->name()); EXPECT_EQ(new_div_node->input(1), "x"); const NodeDef* id_node = node_map.GetNode("id"); ASSERT_TRUE(id_node != nullptr) << "Id node not found"; EXPECT_EQ("id", id_node->name()); ASSERT_EQ(id_node->input_size(), 1); EXPECT_EQ(id_node->input(0), HoistDivName("add")); } auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); if (use_ints) { test::ExpectTensorEqual<int32>(tensors[0], tensors_expected[0]); } else { test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } } } } } TEST_F(ArithmeticOptimizerTest, FuseConjAndTranspose) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output re = ops::Const(s.WithOpName("re"), {1.0f, 2.0f, 3.0f, 4.0f}, {2, 2}); Output im = ops::Const(s.WithOpName("im"), {5.0f, 6.0f, 7.0f, 8.0f}, {2, 2}); Output z = ops::Complex(s.WithOpName("z"), re, im); Output perm = ops::Const(s.WithOpName("perm"), {1, 0}, {2}); Output conj = ops::Conj(s.WithOpName("conj"), z); Output transp = ops::Transpose(s.WithOpName("trans"), conj, perm); GrapplerItem item; item.fetch = {"trans"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); ArithmeticOptimizer optimizer; GraphDef output; OptimizeTwice(&optimizer, &item, &output); NodeMap node_map(&output); EXPECT_EQ(output.node_size(), 7); const string p = "ArithmeticOptimizer/FoldConjugateIntoTranspose"; const string optimized_name = absl::StrCat(p, "_", "trans"); const NodeDef* trans_fused_node = node_map.GetNode(optimized_name); ASSERT_NE(trans_fused_node, nullptr); EXPECT_EQ(trans_fused_node->op(), "ConjugateTranspose"); ASSERT_EQ(trans_fused_node->input_size(), 2); EXPECT_EQ(trans_fused_node->input(0), "z"); EXPECT_EQ(trans_fused_node->input(1), "perm"); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorEqual<complex64>(tensors[0], tensors_expected[0]); } TEST_F(ArithmeticOptimizerTest, FuseConjAndConjugateTranspose) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output re = ops::Const(s.WithOpName("re"), {1.0f, 2.0f, 3.0f, 4.0f}, {2, 2}); Output im = ops::Const(s.WithOpName("im"), {5.0f, 6.0f, 7.0f, 8.0f}, {2, 2}); Output z = ops::Complex(s.WithOpName("z"), re, im); Output perm = ops::Const(s.WithOpName("perm"), {1, 0}, {2}); Output conj = ops::Conj(s.WithOpName("conj"), z); Output transp = ops::ConjugateTranspose(s.WithOpName("conjugate_trans"), conj, perm); GrapplerItem item; item.fetch = {"conjugate_trans"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); ArithmeticOptimizer optimizer; GraphDef output; OptimizeTwice(&optimizer, &item, &output); NodeMap node_map(&output); EXPECT_EQ(output.node_size(), 7); const string p = "ArithmeticOptimizer/FoldConjugateIntoTranspose"; const string optimized_name = absl::StrCat(p, "_", "conjugate_trans"); const NodeDef* conjugate_trans_fused_node = node_map.GetNode(optimized_name); ASSERT_NE(conjugate_trans_fused_node, nullptr); EXPECT_EQ(conjugate_trans_fused_node->op(), "Transpose"); ASSERT_EQ(conjugate_trans_fused_node->input_size(), 2); EXPECT_EQ(conjugate_trans_fused_node->input(0), "z"); EXPECT_EQ(conjugate_trans_fused_node->input(1), "perm"); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorEqual<complex64>(tensors[0], tensors_expected[0]); } TEST_F(ArithmeticOptimizerTest, FuseTransposeAndConj) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output re = ops::Const(s.WithOpName("re"), {1.0f, 2.0f, 3.0f, 4.0f}, {2, 2}); Output im = ops::Const(s.WithOpName("im"), {5.0f, 6.0f, 7.0f, 8.0f}, {2, 2}); Output z = ops::Complex(s.WithOpName("z"), re, im); Output perm = ops::Const(s.WithOpName("perm"), {1, 0}, {2}); Output trans = ops::Transpose(s.WithOpName("trans"), z, perm); Output conj = ops::Conj(s.WithOpName("conj"), trans); GrapplerItem item; item.fetch = {"conj"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); ArithmeticOptimizer optimizer; GraphDef output; OptimizeTwice(&optimizer, &item, &output); NodeMap node_map(&output); EXPECT_EQ(output.node_size(), 7); const string p = "ArithmeticOptimizer/FoldConjugateIntoTranspose"; const string optimized_name = absl::StrCat(p, "_", "conj"); const NodeDef* conj_fused_node = node_map.GetNode(optimized_name); ASSERT_NE(conj_fused_node, nullptr); EXPECT_EQ(conj_fused_node->op(), "ConjugateTranspose"); ASSERT_EQ(conj_fused_node->input_size(), 2); EXPECT_EQ(conj_fused_node->input(0), "z"); EXPECT_EQ(conj_fused_node->input(1), "perm"); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorEqual<complex64>(tensors[0], tensors_expected[0]); } TEST_F(ArithmeticOptimizerTest, FoldTransposeIntoMatMul) { for (const string matmul_type : {"MatMul", "SparseMatMul", "BatchMatMul", "BatchMatMulV2"}) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output a = ops::Const(s.WithOpName("a"), {1.0f, 2.0f, 3.0f, 4.0f}, {2, 2}); Output b = ops::Const(s.WithOpName("b"), {5.0f, 6.0f, 7.0f, 8.0f}, {2, 2}); Output perm = ops::Const(s.WithOpName("perm"), {1, 0}, {2}); Output trans_a = ops::Transpose(s.WithOpName("trans_a"), a, perm); Output trans_b = ops::Transpose(s.WithOpName("trans_b"), b, perm); Output matmul; auto matmul_op = s.WithOpName("matmul"); if (matmul_type == "MatMul") { matmul = ops::MatMul(matmul_op, trans_a, trans_b); } else if (matmul_type == "SparseMatMul") { matmul = ops::SparseMatMul(matmul_op, trans_a, trans_b); } else if (matmul_type == "BatchMatMul") { matmul = ops::BatchMatMul(matmul_op, trans_a, trans_b); } else if (matmul_type == "BatchMatMulV2") { matmul = ops::BatchMatMulV2(matmul_op, trans_a, trans_b); } auto identity = ops::Identity(s.WithOpName("identity"), matmul); GrapplerItem item; item.fetch = {"matmul"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); ArithmeticOptimizer optimizer; EnableOnlyFoldTransposeIntoMatMul(&optimizer); GraphDef output; OptimizeTwice(&optimizer, &item, &output); NodeMap node_map(&output); EXPECT_EQ(output.node_size(), 8); const string p = "ArithmeticOptimizer/FoldTransposeIntoMatMul"; const string optimized_name = absl::StrCat(p, "_", "matmul"); const NodeDef* matmul_fused_node = node_map.GetNode(optimized_name); ASSERT_NE(matmul_fused_node, nullptr); ASSERT_EQ(matmul_fused_node->input_size(), 2); EXPECT_EQ(matmul_fused_node->input(0), "a"); EXPECT_EQ(matmul_fused_node->input(1), "b"); if (matmul_type == "BatchMatMul" || matmul_type == "BatchMatMulV2") { EXPECT_TRUE(matmul_fused_node->attr().at("adj_x").b()); EXPECT_TRUE(matmul_fused_node->attr().at("adj_y").b()); } else { EXPECT_TRUE(matmul_fused_node->attr().at("transpose_a").b()); EXPECT_TRUE(matmul_fused_node->attr().at("transpose_b").b()); } const NodeDef* identity_node = node_map.GetNode("identity"); ASSERT_NE(identity_node, nullptr); ASSERT_EQ(identity_node->input_size(), 1); EXPECT_EQ(identity_node->input(0), optimized_name); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } } TEST_F(ArithmeticOptimizerTest, FoldConjugateTransposeIntoBatchMatMul) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output re_a = ops::Const(s.WithOpName("re_a"), {1.0f, 2.0f, 3.0f, 4.0f}, {2, 2}); Output im_a = ops::Const(s.WithOpName("im_a"), {-1.0f, -2.0f, -3.0f, -4.0f}, {2, 2}); Output re_b = ops::Const(s.WithOpName("re_b"), {5.0f, 6.0f, 7.0f, 8.0f}, {2, 2}); Output im_b = ops::Const(s.WithOpName("im_b"), {-5.0f, -6.0f, -7.0f, -8.0f}, {2, 2}); Output a = ops::Complex(s.WithOpName("a"), re_a, im_a); Output b = ops::Complex(s.WithOpName("b"), re_b, im_b); Output perm = ops::Const(s.WithOpName("perm"), {1, 0}, {2}); Output trans_a = ops::ConjugateTranspose(s.WithOpName("trans_a"), a, perm); Output trans_b = ops::ConjugateTranspose(s.WithOpName("trans_b"), b, perm); Output matmul = ops::BatchMatMul(s.WithOpName("matmul"), trans_a, trans_b); GrapplerItem item; item.fetch = {"matmul"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); ArithmeticOptimizer optimizer; GraphDef output; OptimizeTwice(&optimizer, &item, &output); NodeMap node_map(&output); EXPECT_EQ(output.node_size(), 11); const string p = "ArithmeticOptimizer/FoldTransposeIntoMatMul"; const string optimized_name = absl::StrCat(p, "_", "matmul"); const NodeDef* optimized_matmul = node_map.GetNode(optimized_name); ASSERT_NE(optimized_matmul, nullptr); ASSERT_EQ(optimized_matmul->input_size(), 2); EXPECT_EQ(optimized_matmul->input(0), "a"); EXPECT_EQ(optimized_matmul->input(1), "b"); EXPECT_TRUE(optimized_matmul->attr().at("adj_x").b()); EXPECT_TRUE(optimized_matmul->attr().at("adj_y").b()); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<complex64>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, RemoveRedundantReshapeIdentityReshape) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs = ops::Placeholder(s, DT_FLOAT, ops::Placeholder::Shape({-1, 3, 28, 28})); Output inputs_shape = ops::Shape(s, inputs); // The target shape of the reshape is the concatenation of `batch_size` and // [3,28,28]. Output batch_size = ops::Slice(s, inputs_shape, ops::Const(s, {0}, {1}), ops::Const(s, {1}, {1})); Output target_shape = ops::Concat( s.WithOpName("target_shape"), {batch_size, ops::Const(s, {3, 28, 28}, {3})}, ops::Const(s, {0}, {})); Output reshape = ops::Reshape(s, inputs, target_shape); Output outputs = ops::Identity(s.WithOpName("outputs"), reshape); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto x_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({3, 3, 28, 28})); auto tensors_expected = EvaluateNodes(item.graph, item.fetch, {{"Placeholder", x_t}}); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveRedundantReshape(&optimizer); OptimizeTwiceAndPrune(&optimizer, &item, &output); EXPECT_EQ(CountOpNodes(output, "Reshape"), 0); auto tensors = EvaluateNodes(output, item.fetch, {{"Placeholder", x_t}}); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, RemoveRedundantReshapeIdentityReshapeBetweenSymbolicShapes) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs = ops::Placeholder(s, DT_FLOAT, ops::Placeholder::Shape({-1, 3, -1, -1})); Output inputs_shape = ops::Shape(s, inputs); // The target shape of the reshape is the concatenation of `batch_size`, 3, // `height, and `width`. Output batch_size = ops::Slice(s, inputs_shape, ops::Const(s, {0}, {1}), ops::Const(s, {1}, {1})); Output height = ops::Slice(s, inputs_shape, ops::Const(s, {2}, {1}), ops::Const(s, {1}, {1})); Output width = ops::Slice(s, inputs_shape, ops::Const(s, {3}, {1}), ops::Const(s, {1}, {1})); Output target_shape = ops::Concat(s.WithOpName("target_shape"), {batch_size, ops::Const(s, {3}, {1}), height, width}, ops::Const(s, {0}, {})); Output reshape = ops::Reshape(s, inputs, target_shape); Output outputs = ops::Identity(s.WithOpName("outputs"), reshape); auto x_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({3, 3, 28, 28})); GrapplerItem item; item.fetch = {"outputs"}; item.feed = {{"Placeholder", x_t}}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch, item.feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; // Assume valid feed shape in aggressive mode. ArithmeticOptimizer optimizer(RewriterConfig::AGGRESSIVE); EnableOnlyRemoveRedundantReshape(&optimizer); OptimizeTwiceAndPrune(&optimizer, &item, &output); EXPECT_EQ(CountOpNodes(output, "Reshape"), 0); auto tensors = EvaluateNodes(output, item.fetch, item.feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, RemoveRedundantReshapeNotAssumeValidFeeds) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs = ops::Placeholder(s, DT_FLOAT, ops::Placeholder::Shape({4, 3, 28, 28})); Output target_shape = ops::Const(s, {4, 3, 28, 28}, {4}); Output reshape = ops::Reshape(s, inputs, target_shape); Output outputs = ops::Identity(s.WithOpName("outputs"), reshape); auto x_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({4, 3, 28, 28})); GrapplerItem item; item.fetch = {"outputs"}; item.feed = {{"Placeholder", x_t}}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch, item.feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveRedundantReshape(&optimizer); OptimizeTwiceAndPrune(&optimizer, &item, &output); // The reshape is preserved because the shape of the placeholder can be // different from the shape of the actual feed. EXPECT_EQ(CountOpNodes(output, "Reshape"), 1); auto tensors = EvaluateNodes(output, item.fetch, item.feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, RemoveRedundantReshapeAssumeValidFeedsInAggressiveMode) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs = ops::Placeholder(s, DT_FLOAT, ops::Placeholder::Shape({4, 3, 28, 28})); Output target_shape = ops::Const(s, {4, 3, 28, 28}, {4}); Output reshape = ops::Reshape(s, inputs, target_shape); Output outputs = ops::Identity(s.WithOpName("outputs"), reshape); auto x_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({4, 3, 28, 28})); GrapplerItem item; item.fetch = {"outputs"}; item.feed = {{"Placeholder", x_t}}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch, item.feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer(RewriterConfig::AGGRESSIVE); EnableOnlyRemoveRedundantReshape(&optimizer); OptimizeTwiceAndPrune(&optimizer, &item, &output); EXPECT_EQ(CountOpNodes(output, "Reshape"), 0); auto tensors = EvaluateNodes(output, item.fetch, item.feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, RemoveRedundantReshapeNotIdentityReshape) { // Reshape from [-1,3,28,28] to [8,-1,28,28] is not identity, because it can // be from [4,3,28,28] to [8,6,28,28]. tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs = ops::Placeholder(s, DT_FLOAT, ops::Placeholder::Shape({-1, 3, 28, 28})); Output reshape = ops::Reshape(s, inputs, ops::Const(s, {8, -1, 28, 28}, {4})); Output outputs = ops::Identity(s.WithOpName("outputs"), reshape); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto x_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({8, 3, 28, 28})); item.feed = {{"Placeholder", x_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, item.feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveRedundantReshape(&optimizer); OptimizeTwiceAndPrune(&optimizer, &item, &output); EXPECT_EQ(CountOpNodes(output, "Reshape"), 1); auto tensors = EvaluateNodes(output, item.fetch, item.feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, RemoveRedundantReshapeNotIdentityReshapeTooManyUnknownDimSizes) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs = ops::Placeholder(s, DT_FLOAT, ops::Placeholder::Shape({4, 3})); Output reshape = ops::Reshape(s, inputs, ops::Const(s, {-1, -1}, {2})); Output outputs = ops::Identity(s.WithOpName("outputs"), reshape); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveRedundantReshape(&optimizer); OptimizeTwiceAndPrune(&optimizer, &item, &output); EXPECT_EQ(CountOpNodes(output, "Reshape"), 1); } TEST_F(ArithmeticOptimizerTest, RemoveRedundantReshapeCombineReshapes) { // Converts an NCHW_VECT_C tensor to NHWC and then flattens it to 2D. The two // reshapes should be combined. tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output nchw_vect_c = ops::Placeholder(s.WithOpName("nchw_vect_c"), DT_INT8, ops::Placeholder::Shape({8, 3, 28, 28, 4})); Output transpose = ops::Transpose(s.WithOpName("transpose"), nchw_vect_c, ops::Const(s.WithOpName("perm"), {0, 2, 3, 1, 4}, {5})); Output nhwc = ops::Reshape( s.WithOpName("nhwc"), transpose, ops::Const(s.WithOpName("nhwc_shape"), {8, 28, 28, 12}, {4})); Output flatten = ops::Reshape( s.WithOpName("flatten"), nhwc, ops::Const(s.WithOpName("flatten_shape"), {8, 28 * 28 * 12}, {2})); Output outputs = ops::Identity(s.WithOpName("outputs"), flatten); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto x_t = GenerateRandomTensor<DT_INT8>(TensorShape({8, 3, 28, 28, 4})); item.feed = {{"nchw_vect_c", x_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, item.feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveRedundantReshape(&optimizer); OptimizeTwiceAndPrune(&optimizer, &item, &output); EXPECT_EQ(CountOpNodes(output, "Reshape"), 1); auto tensors = EvaluateNodes(output, item.fetch, item.feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorEqual<int8>(tensors[0], tensors_expected[0]); } TEST_F(ArithmeticOptimizerTest, ReorderTransposeCastProducerIsCast) { tensorflow::Scope s = tensorflow::Scope::NewRootScope().WithDevice("/CPU:0"); Output nhwc_uint8 = ops::Placeholder(s, DT_UINT8, ops::Placeholder::Shape({8, 28, 28, 3})); Output nhwc_fp32 = ops::Cast(s, nhwc_uint8, DT_FLOAT); Output nchw_fp32 = ops::Transpose(s, nhwc_fp32, ops::Const(s, {0, 3, 1, 2}, {4})); Output outputs = ops::Identity(s.WithOpName("outputs"), nchw_fp32); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto input_t = GenerateRandomTensor<DT_UINT8>(TensorShape({8, 28, 28, 3})); auto tensors_expected = EvaluateNodes(item.graph, item.fetch, {{"Placeholder", input_t}}); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; OptimizeAndPrune(&optimizer, &item, &output); const NodeDef* transpose_node = nullptr; for (const NodeDef& node : output.node()) { if (node.op() == "Transpose") { EXPECT_EQ(transpose_node, nullptr); EXPECT_EQ(node.attr().at("T").type(), DT_UINT8); transpose_node = &node; } } ASSERT_NE(transpose_node, nullptr); for (const NodeDef& node : output.node()) { if (node.op() == "Cast") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(transpose_node->name(), NodeName(node.input(0))); } } auto tensors = EvaluateNodes(item.graph, item.fetch, {{"Placeholder", input_t}}); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorEqual<float>(tensors[0], tensors_expected[0]); } TEST_F(ArithmeticOptimizerTest, ReorderS2DCastProducerIsCast) { // TODO(jingyue): Evaluate S2D+Cast on GPU as well. We can't simply put nodes // under a /GPU:0 scope, because this test would fail if the testing machine // doesn't have a GPU. Maybe EvaluateNodes should allow soft placement? tensorflow::Scope s = tensorflow::Scope::NewRootScope().WithDevice("/CPU:0"); Output outputs = ops::Placeholder(s, DT_UINT8, ops::Placeholder::Shape({8, 28, 28, 3})); outputs = ops::Cast(s, outputs, DT_FLOAT); outputs = ops::SpaceToDepth(s, outputs, 2); outputs = ops::Identity(s.WithOpName("outputs"), outputs); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto input_t = GenerateRandomTensor<DT_UINT8>(TensorShape({8, 28, 28, 3})); auto tensors_expected = EvaluateNodes(item.graph, item.fetch, {{"Placeholder", input_t}}); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; OptimizeAndPrune(&optimizer, &item, &output); const NodeDef* s2d_node = nullptr; for (const NodeDef& node : output.node()) { if (node.op() == "SpaceToDepth") { EXPECT_EQ(s2d_node, nullptr); EXPECT_EQ(node.attr().at("T").type(), DT_UINT8); s2d_node = &node; } } ASSERT_NE(s2d_node, nullptr); for (const NodeDef& node : output.node()) { if (node.op() == "Cast") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(s2d_node->name(), NodeName(node.input(0))); } } auto tensors = EvaluateNodes(item.graph, item.fetch, {{"Placeholder", input_t}}); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorEqual<float>(tensors[0], tensors_expected[0]); } TEST_F(ArithmeticOptimizerTest, ReorderTransposeCastProducerIsTranspose) { tensorflow::Scope s = tensorflow::Scope::NewRootScope().WithDevice("/CPU:0"); Output nhwc_fp32 = ops::Placeholder(s, DT_FLOAT, ops::Placeholder::Shape({8, 28, 28, 3})); Output nchw_fp32 = ops::Transpose(s, nhwc_fp32, ops::Const(s, {0, 3, 1, 2}, {4})); Output nchw_uint8 = ops::Cast(s, nchw_fp32, DT_UINT8); Output outputs = ops::Identity(s.WithOpName("outputs"), nchw_uint8); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto input_t = GenerateConstantTensor<DT_FLOAT>(TensorShape({8, 28, 28, 3}), 42.0f); auto tensors_expected = EvaluateNodes(item.graph, item.fetch, {{"Placeholder", input_t}}); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; OptimizeAndPrune(&optimizer, &item, &output); const NodeDef* cast_node = nullptr; for (const NodeDef& node : output.node()) { if (node.op() == "Cast") { EXPECT_EQ(cast_node, nullptr); cast_node = &node; ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(NodeName(node.input(0)), "Placeholder"); } } ASSERT_NE(cast_node, nullptr); for (const NodeDef& node : output.node()) { if (node.op() == "Transpose") { EXPECT_EQ(node.attr().at("T").type(), DT_UINT8); ASSERT_EQ(node.input_size(), 2); EXPECT_EQ(cast_node->name(), NodeName(node.input(0))); } } auto tensors = EvaluateNodes(item.graph, item.fetch, {{"Placeholder", input_t}}); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorEqual<uint8>(tensors[0], tensors_expected[0]); } TEST_F(ArithmeticOptimizerTest, ReorderTransposeReverseCast) { tensorflow::Scope s = tensorflow::Scope::NewRootScope().WithDevice("/CPU:0"); Output nhwc_uint8 = ops::Placeholder(s, DT_UINT8, ops::Placeholder::Shape({8, 28, 28, 3})); Output nhwc_fp32 = ops::Cast(s, nhwc_uint8, DT_FLOAT); Output nhwc_fp32_reversed = ops::Reverse(s, nhwc_fp32, ops::Const(s, {0}, {1})); Output nchw_fp32_reversed = ops::Transpose(s, nhwc_fp32_reversed, ops::Const(s, {0, 3, 1, 2}, {4})); Output outputs = ops::Identity(s.WithOpName("outputs"), nchw_fp32_reversed); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto input_t = GenerateRandomTensor<DT_UINT8>(TensorShape({8, 28, 28, 3})); auto tensors_expected = EvaluateNodes(item.graph, item.fetch, {{"Placeholder", input_t}}); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; OptimizeAndPrune(&optimizer, &item, &output); const NodeDef* reverse_node = nullptr; const NodeDef* transpose_node = nullptr; const NodeDef* cast_node = nullptr; for (const NodeDef& node : output.node()) { if (node.op() == "Transpose") { EXPECT_EQ(transpose_node, nullptr); EXPECT_EQ(node.attr().at("T").type(), DT_UINT8); transpose_node = &node; } else if (node.op() == "ReverseV2") { EXPECT_EQ(reverse_node, nullptr); EXPECT_EQ(node.attr().at("T").type(), DT_UINT8); reverse_node = &node; } else if (node.op() == "Cast") { cast_node = &node; } } ASSERT_NE(cast_node, nullptr); ASSERT_NE(reverse_node, nullptr); ASSERT_NE(transpose_node, nullptr); ASSERT_EQ(reverse_node->input_size(), 2); EXPECT_EQ(NodeName(reverse_node->input(0)), "Placeholder"); ASSERT_EQ(transpose_node->input_size(), 2); EXPECT_EQ(NodeName(transpose_node->input(0)), reverse_node->name()); ASSERT_EQ(cast_node->input_size(), 1); EXPECT_EQ(NodeName(cast_node->input(0)), transpose_node->name()); auto tensors = EvaluateNodes(item.graph, item.fetch, {{"Placeholder", input_t}}); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorEqual<float>(tensors[0], tensors_expected[0]); } TEST_F(ArithmeticOptimizerTest, ReorderTransposeCastCheckNumericsToIdentity) { tensorflow::Scope s = tensorflow::Scope::NewRootScope().WithDevice("/CPU:0"); Output nhwc_uint8 = ops::Placeholder(s, DT_UINT8, ops::Placeholder::Shape({8, 28, 28, 3})); Output nhwc_fp32 = ops::Cast(s, nhwc_uint8, DT_FLOAT); Output nchw_fp32 = ops::CheckNumerics(s, nhwc_fp32, "foo"); Output outputs = ops::Identity(s.WithOpName("outputs"), nchw_fp32); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); GraphDef output; TF_EXPECT_OK(ArithmeticOptimizer().Optimize(nullptr, item, &output)); CompareGraphs(item.graph, output); } TEST_F(ArithmeticOptimizerTest, NoReorderTransposeCastProducerIsCast) { tensorflow::Scope s = tensorflow::Scope::NewRootScope().WithDevice("/CPU:0"); Output nhwc_fp32 = ops::Placeholder(s, DT_FLOAT, ops::Placeholder::Shape({8, 28, 28, 3})); Output nhwc_uint8 = ops::Cast(s, nhwc_fp32, DT_UINT8); Output nchw_uint8 = ops::Transpose(s, nhwc_uint8, ops::Const(s, {0, 3, 1, 2}, {4})); Output outputs = ops::Identity(s.WithOpName("outputs"), nchw_uint8); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); GraphDef output; TF_EXPECT_OK(ArithmeticOptimizer().Optimize(nullptr, item, &output)); CompareGraphs(item.graph, output); } TEST_F(ArithmeticOptimizerTest, NoReorderTransposeCastProducerIsTranspose) { tensorflow::Scope s = tensorflow::Scope::NewRootScope().WithDevice("/CPU:0"); Output nhwc_uint8 = ops::Placeholder(s, DT_UINT8, ops::Placeholder::Shape({8, 28, 28, 3})); Output nchw_uint8 = ops::Transpose(s, nhwc_uint8, ops::Const(s, {0, 3, 1, 2}, {4})); Output nchw_fp32 = ops::Cast(s, nchw_uint8, DT_FLOAT); Output outputs = ops::Identity(s.WithOpName("outputs"), nchw_fp32); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); GraphDef output; TF_EXPECT_OK(ArithmeticOptimizer().Optimize(nullptr, item, &output)); CompareGraphs(item.graph, output); } TEST_F(ArithmeticOptimizerTest, RemoveIdentityTransposes) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs_shape = ops::Const(s.WithOpName("inputs_shape"), {8, 3, 28, 28}, {4}); Output inputs = ops::RandomUniform(s.WithOpName("inputs"), inputs_shape, DT_FLOAT); Output perm1 = ops::Const(s.WithOpName("perm1"), {0, 2, 3, 1}, {4}); Output perm2 = ops::Const(s.WithOpName("perm2"), {0, 3, 1, 2}, {4}); Output perm3 = ops::Const(s.WithOpName("perm3"), {0, 1, 2, 3}, {4}); Output transpose1 = ops::Transpose(s.WithOpName("transpose1"), inputs, perm1); Output transpose2 = ops::Transpose(s.WithOpName("transpose2"), transpose1, perm2); Output transpose3 = ops::Transpose(s.WithOpName("transpose3"), inputs, perm3); Output id1 = ops::Identity(s.WithOpName("id1"), transpose2); Output id2 = ops::Identity(s.WithOpName("id2"), transpose3); GrapplerItem item; item.fetch = {"id1", "id2"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveIdentityTranspose(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); std::set<string> nodes_after_optimization; for (const NodeDef& node : output.node()) { nodes_after_optimization.insert(node.name()); } EXPECT_EQ(nodes_after_optimization, std::set<string>({"id1", "id2", "inputs_shape", "inputs"})); } TEST_F(ArithmeticOptimizerTest, RemoveIdentityTransposesMultipleOutputs) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs_shape = ops::Const(s.WithOpName("inputs_shape"), {8, 9, 28, 28}, {4}); Output inputs = ops::Placeholder(s.WithOpName("inputs"), DT_FLOAT, ops::Placeholder::Shape({8, 12, 28, 28})); OutputList split = ops::Split(s, ops::Const(s, 1), inputs, 3).output; Output perm1 = ops::Const(s, {0, 2, 3, 1}, {4}); Output perm2 = ops::Const(s, {0, 3, 1, 2}, {4}); Output branch0 = split[0]; Output branch1 = ops::Transpose(s, ops::Transpose(s, split[1], perm1), perm2); Output branch2 = split[2]; Output concat = ops::Concat(s, {branch0, branch1, branch2}, ops::Const(s, 1)); Output outputs = ops::Identity(s.WithOpName("outputs"), concat); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto x_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({8, 12, 28, 28})); item.feed = {{"inputs", x_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, item.feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveIdentityTranspose(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); for (const NodeDef& node : output.node()) { if (node.op() == "Concat") { ASSERT_EQ(node.input_size(), 3); EXPECT_EQ(node.input(0), "Split"); EXPECT_EQ(node.input(1), "Split:1"); EXPECT_EQ(node.input(2), "Split:2"); } } auto tensors = EvaluateNodes(output, item.fetch, item.feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, RemoveTransposesWithControlDependency) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs = ops::Placeholder(s, DT_FLOAT, ops::Placeholder::Shape({2, 3})); Output transpose1 = ops::Transpose(s, inputs, ops::Const(s, {1, 0})); Output transpose2 = ops::Transpose(s, transpose1, ops::Const(s, {1, 0})); Output outputs = ops::Identity(s.WithOpName("outputs").WithControlDependencies(transpose2), ops::Const(s.WithOpName("outputs_const"), 1.0f)); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto x_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 3})); item.feed = {{"Placeholder", x_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, item.feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveIdentityTranspose(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); NodeMap node_map(&output); const NodeDef* outputs_node = node_map.GetNode("outputs"); ASSERT_EQ(outputs_node->input_size(), 2); EXPECT_EQ(outputs_node->input(0), "outputs_const"); EXPECT_EQ(outputs_node->input(1), "^Placeholder"); auto tensors = EvaluateNodes(output, item.fetch, item.feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, NotRemoveTransposes) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs_shape = ops::Const(s.WithOpName("inputs_shape"), {8, 3, 28, 28}, {4}); Output inputs = ops::RandomUniform(s.WithOpName("inputs"), inputs_shape, DT_FLOAT); Output perm = ops::Const(s.WithOpName("perm"), {1, 2, 3, 0}, {4}); Output transpose1 = ops::Transpose(s.WithOpName("transpose1"), inputs, perm); Output transpose2 = ops::Transpose(s.WithOpName("transpose2"), transpose1, perm); Output outputs = ops::Identity(s.WithOpName("outputs"), transpose2); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveIdentityTranspose(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); EXPECT_EQ(output.node_size(), 6); } TEST_F(ArithmeticOptimizerTest, RemoveIdentityTransposesThroughChain) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs_shape = ops::Const(s.WithOpName("inputs_shape"), {8, 3, 28, 28}, {4}); Output inputs = ops::RandomUniform(s.WithOpName("inputs"), inputs_shape, DT_FLOAT); Output perm1 = ops::Const(s.WithOpName("perm1"), {0, 2, 3, 1}, {4}); Output perm2 = ops::Const(s.WithOpName("perm2"), {0, 3, 1, 2}, {4}); Output transpose1 = ops::Transpose( s.WithOpName("transpose1").WithControlDependencies(perm2), inputs, perm1); Output identity = ops::Identity(s.WithOpName("id"), transpose1); Output transpose2 = ops::Transpose(s.WithOpName("transpose2"), identity, perm2); Output id1 = ops::Identity(s.WithOpName("id1"), transpose2); GrapplerItem item; item.fetch = {"id1"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); GraphDef output; ArithmeticOptimizer optimizer(RewriterConfig::AGGRESSIVE); EnableOnlyRemoveIdentityTranspose(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); std::set<string> nodes_after_optimization; for (const NodeDef& node : output.node()) { nodes_after_optimization.insert(node.name()); if (node.name() == "id") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "inputs"); } if (node.name() == "id1") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "id"); } } EXPECT_EQ(nodes_after_optimization, std::set<string>({"id", "id1", "inputs_shape", "inputs"})); } TEST_F(ArithmeticOptimizerTest, FoldMulToTransposeConv) { for (bool swap_inputs : {false, true}) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs = ops::Placeholder(s.WithOpName("inputs"), DT_FLOAT, ops::Placeholder::Shape({1, 28, 28, 3})); Output scale = ops::Const(s.WithOpName("scale"), 1.0f / 255.0f, {}); Output scaled_inputs = ops::Multiply(s.WithOpName("scaled_inputs"), swap_inputs ? scale : inputs, swap_inputs ? inputs : scale); Output perm_nhwc_to_nchw = ops::Const(s.WithOpName("perm_nhwc_to_nchw"), {0, 3, 1, 2}, {4}); Output inputs_nchw = ops::Transpose(s.WithOpName("inputs_nchw"), scaled_inputs, perm_nhwc_to_nchw); Output weights = ops::Const(s.WithOpName("weights"), Input::Initializer(127.0f, {5, 5, 3, 4})); Output conv = ops::Conv2D(s.WithOpName("conv"), inputs_nchw, weights, {1, 1, 1, 1}, "VALID", ops::Conv2D::DataFormat("NCHW")); Output outputs = ops::Identity(s.WithOpName("outputs"), conv); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); // LOG(INFO) << "Before:\n" << item.graph.DebugString(); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyFoldMultipleIntoConv(&optimizer); OptimizeTwiceAndPrune(&optimizer, &item, &output); // LOG(INFO) << "After:\n" << output.DebugString(); NodeMap node_map(&output); // `conv` is now a folded convolution with scaled weights. const NodeDef* folded_conv = node_map.GetNode(conv.node()->name()); ASSERT_NE(folded_conv, nullptr); const NodeDef* folded_conv_weights = node_map.GetNode(folded_conv->input(1)); ASSERT_NE(folded_conv_weights, nullptr); EXPECT_EQ(folded_conv_weights->op(), "Mul"); // Its input should be a transpose of `inputs`. const NodeDef* transpose = node_map.GetNode(NodeName(folded_conv->input(0))); ASSERT_NE(transpose, nullptr); ASSERT_EQ(transpose->input_size(), 2); EXPECT_EQ(transpose->input(0), "inputs"); } } TEST_F(ArithmeticOptimizerTest, NotFoldMulAcrossPreservedTranspose) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs = ops::Placeholder(s.WithOpName("inputs"), DT_FLOAT, ops::Placeholder::Shape({8, 28, 28, 3})); Output scale = ops::Const(s.WithOpName("scale"), 1.0f / 255.0f, {}); Output scaled_inputs = ops::Multiply(s.WithOpName("scaled_inputs"), inputs, scale); Output perm_nhwc_to_nchw = ops::Const(s.WithOpName("perm_nhwc_to_nchw"), {0, 3, 1, 2}, {4}); Output inputs_nchw = ops::Transpose(s.WithOpName("inputs_nchw"), scaled_inputs, perm_nhwc_to_nchw); Output weights = ops::Const(s.WithOpName("weights"), Input::Initializer(127.0f, {5, 5, 3, 16})); Output conv = ops::Conv2D(s.WithOpName("conv"), inputs_nchw, weights, {1, 1, 1, 1}, "VALID", ops::Conv2D::DataFormat("NCHW")); Output outputs = ops::Identity(s.WithOpName("outputs"), conv); Tensor inputs_nchw_tensor(DT_FLOAT, {8, 3, 28, 28}); memset(const_cast<char*>(inputs_nchw_tensor.tensor_data().data()), 0, inputs_nchw_tensor.tensor_data().size()); GrapplerItem item; item.fetch = {"outputs"}; item.feed = {{"inputs_nchw", inputs_nchw_tensor}}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); GraphDef output; TF_EXPECT_OK(ArithmeticOptimizer().Optimize(nullptr, item, &output)); item.graph.Swap(&output); TF_EXPECT_OK(ModelPruner().Optimize(nullptr, item, &output)); NodeMap node_map(&output); const NodeDef* inputs_nchw_node_def = node_map.GetNode(inputs_nchw.node()->name()); ASSERT_NE(inputs_nchw_node_def, nullptr); ASSERT_EQ(inputs_nchw_node_def->input_size(), 2); EXPECT_EQ(NodeName(inputs_nchw_node_def->input(0)), scaled_inputs.node()->name()); } TEST_F(ArithmeticOptimizerTest, FoldMulToConv) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs = ops::Placeholder(s.WithOpName("inputs"), DT_FLOAT, ops::Placeholder::Shape({8, 28, 28, 28, 3})); Output scale = ops::Const(s.WithOpName("scale"), 1.0f / 255.0f, {}); Output scaled_inputs = ops::Multiply(s.WithOpName("scaled_inputs"), inputs, scale); Output weights = ops::Const(s.WithOpName("weights"), Input::Initializer(127.0f, {5, 5, 5, 3, 16})); Output conv = ops::Conv3D(s.WithOpName("conv"), scaled_inputs, weights, {1, 1, 1, 1, 1}, "VALID"); Output outputs = ops::Identity(s.WithOpName("outputs"), conv); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); GraphDef output; TF_EXPECT_OK(ArithmeticOptimizer().Optimize(nullptr, item, &output)); item.graph.Swap(&output); TF_EXPECT_OK(ModelPruner().Optimize(nullptr, item, &output)); NodeMap node_map(&output); // `conv` is now a folded convolution on `inputs` and scaled weights. const NodeDef* folded_conv = node_map.GetNode(conv.node()->name()); ASSERT_NE(folded_conv, nullptr); ASSERT_EQ(folded_conv->input_size(), 2); CHECK_EQ(NodeName(folded_conv->input(0)), inputs.node()->name()); const NodeDef* folded_conv_input_1 = node_map.GetNode(NodeName(folded_conv->input(1))); ASSERT_NE(folded_conv_input_1, nullptr); CHECK_EQ(folded_conv_input_1->op(), "Mul"); } TEST_F(ArithmeticOptimizerTest, OptimizeCastMulTransposeConv) { // This unit test exercises two optimizations, folding mul into conv, and // reordering cast and transpose. // // Conv2D(Transpose(Mul(Cast(I), S)), W) // => // Conv2D(Transpose(Cast(I)), W*S) // => // Conv2D(Cast(Transpose(I)), W*S) tensorflow::Scope s = tensorflow::Scope::NewRootScope().WithDevice("/cpu:0"); Output inputs = ops::Placeholder(s, DT_UINT8, ops::Placeholder::Shape({8, 28, 28, 3})); Output cast = ops::Cast(s, inputs, DT_FLOAT); Output mul = ops::Mul(s, cast, ops::Const(s, 1.0f / 255.0f)); Output transpose = ops::Transpose(s, mul, ops::Const(s.WithOpName("perm"), {0, 3, 1, 2})); Output weights = ops::Const(s.WithOpName("weights"), Input::Initializer(127.0f, {5, 5, 3, 16})); Output conv = ops::Conv2D(s, transpose, weights, {1, 1, 1, 1}, "VALID", ops::Conv2D::DataFormat("NCHW")); Output outputs = ops::Identity(s.WithOpName("outputs"), conv); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); GraphDef output; ArithmeticOptimizer optimizer; // all optimization stages are on OptimizeTwiceAndPrune(&optimizer, &item, &output, /*const_folding=*/true); NodeMap node_map(&output); // Expected names for reordered cast and transpose. const string p = "ArithmeticOptimizer/ReorderCastLikeAndValuePreserving_"; const string optimized_cast_name = absl::StrCat(p, "float_Cast"); const string optimized_transpose_name = absl::StrCat(p, "uint8_Transpose"); // Expected names for folded multiply and conv. const string optimized_weights = "ArithmeticOptimizer/FoldMultiplyIntoConv_scaled_Conv2D_weights"; const NodeDef* inputs_node = node_map.GetNode("Placeholder"); const NodeDef* transpose_node = node_map.GetNode(optimized_transpose_name); const NodeDef* cast_node = node_map.GetNode(optimized_cast_name); const NodeDef* weights_node = node_map.GetNode(optimized_weights); const NodeDef* conv_node = node_map.GetNode("Conv2D"); ASSERT_NE(inputs_node, nullptr); ASSERT_NE(transpose_node, nullptr); ASSERT_NE(cast_node, nullptr); ASSERT_NE(weights_node, nullptr); ASSERT_NE(conv_node, nullptr); EXPECT_EQ(output.node_size(), 7); ASSERT_EQ(transpose_node->input_size(), 2); EXPECT_EQ(transpose_node->input(0), inputs_node->name()); ASSERT_EQ(cast_node->input_size(), 1); EXPECT_EQ(cast_node->input(0), transpose_node->name()); ASSERT_EQ(conv_node->input_size(), 2); EXPECT_EQ(conv_node->input(0), cast_node->name()); EXPECT_EQ(conv_node->input(1), weights_node->name()); } TEST_F(ArithmeticOptimizerTest, OptimizeMultipleMulTransposeConv) { // This unit test exercises optimization of folding mul into conv for // multiple nodes in the graph. tensorflow::Scope s = tensorflow::Scope::NewRootScope().WithDevice("/cpu:0"); GrapplerItem item; Output conv[2]; for (int i = 0; i < 2; ++i) { Output inputs = ops::Placeholder(s, DT_FLOAT, ops::Placeholder::Shape({8, 3, 28, 28})); Output mul = ops::Mul(s, inputs, ops::Const(s, 1.0f / 255.0f)); Output weights = ops::Const(s.WithOpName("weights"), Input::Initializer(127.0f, {5, 5, 3, 16})); conv[i] = ops::Conv2D(s, mul, weights, {1, 1, 1, 1}, "VALID", ops::Conv2D::DataFormat("NCHW")); } Output outputs = ops::Add(s.WithOpName("outputs"), conv[0], conv[1]); item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyFoldMultipleIntoConv(&optimizer); OptimizeTwiceAndPrune(&optimizer, &item, &output, /*const_folding=*/true); NodeMap node_map(&output); using absl::StrCat; const string p = "ArithmeticOptimizer/FoldMultiplyIntoConv_"; const string optimized_weights = StrCat(p, "scaled_Conv2D_weights"); const string optimized_weights_1 = StrCat(p, "scaled_Conv2D_1_weights_1"); const NodeDef* weights_node = node_map.GetNode(optimized_weights); const NodeDef* weights_node_1 = node_map.GetNode(optimized_weights_1); const NodeDef* conv_node = node_map.GetNode("Conv2D"); const NodeDef* conv_node_1 = node_map.GetNode("Conv2D_1"); ASSERT_NE(weights_node, nullptr); ASSERT_NE(weights_node_1, nullptr); ASSERT_NE(conv_node, nullptr); ASSERT_NE(conv_node_1, nullptr); ASSERT_EQ(conv_node->input_size(), 2); ASSERT_EQ(conv_node_1->input_size(), 2); EXPECT_EQ(conv_node->input(1), weights_node->name()); EXPECT_EQ(conv_node_1->input(1), weights_node_1->name()); } TEST_F(ArithmeticOptimizerTest, CombineBitcasts) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs = ops::Placeholder(s.WithOpName("inputs"), DT_UINT8, ops::Placeholder::Shape({2, 3})); Output bc1 = ops::Bitcast(s.WithOpName("bc1"), inputs, DT_QINT8); Output bc2 = ops::Bitcast(s.WithOpName("bc2"), bc1, DT_INT8); Output outputs = ops::Identity(s.WithOpName("outputs"), bc2); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto x_t = GenerateRandomTensor<DT_UINT8>(TensorShape({2, 3})); item.feed = {{"inputs", x_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, item.feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveRedundantBitcast(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); NodeMap node_map(&output); // Bitcasts combined into a single op and inputs redirected to updated Bitcast EXPECT_EQ(output.node_size(), 3); EXPECT_EQ(CountOpNodes(output, "Bitcast"), 1); EXPECT_TRUE(IsNodesDirectlyConnected(node_map, "inputs", "bc2")); auto tensors = EvaluateNodes(output, item.fetch, item.feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorEqual<int8>(tensors[0], tensors_expected[0]); } TEST_F(ArithmeticOptimizerTest, CombineAndRemoveBitcasts) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs = ops::Placeholder(s.WithOpName("inputs"), DT_INT8, ops::Placeholder::Shape({2, 3})); Output bc1 = ops::Bitcast(s, inputs, DT_QINT8); Output bc2 = ops::Bitcast(s, bc1, DT_INT8); Output outputs = ops::Identity(s.WithOpName("outputs"), bc2); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto x_t = GenerateRandomTensor<DT_INT8>(TensorShape({2, 3})); item.feed = {{"inputs", x_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, item.feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveRedundantBitcast(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); NodeMap node_map(&output); // Bitcasts removed and inputs redirected to outputs EXPECT_EQ(output.node_size(), 2); EXPECT_EQ(CountOpNodes(output, "Bitcast"), 0); EXPECT_TRUE(IsNodesDirectlyConnected(node_map, "inputs", "outputs")); auto tensors = EvaluateNodes(output, item.fetch, item.feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorEqual<int8>(tensors[0], tensors_expected[0]); } TEST_F(ArithmeticOptimizerTest, RemoveRedundantCast) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output inputs = ops::Placeholder(s.WithOpName("inputs"), DT_INT8, ops::Placeholder::Shape({2, 3})); Output cast = ops::Cast(s, inputs, DT_INT8); Output outputs = ops::Identity(s.WithOpName("outputs"), cast); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto x_t = GenerateRandomTensor<DT_INT8>(TensorShape({2, 3})); item.feed = {{"inputs", x_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, item.feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveRedundantCast(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); NodeMap node_map(&output); // Cast removed and inputs redirected to outputs EXPECT_EQ(output.node_size(), 2); EXPECT_EQ(CountOpNodes(output, "Cast"), 0); EXPECT_TRUE(IsNodesDirectlyConnected(node_map, "inputs", "outputs")); auto tensors = EvaluateNodes(output, item.fetch, item.feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorEqual<int8>(tensors[0], tensors_expected[0]); } TEST_F(ArithmeticOptimizerTest, AddOpsRewriteAddOpsOfIdenticalShape) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); tensorflow::Scope sx = s.NewSubScope("x"); tensorflow::Scope sy = s.NewSubScope("y"); auto a = ops::Variable(s.WithOpName("a"), {2, 2}, DT_FLOAT); auto b = ops::Variable(s.WithOpName("b"), {2, 2}, DT_FLOAT); auto c = ops::Variable(s.WithOpName("c"), {2, 2}, DT_FLOAT); auto add_bc = ops::Add(sx.WithOpName("Add_bc"), b, c); auto add_abc = ops::Add(sy.WithOpName("Add_abc"), a, add_bc); auto outputs = ops::Identity(s.WithOpName("outputs"), add_abc); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto a_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 2})); auto b_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 2})); auto c_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 2})); std::vector<std::pair<string, Tensor>> feed = { {"a", a_t}, {"b", b_t}, {"c", c_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyAddToAddNCombining(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); // We expect the following rewrite(s) to occur: // // + // / \ // a + --> AddN(a, b, c) // / \ // b c EXPECT_EQ(output.node_size(), 5); NodeMap node_map(&output); // check add tree was replaced with AddN const NodeDef* collapsed_add = node_map.GetNode("y/ArithmeticOptimizer/AddOpsRewrite_Add_abc"); ASSERT_NE(collapsed_add, nullptr); EXPECT_EQ(collapsed_add->op(), "AddN"); ASSERT_EQ(collapsed_add->input_size(), 3); EXPECT_EQ(collapsed_add->input(0), "a"); EXPECT_EQ(collapsed_add->input(1), "b"); EXPECT_EQ(collapsed_add->input(2), "c"); // check output was re-wired to new node const NodeDef* updated_outputs = node_map.GetNode("outputs"); ASSERT_NE(updated_outputs, nullptr); ASSERT_EQ(updated_outputs->input_size(), 1); EXPECT_EQ(updated_outputs->input(0), collapsed_add->name()); auto tensors = EvaluateNodes(output, item.fetch, feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, AddOpsRewriteMultiplePasses) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto a = ops::Variable(s.WithOpName("a"), {2, 2}, DT_FLOAT); auto b = ops::Variable(s.WithOpName("b"), {2, 2}, DT_FLOAT); auto c = ops::Variable(s.WithOpName("c"), {2, 2}, DT_FLOAT); auto add_ab = ops::Add(s.WithOpName("Add_ab"), a, b); auto add_abc = ops::Add(s.WithOpName("Add_abc"), add_ab, c); auto x = ops::Variable(s.WithOpName("x"), {2, 2}, DT_FLOAT); auto y = ops::Variable(s.WithOpName("y"), {2, 2}, DT_FLOAT); auto z = ops::Variable(s.WithOpName("z"), {2, 2}, DT_FLOAT); auto add_xy = ops::Add(s.WithOpName("Add_xy"), x, y); auto add_xyz = ops::Add(s.WithOpName("Add_xyz"), add_xy, z); auto mul = ops::Multiply(s.WithOpName("Mul"), add_abc, add_xyz); auto outputs = ops::Identity(s.WithOpName("outputs"), mul); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto a_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 2})); auto b_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 2})); auto c_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 2})); auto x_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 2})); auto y_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 2})); auto z_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 2})); std::vector<std::pair<string, Tensor>> feed = { {"a", a_t}, {"b", b_t}, {"c", c_t}, {"x", x_t}, {"y", y_t}, {"z", z_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyAddToAddNCombining(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); // We expect the following rewrite(s) to occur: // // * // / \ // + + * // / \ / \ / \ // + c x + --> AddN(a, b, c) AddN(x, y, z)) // / \ / \ // a b y z EXPECT_EQ(output.node_size(), 10); NodeMap node_map(&output); // check left Add subtree replaced with AddN const NodeDef* collapsed_left = node_map.GetNode("ArithmeticOptimizer/AddOpsRewrite_Add_abc"); ASSERT_NE(collapsed_left, nullptr); EXPECT_EQ(collapsed_left->op(), "AddN"); ASSERT_EQ(collapsed_left->input_size(), 3); EXPECT_EQ(collapsed_left->input(0), "a"); EXPECT_EQ(collapsed_left->input(1), "b"); EXPECT_EQ(collapsed_left->input(2), "c"); // check right Add subtree replaced with AddN const NodeDef* collapsed_right = node_map.GetNode("ArithmeticOptimizer/AddOpsRewrite_Add_xyz"); ASSERT_NE(collapsed_right, nullptr); EXPECT_EQ(collapsed_right->op(), "AddN"); ASSERT_EQ(collapsed_right->input_size(), 3); EXPECT_EQ(collapsed_right->input(0), "x"); EXPECT_EQ(collapsed_right->input(1), "y"); EXPECT_EQ(collapsed_right->input(2), "z"); // check that Mul inputs re-wired to new Nodes const NodeDef* updated_mul = node_map.GetNode("Mul"); ASSERT_NE(updated_mul, nullptr); EXPECT_EQ(updated_mul->op(), "Mul"); ASSERT_EQ(updated_mul->input_size(), 2); EXPECT_EQ(updated_mul->input(0), collapsed_left->name()); EXPECT_EQ(updated_mul->input(1), collapsed_right->name()); auto tensors = EvaluateNodes(output, item.fetch, feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, AddOpsRewriteAddInputMultipleTimes) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto a = ops::Variable(s.WithOpName("a"), {2, 2}, DT_FLOAT); auto b = ops::Variable(s.WithOpName("b"), {2, 2}, DT_FLOAT); auto c = ops::Variable(s.WithOpName("c"), {2, 2}, DT_FLOAT); auto add_ab = ops::Add(s.WithOpName("Add_ab"), a, b); auto add_bc = ops::Add(s.WithOpName("Add_bc"), b, c); auto add_all = ops::Add(s.WithOpName("Add_all"), add_ab, add_bc); auto outputs = ops::Identity(s.WithOpName("outputs"), add_all); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto a_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 2})); auto b_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 2})); auto c_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 2})); std::vector<std::pair<string, Tensor>> feed = { {"a", a_t}, {"b", b_t}, {"c", c_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyAddToAddNCombining(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); // We expect the following rewrite(s) to occur: // // + // / \ // + + --> AddN(a, b, b, c) // / \ / \ ^ // a b c b added twice! EXPECT_EQ(output.node_size(), 5); NodeMap node_map(&output); // check Add tree replaced with AddN const NodeDef* collapsed_add = node_map.GetNode("ArithmeticOptimizer/AddOpsRewrite_Add_all"); ASSERT_NE(collapsed_add, nullptr); EXPECT_EQ(collapsed_add->op(), "AddN"); ASSERT_EQ(collapsed_add->input_size(), 4); EXPECT_EQ(collapsed_add->input(0), "a"); EXPECT_EQ(collapsed_add->input(1), "b"); EXPECT_EQ(collapsed_add->input(2), "b"); EXPECT_EQ(collapsed_add->input(3), "c"); auto tensors = EvaluateNodes(output, item.fetch, feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, AddOpsRewriteAddOpsOfSymbolicallyEqualShape) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); // unknown input shape propagated symbolically through the graph auto input = ops::Variable(s.WithOpName("input"), {-1, 2}, DT_FLOAT); // [a, b, c] have symbolically equal shapes auto a = ops::Sqrt(s.WithOpName("a"), input); auto b = ops::Square(s.WithOpName("b"), input); auto c = ops::Round(s.WithOpName("c"), input); // [add_ab, add_abc] shape must be inferred from inputs auto add_ab = ops::Add(s.WithOpName("Add_ab"), a, b); auto add_abc = ops::Add(s.WithOpName("Add_abc"), add_ab, c); auto outputs = ops::Identity(s.WithOpName("outputs"), add_abc); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto x_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 2})); std::vector<std::pair<string, Tensor>> feed = {{"input", x_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyAddToAddNCombining(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); // We expect the following rewrite(s) to occur: // // + // / \ // + c --> AddN(a, b, c) // / \ // a b EXPECT_EQ(output.node_size(), 6); NodeMap node_map(&output); // check add tree was replaced with AddN const NodeDef* collapsed_add = node_map.GetNode("ArithmeticOptimizer/AddOpsRewrite_Add_abc"); ASSERT_NE(collapsed_add, nullptr); EXPECT_EQ(collapsed_add->op(), "AddN"); ASSERT_EQ(collapsed_add->input_size(), 3); EXPECT_EQ(collapsed_add->input(0), "a"); EXPECT_EQ(collapsed_add->input(1), "b"); EXPECT_EQ(collapsed_add->input(2), "c"); // check output was re-wired to new node const NodeDef* updated_outputs = node_map.GetNode("outputs"); ASSERT_NE(updated_outputs, nullptr); ASSERT_EQ(updated_outputs->input_size(), 1); EXPECT_EQ(updated_outputs->input(0), collapsed_add->name()); auto tensors = EvaluateNodes(output, item.fetch, feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, AddOpsRewriteMinimizeBCast) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto a = ops::Variable(s.WithOpName("a"), {32}, DT_FLOAT); auto b = ops::Variable(s.WithOpName("b"), {32, 32}, DT_FLOAT); auto c = ops::Variable(s.WithOpName("c"), {32, 32, 32}, DT_FLOAT); auto add_ab = ops::Add(s.WithOpName("Add_ab"), a, b); auto add_abc = ops::Add(s.WithOpName("Add_abc"), add_ab, c); auto x = ops::Variable(s.WithOpName("x"), {32}, DT_FLOAT); auto y = ops::Variable(s.WithOpName("y"), {32, 32}, DT_FLOAT); auto z = ops::Variable(s.WithOpName("z"), {32, 32, 32}, DT_FLOAT); auto add_xy = ops::Add(s.WithOpName("Add_xy"), x, y); auto add_xyz = ops::Add(s.WithOpName("Add_xyz"), add_xy, z); auto add_all = ops::Add(s.WithOpName("AddAll"), add_abc, add_xyz); auto outputs = ops::Identity(s.WithOpName("outputs"), add_all); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto a_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({32})); auto b_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({32, 32})); auto c_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({32, 32, 32})); auto x_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({32})); auto y_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({32, 32})); auto z_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({32, 32, 32})); std::vector<std::pair<string, Tensor>> feed = { {"a", a_t}, {"b", b_t}, {"c", c_t}, {"x", x_t}, {"y", y_t}, {"z", z_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyAddToAddNCombining(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); // We expect the following rewrite(s) to occur: // 1) [a, x], [b, y], [c, z] - aggregate same shapes first // 2) Build an aggregation tree minimizing cost of broadcast // // + + // / \ / \ // + + + AddN(c, z) // / \ / \ / \ // + c x + --> AddN(a, x) AddN(b, y) // / \ / \ // a b y z EXPECT_EQ(output.node_size(), 12); NodeMap node_map(&output); // expected names of outer and inner nodes string outer_add_name = "ArithmeticOptimizer/AddOpsRewrite_AddAll"; string outer_0_add_name = "ArithmeticOptimizer/AddOpsRewrite_Internal_0_AddAll"; string inner_0_add_name = "ArithmeticOptimizer/AddOpsRewrite_Leaf_0_AddAll"; string inner_1_add_name = "ArithmeticOptimizer/AddOpsRewrite_Leaf_1_AddAll"; string inner_2_add_name = "ArithmeticOptimizer/AddOpsRewrite_Leaf_2_AddAll"; // Add [a, x] first const NodeDef* add_ax_node = node_map.GetNode(inner_0_add_name); ASSERT_NE(add_ax_node, nullptr); EXPECT_EQ(add_ax_node->op(), "AddN"); ASSERT_EQ(add_ax_node->input_size(), 2); EXPECT_EQ(add_ax_node->input(0), "a"); EXPECT_EQ(add_ax_node->input(1), "x"); // Then add [b, y] const NodeDef* add_by_node = node_map.GetNode(inner_1_add_name); ASSERT_NE(add_by_node, nullptr); EXPECT_EQ(add_by_node->op(), "AddN"); ASSERT_EQ(2, add_by_node->input_size()); EXPECT_EQ(add_by_node->input(0), "b"); EXPECT_EQ(add_by_node->input(1), "y"); // Then add [c, z] const NodeDef* add_cz_node = node_map.GetNode(inner_2_add_name); ASSERT_NE(add_cz_node, nullptr); EXPECT_EQ(add_cz_node->op(), "AddN"); ASSERT_EQ(add_cz_node->input_size(), 2); EXPECT_EQ(add_cz_node->input(0), "c"); EXPECT_EQ(add_cz_node->input(1), "z"); // Then add results together starting from smaller shapes [a, x] + [b, y] const NodeDef* outer_0_node = node_map.GetNode(outer_0_add_name); ASSERT_NE(outer_0_node, nullptr); EXPECT_EQ(outer_0_node->op(), "Add"); ASSERT_EQ(outer_0_node->input_size(), 2); EXPECT_EQ(outer_0_node->input(0), inner_0_add_name); EXPECT_EQ(outer_0_node->input(1), inner_1_add_name); // And finally top level Add node const NodeDef* outer_node = node_map.GetNode(outer_add_name); ASSERT_NE(outer_node, nullptr); EXPECT_EQ(outer_node->op(), "Add"); ASSERT_EQ(outer_node->input_size(), 2); EXPECT_EQ(outer_node->input(0), outer_0_add_name); EXPECT_EQ(outer_node->input(1), inner_2_add_name); // And outputs reading new top level Add node const NodeDef* updated_outputs = node_map.GetNode("outputs"); ASSERT_NE(updated_outputs, nullptr); ASSERT_EQ(updated_outputs->input_size(), 1); EXPECT_EQ(updated_outputs->input(0), outer_add_name); auto tensors = EvaluateNodes(output, item.fetch, feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, AddOpsRewriteMinimizeBCastWithSymbolicShapes) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); // We have a small input with one unknown dimension auto small = ops::Variable(s.WithOpName("small"), {-1, 1, 1}, DT_DOUBLE); // And second input which is larger, but has the same unknown dimension // device spec prevents this node from rewriting auto d = "/device:CPU:0"; auto v = ops::Variable(s.WithOpName("v"), {1, 32, 32}, DT_DOUBLE); auto large = ops::Add(s.WithOpName("large").WithDevice(d), small, v); // [a, c] have {?, 1, 1} shape, [b] has {?, 32, 32} auto a = ops::Sqrt(s.WithOpName("a"), small); auto b = ops::Square(s.WithOpName("b"), large); auto c = ops::Round(s.WithOpName("c"), small); // [add_ab, add_abc] shape must be inferred from inputs auto add_ab = ops::Add(s.WithOpName("Add_ab"), a, b); auto add_abc = ops::Add(s.WithOpName("Add_abc"), add_ab, c); auto outputs = ops::Identity(s.WithOpName("outputs"), add_abc); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto s_t = GenerateRandomTensor<DT_DOUBLE>(TensorShape({8, 1, 1})); auto v_t = GenerateRandomTensor<DT_DOUBLE>(TensorShape({1, 32, 32})); std::vector<std::pair<string, Tensor>> feed = {{"small", s_t}, {"v", v_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyAddToAddNCombining(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); // We expect the following rewrite(s) to occur: it's much cheaper to add small // tensors, and do the broadcast just once // // + + // / \ / \ // + c --> + b // / \ / \ // a b a c EXPECT_EQ(output.node_size(), 9); NodeMap node_map(&output); // expected names of outer and inner nodes string outer_add_name = "ArithmeticOptimizer/AddOpsRewrite_Add_abc"; string inner_add_name = "ArithmeticOptimizer/AddOpsRewrite_Leaf_0_Add_abc"; // outer Add node const NodeDef* outer_add = node_map.GetNode(outer_add_name); ASSERT_NE(outer_add, nullptr); EXPECT_EQ(outer_add->op(), "Add"); ASSERT_EQ(outer_add->input_size(), 2); EXPECT_EQ(outer_add->input(0), inner_add_name); EXPECT_EQ(outer_add->input(1), "b"); // inner AddN node const NodeDef* inner_add = node_map.GetNode(inner_add_name); ASSERT_NE(inner_add, nullptr); ASSERT_EQ(inner_add->input_size(), 2); EXPECT_EQ(inner_add->input(0), "a"); EXPECT_EQ(inner_add->input(1), "c"); // check output was re-wired to new node const NodeDef* updated_outputs = node_map.GetNode("outputs"); ASSERT_NE(updated_outputs, nullptr); ASSERT_EQ(updated_outputs->input_size(), 1); EXPECT_EQ(updated_outputs->input(0), outer_add_name); auto tensors = EvaluateNodes(output, item.fetch, feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<double>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, RemoveNegation) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x = ops::Variable(s.WithOpName("x"), {2, 2}, DT_FLOAT); auto y = ops::Variable(s.WithOpName("y"), {2, 2}, DT_FLOAT); Output neg_x = ops::Neg(s.WithOpName("Neg_x"), x); Output neg_y = ops::Neg(s.WithOpName("Neg_y"), y); Output add_x_y = ops::Add(s.WithOpName("Add_x_y"), x, y); Output add_negx_y = ops::Add(s.WithOpName("Add_negx_y"), neg_x, y); Output add_x_negy = ops::Add(s.WithOpName("Add_x_negy"), x, neg_y); Output add_negx_negy = ops::Add(s.WithOpName("Add_negx_negy"), neg_x, neg_y); Output sub_x_y = ops::Sub(s.WithOpName("Sub_x_y"), x, y); Output sub_negx_y = ops::Sub(s.WithOpName("Sub_negx_y"), neg_x, y); Output sub_x_negy = ops::Sub(s.WithOpName("Sub_x_negy"), x, neg_y); Output sub_negx_negy = ops::Sub(s.WithOpName("Sub_negx_negy"), neg_x, neg_y); Output neg_x_with_dep = ops::Neg( s.WithOpName("Neg_x_with_dep").WithControlDependencies({add_x_y}), x); Output add_negx_with_dep_y = ops::Add(s.WithOpName("Add_negx_with_dep_y"), neg_x_with_dep, y); auto add_all = ops::AddN(s.WithOpName("add_all"), {add_x_y, add_negx_y, add_x_negy, add_negx_negy, sub_x_y, sub_negx_y, sub_x_negy, sub_negx_negy, add_negx_with_dep_y}); GrapplerItem item; item.fetch = {"add_all"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto x_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 2})); auto y_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({2, 2})); std::vector<std::pair<string, Tensor>> feed = {{"x", x_t}, {"y", y_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveNegation(&optimizer); OptimizeTwice(&optimizer, &item, &output); EXPECT_EQ(output.node_size(), item.graph.node_size()); int found = 0; for (int i = 0; i < output.node_size(); ++i) { const NodeDef& node = output.node(i); if (node.name() == "Add_negx_y") { ++found; EXPECT_EQ(node.op(), "Sub"); ASSERT_EQ(node.input_size(), 2); EXPECT_EQ(node.input(0), "y"); EXPECT_EQ(node.input(1), "x"); } else if (node.name() == "Add_x_negy") { ++found; EXPECT_EQ(node.op(), "Sub"); ASSERT_EQ(node.input_size(), 2); EXPECT_EQ(node.input(0), "x"); EXPECT_EQ(node.input(1), "y"); } else if (node.name() == "Add_negx_negy") { ++found; EXPECT_EQ(node.op(), "Sub"); ASSERT_EQ(node.input_size(), 2); EXPECT_EQ(node.input(0), "Neg_x"); EXPECT_EQ(node.input(1), "y"); } else if (node.name() == "Sub_x_negy") { ++found; EXPECT_EQ(node.op(), "Add"); ASSERT_EQ(node.input_size(), 2); EXPECT_EQ(node.input(0), "x"); EXPECT_EQ(node.input(1), "y"); } else if (node.name() == "Sub_negx_negy") { ++found; EXPECT_EQ(node.op(), "Sub"); ASSERT_EQ(node.input_size(), 2); EXPECT_EQ(node.input(0), "y"); EXPECT_EQ(node.input(1), "x"); } else if (node.name() == "Add_negx_with_dep_y") { ++found; EXPECT_EQ(node.op(), "Sub"); ASSERT_EQ(node.input_size(), 3); EXPECT_EQ(node.input(0), "y"); EXPECT_EQ(node.input(1), "x"); EXPECT_EQ(node.input(2), "^Add_x_y"); } } EXPECT_EQ(found, 6); auto tensors = EvaluateNodes(output, item.fetch, feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, ConvertSqrtDivToRsqrtMul) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x = ops::Const(s.WithOpName("x"), {1.0f, 2.0f}, {1, 2}); auto y = ops::Const(s.WithOpName("y"), {3.0f, 4.0f}, {1, 2}); Output sqrt_y = ops::Sqrt(s.WithOpName("sqrt_y"), y); Output div_x_sqrt_y = ops::Div(s.WithOpName("output"), x, sqrt_y); GrapplerItem item; item.fetch = {"output"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlySqrtDivToRsqrtMul(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); EXPECT_EQ(output.node_size(), item.graph.node_size()); for (int i = 0; i < output.node_size(); ++i) { const NodeDef& node = output.node(i); if (node.name() == "output") { EXPECT_EQ(node.op(), "Mul"); ASSERT_EQ(node.input_size(), 2); EXPECT_EQ(node.input(0), "x"); EXPECT_EQ(node.input(1), "sqrt_y"); } else if (node.name() == "sqrt_y") { EXPECT_EQ(node.op(), "Rsqrt"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "y"); } } } TEST_F(ArithmeticOptimizerTest, DoNotConvertSqrtDivToRsqrtMulDivisorFetchNode) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output floats = ops::Const(s.WithOpName("floats"), {0.7423212f, 0.19757693f, 0.53124744f}, {1, 3}); Output output0 = ops::Sqrt(s.WithOpName("output0"), floats); Output const1 = ops::Const(s.WithOpName("const1"), 1.0f, {3}); Output mul1 = ops::Multiply(s.WithOpName("mul1"), const1, 0.5f); Output grad = ops::Div(s.WithOpName("grad"), mul1, output0); GrapplerItem item; item.fetch = {"grad", "output0"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 2); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlySqrtDivToRsqrtMul(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 2); for (int i = 0; i < tensors.size(); i++) { EXPECT_EQ(tensors[i].NumElements(), tensors_expected[i].NumElements()); test::ExpectTensorNear<float>(tensors[i], tensors_expected[i], 1e-6); } EXPECT_EQ(output.node_size(), item.graph.node_size()); for (int i = 0; i < output.node_size(); ++i) { const NodeDef& node = output.node(i); if (node.name() == "grad") { EXPECT_EQ(node.op(), "Div"); ASSERT_EQ(node.input_size(), 2); EXPECT_EQ(node.input(0), "mul1"); EXPECT_EQ(node.input(1), "output0"); } else if (node.name() == "output0") { EXPECT_EQ(node.op(), "Sqrt"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "floats"); } } } TEST_F(ArithmeticOptimizerTest, ConvertSqrtDivToRsqrtMulExcludeFloorDiv) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x = ops::Const(s.WithOpName("x"), {1.0f, 2.0f}, {1, 2}); auto y = ops::Const(s.WithOpName("y"), {3.0f, 4.0f}, {1, 2}); Output sqrt_y = ops::Sqrt(s.WithOpName("sqrt_y"), y); Output div_x_sqrt_y = ops::FloorDiv(s.WithOpName("output"), x, sqrt_y); GrapplerItem item; item.fetch = {"output"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlySqrtDivToRsqrtMul(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); EXPECT_EQ(output.node_size(), item.graph.node_size()); for (int i = 0; i < output.node_size(); ++i) { const NodeDef& node = output.node(i); if (node.name() == "output") { EXPECT_EQ(node.op(), "FloorDiv"); ASSERT_EQ(node.input_size(), 2); EXPECT_EQ(node.input(0), "x"); EXPECT_EQ(node.input(1), "sqrt_y"); } else if (node.name() == "sqrt_y") { EXPECT_EQ(node.op(), "Sqrt"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "y"); } } } TEST_F(ArithmeticOptimizerTest, FuseSquaredDiff) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x = ops::Const(s.WithOpName("x"), {1.0f, 2.0f}, {1, 2}); auto y = ops::Const(s.WithOpName("y"), {3.0f, 4.0f}, {1, 2}); Output sub_x_y = ops::Sub(s.WithOpName("sub_x_y"), x, y); Output square_sub_x_y = ops::Square(s.WithOpName("output"), sub_x_y); GrapplerItem item; item.fetch = {"output"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); const auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyFuseSquaredDiff(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); const auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); EXPECT_EQ(output.node_size(), item.graph.node_size()); for (int i = 0; i < output.node_size(); ++i) { const NodeDef& node = output.node(i); if (node.name() == "output") { EXPECT_EQ(node.op(), "Identity"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "sub_x_y"); } else if (node.name() == "sub_x_y") { EXPECT_EQ(node.op(), "SquaredDifference"); ASSERT_EQ(node.input_size(), 2); EXPECT_EQ(node.input(0), "x"); EXPECT_EQ(node.input(1), "y"); } } } TEST_F(ArithmeticOptimizerTest, DoNotFuseSquaredDiffFetchNode) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x = ops::Const(s.WithOpName("x"), {1.0f, 2.0f}, {1, 2}); auto y = ops::Const(s.WithOpName("y"), {3.0f, 4.0f}, {1, 2}); Output sub_x_y = ops::Sub(s.WithOpName("sub_x_y"), x, y); Output square_sub_x_y = ops::Square(s.WithOpName("output"), sub_x_y); GrapplerItem item; item.fetch = {"output", "sub_x_y"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); const auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 2); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyFuseSquaredDiff(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); const auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 2); for (int i = 0; i < tensors.size(); i++) { EXPECT_EQ(tensors[i].NumElements(), tensors_expected[i].NumElements()); test::ExpectTensorNear<float>(tensors[i], tensors_expected[i], 1e-6); } EXPECT_EQ(output.node_size(), item.graph.node_size()); for (int i = 0; i < output.node_size(); ++i) { const NodeDef& node = output.node(i); if (node.name() == "output") { EXPECT_EQ(node.op(), "Square"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "sub_x_y"); } else if (node.name() == "sub_x_y") { EXPECT_EQ(node.op(), "Sub"); ASSERT_EQ(node.input_size(), 2); EXPECT_EQ(node.input(0), "x"); EXPECT_EQ(node.input(1), "y"); } } } TEST_F(ArithmeticOptimizerTest, ConvertLogSoftmax) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x = ops::Const(s.WithOpName("x"), {1.0f, 2.0f}, {1, 2}); Output softmax = ops::Softmax(s.WithOpName("softmax"), x); Output logsoftmax = ops::Log(s.WithOpName("output"), softmax); GrapplerItem item; item.fetch = {"output"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); const auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyLogSoftmax(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); const auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); EXPECT_EQ(output.node_size(), item.graph.node_size() - 1); for (int i = 0; i < output.node_size(); ++i) { const NodeDef& node = output.node(i); if (node.name() == "output") { EXPECT_EQ(node.op(), "LogSoftmax"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "x"); } } } TEST_F(ArithmeticOptimizerTest, DoNotConvertLogSoftmaxArgFetchNode) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output floats = ops::Const(s.WithOpName("floats"), {0.7423212f, 0.19757693f, 0.53124744f}, {1, 3}); Output softmax = ops::Softmax(s.WithOpName("softmax"), floats); Output final_output = ops::Log(s.WithOpName("final_output"), softmax); GrapplerItem item; item.fetch = {"softmax", "final_output"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); const auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 2); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyLogSoftmax(&optimizer); OptimizeTwice(&optimizer, &item, &output); const auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 2); // Should be a NoOp since we are not allowed to change the output of fetch // nodes. VerifyGraphsMatch(item.graph, output, __LINE__); for (int i = 0; i < tensors.size(); i++) { EXPECT_EQ(tensors[i].NumElements(), tensors_expected[i].NumElements()); test::ExpectTensorNear<float>(tensors[i], tensors_expected[i], 1e-6); } } TEST_F(ArithmeticOptimizerTest, ConvertPow) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x = ops::Const(s.WithOpName("x"), {1.0f, 2.0f}, {1, 2}); auto y2 = ops::Const(s.WithOpName("y2"), {2.0f, 2.0f}, {1, 2}); auto y3 = ops::Const(s.WithOpName("y3"), {3.0f, 3.0f}, {1, 2}); auto y1 = ops::Const(s.WithOpName("y1"), {1.0f, 1.0f}, {1, 2}); auto yPoint5 = ops::Const(s.WithOpName("y.5"), {0.5f, 0.5f}, {1, 2}); auto y0 = ops::Const(s.WithOpName("y0"), {0.0f, 0.0f}, {1, 2}); auto y_Point5 = ops::Const(s.WithOpName("y_.5"), {-0.5f, -0.5f}, {1, 2}); auto y_1 = ops::Const(s.WithOpName("y_1"), {-1.0f, -1.0f}, {1, 2}); auto y = ops::Const(s.WithOpName("y"), {3.0f, 4.0f}, {1, 2}); auto z = ops::Const(s.WithOpName("z"), {42.0f}, {}); auto ones = ops::Const(s.WithOpName("ones"), {1.0f, 1.0f, 1.0f}, {1, 3}); auto zeros = ops::Const(s.WithOpName("zeros"), {0.0f, 0.0f, 0.0f}, {1, 3}); Output out2 = ops::Pow(s.WithOpName("out2"), x, y2); Output out3 = ops::Pow(s.WithOpName("out3").WithDevice("/device:CPU:0"), x, y3); Output out1 = ops::Pow(s.WithOpName("out1"), x, y1); Output outPoint5 = ops::Pow(s.WithOpName("out.5"), x, yPoint5); Output out0 = ops::Pow(s.WithOpName("out0"), x, y0); Output out_Point5 = ops::Pow(s.WithOpName("out_.5"), x, y_Point5); Output out_1 = ops::Pow(s.WithOpName("out_1"), x, y_1); Output out = ops::Pow(s.WithOpName("out"), x, y); Output out_bcast1 = ops::Pow(s.WithOpName("out_bcast1"), z, ones); Output out_bcast2 = ops::Pow(s.WithOpName("out_bcast2"), z, zeros); GrapplerItem item; item.fetch = {"out2", "out3", "out1", "out.5", "out0", "out_.5", "out_1", "out", "out_bcast1", "out_bcast2"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 10); GraphDef got; ArithmeticOptimizer optimizer; EnableOnlyConvertPow(&optimizer); OptimizeAndPrune(&optimizer, &item, &got); auto tensors = EvaluateNodes(got, item.fetch); ASSERT_EQ(tensors.size(), 10); for (int i = 0; i < tensors.size(); ++i) { EXPECT_EQ(tensors[i].NumElements(), tensors_expected[i].NumElements()); test::ExpectTensorNear<float>(tensors[i], tensors_expected[i], 1e-6); } GraphDef want; AddNode("x", "Const", {}, {}, &want); AddNode("y", "Const", {}, {}, &want); AddNode("z", "Const", {}, {}, &want); AddNode("ones", "Const", {}, {}, &want); AddNode("zeros", "Const", {}, {}, &want); AddNode("out2", "Square", {"x"}, {}, &want); AddNode("ArithmeticOptimizer/ConvertPow__inner_out3", "Square", {"x"}, {}, &want) ->set_device("/device:CPU:0"); AddNode("out3", "Mul", {"x", "ArithmeticOptimizer/ConvertPow__inner_out3"}, {}, &want) ->set_device("/device:CPU:0"); AddNode("out1", "Identity", {"x"}, {}, &want); AddNode("out.5", "Sqrt", {"x"}, {}, &want); AddNode("out0", "Const", {AsControlDependency("x")}, {}, &want); AddNode("out_.5", "Rsqrt", {"x"}, {}, &want); AddNode("out_1", "Reciprocal", {"x"}, {}, &want); AddNode("out", "Pow", {"x", "y"}, {}, &want); AddNode("out_bcast1", "Pow", {"z", "ones"}, {}, &want); AddNode("out_bcast2", "Pow", {"z", "zeros"}, {}, &want); CompareGraphs(want, got); } TEST_F(ArithmeticOptimizerTest, Log1p) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x1 = ops::Const(s.WithOpName("x1"), {1.0f, 1.0f}, {1, 2}); auto x2 = ops::Const(s.WithOpName("x2"), {2.0f, 2.0f}, {1, 2}); auto x3 = ops::Const(s.WithOpName("x3"), {3.0f, 3.0f}, {1, 2}); auto a12 = ops::Add(s.WithOpName("a12").WithControlDependencies(x3), x1, x2); auto a23 = ops::Add(s.WithOpName("a23"), x2, x3); Output out1 = ops::Log(s.WithOpName("out1"), a12); Output out2 = ops::Log(s.WithOpName("out2"), a23); GrapplerItem item; item.fetch = {"out1", "out2"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 2); GraphDef got; ArithmeticOptimizer optimizer; EnableOnlyLog1p(&optimizer); OptimizeAndPrune(&optimizer, &item, &got); auto tensors = EvaluateNodes(got, item.fetch); ASSERT_EQ(tensors.size(), 2); for (int i = 0; i < 2; ++i) { EXPECT_EQ(tensors[i].NumElements(), tensors_expected[i].NumElements()); test::ExpectTensorNear<float>(tensors[i], tensors_expected[i], 1e-6); } GraphDef want; AddNode("x2", "Const", {}, {}, &want); AddNode("x3", "Const", {}, {}, &want); AddNode("a23", "Add", {"x2", "x3"}, {}, &want); AddNode("out1", "Log1p", {"x2", AsControlDependency("x3")}, {}, &want); AddNode("out2", "Log", {"a23"}, {}, &want); CompareGraphs(want, got); } TEST_F(ArithmeticOptimizerTest, Expm1) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x1 = ops::Const(s.WithOpName("x1"), {2.0f, 2.0f}, {1, 2}); auto x2 = ops::Const(s.WithOpName("x2"), {1.0f, 1.0f}, {1, 2}); auto x3 = ops::Const(s.WithOpName("x3"), {3.0f, 3.0f}, {1, 2}); auto exp1 = ops::Exp(s.WithOpName("exp1").WithControlDependencies(x3), x1); Output out1 = ops::Sub(s.WithOpName("out1"), exp1, x2); Output out2 = ops::Sub(s.WithOpName("out2"), exp1, x3); GrapplerItem item; item.fetch = {"out1", "out2"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 2); GraphDef got; ArithmeticOptimizer optimizer; EnableOnlyExpm1(&optimizer); OptimizeAndPrune(&optimizer, &item, &got); auto tensors = EvaluateNodes(got, item.fetch); ASSERT_EQ(tensors.size(), 2); for (int i = 0; i < 2; ++i) { EXPECT_EQ(tensors[i].NumElements(), tensors_expected[i].NumElements()); test::ExpectTensorNear<float>(tensors[i], tensors_expected[i], 1e-6); } GraphDef want; AddNode("x1", "Const", {}, {}, &want); AddNode("x3", "Const", {}, {}, &want); AddNode("exp1", "Exp", {"x1", AsControlDependency("x3")}, {}, &want); AddNode("out1", "Expm1", {"x1", AsControlDependency("x3")}, {}, &want); AddNode("out2", "Sub", {"exp1", "x3"}, {}, &want); CompareGraphs(want, got); } TEST_F(ArithmeticOptimizerTest, MinimizeBroadcasts_SimpleSwap) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto a = ops::Variable(s.WithOpName("a"), {32}, DT_FLOAT); auto b = ops::Variable(s.WithOpName("b"), {32, 32}, DT_FLOAT); auto c = ops::Variable(s.WithOpName("c"), {32}, DT_FLOAT); auto mul1 = ops::Mul(s.WithOpName("mul1"), a, b); auto mul2 = ops::Mul(s.WithOpName("mul2"), mul1, c); auto outputs = ops::Identity(s.WithOpName("outputs"), mul2); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto a_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({32})); auto b_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({32, 32})); auto c_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({32})); std::vector<std::pair<string, Tensor>> feed = { {"a", a_t}, {"b", b_t}, {"c", c_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyMinimizeBroadcasts(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); // We expect the following rewrite(s) to occur: // // * * // / \ / \ // * c --> * b // / \ / \ // a b a c NodeMap node_map(&output); const NodeDef* mul1_node = node_map.GetNode("mul1"); ASSERT_NE(mul1_node, nullptr); ASSERT_EQ(mul1_node->input_size(), 2); EXPECT_EQ(mul1_node->input(0), "a"); EXPECT_EQ(mul1_node->input(1), "c"); const NodeDef* mul2_node = node_map.GetNode("mul2"); ASSERT_NE(mul2_node, nullptr); ASSERT_EQ(mul2_node->input_size(), 2); EXPECT_EQ(mul2_node->input(0), "mul1"); EXPECT_EQ(mul2_node->input(1), "b"); auto tensors = EvaluateNodes(output, item.fetch, feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, MinimizeBroadcasts_FlattenTallGraph) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto a = ops::Variable(s.WithOpName("a"), {32}, DT_DOUBLE); auto b = ops::Variable(s.WithOpName("b"), {32, 32}, DT_DOUBLE); auto c = ops::Variable(s.WithOpName("c"), {32}, DT_DOUBLE); auto d = ops::Variable(s.WithOpName("d"), {32}, DT_DOUBLE); auto e = ops::Variable(s.WithOpName("e"), {32}, DT_DOUBLE); auto mul1 = ops::Mul(s.WithOpName("mul1"), a, b); auto mul2 = ops::Mul(s.WithOpName("mul2"), mul1, c); auto mul3 = ops::Mul(s.WithOpName("mul3"), mul2, d); auto mul4 = ops::Mul(s.WithOpName("mul4"), mul3, e); auto outputs = ops::Identity(s.WithOpName("outputs"), mul4); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto a_t = GenerateRandomTensor<DT_DOUBLE>(TensorShape({32})); auto b_t = GenerateRandomTensor<DT_DOUBLE>(TensorShape({32, 32})); auto c_t = GenerateRandomTensor<DT_DOUBLE>(TensorShape({32})); auto d_t = GenerateRandomTensor<DT_DOUBLE>(TensorShape({32})); auto e_t = GenerateRandomTensor<DT_DOUBLE>(TensorShape({32})); std::vector<std::pair<string, Tensor>> feed = { {"a", a_t}, {"b", b_t}, {"c", c_t}, {"d", d_t}, {"e", e_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyMinimizeBroadcasts(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); // We expect the following rewrite(s) to occur: Graph is "flattened" and // largest shape pushed to the top. // // * // / \ // * e * // / \ / \ // * d * b // / \ / \ // * c --> * * // / \ / \ / \ // a b a c d e NodeMap node_map(&output); const NodeDef* mul1_node = node_map.GetNode("mul1"); ASSERT_NE(mul1_node, nullptr); ASSERT_EQ(mul1_node->input_size(), 2); EXPECT_EQ(mul1_node->input(0), "a"); EXPECT_EQ(mul1_node->input(1), "c"); const NodeDef* mul2_node = node_map.GetNode("mul2"); ASSERT_NE(mul2_node, nullptr); ASSERT_EQ(mul2_node->input_size(), 2); EXPECT_EQ(mul2_node->input(0), "d"); EXPECT_EQ(mul2_node->input(1), "e"); const NodeDef* mul3_node = node_map.GetNode("mul3"); ASSERT_NE(mul3_node, nullptr); ASSERT_EQ(mul3_node->input_size(), 2); EXPECT_EQ(mul3_node->input(0), "mul1"); EXPECT_EQ(mul3_node->input(1), "mul2"); const NodeDef* mul4_node = node_map.GetNode("mul4"); ASSERT_NE(mul4_node, nullptr); ASSERT_EQ(mul4_node->input_size(), 2); EXPECT_EQ(mul4_node->input(0), "mul3"); EXPECT_EQ(mul4_node->input(1), "b"); auto tensors = EvaluateNodes(output, item.fetch, feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<double>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, MinimizeBroadcasts_BuildTreeUp) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); // [a, b, c] - scalars, [d] - matrix auto a = ops::Variable(s.WithOpName("a"), {32}, DT_FLOAT); auto b = ops::Variable(s.WithOpName("b"), {32}, DT_FLOAT); auto c = ops::Variable(s.WithOpName("c"), {32}, DT_FLOAT); auto d = ops::Variable(s.WithOpName("D"), {32, 32}, DT_FLOAT); auto mul1 = ops::Mul(s.WithOpName("mul1"), a, b); auto mul2 = ops::Mul(s.WithOpName("mul2"), c, d); auto mul3 = ops::Mul(s.WithOpName("mul3"), mul1, mul2); auto outputs = ops::Identity(s.WithOpName("outputs"), mul3); GrapplerItem item; item.fetch = {"outputs"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto a_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({32})); auto b_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({32})); auto c_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({32})); auto d_t = GenerateRandomTensor<DT_FLOAT>(TensorShape({32, 32})); std::vector<std::pair<string, Tensor>> feed = { {"a", a_t}, {"b", b_t}, {"c", c_t}, {"D", d_t}}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch, feed); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyMinimizeBroadcasts(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); // We expect the following rewrite(s) to occur: // // * // / \ // * * D // / \ / \ // * * -> * c // / \ / \ / \ // a b c D a b NodeMap node_map(&output); const NodeDef* mul1_node = node_map.GetNode("mul2"); ASSERT_NE(mul1_node, nullptr); ASSERT_EQ(mul1_node->input_size(), 2); EXPECT_EQ(mul1_node->input(0), "a"); EXPECT_EQ(mul1_node->input(1), "b"); const NodeDef* mul2_node = node_map.GetNode("mul1"); ASSERT_NE(mul2_node, nullptr); ASSERT_EQ(mul2_node->input_size(), 2); EXPECT_EQ(mul2_node->input(0), "mul2"); EXPECT_EQ(mul2_node->input(1), "c"); const NodeDef* mul3_node = node_map.GetNode("mul3"); ASSERT_NE(mul3_node, nullptr); ASSERT_EQ(mul3_node->input_size(), 2); EXPECT_EQ(mul3_node->input(0), "D"); EXPECT_EQ(mul3_node->input(1), "mul1"); auto tensors = EvaluateNodes(output, item.fetch, feed); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, DoNotHoistReluFromConcat) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output weights1 = ops::Const(s.WithOpName("weights1"), Input::Initializer(1.0f, {5, 5, 3, 4})); Output weights2 = ops::Const(s.WithOpName("weights2"), Input::Initializer(2.0f, {5, 5, 3, 4})); Output biases = ops::Const(s.WithOpName("biases"), Input::Initializer(2.0f, {4})); Output axis = ops::Const(s.WithOpName("axis"), 3, {}); Output input = ops::Const(s.WithOpName("input"), Input::Initializer(1.0f, {1, 28, 28, 3})); Output branch1 = ops::Conv2D(s.WithOpName("conv1"), input, weights1, {1, 1, 1, 1}, "SAME"); branch1 = ops::BiasAdd(s.WithOpName("biasadd1"), branch1, biases); branch1 = ops::Relu(s.WithOpName("relu1"), branch1); Output branch2 = ops::Conv2D(s.WithOpName("conv2"), input, weights2, {1, 1, 1, 1}, "SAME"); branch2 = ops::BiasAdd(s.WithOpName("biasadd2"), branch2, biases); branch2 = ops::Relu(s.WithOpName("relu2"), branch2); Output concat = ops::Concat(s.WithOpName("concat"), {branch1, branch2}, axis); Output output = ops::Identity(s.WithOpName("output"), concat); GrapplerItem item; item.fetch = {"output"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); GraphDef new_graph; ArithmeticOptimizer optimizer; OptimizeAndPrune(&optimizer, &item, &new_graph); // Verify that the two Relus are not hoisted. EXPECT_EQ(CountOpNodes(new_graph, "Relu"), 2); auto tensors = EvaluateNodes(new_graph, item.fetch); for (int i = 0; i < item.fetch.size(); ++i) { test::ExpectTensorNear<float>(tensors[i], tensors_expected[i], 1e-6); } } TEST_F(ArithmeticOptimizerTest, HoistCWiseUnaryFromConcat) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output a = ops::Const(s.WithOpName("a"), 3.14f, {32}); Output b = ops::Const(s.WithOpName("b"), 1.0f, {32}); Output c = ops::Const(s.WithOpName("c"), 42.0f, {32}); Output axis = ops::Const(s.WithOpName("axis"), 0, {}); Output ctrl1 = ops::Const(s.WithOpName("ctrl1"), 1, {}); Output ctrl2 = ops::Const(s.WithOpName("ctrl2"), 2, {}); Output ctrl3 = ops::Const(s.WithOpName("ctrl3"), 3, {}); // Test case with chains of length 1. // Rewrites // Concat({Exp(a), Exp(b), Exp(c)}) // into // Exp(Concat({a, b, c})). Output sin_a = ops::Sin(s.WithOpName("sin_a").WithControlDependencies(ctrl3), a); Output exp_a = ops::Exp(s.WithOpName("exp_a").WithControlDependencies(ctrl1), sin_a); Output exp_b = ops::Exp(s.WithOpName("exp_b"), b); Output exp_c = ops::Exp(s.WithOpName("exp_c").WithControlDependencies(ctrl2), c); Output concat = ops::Concat(s.WithOpName("concat"), {exp_a, exp_b, exp_c}, axis); Output id = ops::Identity(s.WithOpName("id"), concat); // Test case with chains of length 2. // Rewrites // Concat({Cos(Exp(a)), Cos(Exp(b)), Cos(Exp(c))}) // into // Cos(Exp(Concat({a, b, c}))). Output exp_a2 = ops::Exp(s.WithOpName("exp_a2").WithControlDependencies(ctrl1), sin_a); Output exp_b2 = ops::Exp(s.WithOpName("exp_b2"), b); Output exp_c2 = ops::Exp(s.WithOpName("exp_c2").WithControlDependencies(ctrl2), c); Output cos_exp_a2 = ops::Cos( s.WithOpName("cos_exp_a2").WithControlDependencies(ctrl1), exp_a2); Output cos_exp_b2 = ops::Cos( s.WithOpName("cos_exp_b2").WithControlDependencies(ctrl3), exp_b2); Output cos_exp_c2 = ops::Cos(s.WithOpName("cos_exp_c2"), exp_c2); Output concat2 = ops::Concat(s.WithOpName("concat2"), {cos_exp_a2, cos_exp_b2, cos_exp_c2}, axis); Output id2 = ops::Identity(s.WithOpName("id2"), concat2); GrapplerItem item; item.fetch = {"id", "id2"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyHoistCWiseUnaryChains(&optimizer); OptimizeTwiceAndPrune(&optimizer, &item, &output); int found = 0; for (const NodeDef& node : output.node()) { if (node.name() == "concat") { ASSERT_EQ(node.input_size(), 4); EXPECT_EQ(node.input(0), "sin_a"); EXPECT_EQ(node.input(1), "b"); EXPECT_EQ(node.input(2), "c"); EXPECT_EQ(node.input(3), "axis"); found++; } if (node.name() == "exp_a") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "concat"); found++; } if (node.name() == "id") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "exp_a"); found++; } if (node.name() == "concat2") { ASSERT_EQ(node.input_size(), 4); EXPECT_EQ(node.input(0), "sin_a"); EXPECT_EQ(node.input(1), "b"); EXPECT_EQ(node.input(2), "c"); EXPECT_EQ(node.input(3), "axis"); found++; } if (node.name() == "exp_a2") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "concat2"); found++; } if (node.name() == "cos_exp_a2") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "exp_a2"); found++; } if (node.name() == "id2") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "cos_exp_a2"); found++; } } EXPECT_EQ(found, 7); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), tensors_expected.size()); EXPECT_EQ(tensors.size(), item.fetch.size()); for (int i = 0; i < item.fetch.size(); ++i) { test::ExpectTensorNear<float>(tensors[i], tensors_expected[i], 1e-6); } } TEST_F(ArithmeticOptimizerTest, HoistCWiseUnaryIntoSplit) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output x = ops::Const(s.WithOpName("x"), 3.1415f, {32}); Output axis = ops::Const(s.WithOpName("axis"), 0, {}); Output ctrl1 = ops::Const(s.WithOpName("ctrl1"), 1, {}); Output ctrl2 = ops::Const(s.WithOpName("ctrl2"), 2, {}); Output ctrl3 = ops::Const(s.WithOpName("ctrl3"), 3, {}); // Test case with chains of length 1. // Rewrites // [Sin(y) for y in Split(x)] // into // [y for y in Split(Sin(x))]. ops::Split split1(s.WithOpName("split1"), axis, x, 2); Output sin_a = ops::Sin(s.WithOpName("sin_a").WithControlDependencies(ctrl1), split1[0]); Output id_a = ops::Identity(s.WithOpName("id_a"), sin_a); Output sin_b = ops::Sin(s.WithOpName("sin_b"), split1[1]); Output exp_b = ops::Exp(s.WithOpName("exp_b"), sin_b); Output id_b = ops::Identity(s.WithOpName("id_b"), exp_b); // Test case with SplitV and chains of length 2. // Rewrites // [Cos(Exp(y)) for y in Split(x)] // into // [y for y in Split(Cos(Exp(x)))]. Output size_splits2 = ops::Const(s.WithOpName("size_splits2"), {20, 12}, {2}); ops::SplitV split2(s.WithOpName("split2"), x, size_splits2, axis, 2); Output exp_a2 = ops::Exp( s.WithOpName("exp_a2").WithControlDependencies(ctrl1), split2[0]); Output exp_b2 = ops::Exp(s.WithOpName("exp_b2"), split2[1]); Output cos_exp_a2 = ops::Cos( s.WithOpName("cos_exp_a2").WithControlDependencies(ctrl2), exp_a2); Output cos_exp_b2 = ops::Cos( s.WithOpName("cos_exp_b2").WithControlDependencies(ctrl3), exp_b2); Output id_a2 = ops::Identity(s.WithOpName("id_a2"), cos_exp_a2); Output id_b2 = ops::Identity(s.WithOpName("id_b2"), cos_exp_b2); GrapplerItem item; item.fetch = {"id_a", "id_b", "id_a2", "id_b2"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyHoistCWiseUnaryChains(&optimizer); OptimizeTwiceAndPrune(&optimizer, &item, &output); int found = 0; for (const NodeDef& node : output.node()) { // The following 6 nodes should be pruned. EXPECT_NE(node.name(), "sin_a"); EXPECT_NE(node.name(), "sin_b"); EXPECT_NE(node.name(), "exp_a2"); EXPECT_NE(node.name(), "exp_b2"); EXPECT_NE(node.name(), "cos_exp_a2"); EXPECT_NE(node.name(), "cos_exp_b2"); if (node.name() == "split1") { ASSERT_EQ(node.input_size(), 2); EXPECT_EQ(node.input(0), "axis"); EXPECT_EQ(node.input(1), "ArithmeticOptimizer/_sin_a_split1"); found++; } if (node.name() == "ArithmeticOptimizer/_sin_a_split1") { EXPECT_EQ(node.op(), "Sin"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "x"); found++; } if (node.name() == "id_a") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "split1"); found++; } if (node.name() == "exp_b") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "split1:1"); found++; } if (node.name() == "id_b") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "exp_b"); found++; } if (node.name() == "ArithmeticOptimizer/_exp_a2_split2") { EXPECT_EQ(node.op(), "Exp"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "x"); found++; } if (node.name() == "ArithmeticOptimizer/_cos_exp_a2_split2") { EXPECT_EQ(node.op(), "Cos"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "ArithmeticOptimizer/_exp_a2_split2"); found++; } if (node.name() == "split2") { ASSERT_EQ(node.input_size(), 3); EXPECT_EQ(node.input(0), "ArithmeticOptimizer/_cos_exp_a2_split2"); EXPECT_EQ(node.input(1), "size_splits2"); EXPECT_EQ(node.input(2), "axis"); found++; } if (node.name() == "id_a2") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "split2"); found++; } if (node.name() == "id_b2") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "split2:1"); found++; } } EXPECT_EQ(found, 10); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), tensors_expected.size()); EXPECT_EQ(tensors.size(), item.fetch.size()); for (int i = 0; i < item.fetch.size(); ++i) { test::ExpectTensorNear<float>(tensors[i], tensors_expected[i], 1e-6); } } TEST_F(ArithmeticOptimizerTest, RemoveIdempotent) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output a = ops::Const(s.WithOpName("a"), 3.14f, {32}); Output sn1 = ops::Snapshot(s.WithOpName("sn1"), a); Output sn2 = ops::Snapshot(s.WithOpName("sn2"), sn1); Output out1 = ops::Identity(s.WithOpName("out1"), sn2); Output id1 = ops::Identity(s.WithOpName("id1"), a); Output id2 = ops::Identity(s.WithOpName("id2"), id1); Output out2 = ops::Identity(s.WithOpName("out2"), id2); GrapplerItem item; item.fetch = {"out1", "out2"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveIdempotent(&optimizer); OptimizeTwice(&optimizer, &item, &output); EXPECT_EQ(7, output.node_size()); int found = 0; for (const NodeDef& node : output.node()) { if (node.name() == "out1") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "sn1"); found++; } else if (node.name() == "out2") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "id1"); found++; } else if (node.name() == "sn1") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "a"); found++; } } EXPECT_EQ(found, 3); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), tensors_expected.size()); EXPECT_EQ(tensors.size(), item.fetch.size()); for (int i = 0; i < item.fetch.size(); ++i) { test::ExpectTensorNear<float>(tensors[i], tensors_expected[i], 1e-6); } } TEST_F(ArithmeticOptimizerTest, RemoveLogicalNot) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output a = ops::Const(s.WithOpName("a"), 3.14f, {32}); Output b = ops::Const(s.WithOpName("b"), -3.14f, {32}); Output eq = ops::Equal(s.WithOpName("eq"), a, b); Output neq = ops::NotEqual(s.WithOpName("neq"), a, b); Output lt = ops::Less(s.WithOpName("lt"), a, b); Output le = ops::LessEqual(s.WithOpName("le"), a, b); Output gt = ops::Greater(s.WithOpName("gt"), a, b); Output ge = ops::GreaterEqual(s.WithOpName("ge"), a, b); // not_eq is reserved Output not_eq1 = ops::LogicalNot(s.WithOpName("not_eq1"), eq); Output not_neq = ops::LogicalNot(s.WithOpName("not_neq"), neq); Output not_lt = ops::LogicalNot(s.WithOpName("not_lt"), lt); Output not_le = ops::LogicalNot(s.WithOpName("not_le"), le); Output not_gt = ops::LogicalNot(s.WithOpName("not_gt"), gt); Output not_ge = ops::LogicalNot(s.WithOpName("not_ge"), ge); Output id_not_eq = ops::Identity(s.WithOpName("id_not_eq"), not_eq1); Output id_not_neq = ops::Identity(s.WithOpName("id_not_neq"), not_neq); Output id_not_lt = ops::Identity(s.WithOpName("id_not_lt"), not_lt); Output id_not_le = ops::Identity(s.WithOpName("id_not_le"), not_le); Output id_not_gt = ops::Identity(s.WithOpName("id_not_gt"), not_gt); Output id_not_ge = ops::Identity(s.WithOpName("id_not_ge"), not_ge); GrapplerItem item; item.fetch = {"id_not_eq", "id_not_neq", "id_not_lt", "id_not_le", "id_not_gt", "id_not_ge"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveLogicalNot(&optimizer); OptimizeTwice(&optimizer, &item, &output); int found = 0; for (const NodeDef& node : output.node()) { if (node.name() == "id_not_eq") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "eq"); ++found; } if (node.name() == "id_not_neq") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "neq"); ++found; } if (node.name() == "id_not_lt") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "lt"); ++found; } if (node.name() == "id_not_le") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "le"); ++found; } if (node.name() == "id_not_gt") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "gt"); ++found; } if (node.name() == "id_not_ge") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "ge"); ++found; } if (node.name() == "eq") { EXPECT_EQ(node.op(), "NotEqual"); ++found; } if (node.name() == "neq") { EXPECT_EQ(node.op(), "Equal"); ++found; } if (node.name() == "lt") { EXPECT_EQ(node.op(), "GreaterEqual"); ++found; } if (node.name() == "le") { EXPECT_EQ(node.op(), "Greater"); ++found; } if (node.name() == "gt") { EXPECT_EQ(node.op(), "LessEqual"); ++found; } if (node.name() == "ge") { EXPECT_EQ(node.op(), "Less"); ++found; } } EXPECT_EQ(found, 12); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), tensors_expected.size()); EXPECT_EQ(tensors.size(), item.fetch.size()); for (int i = 0; i < item.fetch.size(); ++i) { test::ExpectTensorEqual<bool>(tensors[i], tensors_expected[i]); } } TEST_F(ArithmeticOptimizerTest, OptimizeMaxOrMinOfMonotonicElementWise) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x = ops::Const(s.WithOpName("x"), {1.0f, 2.0f}, {1, 2}); Output sqrt = ops::Sqrt(s.WithOpName("sqrt"), x); Output reduce_max = ops::Max(s.WithOpName("reduce_max"), sqrt, {0}); Output final_out = ops::Identity(s.WithOpName("final_out"), reduce_max); GrapplerItem item; item.fetch = {"final_out"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyOptimizeMaxOrMinOfMonotonic(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); EXPECT_EQ(output.node_size(), item.graph.node_size()); // Check if the inputs are switched int required_node_count = 0; for (int i = 0; i < output.node_size(); ++i) { const NodeDef& node = output.node(i); if (node.name() == "sqrt") { EXPECT_EQ(node.op(), "Sqrt"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "reduce_max"); ++required_node_count; } else if (node.name() == "reduce_max") { EXPECT_EQ(node.op(), "Max"); ASSERT_EQ(node.input_size(), 2); EXPECT_EQ(node.input(0), "x"); ++required_node_count; } } EXPECT_EQ(required_node_count, 2); } TEST_F(ArithmeticOptimizerTest, OptimizeArgMaxOrArgMinOfMonotonicElementWise) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); const auto x = ops::Const(s.WithOpName("x"), {1.0f, 2.0f}, {1, 2}); Output sqrt = ops::Sqrt(s.WithOpName("sqrt"), x); Output arg_max = ops::ArgMax(s.WithOpName("arg_max"), sqrt, 1); Output final_out = ops::Identity(s.WithOpName("final_out"), arg_max); GrapplerItem item; item.fetch = {"final_out"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); const auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyOptimizeMaxOrMinOfMonotonic(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); const auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorEqual<int64>(tensors[0], tensors_expected[0]); EXPECT_EQ(output.node_size(), item.graph.node_size() - 1); // Check if the inputs are switched int required_node_count = 0; for (int i = 0; i < output.node_size(); ++i) { const NodeDef& node = output.node(i); if (node.name() == "final_out") { EXPECT_EQ(node.op(), "Identity"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "arg_max"); ++required_node_count; } else if (node.name() == "arg_max") { EXPECT_EQ(node.op(), "ArgMax"); ASSERT_EQ(node.input_size(), 2); EXPECT_EQ(node.input(0), "x"); ++required_node_count; } } EXPECT_EQ(required_node_count, 2); } TEST_F(ArithmeticOptimizerTest, OptimizeMaxOrMinOfMonotonicElementWiseDoNotChangeFetchNode) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x = ops::Const(s.WithOpName("x"), {1.0f, 2.0f}, {1, 2}); Output sqrt = ops::Sqrt(s.WithOpName("sqrt"), x); Output reduce_max = ops::Max(s.WithOpName("reduce_max"), sqrt, {0}); Output final_out = ops::Identity(s.WithOpName("final_out"), reduce_max); GrapplerItem item; item.fetch = {"sqrt", "final_out"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); EXPECT_EQ(tensors_expected.size(), 2); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyOptimizeMaxOrMinOfMonotonic(&optimizer); OptimizeTwice(&optimizer, &item, &output); // Should be a NoOp since we are not allowed to change the output of fetch // nodes. VerifyGraphsMatch(item.graph, output, __LINE__); } TEST_F(ArithmeticOptimizerTest, OptimizeMaxOrMinOfMonotonicElementWiseDoNotChangeFetchNodeReduction) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x = ops::Const(s.WithOpName("x"), {2, 3}, {1, 2}); Output reshape = ops::Reshape(s.WithOpName("reshape"), x, {-1}); Output y = ops::Neg(s.WithOpName("y"), reshape); Output z = ops::Max(s.WithOpName("z"), y, {0}); GrapplerItem item; item.fetch = {"z"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyOptimizeMaxOrMinOfMonotonic(&optimizer); OptimizeTwice(&optimizer, &item, &output); // Should be a NoOp since we are not allowed to change the output of fetch // nodes. VerifyGraphsMatch(item.graph, output, __LINE__); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorEqual<int>(tensors[0], tensors_expected[0]); test::ExpectTensorEqual<int>(tensors[0], Tensor(-2)); } TEST_F(ArithmeticOptimizerTest, OptimizeMaxOrMinOfMonotonicElementWiseNonIncreasing) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x = ops::Const(s.WithOpName("x"), {1.0f, 2.0f}, {1, 2}); Output neg = ops::Neg(s.WithOpName("neg"), x); Output reduce_max = ops::Max(s.WithOpName("reduce_max"), neg, {0}); Output final_out = ops::Identity(s.WithOpName("final_out"), reduce_max); GrapplerItem item; item.fetch = {"final_out"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyOptimizeMaxOrMinOfMonotonic(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); EXPECT_EQ(output.node_size(), item.graph.node_size()); // Check if the inputs are switched int required_node_count = 0; for (int i = 0; i < output.node_size(); ++i) { const NodeDef& node = output.node(i); if (node.name() == "neg") { EXPECT_EQ(node.op(), "Neg"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "reduce_max"); ++required_node_count; } else if (node.name() == "reduce_max") { EXPECT_EQ(node.op(), "Min"); ASSERT_EQ(node.input_size(), 2); EXPECT_EQ(node.input(0), "x"); ++required_node_count; } } EXPECT_EQ(2, required_node_count); } TEST_F(ArithmeticOptimizerTest, OptimizeMaxOrMinOfMonotonicElementWiseNonIncreasingDoNotChangeMaxPool) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x = ops::Const(s.WithOpName("x"), 1.5f, {3, 3, 3, 1}); Output neg = ops::Neg(s.WithOpName("neg"), x); Output max_pool = ops::MaxPool(s.WithOpName("max_pool"), neg, {1, 2, 2, 1}, {1, 2, 2, 1}, "VALID"); GrapplerItem item; item.fetch = {"max_pool"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyOptimizeMaxOrMinOfMonotonic(&optimizer); OptimizeTwice(&optimizer, &item, &output); // Should be a NoOp VerifyGraphsMatch(item.graph, output, __LINE__); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, OptimizeMaxOrMinOfMonotonicBiasAddReluMaxPool) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output weights = ops::Const(s.WithOpName("weights"), Input::Initializer(1.0f, {5, 5, 3, 4})); Output biases = ops::Const(s.WithOpName("biases"), Input::Initializer(2.0f, {4})); Output input = ops::Const(s.WithOpName("input"), Input::Initializer(1.0f, {1, 28, 28, 3})); Output output = ops::Conv2D(s.WithOpName("conv"), input, weights, {1, 1, 1, 1}, "SAME"); output = ops::BiasAdd(s.WithOpName("biasadd"), output, biases); output = ops::Relu(s.WithOpName("relu"), output); output = ops::MaxPool(s.WithOpName("max_pool"), output, {1, 2, 2, 1}, {1, 2, 2, 1}, "VALID"); output = ops::Identity(s.WithOpName("output"), output); GrapplerItem item; item.fetch = {"output"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef new_graph; ArithmeticOptimizer optimizer; EnableOnlyOptimizeMaxOrMinOfMonotonic(&optimizer); OptimizeTwice(&optimizer, &item, &new_graph); // Should be a NoOp VerifyGraphsMatch(item.graph, new_graph, __LINE__); auto tensors = EvaluateNodes(new_graph, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, OptimizeMaxOrMinOfMonotonicElementWiseMaxPool) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x = ops::Const(s.WithOpName("x"), 1.5f, {3, 3, 3, 1}); Output sqrt = ops::Sqrt(s.WithOpName("sqrt"), x); Output max_pool = ops::MaxPool(s.WithOpName("max_pool"), sqrt, {1, 2, 2, 1}, {1, 2, 2, 1}, "VALID"); Output final_out = ops::Identity(s.WithOpName("final_out"), max_pool); GrapplerItem item; item.fetch = {"final_out"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyOptimizeMaxOrMinOfMonotonic(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); EXPECT_EQ(output.node_size(), item.graph.node_size()); // Check if the inputs are switched int required_node_count = 0; for (int i = 0; i < output.node_size(); ++i) { const NodeDef& node = output.node(i); if (node.name() == "sqrt") { EXPECT_EQ(node.op(), "Sqrt"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "max_pool"); ++required_node_count; } else if (node.name() == "max_pool") { EXPECT_EQ(node.op(), "MaxPool"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "x"); ++required_node_count; } } EXPECT_EQ(required_node_count, 2); } TEST_F(ArithmeticOptimizerTest, UnaryOpsComposition) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto x = ops::Const(s.WithOpName("x"), {1.0f, 2.0f}, {1, 2}); Output sqrt = ops::Sqrt(s.WithOpName("sqrt"), x); Output log = ops::Log(s.WithOpName("log"), sqrt); Output relu = ops::Relu(s.WithOpName("relu"), log); Output final_out = ops::Identity(s.WithOpName("final_out"), relu); GrapplerItem item; item.fetch = {"final_out"}; TF_CHECK_OK(s.ToGraphDef(&item.graph)); // Place all nodes on CPU. for (int i = 0; i < item.graph.node_size(); ++i) { item.graph.mutable_node(i)->set_device("/device:CPU:0"); } auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyUnaryOpsComposition(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); EXPECT_EQ(output.node_size(), 3); // Check that Sqrt/Log/Relu were replaced with a single op. int required_node_count = 0; for (int i = 0; i < output.node_size(); ++i) { const NodeDef& node = output.node(i); if (node.name() == "final_out") { EXPECT_EQ(node.op(), "Identity"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "relu/unary_ops_composition"); ++required_node_count; } else if (node.name() == "relu/unary_ops_composition") { EXPECT_EQ(node.op(), "_UnaryOpsComposition"); ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "x"); auto op_names = node.attr().at("op_names").list().s(); ASSERT_EQ(op_names.size(), 3); EXPECT_EQ(op_names[0], "Sqrt"); EXPECT_EQ(op_names[1], "Log"); EXPECT_EQ(op_names[2], "Relu"); ++required_node_count; } } EXPECT_EQ(required_node_count, 2); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorNear<float>(tensors[0], tensors_expected[0], 1e-6); } TEST_F(ArithmeticOptimizerTest, RemoveStackStridedSliceSameAxis) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); auto a_in = ops::Const(s.WithOpName("a_in"), {1.0f, 2.0f, 3.0f, 4.0f}, {2, 2}); auto b_in = ops::Const(s.WithOpName("b_in"), {-1.0f, -2.0f, -3.0f, -4.0f}, {2, 2}); auto c_in = ops::Const(s.WithOpName("c_in"), {5.0f, 6.0f, 7.0f, 8.0f}, {2, 2}); auto a = ops::PlaceholderWithDefault(s.WithOpName("a"), a_in, PartialTensorShape({-1, -1})); auto b = ops::PlaceholderWithDefault(s.WithOpName("b"), b_in, PartialTensorShape({-1, -1})); auto c = ops::PlaceholderWithDefault(s.WithOpName("c"), c_in, PartialTensorShape({-1, -1})); // stacked = tf.stack((a, b, c), axis=1). // stacked.shape == [2, 3, 2] (a, b, c are stacked along new axis 1) auto stacked = ops::Stack(s.WithOpName("stacked"), {a.output, b.output, c.output}, ops::Stack::Axis(1)); auto expanded_a = ops::ExpandDims(s.WithOpName("expanded_a"), a, {1}); auto expanded_b = ops::ExpandDims(s.WithOpName("expanded_b"), b, {1}); auto expanded_c = ops::ExpandDims(s.WithOpName("expanded_c"), c, {1}); auto begin_a = ops::Const(s.WithOpName("begin_a"), {0, 0, 0}, {3}); auto end_a = ops::Const(s.WithOpName("end_a"), {0, 1, 0}, {3}); auto begin_b = ops::Const(s.WithOpName("begin_b"), {0, 1, 0}, {3}); auto end_b = ops::Const(s.WithOpName("end_b"), {0, 2, 0}, {3}); auto begin_c = ops::Const(s.WithOpName("begin_c"), {0, 2, 0}, {3}); auto end_c = ops::Const(s.WithOpName("end_c"), {0, 3, 0}, {3}); auto end_c_1to = ops::Const(s.WithOpName("begin_c_2to"), {0, 0, 0}, {3}); auto strides = ops::Const(s.WithOpName("strides"), {1, 1, 1}, {3}); // stacked[:, 0] using SS = ops::StridedSlice; auto pa_slice = ops::Identity( s.WithOpName("pa_slice_out"), SS(s.WithOpName("pa_slice"), stacked, begin_a, end_a, strides, SS::BeginMask(0b0101) // 5 .EllipsisMask(0) .EndMask(0b0101) // 5 .NewAxisMask(0) .ShrinkAxisMask(0b0010))); // 2 // stacked[:, 1] auto pb_slice = ops::Identity( s.WithOpName("pb_slice_out"), SS(s.WithOpName("pb_slice"), stacked, begin_b, end_b, strides, SS::BeginMask(0b0101) // 5 .EllipsisMask(0) .EndMask(0b0101) // 5 .NewAxisMask(0) .ShrinkAxisMask(0b0010))); // 2 // stacked[:, 2] auto pc_slice = ops::Identity( s.WithOpName("pc_slice_out"), SS(s.WithOpName("pc_slice"), stacked, begin_c, end_c, strides, SS::BeginMask(0b0101) // 5 .EllipsisMask(0) .EndMask(0b0101) // 5 .NewAxisMask(0) .ShrinkAxisMask(0b0010))); // 2 // stacked[:, 0:1, :] auto pa_slice_01 = ops::Identity( s.WithOpName("pa_slice_01_out"), SS(s.WithOpName("pa_slice_01"), stacked, begin_a, end_a, strides, SS::BeginMask(0b0101) // 5 .EllipsisMask(0) .EndMask(0b0101) // 5 .NewAxisMask(0) .ShrinkAxisMask(0))); // stacked[:, :1, :] auto pa_slice_to1 = ops::Identity( s.WithOpName("pa_slice_to1_out"), SS(s.WithOpName("pa_slice_to1"), stacked, begin_a, end_a, strides, SS::BeginMask(0b0111) // 7 .EllipsisMask(0) .EndMask(0b0101) // 5 .NewAxisMask(0) .ShrinkAxisMask(0))); // stacked[:, 1:2, :] auto pb_slice_12 = ops::Identity( s.WithOpName("pb_slice_12_out"), SS(s.WithOpName("pb_slice_12"), stacked, begin_b, end_b, strides, SS::BeginMask(0b0101) // 5 .EllipsisMask(0) .EndMask(0b0101) // 5 .NewAxisMask(0) .ShrinkAxisMask(0))); // stacked[:, 2:, :]. auto pc_slice_2to = ops::Identity( s.WithOpName("pc_slice_2to_out"), SS(s.WithOpName("pc_slice_2to"), stacked, begin_c, end_c_1to, strides, SS::BeginMask(0b0101) // 5 .EllipsisMask(0) .EndMask(0b0111) // 7 .NewAxisMask(0) .ShrinkAxisMask(0))); GrapplerItem item; item.fetch = {"a", "b", "c", "pa_slice_out", "pb_slice_out", "pc_slice_out", "expanded_a", "expanded_b", "expanded_c", "pa_slice_01_out", "pa_slice_to1_out", "pb_slice_12_out", "pc_slice_2to_out"}; enum FetchItem { fA, fB, fC, fASliceOut, fBSliceOut, fCSliceOut, fExpandedA, fExpandedB, fExpandedC, fASlice01Out, fASliceTo1Out, fBSlice12Out, fCSlice2ToOut, }; TF_CHECK_OK(s.ToGraphDef(&item.graph)); auto tensors_expected = EvaluateNodes(item.graph, item.fetch); // stacked[:, 0, :] == a. test::ExpectTensorEqual<float>(tensors_expected[fASliceOut], tensors_expected[fA]); // stacked[:, 1, :] == b. test::ExpectTensorEqual<float>(tensors_expected[fBSliceOut], tensors_expected[fB]); // stacked[:, 2, :] == c. test::ExpectTensorEqual<float>(tensors_expected[fCSliceOut], tensors_expected[fC]); // stacked[:, 0:1, :] == expand_dims(a, 1). test::ExpectTensorEqual<float>(tensors_expected[fASlice01Out], tensors_expected[fExpandedA]); // stacked[:, :1, :] == expand_dims(a, 1). test::ExpectTensorEqual<float>(tensors_expected[fASliceTo1Out], tensors_expected[fExpandedA]); // stacked[:, 1:2, :] == expand_dims(b, 1). test::ExpectTensorEqual<float>(tensors_expected[fBSlice12Out], tensors_expected[fExpandedB]); // stacked[:, 2:, :] == expand_dims(c, 1). test::ExpectTensorEqual<float>(tensors_expected[fCSlice2ToOut], tensors_expected[fExpandedC]); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlyRemoveStackStridedSliceSameAxis(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); for (const auto& node : output.node()) { if (node.name() == "pa_slice_out") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "a"); } else if (node.name() == "pb_slice_out") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "b"); } else if (node.name() == "pc_slice_out") { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ(node.input(0), "c"); } else if (str_util::EndsWith(node.name(), "_out")) { ASSERT_EQ(node.input_size(), 1); EXPECT_EQ( absl::StrCat(node.input(0), "_out"), absl::StrCat("ArithmeticOptimizer/RemoveStackStridedSliceSameAxis_", node.name())); } } auto tensors = EvaluateNodes(output, item.fetch); // stacked[:, 0, :] == a. test::ExpectTensorEqual<float>(tensors[fASliceOut], tensors_expected[fA]); // stacked[:, 1, :] == b. test::ExpectTensorEqual<float>(tensors[fBSliceOut], tensors_expected[fB]); // stacked[:, 2, :] == c. test::ExpectTensorEqual<float>(tensors[fCSliceOut], tensors_expected[fC]); // stacked[:, 0:1, :] == expand_dims(a, 1). test::ExpectTensorEqual<float>(tensors[fASlice01Out], tensors_expected[fExpandedA]); // stacked[:, :1, :] == expand_dims(a, 1). test::ExpectTensorEqual<float>(tensors[fASliceTo1Out], tensors_expected[fExpandedA]); // stacked[:, 1:2, :] == expand_dims(b, 1). test::ExpectTensorEqual<float>(tensors[fBSlice12Out], tensors_expected[fExpandedB]); // stacked[:, 2:, :] == expand_dims(c, 1). test::ExpectTensorEqual<float>(tensors[fCSlice2ToOut], tensors_expected[fExpandedC]); } TEST_F(ArithmeticOptimizerTest, SimplifyAggregationBFloat16) { tensorflow::Scope s = tensorflow::Scope::NewRootScope(); Output x = ops::Const(s.WithOpName("x"), {1.0f, 2.0f}, {1, 2}); Output cast = ops::Cast(s.WithOpName("cast"), x, DT_BFLOAT16); Output add = ops::AddN(s.WithOpName("add"), {cast, cast}); Output id = ops::Identity(s.WithOpName("id"), add); GrapplerItem item; TF_CHECK_OK(s.ToGraphDef(&item.graph)); item.fetch = {"id"}; auto tensors_expected = EvaluateNodes(item.graph, item.fetch); ASSERT_EQ(tensors_expected.size(), 1); GraphDef output; ArithmeticOptimizer optimizer; EnableOnlySimplifyAggregation(&optimizer); OptimizeAndPrune(&optimizer, &item, &output); // Extra node created for multiplier. EXPECT_EQ(output.node_size(), 5); auto tensors = EvaluateNodes(output, item.fetch); ASSERT_EQ(tensors.size(), 1); test::ExpectTensorEqual<bfloat16>(tensors[0], tensors_expected[0]); } } // namespace grappler } // namespace tensorflow
{ "content_hash": "61e2a516b377f5ae54ae53a3fcca7be2", "timestamp": "", "source": "github", "line_count": 4067, "max_line_length": 80, "avg_line_length": 38.52962871895746, "alnum_prop": 0.6365283982131461, "repo_name": "jhseu/tensorflow", "id": "4c703439420a2371f5431c62515249a38e31833f", "size": "157368", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tensorflow/core/grappler/optimizers/arithmetic_optimizer_test.cc", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "27480" }, { "name": "Batchfile", "bytes": "49527" }, { "name": "C", "bytes": "875455" }, { "name": "C#", "bytes": "8562" }, { "name": "C++", "bytes": "80051513" }, { "name": "CMake", "bytes": "6500" }, { "name": "Dockerfile", "bytes": "112748" }, { "name": "Go", "bytes": "1853641" }, { "name": "HTML", "bytes": "4686483" }, { "name": "Java", "bytes": "961600" }, { "name": "Jupyter Notebook", "bytes": "549457" }, { "name": "LLVM", "bytes": "6536" }, { "name": "MLIR", "bytes": "1729057" }, { "name": "Makefile", "bytes": "62498" }, { "name": "Objective-C", "bytes": "116558" }, { "name": "Objective-C++", "bytes": "304661" }, { "name": "PHP", "bytes": "4236" }, { "name": "Pascal", "bytes": "318" }, { "name": "Pawn", "bytes": "19515" }, { "name": "Perl", "bytes": "7536" }, { "name": "Python", "bytes": "36791185" }, { "name": "RobotFramework", "bytes": "891" }, { "name": "Roff", "bytes": "2705" }, { "name": "Ruby", "bytes": "7464" }, { "name": "SWIG", "bytes": "56741" }, { "name": "Shell", "bytes": "685877" }, { "name": "Smarty", "bytes": "35147" }, { "name": "Starlark", "bytes": "3504187" }, { "name": "Swift", "bytes": "62814" }, { "name": "Vim Snippet", "bytes": "58" } ], "symlink_target": "" }
package org.nem.ncc.controller.viewmodels; import net.minidev.json.*; import org.hamcrest.core.*; import org.junit.*; import org.nem.core.model.AccountStatus; import org.nem.core.serialization.JsonSerializer; import org.nem.ncc.test.Utils; import java.util.*; public class AccountTransactionsPairTest { @Test public void canCreateMetaDataPair() { // Arrange: final AccountViewModel account = new AccountViewModel(Utils.generateRandomAccountInfo(), AccountStatus.LOCKED, null); final List<TransferViewModel> transactions = new ArrayList<>(); final AccountTransactionsPair pair = new AccountTransactionsPair(account, transactions); // Assert: Assert.assertThat(pair.getAccount(), IsSame.sameInstance(account)); Assert.assertThat(pair.getTransactions(), IsSame.sameInstance(transactions)); } @Test public void canSerializeMetaDataPair() { // Arrange: final AccountViewModel account = new AccountViewModel(Utils.generateRandomAccountInfo(), AccountStatus.LOCKED, null); final List<TransferViewModel> transactions = new ArrayList<>(); final AccountTransactionsPair pair = new AccountTransactionsPair(account, transactions); // Act: final JSONObject jsonObject = JsonSerializer.serializeToJson(pair); // Assert: Assert.assertThat(jsonObject.size(), IsEqual.equalTo(8)); Assert.assertThat(jsonObject.get("address"), IsEqual.equalTo(account.getAddress().getEncoded())); Assert.assertThat(((JSONArray)jsonObject.get("transactions")).size(), IsEqual.equalTo(0)); } }
{ "content_hash": "35fe5f6c62f795c509ba4355addb1c0a", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 119, "avg_line_length": 36.68292682926829, "alnum_prop": 0.7772606382978723, "repo_name": "lcharles123/NemCommunityClient", "id": "6a55b668d7becc2fd065eeef74fc9dd219c21828", "size": "1504", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "nem-client-api/src/test/java/org/nem/ncc/controller/viewmodels/AccountTransactionsPairTest.java", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en-us" xml:lang="en-us"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="copyright" content="(C) Copyright 2005"/> <meta name="DC.rights.owner" content="(C) Copyright 2005"/> <meta name="DC.Type" content="reference"/> <meta name="DC.Title" content="cxxUnionDeclarationFileLineStart"/> <meta name="abstract" content="The &lt;cxxUnionDeclarationFileLineStart&gt; element specifies the beginning of the union definition."/> <meta name="description" content="The &lt;cxxUnionDeclarationFileLineStart&gt; element specifies the beginning of the union definition."/> <meta name="DC.Relation" scheme="URI" content="../cxxUnion/cxxUnion_module.html"/> <meta name="DC.Format" content="XHTML"/> <meta name="DC.Identifier" content="cxxUnionDeclarationFileLineStart"/> <meta name="DC.Language" content="en-us"/> <link rel="stylesheet" type="text/css" href="../commonltr.css"/> <title>cxxUnionDeclarationFileLineStart</title> <link rel="stylesheet" type="text/css" href="../nokiacxxref.css"/></head> <body class="element" id="cxxUnionDeclarationFileLineStart"><a name="cxxUnionDeclarationFileLineStart"><!-- --></a> <h1 class="topictitle1">cxxUnionDeclarationFileLineStart</h1> <div><p>The &lt;cxxUnionDeclarationFileLineStart&gt; element specifies the beginning of the union definition.</p> <div class="section"><h2 class="sectiontitle">Description</h2> <p>The &lt;cxxUnionDeclarationFileLineStart&gt; element is declared within &lt;cxxUnionAPIItemLocation&gt;. It contains the line number that the union declaration begins on. The element is empty but for the required attributes <em>name</em> and <em>value</em>. The attribute <em>name</em> must be set to "lineNumber". The attribute <em>value</em> is set to the line number where union declaration begins.</p> </div> <div class="example"><h2 class="sectiontitle">Example</h2> <pre class="codeblock">&lt;cxxUnionDeclarationFileLineStart name="lineNumber" value="58"/&gt;</pre> </div> <div class="elementContainedBy"><h2 class="sectiontitle">Contained by</h2> <p id="cxxUnionDeclarationFileLineStart__d13857e15886"><a name="cxxUnionDeclarationFileLineStart__d13857e15886"><!-- --></a> <a href="cxxUnionAPIItemLocation.html" title="Contains child elements specifying the location of the union.">cxxUnionAPIItemLocation</a> </p> </div> <div class="elementContains"><h2 class="sectiontitle">Contains</h2> <p id="cxxUnionDeclarationFileLineStart__d13857e15898"><a name="cxxUnionDeclarationFileLineStart__d13857e15898"><!-- --></a> </p> </div> <div class="elementContentModel"><h2 class="sectiontitle">Content Model</h2> <p id="cxxUnionDeclarationFileLineStart__d13857e15907"><a name="cxxUnionDeclarationFileLineStart__d13857e15907"><!-- --></a> No content. </p> </div> <div class="elementAttList"/> <div class="elementClassValue"><h2 class="sectiontitle">Inheritance</h2> <p id="cxxUnionDeclarationFileLineStart__d13857e15918"><a name="cxxUnionDeclarationFileLineStart__d13857e15918"><!-- --></a> topic/<span class="keyword">state</span> reference/<span class="keyword">state</span> apiRef/<span class="keyword">apiQualifier</span> apiUnionifier/<span class="keyword">apiQualifier</span> cxxUnion/<span class="keyword">cxxUnionDeclarationFileLineStart</span></p> </div> </div> <div> <div class="familylinks"> <div class="parentlink"><strong>Parent topic:</strong> <a href="../cxxUnion/cxxUnion_module.html" title="Defines a top-level container for all the elements necessary to describe a C++ union.">cxxUnion module</a></div> </div> </div> </body> </html>
{ "content_hash": "f152702baf0ae7007eade758577a99a4", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 266, "avg_line_length": 47.390243902439025, "alnum_prop": 0.7192485846628924, "repo_name": "prio/cxxapiref", "id": "c778d32f27823f58ed9a316f8ca46c46049480e9", "size": "3886", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/html/cxxUnion/cxxUnionDeclarationFileLineStart.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C++", "bytes": "2834" } ], "symlink_target": "" }
@interface DDAppDelegate : NSObject <NSApplicationDelegate> @property (assign) IBOutlet NSWindow *window; @property (assign) IBOutlet DDModifiedQL *view; @end
{ "content_hash": "ca6f0c012a835727446973b2212e4513", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 59, "avg_line_length": 26.833333333333332, "alnum_prop": 0.7950310559006211, "repo_name": "Daij-Djan/QuicklookAdditionalViews", "id": "fc1847ebc1e4d560c246cad612fa38b1be463c75", "size": "353", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "QLPreviewPanel+AdditionalViewsDemo/DDAppDelegate.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Objective-C", "bytes": "18485" }, { "name": "Ruby", "bytes": "786" } ], "symlink_target": "" }
using System; namespace iRuler.Utility { /// <summary> /// Summary description for iRuleInfo. /// </summary> public class iRuleInfo { public enum RuleType { LOCALLB = 0, GLOBALLB = 1, CONFIG = 2 }; public RuleType rule_type = RuleType.LOCALLB; public String rule_name = ""; public String rule_details = ""; public String original_rule_details = ""; public bool modified = false; public DateTime download_time; public iRuleInfo() { download_time = DateTime.Now; } public iRuleInfo(String rulename, String ruledetails, bool rulemodified) { rule_name = rulename; rule_details = ruledetails; original_rule_details = ruledetails; modified = rulemodified; } public TimeSpan Age() { return DateTime.Now - download_time; } } }
{ "content_hash": "d458a67e43a00e823743d4b8709521f3", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 74, "avg_line_length": 21.875, "alnum_prop": 0.6091428571428571, "repo_name": "F5Networks/f5-irule-editor", "id": "5641b690b4acabe8eae570ead0a1cc9867a3a6f1", "size": "2651", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "iRuler/Utility/iRuleInfo.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "371177" }, { "name": "HTML", "bytes": "38416" } ], "symlink_target": "" }
package com.av.autopivot; import static com.av.csv.discover.CSVDiscovery.isDate; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Properties; import java.util.Set; import java.util.logging.Logger; import com.qfs.chunk.impl.Chunks; import com.qfs.desc.*; import com.qfs.pivot.cube.provider.multi.IMultipleAggregateProvider; import com.quartetfs.biz.pivot.postprocessing.IPostProcessorConstants; import org.springframework.core.env.Environment; import com.av.csv.CSVFormat; import com.qfs.desc.IOptimizationDescription.Optimization; import com.qfs.desc.impl.FieldDescription; import com.qfs.desc.impl.OptimizationDescription; import com.qfs.desc.impl.StoreDescription; import com.qfs.platform.IPlatform; import com.qfs.store.part.IPartitioningDescription; import com.qfs.store.part.impl.ModuloFunctionDescription; import com.qfs.store.part.impl.PartitioningDescriptionBuilder; import com.qfs.store.selection.impl.SelectionField; import com.qfs.util.impl.QfsArrays; import com.quartetfs.biz.pivot.cube.dimension.IDimension.DimensionType; import com.quartetfs.biz.pivot.cube.hierarchy.ILevelInfo.LevelType; import com.quartetfs.biz.pivot.cube.hierarchy.measures.IMeasureHierarchy; import com.quartetfs.biz.pivot.definitions.IActivePivotDescription; import com.quartetfs.biz.pivot.definitions.IActivePivotInstanceDescription; import com.quartetfs.biz.pivot.definitions.IActivePivotManagerDescription; import com.quartetfs.biz.pivot.definitions.IActivePivotSchemaDescription; import com.quartetfs.biz.pivot.definitions.IActivePivotSchemaInstanceDescription; import com.quartetfs.biz.pivot.definitions.IAggregateProviderDefinition; import com.quartetfs.biz.pivot.definitions.IAggregatedMeasureDescription; import com.quartetfs.biz.pivot.definitions.IAggregatesCacheDescription; import com.quartetfs.biz.pivot.definitions.IAxisHierarchyDescription; import com.quartetfs.biz.pivot.definitions.IAxisLevelDescription; import com.quartetfs.biz.pivot.definitions.ICatalogDescription; import com.quartetfs.biz.pivot.definitions.INativeMeasureDescription; import com.quartetfs.biz.pivot.definitions.IPostProcessorDescription; import com.quartetfs.biz.pivot.definitions.impl.ActivePivotDescription; import com.quartetfs.biz.pivot.definitions.impl.ActivePivotInstanceDescription; import com.quartetfs.biz.pivot.definitions.impl.ActivePivotManagerDescription; import com.quartetfs.biz.pivot.definitions.impl.ActivePivotSchemaDescription; import com.quartetfs.biz.pivot.definitions.impl.ActivePivotSchemaInstanceDescription; import com.quartetfs.biz.pivot.definitions.impl.AggregateProviderDefinition; import com.quartetfs.biz.pivot.definitions.impl.AggregatedMeasureDescription; import com.quartetfs.biz.pivot.definitions.impl.AggregatesCacheDescription; import com.quartetfs.biz.pivot.definitions.impl.AxisDimensionDescription; import com.quartetfs.biz.pivot.definitions.impl.AxisDimensionsDescription; import com.quartetfs.biz.pivot.definitions.impl.AxisHierarchyDescription; import com.quartetfs.biz.pivot.definitions.impl.AxisLevelDescription; import com.quartetfs.biz.pivot.definitions.impl.CatalogDescription; import com.quartetfs.biz.pivot.definitions.impl.MeasuresDescription; import com.quartetfs.biz.pivot.definitions.impl.NativeMeasureDescription; import com.quartetfs.biz.pivot.definitions.impl.PostProcessorDescription; import com.quartetfs.biz.pivot.definitions.impl.SelectionDescription; /** * * Describe the components of an ActivePivot application * automatically based on the input data format. * * @author ActiveViam * */ public class AutoPivotGenerator { /** Logger **/ protected static Logger LOGGER = Logger.getLogger(AutoPivotGenerator.class.getName()); /** Default name of the base store */ public static final String BASE_STORE = "DATA"; /** Default name of the base pivot */ public static final String PIVOT = "AUTOPIVOT"; /** Default format for double measures */ public static final String DOUBLE_FORMAT = "DOUBLE[#,###.00;-#,###.00]"; /** Default format for integer measures */ public static final String INTEGER_FORMAT = "INT[#,###;-#,###]"; /** Default format for time levels */ public static final String TIME_FORMAT = "DATE[HH:mm:ss]"; /** * * Generate a store description based on the discovery of the input data. * * @param format * @return store description */ public IStoreDescription createStoreDescription(CSVFormat format, Environment env) { List<IFieldDescription> fields = new ArrayList<>(); for(int c = 0; c < format.getColumnCount(); c++) { String columnName = format.getColumnName(c); String columnType = format.getColumnType(c); FieldDescription desc = new FieldDescription(columnName, columnType); // For date fields automatically add YEAR - MONTH - DAY fields if(isDate(columnType)) { FieldDescription year = new FieldDescription(columnName + ".YEAR", "int"); FieldDescription month = new FieldDescription(columnName + ".MONTH", "int"); FieldDescription day = new FieldDescription(columnName + ".DAY", "int"); fields.add(year); fields.add(month); fields.add(day); } fields.add(desc); } // Partitioning IPartitioningDescription partitioning = createPartitioningDescription(format, env); @SuppressWarnings("unchecked") StoreDescription desc = new StoreDescription(BASE_STORE, Collections.EMPTY_LIST, fields, partitioning, Collections.emptyList(), false, Chunks.DEFAULT_CHUNK_SIZE, (IDuplicateKeyHandler)null, (IStoreDescriptionBuilder.IRemoveUnknownKeyListener)null, (Properties)null, (INumaSelectorDescription)null, false); return desc; } /** * * Automatically configure the partitioning of the datastore. * The first non floating point field is used as the partitioning * field, and the number of partitions is half the number * of cores. * * @param format * @return partitioning description */ public IPartitioningDescription createPartitioningDescription(CSVFormat format, Environment env) { int processorCount = IPlatform.CURRENT_PLATFORM.getProcessorCount(); int partitionCount = processorCount/2; if(partitionCount > 1) { String partitioningField = env.getProperty("datastore.partitioningField"); if(partitioningField != null) { for(int c = 0; c < format.getColumnCount(); c++) { String fieldName = format.getColumnName(c); if(fieldName.equalsIgnoreCase(partitioningField)) { return new PartitioningDescriptionBuilder() .addSubPartitioning(fieldName, new ModuloFunctionDescription(partitionCount)) .build(); } } LOGGER.warning("Configured partitioning field '" + partitioningField + "' does not exist in input file format. Default partitioning will be used."); } // Default partitioning, partition on the first field // that is not numerical for(int c = 0; c < format.getColumnCount(); c++) { String fieldName = format.getColumnName(c); String fieldType = format.getColumnType(c); if(!"float".equalsIgnoreCase(fieldType) && !"double".equalsIgnoreCase(fieldType) && !"long".equalsIgnoreCase(fieldType)) { LOGGER.info("Applying default partitioning policy: " + partitionCount + " partitions with partitioning field '" + fieldName + "'"); return new PartitioningDescriptionBuilder() .addSubPartitioning(fieldName, new ModuloFunctionDescription(partitionCount)) .build(); } } } return null; } /** * * Create the description of an ActivePivot cube automatically, * based on the description of the input dataset. * * @param format * @return AcivePivot description */ public IActivePivotDescription createActivePivotDescription(CSVFormat format, Environment env) { ActivePivotDescription desc = new ActivePivotDescription(); IAggregateProviderDefinition apd = new AggregateProviderDefinition(IMultipleAggregateProvider.DEFAULT_UNDERLYINGPROVIDER_PLUGINKEY); desc.setAggregateProvider(apd); // Hierarchies and dimensions AxisDimensionsDescription dimensions = new AxisDimensionsDescription(); Set<String> numerics = QfsArrays.mutableSet("double", "float", "int", "long"); Set<String> integers = QfsArrays.mutableSet("int", "long"); Set<String> decimals = QfsArrays.mutableSet("double", "float"); Set<String> numericsOnly = QfsArrays.mutableSet("double", "float", "long"); for(int f = 0; f < format.getColumnCount(); f++) { String fieldName = format.getColumnName(f); String fieldType = format.getColumnType(f); if(!numericsOnly.contains(fieldType)) { AxisDimensionDescription dimension = new AxisDimensionDescription(fieldName); IAxisHierarchyDescription h = new AxisHierarchyDescription(fieldName); IAxisLevelDescription l = new AxisLevelDescription(fieldName); h.getLevels().add(l); dimension.getHierarchies().add(h); dimensions.addValues(Arrays.asList(dimension)); // For date fields generate the YEAR-MONTH-DAY hierarchy if(isDate(fieldType)) { dimension.setDimensionType(DimensionType.TIME); List<IAxisHierarchyDescription> hierarchies = new ArrayList<>(); IAxisHierarchyDescription hierarchy = new AxisHierarchyDescription(fieldName); hierarchy.setDefaultHierarchy(true); IAxisLevelDescription dateLevel = new AxisLevelDescription(fieldName); dateLevel.setLevelType(LevelType.TIME); hierarchy.setLevels(Arrays.asList(dateLevel)); hierarchies.add(hierarchy); IAxisHierarchyDescription ymd = new AxisHierarchyDescription(fieldName + "_YMD"); List<IAxisLevelDescription> levels = new ArrayList<>(); levels.add(new AxisLevelDescription("Year", fieldName + ".YEAR")); levels.add(new AxisLevelDescription("Month", fieldName + ".MONTH")); levels.add(new AxisLevelDescription("Day", fieldName + ".DAY")); ymd.setLevels(levels); hierarchies.add(ymd); dimension.setHierarchies(hierarchies); } } } desc.setAxisDimensions(dimensions); // Measures MeasuresDescription measureDesc = new MeasuresDescription(); List<IAggregatedMeasureDescription> measures = new ArrayList<>(); List<IPostProcessorDescription> postProcessors = new ArrayList<>(); for(int f = 0; f < format.getColumnCount(); f++) { String fieldName = format.getColumnName(f).trim(); String fieldType = format.getColumnType(f); if(numerics.contains(fieldType) && !fieldName.endsWith("id") && !fieldName.endsWith("ID")) { // For each numerical input value, create aggregations for SUM, MIN, MAX AggregatedMeasureDescription sum = new AggregatedMeasureDescription(fieldName, "SUM"); AggregatedMeasureDescription min = new AggregatedMeasureDescription(fieldName, "MIN"); AggregatedMeasureDescription max = new AggregatedMeasureDescription(fieldName, "MAX"); AggregatedMeasureDescription sq_sum = new AggregatedMeasureDescription(fieldName, "SQ_SUM"); sq_sum.setVisible(false); // Shared formula expressions String sumExpression = "aggregatedValue[" + fieldName + ".SUM]"; String squareSumExpression = "aggregatedValue[" + fieldName + ".SQ_SUM]"; String countExpression = "aggregatedValue[contributors.COUNT]"; String avgExpression = "aggregatedValue[" + fieldName + ".avg]"; // Define a formula post processor to compute the average PostProcessorDescription avg = new PostProcessorDescription(fieldName + ".avg", "FORMULA", new Properties()); String formula = sumExpression + ", " + countExpression + ", /"; avg.getProperties().setProperty("formula", formula); // Define a formula post processor to compute the standard deviation PostProcessorDescription std = new PostProcessorDescription(fieldName + ".STD", "FORMULA", new Properties()); String stdFormula = "(" + squareSumExpression + ", " + countExpression + ", /)"; stdFormula += ", (" + avgExpression + ", " + avgExpression + ", *), -, SQRT"; std.getProperties().setProperty("formula", stdFormula); // Put the measures for that field in one folder sum.setFolder(fieldName); sq_sum.setFolder(fieldName); avg.setFolder(fieldName); std.setFolder(fieldName); min.setFolder(fieldName); max.setFolder(fieldName); // Setup measure formatters String formatter = integers.contains(fieldType) ? INTEGER_FORMAT : DOUBLE_FORMAT; sum.setFormatter(formatter); sq_sum.setFormatter(formatter); min.setFormatter(formatter); max.setFormatter(formatter); avg.setFormatter(DOUBLE_FORMAT); std.setFormatter(DOUBLE_FORMAT); measures.add(sum); measures.add(min); measures.add(max); postProcessors.add(avg); // Add standard deviation only for floating point inputs if(decimals.contains(fieldType)) { measures.add(sq_sum); postProcessors.add(std); } } } // Add distinct count calculation for each level field for(int f = 0; f < format.getColumnCount(); f++) { String fieldName = format.getColumnName(f).trim(); String fieldType = format.getColumnType(f); if(!numericsOnly.contains(fieldType)) { PostProcessorDescription dc = new PostProcessorDescription(fieldName + ".COUNT", IPostProcessorConstants.LEAF_COUNT_PLUGIN_KEY, new Properties()); String leafExpression = fieldName + "@" + fieldName; dc.getProperties().setProperty(IPostProcessorConstants.LEAF_COUNT_PARAM_LEAF_LEVELS, leafExpression); dc.setFolder("Distinct Count"); postProcessors.add(dc); } } measureDesc.setAggregatedMeasuresDescription(measures); measureDesc.setPostProcessorsDescription(postProcessors); // Configure "count" native measure List<INativeMeasureDescription> nativeMeasures = new ArrayList<>(); INativeMeasureDescription countMeasure = new NativeMeasureDescription(IMeasureHierarchy.COUNT_ID, "Count"); countMeasure.setFormatter(INTEGER_FORMAT); nativeMeasures.add(countMeasure); // Hide the last update measure that does not work Just In Time INativeMeasureDescription lastUpdateMeasure = new NativeMeasureDescription(IMeasureHierarchy.TIMESTAMP_ID); lastUpdateMeasure.setVisible(false); nativeMeasures.add(lastUpdateMeasure); measureDesc.setNativeMeasures(nativeMeasures); desc.setMeasuresDescription(measureDesc); // Aggregate cache configuration if(env.containsProperty("pivot.cache.size")) { Integer cacheSize = env.getProperty("pivot.cache.size", Integer.class); LOGGER.info("Configuring aggregate cache of size " + cacheSize); IAggregatesCacheDescription cacheDescription = new AggregatesCacheDescription(); cacheDescription.setSize(cacheSize); desc.setAggregatesCacheDescription(cacheDescription); } return desc; } /** * * @param format format of the CSV file * @param env spring environment * @return schema description */ public IActivePivotSchemaDescription createActivePivotSchemaDescription(CSVFormat format, Environment env) { ActivePivotSchemaDescription desc = new ActivePivotSchemaDescription(); // Datastore selection List<SelectionField> fields = new ArrayList<>(); for(int f = 0; f < format.getColumnCount(); f++) { String fieldName = format.getColumnName(f); String fieldType = format.getColumnType(f); fields.add(new SelectionField(fieldName)); if(isDate(fieldType)) { fields.add(new SelectionField(fieldName + ".YEAR")); fields.add(new SelectionField(fieldName + ".MONTH")); fields.add(new SelectionField(fieldName + ".DAY")); } } SelectionDescription selection = new SelectionDescription(BASE_STORE, fields); // ActivePivot instance IActivePivotDescription pivot = createActivePivotDescription(format, env); IActivePivotInstanceDescription instance = new ActivePivotInstanceDescription(PIVOT, pivot); desc.setDatastoreSelection(selection); desc.setActivePivotInstanceDescriptions(Collections.singletonList(instance)); return desc; } /** * * Generate a complete ActivePivot Manager description, with one catalog, * one schema and one cube, based on the provided input data format. * * @param format input data format * @return ActivePivot Manager description */ public IActivePivotManagerDescription createActivePivotManagerDescription(CSVFormat format, Environment env) { ICatalogDescription catalog = new CatalogDescription(PIVOT + "_CATALOG", Arrays.asList(PIVOT)); IActivePivotSchemaDescription schema = createActivePivotSchemaDescription(format, env); IActivePivotSchemaInstanceDescription instance = new ActivePivotSchemaInstanceDescription(PIVOT + "_SCHEMA", schema); ActivePivotManagerDescription desc = new ActivePivotManagerDescription(); desc.setCatalogs(Arrays.asList(catalog)); desc.setSchemas(Arrays.asList(instance)); return desc; } }
{ "content_hash": "a5178c9c779a1e9a4a59ee1b72f4ce79", "timestamp": "", "source": "github", "line_count": 430, "max_line_length": 152, "avg_line_length": 39.30930232558139, "alnum_prop": 0.7541856475181921, "repo_name": "activeviam/autopivot", "id": "d47c2bd74b930d76d8418e55dbc308c4c80a3238", "size": "17713", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/av/autopivot/AutoPivotGenerator.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "103181" }, { "name": "JavaScript", "bytes": "594" } ], "symlink_target": "" }
using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using Commanigy.Iquomi.Services; #endregion namespace Commanigy.Iquomi.WebServices { /// <summary> /// Summary description for IqCore. /// </summary> //[WebServiceBinding(ConformanceClaims = WsiClaims.BP10, EmitConformanceClaims = true)] [WebService(Description = "IqCore", Namespace = "http://services.iquomi.com/2004/01/core")] public class IqCore : IqCoreService { public override System.Reflection.Module ServiceModule { get { return null; } } } }
{ "content_hash": "1046d833b1b90fa5dbe7b3b95f105e57", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 92, "avg_line_length": 27.19047619047619, "alnum_prop": 0.7197898423817863, "repo_name": "theill/iquomi", "id": "391b5e2011924d4bd07c2b2594c8a5677cf8bb38", "size": "597", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "webservices/App_Code/IqCore.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "224842" }, { "name": "C#", "bytes": "5393659" }, { "name": "CSS", "bytes": "30092" }, { "name": "HTML", "bytes": "247898" }, { "name": "JavaScript", "bytes": "60563" }, { "name": "Shell", "bytes": "3892" }, { "name": "Visual Basic", "bytes": "3664" }, { "name": "XSLT", "bytes": "27235" } ], "symlink_target": "" }
package fathom.rest.route; import com.google.common.base.Strings; import fathom.rest.Context; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ro.pippo.core.Languages; import ro.pippo.core.route.RouteHandler; import java.util.Locale; /** * The LanguageHandler determines the appropriate language, binds the lang * and locale Response models, and continues the handler chain. * * @author James Moger */ public class LanguageHandler implements RouteHandler<Context> { public static class Parameter { public static final String LANG = "lang"; public static final String LOCALE = "locale"; public static final String LANGUAGES = "languages"; } private static final Logger log = LoggerFactory.getLogger(LanguageHandler.class); protected final Languages languages; protected final boolean enableQueryParameter; protected final boolean setCookie; /** * Create the language filter with optional support for accepting the * language specification from a query parameter (e.g. "?lang=LN") * * @param languages * @param enableQueryParameter */ public LanguageHandler(Languages languages, boolean enableQueryParameter, boolean setCookie) { this.languages = languages; this.enableQueryParameter = enableQueryParameter; this.setCookie = setCookie; } @Override public void handle(Context context) { String language = enableQueryParameter ? context.getParameter(Parameter.LANG).toString() : null; if (Strings.isNullOrEmpty(language)) { language = languages.getLanguageOrDefault(context); } Locale locale = languages.getLocaleOrDefault(language); context.setLocal(Parameter.LANG, language); context.setLocal(Parameter.LOCALE, locale); context.setLocal(Parameter.LANGUAGES, languages.getRegisteredLanguages()); if (setCookie) { if (context.getResponse().isCommitted()) { log.debug("LANG cookie NOT set, Response already committed!"); } else { languages.setLanguageCookie(language, context); } } context.next(); } }
{ "content_hash": "b2e4b8e0fde8aa21a61ffc6b303f5166", "timestamp": "", "source": "github", "line_count": 72, "max_line_length": 104, "avg_line_length": 30.819444444444443, "alnum_prop": 0.6872465074357819, "repo_name": "gitblit/fathom", "id": "8edae58e3de531a73554744e1f06b062cae3c7aa", "size": "2837", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "fathom-rest/src/main/java/fathom/rest/route/LanguageHandler.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "231" }, { "name": "FreeMarker", "bytes": "32559" }, { "name": "Java", "bytes": "1051772" }, { "name": "Mustache", "bytes": "4865" } ], "symlink_target": "" }
 namespace Anycmd.ViewModel { using Engine.Ac; using Exceptions; using System.Globalization; using Util; /// <summary> /// 为AcDomain提供扩展方法。<see cref="IAcDomain"/> /// </summary> public static class AcDomainExtension { /// <summary> /// 根据系统字典将字典项码翻译为字典项名 /// </summary> /// <param name="acDomain"></param> /// <param name="codespace"></param> /// <param name="entityTypeCode"></param> /// <param name="propertyCode"></param> /// <param name="dicItemCode"></param> /// <returns></returns> public static string Translate(this IAcDomain acDomain, string codespace, string entityTypeCode, string propertyCode, int dicItemCode) { return Translate(acDomain, codespace, entityTypeCode, propertyCode, dicItemCode.ToString(CultureInfo.InvariantCulture)); } /// <summary> /// 根据系统字典将字典项码翻译为字典项名 /// </summary> /// <param name="acDomain"></param> /// <param name="codespace"></param> /// <param name="entityTypeCode"></param> /// <param name="propertyCode"></param> /// <param name="dicItemCode"></param> /// <returns></returns> public static string Translate(this IAcDomain acDomain, string codespace, string entityTypeCode, string propertyCode, bool dicItemCode) { return Translate(acDomain, codespace, entityTypeCode, propertyCode, dicItemCode.ToString()); } /// <summary> /// 根据系统字典将字典项码翻译为字典项名 /// </summary> /// <param name="acDomain"></param> /// <param name="codespace"></param> /// <param name="entityTypeCode"></param> /// <param name="propertyCode"></param> /// <param name="dicItemCode"></param> /// <returns></returns> public static string Translate(this IAcDomain acDomain, string codespace, string entityTypeCode, string propertyCode, string dicItemCode) { EntityTypeState entityType; if (!acDomain.EntityTypeSet.TryGetEntityType(new Coder(codespace, entityTypeCode), out entityType)) { throw new AnycmdException(string.Format("意外的实体类型:{0}.{1}", codespace, entityTypeCode)); } PropertyState property; if (!acDomain.EntityTypeSet.TryGetProperty(entityType, propertyCode, out property)) { return dicItemCode; } if (property.DicId.HasValue) { CatalogState dicState; if (!acDomain.CatalogSet.TryGetCatalog(property.DicId.Value, out dicState)) { return dicItemCode; } CatalogState dicitem; if (acDomain.CatalogSet.TryGetCatalog(dicState.Code + "." + dicItemCode, out dicitem)) { return dicitem.Name; } } return dicItemCode; } } }
{ "content_hash": "04e3e4aa9c5524054e71f18a23504c9d", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 145, "avg_line_length": 38.34177215189873, "alnum_prop": 0.5704853086827336, "repo_name": "anycmd/anycmd", "id": "8e24b91d56fd97092bd2a91ff3b0485139914bb3", "size": "3171", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Examples/Default/Infrastructure/Anycmd.ViewModel/AcDomainExtension.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "42024" }, { "name": "Batchfile", "bytes": "207" }, { "name": "C#", "bytes": "6965720" }, { "name": "CSS", "bytes": "279467" }, { "name": "HTML", "bytes": "385769" }, { "name": "Java", "bytes": "10698" }, { "name": "JavaScript", "bytes": "1311453" }, { "name": "PHP", "bytes": "92207" } ], "symlink_target": "" }
<?php namespace futboleros; use Illuminate\Database\Eloquent\Model; use Carbon\Carbon; use Storage; use File; class Equipo extends Model { protected $fillable = ['nombre_equipo','alias','fecha_fundacion','presidente_actual','nombre_hinchada','activado','campeonato_id','estadio_id','tecnico_id','nombre_estadio','path']; //***** Relaciones entre las Clases****// //Un equipo tiene un Tecnico function tecnico(){ return $this->belongsTo('\futboleros\Tecnico'); } //Un Equipo pertenece a campeonato (Liga) function campeonato(){ return $this->belongsTo('\futboleros\Campeonato'); } //Un Equipo Tiene Muchos Juagadores function juagadors(){ return $this->hasMany('\futboleros\Jugador'); } //metodo para select dinamico public static function get_equipos($id){ return Equipo::where('campeonato_id','=',$id)->get(); } public static function get_estadio($id){ return Equipo::where('id','=',$id)->get(); } public function partidos(){ return $this->belongsToMany('futboleros\Partido'); } public function goles(){ return $this->hasMany('futboleros\Gol'); } public function setPathAttribute($path){ if(!empty($path)){ $name =$path->getClientOriginalName(); $this->attributes['path'] = $name; Storage::disk('local')->put($name, File::get($path)); } } }
{ "content_hash": "886ece1572abf36efc769a9ab7f09add", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 185, "avg_line_length": 29.73469387755102, "alnum_prop": 0.6156485929993136, "repo_name": "wilsonwp/futbol_backend", "id": "7cf12d1241d7b42d064b173233d9b0af5c021405", "size": "1457", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/Equipo.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "566" }, { "name": "CSS", "bytes": "72" }, { "name": "HTML", "bytes": "306926" }, { "name": "JavaScript", "bytes": "573738" }, { "name": "PHP", "bytes": "244484" }, { "name": "Shell", "bytes": "291" } ], "symlink_target": "" }
FOUNDATION_EXPORT double Pods_RFFeatureToggleTestsVersionNumber; FOUNDATION_EXPORT const unsigned char Pods_RFFeatureToggleTestsVersionString[];
{ "content_hash": "0e40f0afd597b3de57e6666f51adc08e", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 79, "avg_line_length": 48.666666666666664, "alnum_prop": 0.8835616438356164, "repo_name": "raumfeld/RFFeatureToggle", "id": "35c29996e24d72de38dc8d94a4ae653d51610975", "size": "342", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Pods/Target Support Files/Pods-RFFeatureToggleTests/Pods-RFFeatureToggleTests-umbrella.h", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "70840" }, { "name": "Ruby", "bytes": "8733" }, { "name": "Shell", "bytes": "101" } ], "symlink_target": "" }
title: Fractions --- ## Fractions A fractional number represents part of a whole number, a value between 0 and 1. They can be represented using decimals (e.g. 0.1), percentages (e.g. 10%), negative indices (e.g. 10 ^ -1) or fractions (e.g. 1/10). A fraction normally has two parts which are divided by a line: * Numerator: Represents the number of equal parts marking up the fraction. (above the line) * Denominator: Represents the number by which the numerator is divided to make the fraction. (below the line) The numerator and denominator are both integers (whole numbers). A proper fraction is one where the numerator is less than the denominator. Fractions can also be added after a whole number to increase its accuracy. ### Examples 1½ represents 1 + 1/2 or 1.5. Not all fractions have decimal representations: ⅓ or 1/3 represents 1 divided by 3
{ "content_hash": "504430d314b43b8f30c64cf2a747948a", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 212, "avg_line_length": 33.26923076923077, "alnum_prop": 0.753757225433526, "repo_name": "pahosler/freecodecamp", "id": "2ebe3a847abf627df3e6031ca5a750ba239f444b", "size": "872", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "guide/english/mathematics/fractions/index.md", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "35491" }, { "name": "HTML", "bytes": "17600" }, { "name": "JavaScript", "bytes": "777274" } ], "symlink_target": "" }
import * as vscode from 'vscode'; import { workspace } from 'vscode'; import * as gitflowUtils from '../helpers/gitflowUtils'; import * as gitUtils from '../helpers/gitUtils'; import * as path from 'path'; import { InitConfigSettings } from '../settings/configSettings'; import { BranchSetting } from '../settings/branchSettings'; const config = workspace.getConfiguration(); const initValues = config.get('gitflow4code.init') as InitConfigSettings; const askForDeletion = config.get('gitflow4code.askBeforeDeletion') as boolean; const deleteByDefault = config.get('gitflow4code.deleteBranchByDefault') as boolean; const pushAfterFinishing = config.get('gitflow4code.pushAfterFinishing') as boolean; export function run(outChannel, action) { if(action === 'start') { var itemPickList = [ { label: 'Start Feature from ' + initValues.develop, description: '' }, { label: 'Start Feature from another base branch', description: '' } ]; vscode.window.showQuickPick(itemPickList).then(function(item) { if(!item) return; outChannel.clear(); if(item.label === itemPickList[0].label) vscode.window.showInputBox({ prompt: 'Name of Feature: ', ignoreFocusOut: true }).then(val => startFeature(outChannel, val, initValues.develop)); else { gitUtils.getBranchList(workspace.rootPath).then((features) => { var branchPickList = []; features.forEach(branchName => { branchPickList.push( { label: branchName, description: 'create feature branch using ' + branchName + ' as your base'}); }); vscode.window.showQuickPick(branchPickList).then(function(item) { if(!item) return; outChannel.clear(); vscode.window.showInputBox({ prompt: 'Name of Feature: ', ignoreFocusOut: true }).then(val => startFeature(outChannel, val, item.label)); }); }); } }); } else if (action === 'finish') { if(askForDeletion) vscode.window.showInputBox({ prompt: 'Would you like this feature branch deleted after finishing? (y/n)', ignoreFocusOut: true }).then(function(val) { if(val !== undefined && (val.toLowerCase() === 'y' || val.toLowerCase() === 'n')) { var deleteBranch = val.toLowerCase() === 'y'; finishFeature(outChannel, deleteBranch); } }); else finishFeature(outChannel, deleteByDefault); } } function startFeature(outChannel, featureName, baseBranch) { if(featureName !== undefined) // User chose to Cancel/Esc operation if(featureName !== '') { featureName = featureName.trim().replace(/ /g, '_'); gitUtils.getGitRepositoryPath(vscode.workspace.rootPath).then(function (gitRepositoryPath) { gitflowUtils.startFeature(gitRepositoryPath, featureName, baseBranch) .then(startFeature, genericErrorHandler) .catch(genericErrorHandler) }).catch(genericErrorHandler); } else genericErrorHandler('Name of feature cannot be blank'); function startFeature(log) { if(log.length === 0) { vscode.window.showInformationMessage('Nothing to show'); return; } let featuresConfig = config.get('gitflow4code.features') as BranchSetting[]; featuresConfig.push(new BranchSetting(initValues.features + featureName, baseBranch, pushAfterFinishing)); config.update('gitflow4code.features', featuresConfig); outChannel.append(log); outChannel.show(); } function genericErrorHandler(error) { if(error.code && error.syscall && error.code === 'ENOENT' && error.syscall === 'spawn git') vscode.window.showErrorMessage('Cannot find git installation'); else { outChannel.appendLine(error); outChannel.show(); vscode.window.showErrorMessage('There was an error, please view details in output log'); } } } function finishFeature(outChannel, deleteBranch) { gitUtils.getGitRepositoryPath(vscode.workspace.rootPath).then(function (gitRepositoryPath) { gitUtils.getCurrentBranchName(vscode.workspace.rootPath).then((branchName) => { if(branchName.toString().startsWith(initValues.features)) { let featuresConfig = config.get('gitflow4code.features') as BranchSetting[]; let featureSetting = featuresConfig.find((feature) => feature.name === branchName.toString()); if(!featureSetting) featureSetting = new BranchSetting(branchName.toString(), initValues.develop, pushAfterFinishing); let options = { pushToOrigin: pushAfterFinishing }; gitflowUtils.finishFeature(gitRepositoryPath, branchName.toString(), featureSetting.base, deleteBranch, options).then(finishFeature, genericErrorHandler); function finishFeature(log) { if(log.length === 0) { vscode.window.showInformationMessage('Nothing to show'); return; } if(deleteBranch) { let featureIndex = featuresConfig.indexOf(featureSetting); featuresConfig.splice(featureIndex, 1); config.update('gitflow4code.features', featuresConfig); } outChannel.append(log); outChannel.show(); } } else vscode.window.showErrorMessage('Not currently on a Feature branch'); }) }).catch(genericErrorHandler); function genericErrorHandler(error) { if(error.code && error.syscall && error.code === 'ENOENT' && error.syscall === 'spawn git') vscode.window.showErrorMessage('Cannot find git installation'); else { outChannel.appendLine(error); outChannel.show(); vscode.window.showErrorMessage('There was an error, please view details in output log'); } } }
{ "content_hash": "b1333164aa5ea57b24eb7a02fa7c7dd6", "timestamp": "", "source": "github", "line_count": 145, "max_line_length": 170, "avg_line_length": 45.53793103448276, "alnum_prop": 0.5810995002271695, "repo_name": "Shaggy13spe/gitflow4code", "id": "34ffdee872a800a0f46c7c0ca85eb5875a6bfdaf", "size": "6603", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "src/commands/features.ts", "mode": "33188", "license": "mit", "language": [ { "name": "TypeScript", "bytes": "66900" } ], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="/maps/leaflet/dist/leaflet.css" /> <link rel="stylesheet" href="../src/leaflet-search.css" /> <link rel="stylesheet" href="../style.css" /> <style> .leaflet-marker-icon { color: #fff; font-size: 16px; line-height: 16px; text-align: center; vertical-align: middle; box-shadow: 2px 1px 4px rgba(0,0,0,0.3); border-radius: 8px; border:1px solid #fff; } .search-tip b { color: #fff; } .bar.search-tip b, .bar.leaflet-marker-icon { background: #f66 } .pharmacy.search-tip b, .pharmacy.leaflet-marker-icon { background: #f6f } .restaurant.search-tip b, .restaurant.leaflet-marker-icon { background: #66f } .search-tip { white-space: nowrap; } .search-tip b { display: inline-block; clear: left; float: right; padding: 0 4px; margin-left: 4px; } </style> </head> <body> <h3><a href="../"><big>◄</big> Leaflet.Control.Search</a></h3> <h4>Multiple Layers Example: <em>search markers in multiple layers</em></h4> <div id="map"></div> <script src="/maps/leaflet/dist/leaflet-src.js"></script> <script src="../src/leaflet-search.js"></script> <script src="data/bar.geojson.js"></script> <script src="data/pharmacy.geojson.js"></script> <script src="data/restaurant.geojson.js"></script> <script> var map = L.map('map', { zoom: 14, center: new L.latLng(41.8990, 12.4977), layers: L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png') }), geojsonOpts = { pointToLayer: function(feature, latlng) { return L.marker(latlng, { icon: L.divIcon({ className: feature.properties.amenity, iconSize: L.point(16, 16), html: feature.properties.amenity[0].toUpperCase(), }) }).bindPopup(feature.properties.amenity+'<br><b>'+feature.properties.name+'</b>'); } }; var poiLayers = L.layerGroup([ L.geoJson(bar, geojsonOpts), L.geoJson(pharmacy, geojsonOpts), L.geoJson(restaurant, geojsonOpts) ]) .addTo(map); L.control.search({ layer: poiLayers, initial: false, zoom: 18, propertyName: 'name', buildTip: function(text, val) { var type = val.layer.feature.properties.amenity; return '<a href="#" class="'+type+'">'+text+'<b>'+type+'</b></a>'; } }) .addTo(map); </script> <div id="copy"><a href="http://labs.easyblog.it/">Labs</a> &bull; <a rel="author" href="http://labs.easyblog.it/stefano-cudini/">Stefano Cudini</a></div> <script type="text/javascript" src="/labs-common.js"></script> </body> </html>
{ "content_hash": "9b2218e29415df8a07d43b9dda5fbf6c", "timestamp": "", "source": "github", "line_count": 105, "max_line_length": 153, "avg_line_length": 25.561904761904763, "alnum_prop": 0.657973174366617, "repo_name": "ajvol/leaflet-search", "id": "755ba09606446d94d8f5ad72e3bb0d7fcfc1f025", "size": "2686", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "examples/multiple-layers.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "10369" }, { "name": "HTML", "bytes": "4948" }, { "name": "JavaScript", "bytes": "60780" } ], "symlink_target": "" }
from blazar.plugins import base class DummyVMPlugin(base.BasePlugin): """Plugin for VM resource that does nothing.""" resource_type = 'virtual:instance' title = 'Dummy VM Plugin' description = 'This plugin does nothing.' def reserve_resource(self, reservation_id, values): return None def update_reservation(self, reservation_id, values): return None def on_start(self, resource_id): """Dummy VM plugin does nothing.""" return 'VM %s should be waked up this moment.' % resource_id def on_end(self, resource_id): """Dummy VM plugin does nothing.""" return 'VM %s should be deleted this moment.' % resource_id
{ "content_hash": "62c260ad9afda81396d87b826860a37d", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 68, "avg_line_length": 31.545454545454547, "alnum_prop": 0.6570605187319885, "repo_name": "stackforge/blazar", "id": "5e35b56dc4f7350a7af396a3259b6a5cb7b4414c", "size": "1277", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "blazar/plugins/dummy_vm_plugin.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Mako", "bytes": "1014" }, { "name": "Python", "bytes": "905154" }, { "name": "Shell", "bytes": "8897" } ], "symlink_target": "" }
@implementation MKFractionToPercentTransformer + (Class)transformedValueClass { return [NSNumber class]; } + (BOOL)allowsReverseTransformation { return YES; } - (id)transformedValue:(id)value { float scaleInputValue; float zoomOutputValue; if (value == nil) return nil; if ([value respondsToSelector:@selector(floatValue)]) { scaleInputValue = [value floatValue]; } else { [NSException raise:NSInternalInconsistencyException format:@"Value (%@) does not respond to -floatValue.", [value class]]; } zoomOutputValue = scaleInputValue * 100; return [NSNumber numberWithFloat:zoomOutputValue]; } - (id)reverseTransformedValue:(id)value { float zoomInputValue; float scaleOutputValue; if (value == nil) return nil; if ([value respondsToSelector:@selector(floatValue)]) { zoomInputValue = [value floatValue]; } else { [NSException raise:NSInternalInconsistencyException format:@"Value (%@) does not respond to -floatValue.", [value class]]; } scaleOutputValue = zoomInputValue / 100; return [NSNumber numberWithFloat:scaleOutputValue]; } @end
{ "content_hash": "7b64790b8b9a052e5a39cad0ed6db277", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 90, "avg_line_length": 26.085106382978722, "alnum_prop": 0.6566068515497553, "repo_name": "mkdynamic/prototype", "id": "aaab964a475c1caec0912509c6138db4b65f0c54", "size": "2367", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Source/MKFractionToPercentTransformer.m", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "461601" } ], "symlink_target": "" }
<div id="base-search-component"> <h4>Base Search</h4> <input #searchBox id="search-box" (keyup)="search(searchBox.value)" /> <div> <div *ngFor="let base of bases | async" (click)="gotoDetail(base)" class="search-result" > {{base.name}} </div> </div> </div>
{ "content_hash": "6338b9bc7688df498c3d08e667402f07", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 72, "avg_line_length": 28.8, "alnum_prop": 0.59375, "repo_name": "Shakyamuni177te/Ang2Mouse", "id": "d10624a3e9a1a223ff5137466b70e2ec51c954c1", "size": "288", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "client/app/bases/base-search.component.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "11155" }, { "name": "HTML", "bytes": "8324" }, { "name": "JavaScript", "bytes": "18173" }, { "name": "TypeScript", "bytes": "35917" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "551447f6dcf7d93394dac1855f99ac32", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "99511ebbe9c937c09ffc565e9dc784c6e334aaea", "size": "189", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Fabales/Fabaceae/Lysiloma/Lysiloma acapulcense/ Syn. Lysiloma cuneatum/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package com.ogamelib.building.producer; import com.ogamelib.resource.ResourceSet; public class CrystalMine extends Producer { @Override public Long getProductionBaseForMetal() { return 0L; } @Override public Long getProductionBaseForCrystal() { return (long) Math.floor((double) 20 * getLevel() * Math.pow(1.1, getLevel())); } @Override public Long getProductionBaseForDeuterium() { return 0L; } @Override public Long getProductionBaseForAntimatter() { return 0L; } @Override public Long getProductionBaseForEnergy() { return (long) Math.floor(-10 * getLevel() * Math.pow(1.1, getLevel())); } @Override public ResourceSet getNextLevelCost() { ResourceSet cost = new ResourceSet(); cost.metal.setAmount((long) Math.floor(48 * Math.pow(1.6, getLevel()))); cost.crystal.setAmount((long) Math.floor(24 * Math.pow(1.6, getLevel()))); return cost; } @Override public ResourceSet getInitialCost() { return new CrystalMine().getNextLevelCost(); } }
{ "content_hash": "014d57ac73db0e237272fb0415ab0a49", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 73, "avg_line_length": 21.361702127659573, "alnum_prop": 0.7101593625498008, "repo_name": "matthieu-vergne/Ogame-Library", "id": "acc79037c3a72f6c64f86d1d93fe827661a294b9", "size": "1004", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/ogamelib/building/producer/CrystalMine.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Java", "bytes": "106226" } ], "symlink_target": "" }
layout: post title: Creating Dynamic Nested Forms in Rails with jQuery - Part II date: 2018-01-22 --- Gems like [cocoon](https://github.com/nathanvda/cocoon) and [nested_form](https://github.com/ryanb/nested_form) make nested forms an easy cake in Rails, but not everyone prefers to pile on gems in their projects. Whether it's because of dependencies issues down the line, or whether it's the lack of control, you might want to build nested forms the old-fashion vanilla way. For me, it was because the nested_form gem just wasn't producing the exact outcome I was looking for. Creating user-friendly, dynamic forms can get tricky, especially when relationships are complex. But even if you end up using gems, hopefully this article still sheds some light on how they operate behind the scenes. In this project, Event has_many sponsorship_levels, and SponsorshipLevel has_many perks through sponsorship_perks. In my [previous article]({% post_url 2017-10-28-creating-dynamic-nested-forms-in-rails-with-jquery-part-i %}), I implemented a nested form between Event and SponsorshipLevel using the nested_form gem. To go another level deep into sponsorship_perks and perks -- all in the same form -- I will be using purely jQuery to create the Perks section of the form. ![Sponsorship Levels Form]({{ site.img_path }}{{ page.date | date: '%Y-%m-%d' }}/sponsorship-levels.gif) As mentioned in the [last article]({% post_url 2017-10-28-creating-dynamic-nested-forms-in-rails-with-jquery-part-i %}), make sure your models are all set for accepting nested attributes: First, define relationships and add `accepts_nested_attributes_for :sponsorship_perks` to the Event model ```ruby # app/models/sponsorship_level.rb class SponsorshipLevel < ActiveRecord::Base belongs_to :event has_many :sponsorship_perks has_many :perks, through: :sponsorship_perks accepts_nested_attributes_for :sponsorship_perks, reject_if: :all_blank, allow_destroy: true end ``` Then, make sure you've permitted all the attributes you need using strong parameters, and create the nested form using `fields_for`. I excluded the parts already mentioned in the [previous article]({% post_url 2017-10-28-creating-dynamic-nested-forms-in-rails-with-jquery-part-i %}) as we're focusing on just the perks section. ```ruby <div id="add-sponsorship-levels" class="add-fields"> <div id="sponsorship-levels-form" class="fields-form"> <%= f.fields_for(:sponsorship_levels, @event.sponsorship_levels.build, html: { class: "form-horizontal sponsorshipLevelsForm" }) do |ff| %> <!-- fields for sponsorship levels --> <!-- sponsorship perks form --> <div class="new-perks"> <div class="new-perks-container"> <div class="new-perk"> <h4 class="sub subsection">Perk <span>1</span></h4> <%= ff.fields_for(:sponsorship_perks, @event.sponsorship_levels.build.sponsorship_perks.build, html: { class: "form-horizontal sponsorshipPerksForm" }) do |fff| %> <%= fff.fields_for(:perk, @event.sponsorship_levels.build.sponsorship_perks.build.build_perk, html: { class: "form-horizontal PerksForm" }) do |ffff| %> <div class="form-group"> <%= ffff.label :description, "Brief Description", class: "control-label col-sm-4 required" %> <div class="col-sm-6"> <%= ffff.text_field :description, class: "form-control", required: true, maxlength: 140, placeholder: "e.g., Logo printed on the back of our t-shirts" %> </div> </div> <div class="form-group"> <%= ffff.label :details, class: "control-label col-sm-4" %> <div class="col-sm-6"> <%= ffff.text_area :details, class: "form-control", rows: "6", maxlength: 600, placeholder: "e.g., Your brand name and logo will be printed on the back on our t-shirts for this fundraiser, which will be sold and distributed at the booths." %> </div> </div> <% end %> <% end %> </div> </div> <div class="col-sm-offset-4"> <button class="btn btn-subtle btn-xs add-another-perk" type="button" onclick="addPerkFields(this)">+ Add another perk</button> </div> </div> <!-- buttons to add and remove sponsorship levels --> ``` Rails convention requires parameters to be structured in a way to allow Rails to identify which attributes belong to which model or object to be created. Each set of attributes that belong to a model must have a unique identifier, like this given our `has_many :through` relationship between the 3 models: ```ruby "sponsorship_levels_attributes"=> {"0"=> {"name"=>"Gold", "amount"=>"3000" "sponsorship_perks_attributes"=> {"0"=> {"perk_attributes"=> {"description"=> "Logo placement on our homepage and products pages for one year", "details"=> "Your logo will be placed as a sponsor on our homepage and products pages for one year."}}, "001"=> {"perk_attributes"=> {"description"=> "Brand featured on a banner during event", "details"=> "Your brand will be featured on a banner during our event, and we'll give you a shout out!"}}, "002"=> {"perk_attributes"=> {"description"=>"Social media promotion", "details"=> "We'll post about your brand and sponsorship on our Facebook and Twitter pages."}}}} ``` This unique identifiers derive from the `name=` and `id=` of the form field, so we want to make sure that each name and id is unique, and that the forms fields that belong to the same model have the same identifier in their names and ids. The most common way is to use UNIX timestamps. For example, `name="event[sponsorship_levels_attributes][0][sponsorship_perks_attributes][1520268053750][perk_attributes][details]"` and `id="event_sponsorship_levels_attributes_0_sponsorship_perks_attributes_1520268053750_perk_attributes_details"`. Below is the function used to (1) duplicate the form fields needed using `clone()`, (2) get the current time using `new Date()` and `getTime()`, and (3) rearrange the numbering of the added or removed fields to correspond to the visible order on the page. It is triggered when the user clicks on the "Add another perk" button. ```javascript function addPerkFields(element) { // get parent container div and sponsorship level ID var parentSponsorship = $(element).closest('#sponsorship-levels-form .fields'); // event_sponsorship_levels_attributes_0_name var levelId = parentSponsorship.find('input:first').attr('id').replace('event_sponsorship_levels_attributes_', '').replace('_name', ''); // create Date object var date = new Date(); // get UNIX timestamp and use it for address key var mSec = date.getTime(); // replace 0 with timestamp descriptionIdAttribute = "event_sponsorship_levels_attributes_[level]_sponsorship_perks_attributes_[perk]_perk_attributes_description".replace("[level]", levelId).replace("[perk]", mSec); descriptionNameAttribute = "event[sponsorship_levels_attributes][level_num][sponsorship_perks_attributes][perk_num][perk_attributes][description]".replace("level_num", levelId).replace("perk_num", mSec); detailsIdAttribute = "event_sponsorship_levels_attributes_[level]_sponsorship_perks_attributes_[perk]_perk_attributes_details".replace("[level]", levelId).replace("[perk]", mSec); detailsNameAttribute = "event[sponsorship_levels_attributes][level_num][sponsorship_perks_attributes][perk_num][perk_attributes][details]".replace("level_num", levelId).replace("perk_num", mSec); var newdiv = $(".new-perk:first").clone(); // apply timestamps to form fields and append to form $.each(newdiv.find(":input"), function() { if ($(this).attr('id').includes('description')) { $(this).attr('id', descriptionIdAttribute); $(this).attr('name', descriptionNameAttribute); } else if ($(this).attr('id').includes('details')) { $(this).attr('id', detailsIdAttribute); $(this).attr('name', detailsNameAttribute); } $(this).val(''); }); var parentPerks = element.closest(".new-perks"); $(parentPerks).find(".new-perks-container").append(newdiv); // add remove button to all perks except first if ($(parentSponsorship).find('.new-perk').length > 1) { newdiv.append("<div class='remove-perk'><button class='btn btn-danger btn-xs col-sm-offset-4' type='button' onclick='removePerk(this)'>Remove perk</button></div>"); } // number order of perks $(parentSponsorship).find('.new-perk h4.subsection span:visible').each(function(index) { $(this).html(index + 1); }); }; ``` When the user clicks on "Remove perk", it simply removes the corresponding fields and visually reorders the perk fields. ```javascript function removePerk(element) { var parentSponsorship = $(element).closest('#sponsorship-levels-form .fields'); $(element).closest('.new-perk').remove(); // number order of perks $(parentSponsorship).find('.new-perk h4.subsection span:visible').each(function(index) { $(this).html(index + 1); }); } ``` The output parameters will have this structure: ```ruby "sponsorship_levels_attributes"=> {"0"=> {"name"=>"Gold", "amount"=>"3000", "max_sponsorships"=>"", "_destroy"=>"false", "sponsorship_perks_attributes"=> {"0"=> {"perk_attributes"=> {"description"=> "Logo placement on our homepage and products pages for one year", "details"=> "Your logo will be placed as a sponsor on our homepage and products pages for one year."}}, "1520268053750"=> {"perk_attributes"=> {"description"=> "Brand featured on a banner during event", "details"=> "Your brand will be featured on a banner during our event, and we'll give you a shout out!"}}, "1520268107993"=> {"perk_attributes"=> {"description"=>"Social media promotion", "details"=> "We'll post about your brand and sponsorship on our Facebook and Twitter pages."}}}} ```
{ "content_hash": "88f84ce65fb1474fbfd6bf7295af57d6", "timestamp": "", "source": "github", "line_count": 183, "max_line_length": 693, "avg_line_length": 55.797814207650276, "alnum_prop": 0.6774067182450298, "repo_name": "auranbuckles/auranbuckles.github.io", "id": "ed7dbf49b3815aed536ec0612dce8467338171f8", "size": "10215", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/2018-01-22-creating-dynamic-nested-forms-in-rails-with-jquery-part-ii.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "21978" }, { "name": "HTML", "bytes": "15071" }, { "name": "JavaScript", "bytes": "54193" }, { "name": "PHP", "bytes": "1242" }, { "name": "Ruby", "bytes": "6242" } ], "symlink_target": "" }