text
stringlengths
2
1.04M
meta
dict
. ${srcdir}/tests/common.shi ${RUNENV} ${MEMCHECK} ./rwfile ${SRCDIR}/input_truecolor16.pam EPSI
{ "content_hash": "182dcc046cd7e5bc7f5aa63465fb449e", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 67, "avg_line_length": 48.5, "alnum_prop": 0.711340206185567, "repo_name": "anasazi/POP-REU-Project", "id": "399c1d7959dc00a9f3567954dadd381b59d34704", "size": "366", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "pkgs/libs/imagick/src/tests/rwfile_EPSI_truecolor16.sh", "mode": "33261", "license": "bsd-3-clause", "language": [ { "name": "Ada", "bytes": "89080" }, { "name": "Assembly", "bytes": "2968894" }, { "name": "Awk", "bytes": "142" }, { "name": "C", "bytes": "78039389" }, { "name": "C#", "bytes": "55726" }, { "name": "C++", "bytes": "14864428" }, { "name": "CLIPS", "bytes": "6933" }, { "name": "CSS", "bytes": "20961" }, { "name": "Emacs Lisp", "bytes": "9437" }, { "name": "FORTRAN", "bytes": "6058" }, { "name": "Java", "bytes": "291" }, { "name": "JavaScript", "bytes": "37584" }, { "name": "Logos", "bytes": "108920" }, { "name": "Lua", "bytes": "9" }, { "name": "Objective-C", "bytes": "362902" }, { "name": "PHP", "bytes": "20640" }, { "name": "Pascal", "bytes": "40318" }, { "name": "Perl", "bytes": "2135645" }, { "name": "Pike", "bytes": "1350" }, { "name": "Prolog", "bytes": "3350" }, { "name": "Python", "bytes": "871836" }, { "name": "Rebol", "bytes": "106436" }, { "name": "Ruby", "bytes": "1237" }, { "name": "Scheme", "bytes": "4249" }, { "name": "Shell", "bytes": "3227172" }, { "name": "Tcl", "bytes": "2809" }, { "name": "VimL", "bytes": "7550" }, { "name": "XSLT", "bytes": "167485" }, { "name": "eC", "bytes": "4568" } ], "symlink_target": "" }
var Maybe = require('data.maybe') var compose = require('core.lambda').compose var chalk = require('chalk') var show = require('util').inspect var Nothing = Maybe.Nothing var Just = Maybe.Just var success = chalk.green var failure = chalk.red var ignored = chalk.gray var faded = chalk.gray /** * Computes the nesting level of a suite/test. * * @summary Test → Number */ function level(test) { return (test.fullTitle().filter(Boolean).length - 1) * 2 } /** * Pads a String with some whitespace. * * @summary Number, String → String */ function pad(n, s) { var before = Array(n + 1).join(' ') return s.split(/\r\n|\r|\n/) .map(function(a){ return before + a }) .join('\n') } /** * Overtly ad-hoc pluralization. * * @summary Number, String → String */ function plural(n, s) { return n > 1? s + 's' : /* otherwise */ s } /** * Shows that a suite has started. * * @summary Signal → Test → Maybe[(Int, String)] */ function maybeRenderSuite(signal) { return function(a) { return a.cata({ Suite: function(){ return Just([signal.path.length, a.name]) } , Case: Nothing }) }} /** * Shows the logs of a result * * @summary Result → String */ function logs(a) { return a.isIgnored? '' : a.log.length === 0? '' : /* otherwise */ '\n' + pad( 2 , '=== Captured logs:\n' + a.log.map(function(x){ return faded('- ' + show(x.log))}) .join('\n') + '\n---\n') } /** * Re-throws an error. * * @summary Error → Void */ function raise(error){ setTimeout(function(){ throw error }) } /** * Shows the result of running a test. * * @summary Result → String */ function renderResult(a) { return a.cata({ Success: function() { return success('✓ ' + a.name()) } , Failure: function(_, ex) { return failure('✗ ' + a.name()) + '\n' + faded(pad(2, '[' + ex.name + ']: ' + ex.message)) } , Ignored: function() { return ignored('⚪ ' + a.name()) } }) + logs(a) } /** * Renders the number of ignored tests. * * @summary Number → String */ function renderIgnored(x){ return x > 0? x + ' ignored / ' : /* otherwise */ '' } /** * A reporter for Spec-style output of Hi-Five tests. * * You can specify an alternative logging function, by default we just go * happily with `console.log` * * @summary (String... → Void) → Report → Void */ module.exports = function specReporter(logger) { return function(stream, report) { if (!logger) logger = console.log.bind(console) function log() { logger([].join.call(arguments, ' ')) } var toRender = stream.map(function(a) { return a.cata({ Started : maybeRenderSuite(a) , TestResult : function(x){ return Just([x.title.length - 1, renderResult(x)]) } , Finished : Nothing })}) toRender.subscribe( function(x){ x.chain(function(xs) { log(pad(xs[0] * 2, xs[1])) })} , raise) report.subscribe(function(data) { var passed = data.passed.length var failed = data.failed.length var ignored = data.ignored.length var total = passed + failed var colour = failed? failure : success log('') log( colour('Ran ' + total + ' ' + plural(total, 'test')) + ' ' + faded('(' + renderIgnored(ignored) + data.time() + 'ms)')) if (passed) log(success(passed + ' ' + plural(passed, 'test') + ' passed.')) if (failed) log(failure(failed + ' ' + plural(failed, 'test') + ' failed.')) data.failed.forEach(function(d, i) { d.cata({ Failure: function(_, ex) { log('') log(failure(i + 1 + ') ' + d.fullTitle())) log(faded(pad(2, '[' + ex.name + ']: ' + '\n' + ex.stack))) log('---') } })}) }) }}
{ "content_hash": "683e5882126e7bd4e4af25faa76da8a4", "timestamp": "", "source": "github", "line_count": 158, "max_line_length": 87, "avg_line_length": 25.740506329113924, "alnum_prop": 0.5247110892549791, "repo_name": "origamitower/specify-reporter-spec", "id": "a98f3a3c706c5f475ad9e7b1516f3839ce4980ea", "size": "4097", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "index.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "4097" } ], "symlink_target": "" }
int TestFunction(std::ostream& _stream, const char* _log) { _stream << _log << std::endl; return 46; } void TestLogLevel(ozz::log::Level _level) { ozz::log::SetLevel(_level); EXPECT_LOG_LOGV(TestFunction(ozz::log::LogV(), "logv"), "logv"); EXPECT_LOG_LOG(TestFunction(ozz::log::Log(), "log"), "log"); EXPECT_LOG_OUT(TestFunction(ozz::log::Out(), "out"), "out"); EXPECT_LOG_ERR(TestFunction(ozz::log::Err(), "err"), "err"); EXPECT_EQ_LOG_LOGV(TestFunction(ozz::log::LogV(), "logv"), 46, "logv"); EXPECT_EQ_LOG_LOG(TestFunction(ozz::log::Log(), "log"), 46, "log"); EXPECT_EQ_LOG_OUT(TestFunction(ozz::log::Out(), "out"), 46, "out"); EXPECT_EQ_LOG_ERR(TestFunction(ozz::log::Err(), "err"), 46, "err"); } TEST(Log, Silent) { TestLogLevel(ozz::log::Silent); } TEST(Log, Standard) { TestLogLevel(ozz::log::Standard); } TEST(Log, Verbose) { TestLogLevel(ozz::log::Verbose); }
{ "content_hash": "31339dc3cc98941f136d6427666377a1", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 73, "avg_line_length": 30.1, "alnum_prop": 0.6323366555924695, "repo_name": "dgu123/ozz-animation-1", "id": "f8f81d04fd227c0c7c2bd7d5313a9e693167c00b", "size": "3098", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "test/base/log_tests.cc", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "14981" }, { "name": "C++", "bytes": "1483804" }, { "name": "CMake", "bytes": "65379" }, { "name": "HTML", "bytes": "600" }, { "name": "Python", "bytes": "21033" } ], "symlink_target": "" }
'use strict'; function ZZTFileStream(arrayBuffer) { this.dataView = new DataView(arrayBuffer); this.position = 0; } ZZTFileStream.prototype.getUint8 = function() { return this.dataView.getUint8(this.position++); } ZZTFileStream.prototype.getBoolean = function() { return this.dataView.getUint8(this.position++) > 0; } ZZTFileStream.prototype.getInt16 = function() { var v = this.dataView.getInt16(this.position, true); this.position += 2; return v; } /* Strings are 1 byte length, followed by maxlen bytes of data */ ZZTFileStream.prototype.getFixedPascalString = function(maxlen) { var len = this.getUint8(); if (len > maxlen) len = maxlen; var str = this.getFixedString(len); /* advance the rest */ this.position += (maxlen - len); return str; } ZZTFileStream.prototype.getFixedString = function(len) { var str = ""; for (var i = 0; i < len; ++i) { var ch = this.getUint8(); if (ch == 13) str += "\n"; else str += String.fromCharCode(ch); } return str; }
{ "content_hash": "bba5ad4feea473c9f4f523afe3172db3", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 65, "avg_line_length": 20.403846153846153, "alnum_prop": 0.6437323279924599, "repo_name": "bstreiff/zztjs", "id": "300c14055566d0d62b8edaec42fd32ddc6111ffe", "size": "1061", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "zztfilestream.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "58749" } ], "symlink_target": "" }
package org.odata4j.core; /** * An object with a title. * * <p>No behavior or semantics are implied, this is simply a convenient reusable interface.</p> */ public interface Titled { /** * Gets the title. * * @return the title */ String getTitle(); }
{ "content_hash": "9b2b3404784c302894ac7c96a3af3a78", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 95, "avg_line_length": 17.058823529411764, "alnum_prop": 0.596551724137931, "repo_name": "delkyd/oreva", "id": "b2754108cf04bb8914f499024230810ee8e4000b", "size": "290", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "odata-core/src/main/java/org/odata4j/core/Titled.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "2342080" } ], "symlink_target": "" }
require 'spec_helper' describe Terrier::DoiData do describe 'initalizer' do use_vcr_cassette it "sets passed in doi as url" do terrier = Terrier::DoiData.new('doi:10.1186/1479-5868-10-79') expect(terrier.doi).to eq('doi:10.1186/1479-5868-10-79') end end describe 'data' do use_vcr_cassette it "returns a collection containing the a url" do expect(Terrier::DoiData.new('doi:10.1186/1479-5868-10-79').data[:url]).to eq('http://dx.doi.org/10.1186/1479-5868-10-79') end it "returns a collection containing the journal name" do expect(Terrier::DoiData.new('doi:10.1186/1479-5868-10-79').data[:journal]).to eq('Int J Behav Nutr Phys Act') end it "returns a collection containing the journal publisher" do expect(Terrier::DoiData.new('doi:10.1186/1479-5868-10-79').data[:publisher]).to eq('Springer Science + Business Media') end it "returns a collection containing the journal title" do expect(Terrier::DoiData.new('doi:10.1186/1479-5868-10-79').data[:title]).to eq('The relationship between cell phone use, physical and sedentary activity, and cardiorespiratory fitness in a sample of U.S. college students') end it "returns a collection containing a collection of authors" do expect(Terrier::DoiData.new('doi:10.1186/1479-5868-10-79').data[:authors]).to eq(["Andrew Lepp", "Jacob E Barkley", "Gabriel J Sanders", "Michael Rebold", "Peter Gates"]) end it "returns a collection containing publication year" do expect(Terrier::DoiData.new('doi:10.1186/1479-5868-10-79').data[:publication_year]).to eq(2013) end it "returns a collection containing issn" do expect(Terrier::DoiData.new('doi:10.1186/1479-5868-10-79').data[:issn]).to eq(["1479-5868"]) end it "returns a collection containing a well formed bibliography" do expect(Terrier::DoiData.new('doi:10.1186/1479-5868-10-79').data[:bibliography]).to eq("Lepp, A., Barkley, J. E., Sanders, G. J., Rebold, M., & Gates, P. (2013). The relationship between cell phone use, physical and sedentary activity, and cardiorespiratory fitness in a sample of U.S. college students. International Journal of Behavioral Nutrition and Physical Activity, 10(1), 79. <a href=\"https://doi.org/10.1186/1479-5868-10-79\">doi:10.1186/1479-5868-10-79</a>") end end end
{ "content_hash": "24391959b86408779939d3e31cece522", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 474, "avg_line_length": 48.04081632653061, "alnum_prop": 0.6992353440951572, "repo_name": "thewinnower/terrier", "id": "94d5d06e1cf1c5759804702d835db7c04b7d242b", "size": "2354", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spec/doi_data_spec.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "15143" } ], "symlink_target": "" }
package com.szh.util; import com.google.gson.Gson; import com.google.gson.JsonObject; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang.StringUtils; import org.apache.http.Consts; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.config.CookieSpecs; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.utils.URIBuilder; import org.apache.http.config.*; import org.apache.http.conn.socket.ConnectionSocketFactory; import org.apache.http.conn.socket.PlainConnectionSocketFactory; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.conn.ssl.SSLContexts; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.FileBody; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.message.BasicHeader; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.CodingErrorAction; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * @author jianguo.li * @date 2014年2月21日 * @descriable 发送HTTP请求的工具类,主要是对apache httpclient4.3的进行下一步的封装 */ public final class HTTPUTIL { private static final Logger LOG = Logger.getLogger(HTTPUTIL.class); private static final int HTTP_CONNECT_TIME_OUT_IN_MILLIS = 5000; private static final int HTTP_SOCKET_TIME_OUT_IN_MILLIS = 5000; private static final int HTTP_REQUEST_CONNECT_TIME_OUT_IN_MILLIS = 3000; private static final int HTTP_MAX_CONNECTIONS = 1000; private static final int MAX_RETRY_TIMES = 3; private static final int MAX_HTTP_HEADER_COUNT = 200; private static final int MAX_HTTP_BODY_LINE_COUNT = 100000; private static CloseableHttpClient httpClient; private HTTPUTIL() { } static { try { // 设置HTTPS链接的信息 SSLContext sslContext = SSLContexts.custom().useTLS().build(); sslContext.init(null, new TrustManager[]{new X509TrustManager() { public X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(X509Certificate[] certs, String authType) { } public void checkServerTrusted(X509Certificate[] certs, String authType) { } }}, null); Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder .<ConnectionSocketFactory>create() .register("http", PlainConnectionSocketFactory.INSTANCE) .register("https", new SSLConnectionSocketFactory(sslContext)).build(); // 构建HTTP链接池 PoolingHttpClientConnectionManager ClientConnectionManager = new PoolingHttpClientConnectionManager( socketFactoryRegistry); RequestConfig requestConfig = RequestConfig .custom() // 设置建立TCP连接的最大等待时间(毫秒) .setConnectTimeout(HTTP_CONNECT_TIME_OUT_IN_MILLIS) // 设置从HTTP连接池中获取一个链接的最大等待时间(毫秒) .setConnectionRequestTimeout( HTTP_REQUEST_CONNECT_TIME_OUT_IN_MILLIS) // 设置获取获取响应的最大等待时间(毫秒) .setSocketTimeout(HTTP_SOCKET_TIME_OUT_IN_MILLIS) // 设置成浏览器兼容的模式 .setCookieSpec(CookieSpecs.BROWSER_COMPATIBILITY).build(); SocketConfig socketConfig = SocketConfig.custom() // 因为是LAN所以讲tcpNoDelay打开 .setTcpNoDelay(true).build(); ClientConnectionManager.setDefaultSocketConfig(socketConfig); // Create message constraints MessageConstraints messageConstraints = MessageConstraints.custom() // 设置能接受HTTP头的最大数量 .setMaxHeaderCount(MAX_HTTP_HEADER_COUNT) // 设置能接受的HTTP体最大的数量 .setMaxLineLength(MAX_HTTP_BODY_LINE_COUNT).build(); // Create connection configuration ConnectionConfig connectionConfig = ConnectionConfig.custom() .setMalformedInputAction(CodingErrorAction.IGNORE) .setUnmappableInputAction(CodingErrorAction.IGNORE) // 设置HTTP的编码 .setCharset(Consts.UTF_8) .setMessageConstraints(messageConstraints).build(); ClientConnectionManager .setDefaultConnectionConfig(connectionConfig); // 连接池里的最大连接数 ClientConnectionManager.setMaxTotal(HTTP_MAX_CONNECTIONS); // 每个路由的默认最大连接数,这服务器的数量以及连接池的最大连接数有关 ClientConnectionManager .setDefaultMaxPerRoute(HTTP_MAX_CONNECTIONS / 2); // 设置默认的HTTP请求头信息 List<BasicHeader> defaultHeaders = new ArrayList<BasicHeader>() { private static final long serialVersionUID = 1263811764541797122L; { // 不使用缓存,默认的HTTP Client就是禁用缓存的,这里就画蛇添足一下,以防止万一:P add(new BasicHeader("Expires", "0")); add(new BasicHeader("Cache-Control", "no-store")); } }; httpClient = HttpClientBuilder .create() // 设置HTTP的重试策略,目前设置为重新尝试3次(已关闭重试) .setRetryHandler( new DefaultHttpRequestRetryHandler(MAX_RETRY_TIMES, false)) .setConnectionManager(ClientConnectionManager) .setDefaultRequestConfig(requestConfig) .setDefaultHeaders(defaultHeaders).build(); } catch (Exception e) { throw new RuntimeException(e); } } /* * 发送HTTP GET 请求并并将返回值以字符串的形式返回,默认以UTF-8的编码格式返回 * * @param url *请求地址 * @param queryParameterPair *查询参数 * @param encoding *期望的返回的字符编码格式,默认的编码设置为UTF-8 * *@return */ public static String sendGetRequest(String url, Map<String, String> queryParameterPair, String encoding) { String result = null; HttpGet httpGet = null; CloseableHttpResponse response = null; try { URIBuilder UriBuilder = new URIBuilder(url); if (MapUtils.isNotEmpty(queryParameterPair)) { for (Map.Entry<String, String> param : queryParameterPair .entrySet()) { UriBuilder.addParameter(param.getKey(), param.getValue()); } } if (LOG.isInfoEnabled()) { LOG.info("request url[" + UriBuilder.build() + "]"); } httpGet = new HttpGet(UriBuilder.build()); response = httpClient.execute(httpGet); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { LOG.error("send get request url[" + UriBuilder.build() + "] return http status code = " + statusCode); } HttpEntity entity = response.getEntity(); if (entity != null) { try { if (StringUtils.isBlank(encoding)) { encoding = "UTF-8"; } result = EntityUtils.toString(entity, encoding); } finally { // 这个方法也可以把底层的流给关闭了 EntityUtils.consume(entity); } } } catch (Exception e) { LOG.error("occur error : ", e); } finally { if (response != null) { try { response.close(); } catch (IOException e) { LOG.error("close response occur error :", e); } } } return result; } /* @param url *请求的URI包含QueryString的信息 * @param encoding *期望的返回的字符编码格式,默认的编码设置为UTF-8 *@return */ public static String sendGetRequest(String url, String encoding) { String result = null; HttpGet httpGet = null; try { httpGet = new HttpGet(url); HttpResponse response = httpClient.execute(httpGet); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode == HttpStatus.SC_OK) { LOG.error("send get request url[" + url + "] return http status code = " + statusCode); } HttpEntity entity = response.getEntity(); if (entity != null) { try { if (StringUtils.isBlank(encoding)) { encoding = "UTF-8"; } result = EntityUtils.toString(entity, encoding); } finally { // 这个方法也可以把底层的流给关闭了 EntityUtils.consume(entity); } } } catch (Exception e) { LOG.error("occur error : ", e); } finally { if (httpGet != null) { httpGet.abort(); } } return result; } /* /*/ /** * 发送HTTP GET请求 * ,并将返回结果以字节数组的形式返回 * * @param url 请求的地址 * @param queryParameterPair 请求的参数列表 * @return *//*/*/ public static byte[] sendGetRequest(String url, Map<String, String> queryParameterPair) { byte[] result = null; HttpGet httpGet = null; try { URIBuilder UriBuilder = new URIBuilder(url); if (MapUtils.isNotEmpty(queryParameterPair)) { for (Map.Entry<String, String> param : queryParameterPair .entrySet()) { UriBuilder.addParameter(param.getKey(), param.getValue()); } } httpGet = new HttpGet(UriBuilder.build()); HttpResponse response = httpClient.execute(httpGet); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode == HttpStatus.SC_OK) { HttpEntity entity = response.getEntity(); if (entity != null) { try { result = EntityUtils.toByteArray(entity); } finally { // 这个方法也可以把底层的流给关闭了 EntityUtils.consume(entity); } } } else { LOG.error("send get request url[" + UriBuilder.build() + "] return http status code = " + statusCode); } } catch (Exception e) { LOG.error("occur error : ", e); } finally { if (httpGet != null) { httpGet.abort(); } } return result; } /* 发送HTTP GET请求 * ,并将返回结果以字节数组的形式返回 * * @param url 请求的地址 * @param queryParameterPair 请求的参数列表 *@return */ public static byte[] sendGetRequest(String url) { byte[] result = null; HttpGet httpGet = null; try { httpGet = new HttpGet(url); HttpResponse response = httpClient.execute(httpGet); int statusCode = response.getStatusLine().getStatusCode(); if (statusCode == HttpStatus.SC_OK) { HttpEntity entity = response.getEntity(); if (entity != null) { try { result = EntityUtils.toByteArray(entity); } finally { // 这个方法也可以把底层的流给关闭了 EntityUtils.consume(entity); } } } else { LOG.error("send get request url[" + url + "] return http status code = " + statusCode); } } catch (Exception e) { LOG.error("occur error : ", e); } finally { if (httpGet != null) { httpGet.abort(); } } return result; } /* 发送 HTTP POST的请求,并将返回结果以字符串的形式返回 * * @param url *请求地址 * @param content *发送的内容 * @param encoding *设置字符编码 * @param isSetHeader *是否设置Content- type http头字段 *@return*/ public static String sendPostRequest(String url, String content, String encoding, boolean isSetHeader) { HttpPost httpPost = new HttpPost(url); if (isSetHeader) { httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded"); } String result = null; try { StringEntity strEntity = new StringEntity(content, encoding); strEntity.setContentEncoding(encoding); httpPost.setEntity(strEntity); HttpResponse response = httpClient.execute(httpPost); HttpEntity resEntity = response.getEntity(); if (resEntity != null) { try { if (StringUtils.isBlank(encoding)) { encoding = "UTF-8"; } result = EntityUtils.toString(resEntity, encoding).trim(); } finally { EntityUtils.consume(resEntity); } } } catch (Exception e) { LOG.error("occur error :", e); } finally { httpPost.abort(); } return result; } /* *上传文件 * * @param url *请求的地址 * @param fileField *文件的上传的字段名称 * @param file *将要上传的文件 * @param params *将要设置的参数列表 *@return*/ public static String uploadFile(String url, String fileField, File file, Map<String, String> params) { String result = null; HttpPost httpPost = null; try { httpPost = new HttpPost(url); FileBody fileBody = new FileBody(file); MultipartEntityBuilder reqEntityBuilder = MultipartEntityBuilder .create(); reqEntityBuilder.addPart(fileField, fileBody); for (Map.Entry<String, String> mapEntry : params.entrySet()) { reqEntityBuilder.addPart(mapEntry.getKey(), new StringBody( mapEntry.getValue(), ContentType.TEXT_PLAIN)); } // 设置请求 httpPost.setEntity(reqEntityBuilder.build()); // 执行 HttpResponse response = httpClient.execute(httpPost); HttpEntity entity = response.getEntity(); if (entity != null) { try { result = EntityUtils.toString(entity).trim(); } finally { EntityUtils.consume(entity); } } } catch (Exception e) { LOG.error(" occur error ", e); } finally { httpPost.abort(); } return result; } /* 发送HTTP POST请求以JSON的格式发送 * * @param url * @param jsonHttpBody * @param queryStringPairs * @param encoding *@return*/ public static String sendPostRequestWithJsonEntity(String url, JsonObject jsonHttpBody) { DefaultHttpClient client = new DefaultHttpClient(); try { URIBuilder builder = new URIBuilder(url); HttpPost postRequest = new HttpPost( builder.build()); String jsonString = new Gson().toJson(jsonHttpBody); StringEntity input = new StringEntity(jsonString); input.setContentType("application/json"); postRequest.setEntity(input); HttpResponse response = client.execute(postRequest); BufferedReader br = new BufferedReader(new InputStreamReader( (response.getEntity().getContent()))); StringBuilder sb = new StringBuilder(); String output; while ((output = br.readLine()) != null) { sb.append(output); } return sb.toString(); } catch (Exception e) { LOG.error("[POST DATA]", e); return null; } finally { client.getConnectionManager().shutdown(); } } /* public static Pair<String, Map<String, String>> sendPostRequestWithHeader(String host, String queryString, String httpBody, Map<String, String> headers, String encoding, String... headNames) { Pair<String, Map<String, String>> result = new Pair<String, Map<String, String>>("", new HashMap<String, String>()); if (StringUtils.isNotBlank(queryString)) { host = host + "?" + queryString; } LOG.info("[request url=" + host + "]"); HttpPost httpPost = new HttpPost(host); try { for (Map.Entry<String, String> header : headers.entrySet()) { httpPost.addHeader(header.getKey(), header.getValue()); } // 设置请求 if (StringUtils.isNotBlank(httpBody)) { httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded"); StringEntity stringEntity = new StringEntity(httpBody, encoding); stringEntity.setContentEncoding(encoding); httpPost.setEntity(stringEntity); } LOG.info("[request http body=" + httpBody + "]"); HttpResponse response = httpClient.execute(httpPost); if (null != headNames) { Map<String, String> heads = new HashMap<String, String>(); for (String headName : headNames) { if (StringUtils.isNotBlank(headName) && null != response.getFirstHeader(headName)) { heads.put(headName, response.getFirstHeader(headName).getValue()); } } result.setValue(heads); } final int statusCode = response.getStatusLine().getStatusCode(); if (statusCode == HttpStatus.SC_OK) { LOG.error("[send post request return http status code :" + statusCode); } HttpEntity entity = response.getEntity(); if (entity != null) { try { result.setKey(EntityUtils.toString(entity, encoding).trim()); } finally { EntityUtils.consume(entity); } } } catch (Exception e) { LOG.error(" catch error : " + e); } finally { httpPost.abort(); } return result; }*/ /* public static String nativeSendGetRequest(String url, boolean useProxy) throws Exception { HttpURLConnection connection = null; BufferedReader in = null; String result = null; try { URL urlAddress = new URL(url); if (useProxy) { final String proxyHost = GameConfigLogic.INSTANCE.getGameConfigValue("proxyUrl"); final int proxyPort = Integer.valueOf(GameConfigLogic.INSTANCE.getGameConfigValue("proxyPort")); Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort)); connection = (HttpURLConnection) urlAddress.openConnection(proxy); } else { connection = (HttpURLConnection) urlAddress.openConnection(); } connection.setRequestMethod("get"); connection.setConnectTimeout(HTTP_CONNECT_TIME_OUT_IN_MILLIS); connection.setReadTimeout(HTTP_SOCKET_TIME_OUT_IN_MILLIS); connection.setDefaultUseCaches(false); connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); final int stateCode = connection.getResponseCode(); if (200 != stateCode) { LOG.error("request url[" + url + "] status code[" + stateCode + "]"); } in = new BufferedReader( new InputStreamReader(connection.getInputStream())); StringBuffer response = new StringBuffer(); String inputLine = null; while ((inputLine = in.readLine()) != null) { response.append(inputLine); } result = response.toString(); } catch (Exception e) { LOG.error("occur error:", e); } finally { if (null != in) { in.close(); } if (null != connection) { connection.connect(); } } return result; }*/ }
{ "content_hash": "786839ff5d764a02cb1230ab2abc1c05", "timestamp": "", "source": "github", "line_count": 689, "max_line_length": 198, "avg_line_length": 32.432510885341074, "alnum_prop": 0.537322115814911, "repo_name": "zhihaoSong/com-szh-concurrent", "id": "400133f0b4deaf05552a886eef35f33c48963329", "size": "23484", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/szh/util/HTTPUTIL.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "436827" }, { "name": "Shell", "bytes": "1589" } ], "symlink_target": "" }
{% extends 'judge/base.html' %} {% block body_block %} <div style="position: relative;top: 100px"> <div> <h1> {{ problem.name}} </h1> <br/><br/> {{ problem.statement }} </div> </div> {% endblock %} {% block submit %} <a class = "item" href="/judge/submit/{{problem.code}}"> Submit Solution </a> {%endblock%}
{ "content_hash": "8836cc3598d4a4ccdf5f4734b7183b7d", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 57, "avg_line_length": 19.235294117647058, "alnum_prop": 0.5749235474006116, "repo_name": "paramsingh/poj", "id": "a0bd2b82f19cd8d249bb1743f719100d7517b6d0", "size": "327", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "templates/judge/problem.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1443333" }, { "name": "HTML", "bytes": "2076" }, { "name": "JavaScript", "bytes": "1428038" }, { "name": "Python", "bytes": "15677" } ], "symlink_target": "" }
using System.Linq; using Plainion.Wiki.AST; using Plainion.Wiki.Rendering; namespace Plainion.Wiki.Xaml.Rendering.RenderActions { [XamlRenderAction( typeof( PreformattedText ) )] public class PreformattedTextRenderAction : GenericRenderAction<PreformattedText> { protected override void Render( PreformattedText text ) { WriteLine( "<Paragraph FontFamiliy=\"Courier New\">" ); WriteLine( text.Text ); WriteLine( "</Paragraph>" ); } } }
{ "content_hash": "c5bc83dfa715d983d1a1116eda1287b3", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 85, "avg_line_length": 31.235294117647058, "alnum_prop": 0.6421845574387948, "repo_name": "ronin4net/Plainion.Notes", "id": "7c73261ab526ca5fd5c7697308f44ff28d1c2ca3", "size": "533", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Plainion.Wiki.Xaml/Rendering/RenderActions/PreformattedTextRenderAction.cs", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C#", "bytes": "660564" }, { "name": "CSS", "bytes": "7721" }, { "name": "F#", "bytes": "681" }, { "name": "HTML", "bytes": "1450" }, { "name": "JavaScript", "bytes": "2509" } ], "symlink_target": "" }
import _plotly_utils.basevalidators class IdsValidator(_plotly_utils.basevalidators.DataArrayValidator): def __init__(self, plotly_name="ids", parent_name="volume", **kwargs): super(IdsValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, edit_type=kwargs.pop("edit_type", "calc"), role=kwargs.pop("role", "data"), **kwargs )
{ "content_hash": "d037505516d9a426f323a3187d345ff0", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 74, "avg_line_length": 35.916666666666664, "alnum_prop": 0.5986078886310905, "repo_name": "plotly/python-api", "id": "46bb0b47d03425f9c288bb18973f8f197246bb10", "size": "431", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "packages/python/plotly/plotly/validators/volume/_ids.py", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "6870" }, { "name": "Makefile", "bytes": "1708" }, { "name": "Python", "bytes": "823245" }, { "name": "Shell", "bytes": "3238" } ], "symlink_target": "" }
<?php use HtmlObject\Element; class TreeObjectTest extends HtmlObjectTests { public function setUp() { $this->object = new Element('p', 'foo'); } public function testCanNest() { $object = Element::strong('foo'); $this->object->nest('strong', 'foo'); $this->assertEquals('<p>foo<strong>foo</strong></p>', $this->object->render()); } public function testCanNestStrings() { $object = Element::strong('foo'); $this->object->nest('<strong>foo</strong>'); $this->assertEquals('<p>foo<strong>foo</strong></p>', $this->object->render()); } public function testCanNestObjects() { $object = Element::strong('foo'); $this->object->nest($object); $this->assertEquals('<p>foo<strong>foo</strong></p>', $this->object->render()); } public function testCanNestObjectsInChildren() { $object = Element::strong('foo'); $link = Element::a('foo'); $this->object->nest($object, 'body'); $this->object->nest($link, 'body.link'); $this->assertEquals('<p>foo<strong>foo<a>foo</a></strong></p>', $this->object->render()); } public function testCanNestStringsInChildren() { $strong = Element::strong('title'); $title = Element::h1('bar')->nest($strong, 'strong'); $object = Element::div()->nest($title, 'title'); $this->object->nest($object, 'body'); $this->object->nest('by <a>someone</a>', 'body.title'); $this->assertEquals('<p>foo<div><h1>bar<strong>title</strong>by <a>someone</a></h1></div></p>', $this->object->render()); } public function testCanGetNestedElements() { $object = Element::strong('foo'); $this->object->nest($object, 'foo'); $this->assertEquals($object, $this->object->getChild('foo')); } public function testCanGetChildWithDotsInName() { $object = Element::p('foo'); $this->object->setChild($object, '11:30 a.m.', true); $this->assertEquals($object, $this->object->getChild('11:30 a.m.')); } public function testCanNestMultipleValues() { $object = Element::strong('foo'); $this->object->nestChildren(array('strong' => 'foo', 'em' => 'bar')); $this->assertEquals('<p>foo<strong>foo</strong><em>bar</em></p>', $this->object->render()); } public function testCanNestMultipleValuesUsingNest() { $object = Element::strong('foo'); $this->object->nest(array('strong' => 'foo', 'em' => 'bar')); $this->assertEquals('<p>foo<strong>foo</strong><em>bar</em></p>', $this->object->render()); } public function testCanNestMultipleElements() { $foo = Element::strong('foo'); $bar = Element::p('bar'); $this->object->nestChildren(array( 'foo' => $foo, 'bar' => $bar, )); $this->assertEquals($foo, $this->object->getChild('foo')); $this->assertEquals($bar, $this->object->getChild('bar')); } public function testCanNestMultipleObjects() { $strong = Element::strong('foo'); $em = Element::em('bar'); $this->object->nestChildren(array($strong, $em)); $this->assertEquals('<p>foo<strong>foo</strong><em>bar</em></p>', $this->object->render()); } public function testCanWalkTree() { $strong = Element::strong('foo'); $this->object->nest($strong); $this->assertEquals($this->object, $this->object->getChild(0)->getParent()); } public function testCanModifyChildren() { $strong = Element::strong('foo'); $this->object->nest($strong); $this->object->getChild(0)->addClass('foo'); $this->assertEquals('<p>foo<strong class="foo">foo</strong></p>', $this->object->render()); } public function testCanCrawlToTextNode() { $this->object->nest('<strong>foo</strong>'); $this->object->getChild(0)->addClass('foo'); $this->assertEquals('<p>foo<strong>foo</strong></p>', $this->object->render()); } public function testCanCrawlSeveralLayersDeep() { $strong = Element::strong('foo'); $em = Element::em('bar'); $this->object->nest($strong, 'strong')->getChild('strong')->nest($em, 'em'); $this->assertEquals('<p>foo<strong>foo<em>bar</em></strong></p>', $this->object->render()); $this->assertEquals($em, $this->object->getChild('strong.em')); } public function testCanCrawlAnonymousLayers() { $strong = Element::strong('foo'); $em = Element::em('bar'); $this->object->nest($strong)->getChild(0)->nest($em); $this->assertEquals('<p>foo<strong>foo<em>bar</em></strong></p>', $this->object->render()); $this->assertEquals($em, $this->object->getChild('0.0')); } public function testCanGoBackUpSeveralLevels() { $strong = Element::strong('foo'); $em = Element::em('bar'); $this->object->nest($strong, 'strong')->getChild('strong')->nest($em, 'em'); $child = $this->object->getChild('strong.em'); $this->assertEquals($child->getParent()->getParent(), $this->object); $this->assertEquals($child->getParent()->getParent(), $child->getParent(1)); } public function testCanCheckIfObjectHasParent() { $this->object->setParent(Element::div()); $this->assertTrue($this->object->hasParent()); } public function testCanCheckIfObjectHasChildren() { $this->assertFalse($this->object->hasChildren()); $this->object->nest(Element::div()); $this->assertTrue($this->object->hasChildren()); } public function testCanCheckIfChildrenIsAfterSibling() { $this->object->nestChildren(array( 'first' => Element::div(), 'last' => Element::div(), )); $first = $this->object->first; $last = $this->object->last; $this->assertTrue($last->isAfter('first')); $this->assertFalse($first->isAfter('last')); } public function testCanCheckIfElementHasChild() { $element = Element::create('div', 'foo'); $this->object->nest($element, 'body'); $this->assertTrue($this->object->hasChild('body')); $this->assertFalse($this->object->hasChild('title')); } }
{ "content_hash": "7b12bc4132bebe389e39a843c9b64382", "timestamp": "", "source": "github", "line_count": 202, "max_line_length": 125, "avg_line_length": 29.326732673267326, "alnum_prop": 0.6159689399054693, "repo_name": "back1992/gary", "id": "9a019f612fc97c63c0daaf723eb6afc80ea01577", "size": "5924", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "vendor/anahkiasen/html-object/tests/TreeObjectTest.php", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "13801" }, { "name": "JavaScript", "bytes": "386003" }, { "name": "PHP", "bytes": "781268" }, { "name": "Perl", "bytes": "2452" }, { "name": "Shell", "bytes": "191" } ], "symlink_target": "" }
<?php declare(strict_types=1); namespace SuitUp\Paginate; use Closure; use Countable; use SuitUp\Database\DbAdapter\QueryCreatorInterface; use SuitUp\Database\DbAdapterInterface; use SuitUp\Exception\PaginateException; /** * Class Paginate * * @package SuitUp\Paginate */ class Paginate implements Countable, PaginateI { /** * The name of parameter from URL */ private static $paramName = 'page'; /** * @var DbAdapterInterface */ private $db; /** * The SQL Query object * * @var QueryCreatorInterface */ private $adapter; /** * A list of parameters to append to the query * * @var array */ private $params = array(); /** * The result set. * * @var array */ private $result; /** * Number total of pages * * @var integer */ private $totalPages = 1; /** * Total pages shown to the user to choose * * @var integer */ private $pageRange = 5; /** * The current page number * * @var integer */ private $currentPage = 1; /** * Maximum registers shown on each page * * @var integer */ private $numberPerPage = 50; /** * This callback function is executed for each row returned by the SQL Query * * @var Closure */ private $itemCallback; /** * Change the name of parameter in the URL that identifies the current page. * It is used in the paginate.phtml file. * * @param string $name * @return void */ public static function setParamName(string $name): void { self::$paramName = $name; } /** * Return the parameter in the URL that identifies the current page. * It is used in the paginate.phtml file. * * @return string */ public static function getParamName(): string { return self::$paramName; } /** * Setup pagination by database connection and the object to construct the Sql query. * * @param DbAdapterInterface $db * @param QueryCreatorInterface $adapter * @param array $params A list of parameters to the query * @param Closure $closureFunc */ public function __construct(DbAdapterInterface $db, QueryCreatorInterface $adapter, array $params = array(), Closure $closureFunc = null) { $this->setDb($db); $this->setAdapter($adapter); if ($params) { $this->setParams($params); } if ($closureFunc) { $this->setClosureFunc($closureFunc); } } /** * The Db Adapter responsible to the connection and to management of * SQL Queries * * @param DbAdapterInterface $db * @return Paginate */ public function setDb(DbAdapterInterface $db): Paginate { $this->db = $db; return $this; } /** * The Db Adapter responsible to the connection and to management of * SQL Queries * * @return DbAdapterInterface */ public function getDb(): DbAdapterInterface { return $this->db; } /** * This object is responsible for assembling SQL queries. * * @param QueryCreatorInterface $adapter * @return Paginate */ public function setAdapter(QueryCreatorInterface $adapter): Paginate { $this->adapter = $adapter; return $this; } /** * Return the object is responsible for assembling SQL queries. * * @return QueryCreatorInterface */ public function getAdapter(): QueryCreatorInterface { return $this->adapter; } /** * List of parameters to the SQL Query * * @param array $params * @return Paginate */ public function setParams(array $params): Paginate { $this->params = $params; return $this; } /** * List of parameters to the SQL Query * * @return array */ public function getParams(): array { return $this->params; } /** * Set page to range in view to user * * @param string $pageRange * @return Paginate * @throws PaginateException */ public function setPageRange($pageRange): Paginate { if (is_integer($pageRange)) { if ($pageRange <= 2) { throw new PaginateException("The minimum range of pages must to be greater or equal to 3"); } } else { $pageRange = 'total'; } $this->pageRange = $pageRange; return $this; } /** * Return the number of pages in the range defined * * @return int */ public function getPageRange(): int { return $this->pageRange; } /** * Set current page. The offset of slice. * * @param mixed $currentPage * @return Paginate */ public function setCurrentPage($currentPage): Paginate { if ((int) $currentPage >= 1) { $this->currentPage = (int) $currentPage; } return $this; } /** * Return the number of current page (offset of slice). * * @return int */ public function getCurrentPage(): int { return (int) $this->currentPage; } /** * Number of rows per page * * @param int $numberPerPage * @return Paginate */ public function setNumberPerPage(int $numberPerPage): Paginate { if ((int) $numberPerPage >= 1) { $this->numberPerPage = (int) $numberPerPage; } return $this; } /** * Return number of rows per page * * @return int */ public function getNumberPerPage(): int { return (int) $this->numberPerPage; } /** * Append to the Paginate object a function that will be * executed for each row in the dataset. * * <b>It was made like that to avoid you to make loops * under the result set as array, what is a great lost of * performance.</b> * * @param Closure $func * @return $this */ public function setClosureFunc(Closure $func): Paginate { $this->itemCallback = $func; return $this; } /** * Return the function that must to be called for each row * in the dataset. * * @return Closure */ public function getClosureFunc(): Closure { return $this->itemCallback; } /** * Return number total of pieces that data was sliced * * @return int */ public function getTotalPages(): int { return (int) $this->totalPages; } /** * Return data sliced * * @return array */ public function getResult(): array { if ($this->result === null) { $this->rewind(); } return $this->result; } /** * Countable SPL. This class can count the number of results the object * will retrieve as an array. * * @return int */ public function count(): int { if ($this->result === null) { $this->rewind(); } // Get the query as string $query = $this->getAdapter()->__toString(); /** * Count the total rows possible with this SQL Query * * @todo Check with other types of database (postgres, db2, etc...) if the base query to do it must to be change. */ return (int) $this->getDb()->single("/* SuitUp Paginate */\r\nSELECT COUNT(1) FROM ($query) as tmp", $this->getParams()); } /** * Iterator. This method set in each loop the actual result * * @return Paginate */ public function rewind(): Paginate { $this->_setResult(); return $this; } /** * Iterator SPL. Gives the current data of object as an array * * @return mixed */ public function current() { if ($this->result === null) { $this->rewind(); } $item = current($this->result); // If there's an encapsulated function call it if ($this->itemCallback) { $callBack = $this->itemCallback; $callBack($item); } return $item; } /** * Iterator SPL. Gives the key data of object as an array * * @return mixed */ public function key() { return key($this->result); } /** * Iterator SPL. Gives the next data of object as an array * * @return Paginate */ public function next(): Paginate { next($this->result); return $this; } /** * Iterator SPL. Gives if is valid loop of object as an array * * @return bool */ public function valid(): bool { return $this->current() !== false; } /** * Determine the total of pages the data will sliced * * @return Paginate */ private function _setTotalPages(): Paginate { // Get the query string $query = $this->getAdapter()->__toString(); $count = $this->getDb()->single("/* SuitUp Paginate */\r\nSELECT COUNT(1) FROM ($query) as tmp", $this->getParams()); // Calculate $this->totalPages = (int) ceil($count / $this->getNumberPerPage()); return $this; } /** * Fetch SQL query to retrieve data sliced. Add to the SQL the limit clause * based on number per page and the relation between current page with number * per page. * * @return Paginate */ private function _setResult(): Paginate { $this->_setTotalPages(); if ($this->getCurrentPage() > $this->getTotalPages()) { $this->setCurrentPage($this->getTotalPages()); } $offSet = (($this->getCurrentPage() - 1) * $this->getNumberPerPage()); if ($offSet < 0) { $offSet = 0; } // Clone the object to avoid modification on it $adapter = clone $this->getAdapter(); // Effectuate the query $query = "/* SuitUp Paginate */\r\n".$adapter->limit($this->getNumberPerPage(), $offSet)->__toString(); $this->result = $this->getDb()->query($query, $this->getParams()); // If there's callback function if ($this->itemCallback) { $callBack = $this->itemCallback; foreach ($this->result as $key => $item) { // Replace the item with what was returned by the // user function $this->result[$key] = $callBack($item); } reset($this->result); } return $this; } }
{ "content_hash": "8f4dbdf4b809c072fe8ec6297546b98a", "timestamp": "", "source": "github", "line_count": 450, "max_line_length": 141, "avg_line_length": 22.448888888888888, "alnum_prop": 0.5816669966343299, "repo_name": "braghimsistemas/suitup-php", "id": "2487d641f1c8c970ea6276db4bd0c0494f96967b", "size": "11273", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Paginate/Paginate.php", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "14167" }, { "name": "PHP", "bytes": "284457" }, { "name": "Shell", "bytes": "39315" }, { "name": "TSQL", "bytes": "4993" } ], "symlink_target": "" }
<html> <head> <title>Dr Suvendrini Perera's panel show appearances</title> <script type="text/javascript" src="../common.js"></script> <link rel="stylesheet" media="all" href="../style.css" type="text/css"/> <script type="text/javascript" src="../people.js"></script> <!--#include virtual="head.txt" --> </head> <body> <!--#include virtual="nav.txt" --> <div class="page"> <h1>Dr Suvendrini Perera's panel show appearances</h1> <p>Dr Suvendrini Perera has appeared in <span class="total">1</span> episodes between 2010-2010. Note that these appearances may be for more than one person if multiple people have the same name.</p> <div class="performerholder"> <table class="performer"> <tr style="vertical-align:bottom;"> <td><div style="height:100px;" class="performances female" title="1"></div><span class="year">2010</span></td> </tr> </table> </div> <ol class="episodes"> <li><strong>2010-08-12</strong> / <a href="../shows/qanda.html">Q&A</a></li> </ol> </div> </body> </html>
{ "content_hash": "bf6367592bb1564b9ffb5c224d415c60", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 200, "avg_line_length": 33.53333333333333, "alnum_prop": 0.6699801192842942, "repo_name": "slowe/panelshows", "id": "a6eb2565cc64c9adda058886e997b3a3283d12e1", "size": "1006", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "people/d370qd8b.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "8431" }, { "name": "HTML", "bytes": "25483901" }, { "name": "JavaScript", "bytes": "95028" }, { "name": "Perl", "bytes": "19899" } ], "symlink_target": "" }
vert.x-microservice =================== A Vert.x based micro service framework [![Build Status](https://travis-ci.org/amoAHCP/vert.x-microservice.svg?branch=master)](https://travis-ci.org/amoAHCP/vert.x-microservice)
{ "content_hash": "e48a44da51e21c9ba72c42ea70f0c504", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 137, "avg_line_length": 36.5, "alnum_prop": 0.7077625570776256, "repo_name": "amoAHCP/vert.x-microservice", "id": "2b7cc318127edad8582c9235dbae95db0eba2cd7", "size": "219", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "276687" } ], "symlink_target": "" }
import java.util.*; public class Battleship { private ArrayList<String> locationCells; private String name; public void setLocationCells(ArrayList<String> loc) { locationCells = loc; } public void setName(String n) { name = n; } public String checkYourself(String userInput) { String result = "miss"; int index = locationCells.indexOf(userInput); if (index >= 0) { locationCells.remove(index); if (locationCells.isEmpty()) { result = "kill"; System.out.println("Ouch! You sunk " + name + " :("); } else { result = "hit"; } } return result; } }
{ "content_hash": "ac566ed102b501d5206828cab4e4ba1e", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 61, "avg_line_length": 20.677419354838708, "alnum_prop": 0.6068642745709828, "repo_name": "morganmccrory/java-battleship", "id": "aac2a16564c41ed53473fcd2371443a5f22dbd34", "size": "641", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Battleship.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "4950" } ], "symlink_target": "" }
title: 'Tie- ja Meriliikenteen siirto AWS-pilvipalveluun on valmistunut' categories: Tiedotteet image: lang: fi published: true ref: 2018-11-12-road-marine-now-in-aws traffictypes: - Tieliikenne - Meriliikenne tags: - Rajapinnat - Ylläpito --- Digitrafficin tie- ja meriliikenteen palvelut ovat siirtyneet AWS-pilvipalveluun. Merkillepantavaa muutoksessa ovat seuraavat asiat: * Ennen muutosta aikaleimat olivat Suomen paikallista aikaa. Muutoksen jälkeen ajat ilmoitetaan [koordinoidussa yleisajassa (UTC)](https://fi.wikipedia.org/wiki/ISO_8601#Aika). Lisäksi aikaleimojen formaatti vaihtui: Ennen muutosta aikaleiman perään merkittiin ero koordinoituun yleisaikaan (UTC). Muutoksen jälkeen käytetään koordinoidun yleisajan lyhennettä Z. Ennen muutosta ajat ilmoitettiin esimerkiksi muodossa `2018-11-06T15:51:00+03:00` Uusi formaatti samalle aikaleimalle on: `2018-11-06T12:51:00Z` Lisätietoja: [2018-11-12-timestamp-change](http://www.digitraffic.fi/tiedotteet/2018/11/12/timestamp-change.html) * Uudessa ympäristössä tietokantamoottori vaihtuu Postgres:iin, joten on mahdollista, että joissakin tulosjoukoissa vastausten järjestys hieman muuttuu. Muilta osin ympäristöjen pitäisi toimia identtisesti. Lue myös tiedote Websocket-rajapintojen muutoksista [2018-10-12-ws-legacy-marine](http://www.digitraffic.fi/tiedotteet/2018/10/12/ws-legacy-marine.html) sivulla.
{ "content_hash": "4f1386030610306f451e160eaf5d6eb3", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 176, "avg_line_length": 40.76470588235294, "alnum_prop": 0.8145743145743146, "repo_name": "lapintom/digitraffic", "id": "1cfd743f25ee6a18b38869d0fe1b20a8d3665daa", "size": "1410", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/2018-11-12-road-marine-now-in-aws.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "102259" }, { "name": "HTML", "bytes": "126933" }, { "name": "JavaScript", "bytes": "134606" }, { "name": "Ruby", "bytes": "1463" }, { "name": "Shell", "bytes": "298" } ], "symlink_target": "" }
package com.jrefinery.chart; import java.awt.*; import java.awt.font.*; import java.awt.geom.*; import java.util.*; /** * An axis that displays categories. Used for bar charts and line charts. * <P> * The axis needs to rely on the plot for placement of labels, since the plot controls how the * categories are distributed. */ public abstract class CategoryAxis extends Axis { /** * Standard constructor: returns a new CategoryAxis with attributes as specified by the * caller. * @param label The axis label; * @param labelFont The font for displaying the axis label; * @param labelPaint The paint used to draw the axis label; * @param labelInsets Determines the amount of blank space around the label; * @param showCategoryLabels Flag indicating whether or not category (tick) labels are visible; * @param categoryLabelFont The font used to display category (tick) labels; * @param categoryLabelPaint The paint used to draw category (tick) labels; * @param showTickMarks Flag indicating whether or not tick marks are visible; * @param tickMarkStroke The stroke used to draw tick marks (if visible). */ public CategoryAxis(String label, Font labelFont, Paint labelPaint, Insets labelInsets, boolean showCategoryLabels, Font categoryLabelFont, Paint categoryLabelPaint, Insets categoryLabelInsets, boolean showTickMarks, Stroke tickMarkStroke) { super(label, labelFont, labelPaint, labelInsets, showCategoryLabels, categoryLabelFont, categoryLabelPaint, categoryLabelInsets, showTickMarks, tickMarkStroke); } /** * Standard constructor - builds a category axis with default values for most attributes. * <P> * Note that this class is not intended to be instantiated directly - use a subclass. * @param label The axis label; */ public CategoryAxis(String label) { super(label); } }
{ "content_hash": "ed9a5e53e3087296368962e0ea6f0af0", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 99, "avg_line_length": 37.745098039215684, "alnum_prop": 0.7251948051948052, "repo_name": "leriomaggio/code-coherence-evaluation-tool", "id": "c74dabfc88726e6cb455f6c04f1d9d6315aada63", "size": "3310", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "code_comments_coherence/media/jfreechart/0.6.0/jfreechart-060zip/extracted/jfreechart-0.6.0/source/com/jrefinery/chart/CategoryAxis.java", "mode": "33261", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "4554" }, { "name": "GAP", "bytes": "54356" }, { "name": "HTML", "bytes": "101167" }, { "name": "Java", "bytes": "7241060" }, { "name": "JavaScript", "bytes": "4644" }, { "name": "Python", "bytes": "1934652" } ], "symlink_target": "" }
module CommitBenchmarksHelper end
{ "content_hash": "b0921bde0d8829e99b175d061be36aa4", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 29, "avg_line_length": 17, "alnum_prop": 0.9117647058823529, "repo_name": "Widdershin/helix-pi-graphs", "id": "8d6aa05793ad852c31f29d99d6bcf4b61c080569", "size": "34", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "app/helpers/commit_benchmarks_helper.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1819" }, { "name": "HTML", "bytes": "5273" }, { "name": "JavaScript", "bytes": "1102" }, { "name": "Ruby", "bytes": "40510" } ], "symlink_target": "" }
package plainview; import clojure.lang.ISeq; import clojure.lang.Var; import clojure.lang.RT; public class Producer { private static final Var SYMBOL = RT.var("clojure.core", "symbol"); private static final Var REQUIRE = RT.var("clojure.core", "require"); private static final Var MAIN = RT.var("plainview.producer", "-main"); public static void main(String... args) { REQUIRE.invoke(SYMBOL.invoke("plainview.producer")); MAIN.invoke(args); } }
{ "content_hash": "85183aad1c8159acea6301fa2c51f203", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 77, "avg_line_length": 28.764705882352942, "alnum_prop": 0.6789366053169734, "repo_name": "cmerrick/plainview", "id": "119c780e56797c0cbdba633e9665be10632fe2a7", "size": "489", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/java/plainview/Producer.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Clojure", "bytes": "12288" }, { "name": "Java", "bytes": "469" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <!--日志级别以及优先级排序: OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL --> <!--Configuration后面的status,这个用于设置log4j2自身内部的信息输出,可以不设置,当设置成trace时,你会看到log4j2内部各种详细输出--> <!--monitorInterval:Log4j能够自动检测修改配置 文件和重新配置本身,设置间隔秒数--> <configuration status="INFO" monitorInterval="30"> <!--先定义所有的appender--> <appenders> <!--这个输出控制台的配置--> <console name="Console" target="SYSTEM_OUT" follow="true"> <!--输出日志的格式--> <PatternLayout pattern="%d{yyyy/MM/dd HH:mm:ss.SSS} %t [%p] %c{1} (%F:%L) %msg%n"/> </console> <!--实时log文件--> <File name="logFile" fileName="/data/logs/request.log"> <PatternLayout pattern="%d{yyyy/MM/dd HH:mm:ss.SSS} %t [%p] %c{1} (%F:%L) %msg%n"/> </File> <!-- 这个会打印出所有的info及以下级别的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档--> <RollingFile name="RollingFileInfo" fileName="/data/logs/info.log" filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz"> <!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)--> <ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="ACCEPT"/> <PatternLayout pattern="%d{yyyy/MM/dd HH:mm:ss.SSS} %t [%p] %c{1} (%F:%L) %msg%n"/> <Policies> <TimeBasedTriggeringPolicy/> <SizeBasedTriggeringPolicy size="100 MB"/> </Policies> <DefaultRolloverStrategy max="20"/> </RollingFile> <RollingFile name="RollingFileWarn" fileName="/data/logs/warn.log" filePattern="/data/logs/$${date:yyyy-MM}/warn-%d{yyyy-MM-dd}-%i.log"> <ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/> <PatternLayout pattern="%d{yyyy/MM/dd HH:mm:ss.SSS} %t [%p] %c{1} (%F:%L) %msg%n"/> <Policies> <TimeBasedTriggeringPolicy/> <SizeBasedTriggeringPolicy size="100 MB"/> </Policies> <!-- DefaultRolloverStrategy属性如不设置,则默认为最多同一文件夹下7个文件,这里设置了20 --> <DefaultRolloverStrategy max="20"/> </RollingFile> <RollingFile name="RollingFileError" fileName="/data/logs/error.log" filePattern="/data/logs/$${date:yyyy-MM}/error-%d{yyyy-MM-dd}-%i.log"> <ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/> <PatternLayout pattern="%d{yyyy/MM/dd HH:mm:ss.SSS} %t [%p] %c{1} (%F:%L) %msg%n"/> <Policies> <TimeBasedTriggeringPolicy/> <SizeBasedTriggeringPolicy size="100 MB"/> </Policies> </RollingFile> </appenders> <!--然后定义logger,只有定义了logger并引入的appender,appender才会生效--> <loggers> <!--过滤掉spring和mybatis的一些无用的DEBUG信息--> <!--<logger name="org.springframework" level="INFO"></logger>--> <!--<logger name="org.mybatis" level="INFO"></logger>--> <!--<logger name="org.apache" level="INFO"></logger>--> <!--<logger name="org.hibernate" level="INFO"></logger>--> <root level="info" includeLocation="true"> <appender-ref ref="Console"/> <appender-ref ref="logFile"/> <appender-ref ref="RollingFileInfo"/> <appender-ref ref="RollingFileWarn"/> <appender-ref ref="RollingFileError"/> </root> </loggers> </configuration>
{ "content_hash": "25eb1168c2edf83928e9dc851142d560", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 147, "avg_line_length": 49.072463768115945, "alnum_prop": 0.5815121086828116, "repo_name": "51721198/license-backend", "id": "321c035ff62ba27c8851d02b3ef464aa24e3e3e0", "size": "3894", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/resources/log4j2.xml", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "29721" }, { "name": "HTML", "bytes": "11859" }, { "name": "Java", "bytes": "128020" }, { "name": "JavaScript", "bytes": "42367" }, { "name": "Thrift", "bytes": "258" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <title>RequestProtocolError.java</title> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/> <link rel='stylesheet' type='text/css' href='../../../../../../coverage.css'/> <link rel='shortcut icon' type='image/png' href='../../../../../../logo.png'/> <script type='text/javascript' src='../../../../../../coverage.js'></script> <script type='text/javascript' src='../../../../../../prettify.js'></script> </head> <body onload='prettyPrint()'> <table cellpadding='0' cellspacing='1'> <caption>httpclient-cache/src/main/java/org/apache/http/impl/client/cache/RequestProtocolError.java</caption> <tr> <td class='line'></td><td>&nbsp;</td> <td class='comment' onclick='showHideLines(this)'><div></div><span>/*...*/</span></td> </tr> <tr> <td class='line'>27</td><td>&nbsp;</td> <td><pre class='prettyprint'>package org.apache.http.impl.client.cache;</pre></td> </tr> <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr> <tr> <td class='line'></td><td>&nbsp;</td> <td class='comment' onclick='showHideLines(this)'><div>/** * @since 4.1 */</div><span>/*...*/</span></td> </tr> <tr> <td class='line'>32</td><td class='count'>6</td> <td><pre class='prettyprint covered cp' onclick='showHide(this)' id='l32s0'>enum RequestProtocolError {</pre> <ol style='display:none'> <li>org.apache.http.impl.client.cache.TestProtocolRequirements#testDELETEWithIfNoneMatchWeakETagIsNotAllowed: 3069x6</li> </ol> </td> </tr> <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr> <tr> <td class='line'>34</td><td>&nbsp;</td> <td><pre class='prettyprint'> UNKNOWN,</pre></td> </tr> <tr> <td class='line'>35</td><td>&nbsp;</td> <td><pre class='prettyprint'> BODY_BUT_NO_LENGTH_ERROR,</pre></td> </tr> <tr> <td class='line'>36</td><td>&nbsp;</td> <td><pre class='prettyprint'> WEAK_ETAG_ON_PUTDELETE_METHOD_ERROR,</pre></td> </tr> <tr> <td class='line'>37</td><td>&nbsp;</td> <td><pre class='prettyprint'> WEAK_ETAG_AND_RANGE_ERROR,</pre></td> </tr> <tr> <td class='line'>38</td><td>&nbsp;</td> <td><pre class='prettyprint'> NO_CACHE_DIRECTIVE_WITH_FIELD_NAME</pre></td> </tr> <tr><td class='line'></td><td colspan='2'>&nbsp;</td></tr> <tr> <td class='line'>40</td><td>&nbsp;</td> <td><pre class='prettyprint'>}</pre></td> </tr> </table> </body> </html>
{ "content_hash": "dec65c2c55b68f42aed2385243e312c5", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 131, "avg_line_length": 39.46153846153846, "alnum_prop": 0.5676413255360624, "repo_name": "hideshis/scripts_for_research", "id": "ef8c698cb4def544a9e43ef4ecba381591a1eecd", "size": "3751", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "JMockit_sample/coverage-report/org/apache/http/impl/client/cache/RequestProtocolError.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "14628" }, { "name": "HTML", "bytes": "9246561" }, { "name": "Java", "bytes": "5739" }, { "name": "JavaScript", "bytes": "14576" }, { "name": "PostScript", "bytes": "510108" }, { "name": "Python", "bytes": "312380" }, { "name": "R", "bytes": "5553" }, { "name": "Shell", "bytes": "5927" } ], "symlink_target": "" }
import CopyPlugin from 'copy-webpack-plugin'; import * as webpack from 'webpack'; import { merge } from 'webpack-merge'; import ZipPlugin from 'zip-webpack-plugin'; import browserConfig from './browsers.manifest.json'; import { commonConfig } from './webpack.common'; import { BrowserProps, WebpackOptions } from './webpack.interface'; const version = process.env.npm_package_version; // tslint:disable:object-literal-sort-keys export default (options: WebpackOptions) => { const target = options.target; // Set Chrome as default browser config let browserSpecificProperties: BrowserProps = browserConfig.chrome; if (target) { browserSpecificProperties = browserConfig[target]; } return merge(commonConfig, { mode: 'production', optimization: { minimize: false }, plugins: [ new webpack.DefinePlugin({ // Set variable to find out what browser is compiled BROWSER: JSON.stringify(target) }), new CopyPlugin({ patterns: [ { from: 'src/manifest-common.json', to: 'manifest.json', transform: (content) => { const manifest = JSON.parse(content.toString()); manifest.version = version; const manifestObj = Object.assign(manifest, browserSpecificProperties); return JSON.stringify(manifestObj, null, 2); } } ] }), new ZipPlugin({ // OPTIONAL: defaults to the Webpack output path (above) // can be relative (to Webpack output path) or absolute path: '../zip', // OPTIONAL: defaults to the Webpack output filename (above) or, // if not present, the basename of the path filename: target + '.zip', // OPTIONAL: defaults to 'zip' // the file extension to use instead of 'zip' extension: 'zip', // OPTIONAL: defaults to the empty string // the prefix for the files included in the zip file pathPrefix: '', // OPTIONAL: defaults to the identity function // a function mapping asset paths to new paths pathMapper: (assetPath) => { // put all pngs in an `images` subdir // if (assetPath.endsWith('.png')) // return path.join(path.dirname(assetPath), 'images', path.basename(assetPath)); return assetPath; }, // OPTIONAL: defaults to including everything // can be a string, a RegExp, or an array of strings and RegExps // include: [/\.js$/], // OPTIONAL: defaults to excluding nothing // can be a string, a RegExp, or an array of strings and RegExps // if a file matches both include and exclude, exclude takes precedence // exclude: [/\.png$/, /\.html$/], // yazl Options // OPTIONAL: see https://github.com/thejoshwolfe/yazl#addfilerealpath-metadatapath-options fileOptions: { mtime: new Date(), mode: 0o100664, compress: true, forceZip64Format: false }, // OPTIONAL: see https://github.com/thejoshwolfe/yazl#endoptions-finalsizecallback zipOptions: { forceZip64Format: false } }) ] }); };
{ "content_hash": "3c20408617fddf3f584ac307b3e9054b", "timestamp": "", "source": "github", "line_count": 96, "max_line_length": 98, "avg_line_length": 33.927083333333336, "alnum_prop": 0.6082284310715382, "repo_name": "bartholomej/csfd-magnets", "id": "482bc1c081bd4516a3b92c34f057b5a4990deab4", "size": "3257", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "config/webpack.prod.ts", "mode": "33261", "license": "mit", "language": [ { "name": "SCSS", "bytes": "1372" }, { "name": "Shell", "bytes": "68" }, { "name": "TypeScript", "bytes": "34491" } ], "symlink_target": "" }
using System; namespace ThinkingHome.Plugins.Mqtt.Model { public class ReceivedData { public virtual Guid Id { get; set; } public virtual string Path { get; set; } public virtual DateTime Timestamp { get; set; } public virtual string Message { get; set; } } }
{ "content_hash": "88817c2c143996535165892592a12c51", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 49, "avg_line_length": 19.4, "alnum_prop": 0.6632302405498282, "repo_name": "dima117/thinking-home", "id": "fe7ee186ae84255c2c821c5da171fc71b72957d9", "size": "293", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ThinkingHome.Plugins.Mqtt/Model/ReceivedData.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "261" }, { "name": "C#", "bytes": "196129" }, { "name": "CSS", "bytes": "841" }, { "name": "HTML", "bytes": "1066" }, { "name": "JavaScript", "bytes": "234994" }, { "name": "Smarty", "bytes": "14707" } ], "symlink_target": "" }
<!-- ! Licensed to the Apache Software Foundation (ASF) under one ! or more contributor license agreements. See the NOTICE file ! distributed with this work for additional information ! regarding copyright ownership. The ASF licenses this file ! to you under the Apache License, Version 2.0 (the ! "License"); you may not use this file except in compliance ! with the License. You may obtain a copy of the License at ! ! http://www.apache.org/licenses/LICENSE-2.0 ! ! Unless required by applicable law or agreed to in writing, ! software distributed under the License is distributed on an ! "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ! KIND, either express or implied. See the License for the ! specific language governing permissions and limitations ! under the License. !--> ## <a id="StringFunctions">String Functions</a> ## ### concat ### * Syntax: concat(string1, string2, ...) * Returns a concatenated string from arguments. * Arguments: * `string1`: a string value, * `string2`: a string value, * .... * Return Value: * a concatenated string from arguments, * `missing` if any argument is a `missing` value, * `null` if any argument is a `null` value but no argument is a `missing` value, * any other non-string input value will cause a type error. * Example: concat("test ", "driven ", "development"); * The expected result is: "test driven development" ### contains ### * Syntax: contains(string, substring_to_contain) * Checks whether the string `string` contains the string `substring_to_contain` * Arguments: * `string` : a `string` that might contain the given substring, * `substring_to_contain` : a target `string` that might be contained. * Return Value: * a `boolean` value, `true` if `string` contains `substring_to_contain`, * `missing` if any argument is a `missing` value, * `null` if any argument is a `null` value but no argument is a `missing` value, * any other non-string input value will cause a type error, * `false` otherwise. * Note: an [n_gram index](similarity.html#UsingIndexesToSupportSimilarityQueries) can be utilized for this function. * Example: { "v1": contains("I like x-phone", "phone"), "v2": contains("one", "phone") }; * The expected result is: { "v1": true, "v2": false } ### ends_with ### * Syntax: ends_with(string, substring_to_end_with) * Checks whether the string `string` ends with the string `substring_to_end_with`. * Arguments: * `string` : a `string` that might end with the given string, * `substring_to_end_with` : a `string` that might be contained as the ending substring. * Return Value: * a `boolean` value, `true` if `string` contains `substring_to_contain`, * `missing` if any argument is a `missing` value, * `null` if any argument is a `null` value but no argument is a `missing` value, * any other non-string input value will cause a type error, * `false` otherwise. * Example: { "v1": ends_with(" love product-b its shortcut_menu is awesome:)", ":)"), "v2": ends_with(" awsome:)", ":-)") }; * The expected result is: { "v1": true, "v2": false } ### initcap (or title) ### * Syntax: initcap(string) * Converts a given string `string` so that the first letter of each word is uppercase and every other letter is lowercase. The function has an alias called "title". * Arguments: * `string` : a `string` to be converted. * Return Value: * a `string` as the title form of the given `string`, * `missing` if the argument is a `missing` value, * `null` if the argument is a `null` value, * any other non-string input value will cause a type error. * Example: { "v1": initcap("ASTERIXDB is here!"), "v2": title("ASTERIXDB is here!") }; * The expected result is: { "v1": "Asterixdb Is Here!", "v2": "Asterixdb Is Here!" } ### length ### * Syntax: length(string) * Returns the length of the string `string`. Note that the length is in the unit of code point. See the following examples for more details. * Arguments: * `string` : a `string` or `null` that represents the string to be checked. * Return Value: * an `bigint` that represents the length of `string`, * `missing` if the argument is a `missing` value, * `null` if the argument is a `null` value, * any other non-string input value will cause a type error. * Example: length("test string"); * The expected result is: 11 * Example: length("👩‍👩‍👧‍👦"); * The expected result is (the emoji character 👩‍👩‍👧‍👦 has 7 code points): 7 ### lower ### * Syntax: lower(string) * Converts a given string `string` to its lowercase form. * Arguments: * `string` : a `string` to be converted. * Return Value: * a `string` as the lowercase form of the given `string`, * `missing` if the argument is a `missing` value, * `null` if the argument is a `null` value, * any other non-string input value will cause a type error. * Example: lower("ASTERIXDB"); * The expected result is: "asterixdb" ### ltrim ### * Syntax: ltrim(string[, chars]); * Returns a new string with all leading characters that appear in `chars` removed. By default, white space is the character to trim. Note that here one character means one code point. For example, the emoji 4-people-family notation "👩‍👩‍👧‍👦" contains 7 code points, and it is possible to trim a few code points (such as a 2-people-family "👨‍👦") from it. See the following example for more details. * Arguments: * `string` : a `string` to be trimmed, * `chars` : a `string` that contains characters that are used to trim. * Return Value: * a trimmed, new `string`, * `missing` if any argument is a `missing` value, * `null` if any argument is a `null` value but no argument is a `missing` value, * any other non-string input value will cause a type error. * Related functions: see `trim()`, `rtrim()` * Example: ltrim("me like x-phone", "eml"); * The expected result is: " like x-phone" * Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy): ltrim("👨‍👩‍👧‍👦", "👨‍👦") * The expected result is (only woman, girl and boy are left in the family): "👩‍👧‍👦" ### position ### * Syntax: position(string, string_pattern) * Returns the first position of `string_pattern` within `string`. The result is counted in the unit of code points. See the following example for more details. * The function returns the 0-based position. Another version of the function returns the 1-based position. Below are the aliases for each version: * 0-based: `position`, `pos`, `position0`, `pos0`. * 1-based: `position1`, `pos1`. * Arguments: * `string` : a `string` that might contain the pattern. * `string_pattern` : a pattern `string` to be matched. * Return Value: * the first position that `string_pattern` appears within `string` (starting at 0), or -1 if it does not appear, * `missing` if any argument is a `missing` value, * `null` if any argument is a `null` value but no argument is a `missing` value, * any other non-string input value will return a `null`. * Example: { "v1": position("ppphonepp", "phone"), "v2": position("hone", "phone"), "v3": position1("ppphonepp", "phone"), "v4": position1("hone", "phone") }; * The expected result is: { "v1": 2, "v2": -1, v3": 3, "v4": -1 } * Example of multi-code-point character: position("👩‍👩‍👧‍👦🏀", "🏀"); * The expected result is (the emoji family character has 7 code points): 7 ### regexp_contains ### * Syntax: regexp_contains(string, string_pattern[, string_flags]) * Checks whether the strings `string` contains the regular expression pattern `string_pattern` (a Java regular expression pattern). * Aliases: * `regexp_contains`, `regex_contains`, `contains_regexp`, `contains_regex`. * Arguments: * `string` : a `string` that might contain the pattern. * `string_pattern` : a pattern `string` to be matched. * `string_flag` : (Optional) a `string` with flags to be used during regular expression matching. * The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x). * Return Value: * a `boolean`, returns `true` if `string` contains the pattern `string_pattern`, `false` otherwise. * `missing` if any argument is a `missing` value. * `null` if any argument is a `null` value but no argument is a `missing` value. * any other non-string input value will return a `null`. * Example: { "v1": regexp_contains("pphonepp", "p*hone"), "v2": regexp_contains("hone", "p+hone") }; * The expected result is: { "v1": true, "v2": false } ### regexp_like ### * Syntax: regexp_like(string, string_pattern[, string_flags]) * Checks whether the string `string` exactly matches the regular expression pattern `string_pattern` (a Java regular expression pattern). * Aliases: * `regexp_like`, `regex_like`. * Arguments: * `string` : a `string` that might contain the pattern. * `string_pattern` : a pattern `string` that might be contained. * `string_flag` : (Optional) a `string` with flags to be used during regular expression matching. * The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x). * Return Value: * a `boolean` value, `true` if `string` contains the pattern `string_pattern`, `false` otherwise. * `missing` if any argument is a `missing` value. * `null` if any argument is a `null` value but no argument is a `missing` value. * any other non-string input value will return a `null`. * Example: { "v1": regexp_like(" can't stand acast the network is horrible:(", ".*acast.*"), "v2": regexp_like("acast", ".*acst.*") }; * The expected result is: { "v1": true, "v2": false } ### regexp_position ### * Syntax: regexp_position(string, string_pattern[, string_flags]) * Returns first position of the regular expression `string_pattern` (a Java regular expression pattern) within `string`. The function returns the 0-based position. Another version of the function returns the 1-based position. Below are the aliases for each version: * Aliases: * 0-Based: `regexp_position`, `regexp_pos`, `regexp_position0`, `regexp_pos0`, `regex_position`, `regex_pos`, `regex_position0`, `regex_pos0`. * 1-Based: `regexp_position1`, `regexp_pos1`, `regex_position1` `regex_pos1`. * Arguments: * `string` : a `string` that might contain the pattern. * `string_pattern` : a pattern `string` to be matched. * `string_flag` : (Optional) a `string` with flags to be used during regular expression matching. * The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x). * Return Value: * the first position that the regular expression `string_pattern` appears in `string` (starting at 0), or -1 if it does not appear. * `missing` if any argument is a `missing` value, * `null` if any argument is a `null` value but no argument is a `missing` value, * any other non-string input value will return a `null`. * Example: { "v1": regexp_position("pphonepp", "p*hone"), "v2": regexp_position("hone", "p+hone"), "v3": regexp_position1("pphonepp", "p*hone"), "v4": regexp_position1("hone", "p+hone") }; * The expected result is: { "v1": 0, "v2": -1, "v3": 1, "v4": -1 } ### regexp_replace ### * Syntax: regexp_replace(string, string_pattern, string_replacement[, string_flags]) regexp_replace(string, string_pattern, string_replacement[, replacement_limit]) * Checks whether the string `string` matches the given regular expression pattern `string_pattern` (a Java regular expression pattern), and replaces the matched pattern `string_pattern` with the new pattern `string_replacement`. * Aliases: * `regexp_replace`, `regex_replace`. * Arguments: * `string` : a `string` that might contain the pattern. * `string_pattern` : a pattern `string` to be matched. * `string_replacement` : a pattern `string` to be used as the replacement. * `string_flag` : (Optional) a `string` with flags to be used during replace. * The following modes are enabled with these flags: dotall (s), multiline (m), case_insensitive (i), and comments and whitespace (x). * `replacement_limit`: (Optional) an `integer` specifying the maximum number of replacements to make (if negative then all occurrences will be replaced) * Return Value: * Returns a `string` that is obtained after the replacements. * `missing` if any argument is a `missing` value. * `null` if any argument is a `null` value but no argument is a `missing` value. * any other non-string input value will return a `null`. * Example: regexp_replace(" like x-phone the voicemail_service is awesome", " like x-phone", "like product-a"); * The expected result is: "like product-a the voicemail_service is awesome" ### repeat ### * Syntax: repeat(string, n) * Returns a string formed by repeating the input `string` `n` times. * Arguments: * `string` : a `string` to be repeated, * `n` : an `tinyint`/`smallint`/`integer`/`bigint` value - how many times the string should be repeated. * Return Value: * a string that repeats the input `string` `n` times, * `missing` if any argument is a `missing` value, * `null` if any argument is a `null` value but no argument is a `missing` value, * a type error will be raised if: * the first argument is any other non-string value, * or, the second argument is not a `tinyint`, `smallint`, `integer`, or `bigint`. * Example: repeat("test", 3); * The expected result is: "testtesttest" ### replace ### * Syntax: replace(string, search_string, replacement_string[, limit]) * Finds occurrences of the given substring `search_string` in the input string `string` and replaces them with the new substring `replacement_string`. * Arguments: * `string` : an input `string`, * `search_string` : a `string` substring to be searched for, * `replacement_string` : a `string` to be used as the replacement, * `limit` : (Optional) an `integer` - maximum number of occurrences to be replaced. If not specified or negative then all occurrences will be replaced * Return Value: * Returns a `string` that is obtained after the replacements, * `missing` if any argument is a `missing` value, * any other non-string input value or non-integer `limit` will cause a type error, * `null` if any argument is a `null` value but no argument is a `missing` value. * Example: { "v1": replace(" like x-phone the voicemail_service is awesome", " like x-phone", "like product-a"), "v2": replace("x-phone and x-phone", "x-phone", "product-a", 1) }; * The expected result is: { "v1": "like product-a the voicemail_service is awesome", "v2": "product-a and x-phone" } ### reverse ### * Syntax: reverse(string) * Returns a string formed by reversing characters in the input `string`. For characters of multiple code points, code point is the minimal unit to reverse. See the following examples for more details. * Arguments: * `string` : a `string` to be reversed * Return Value: * a string containing characters from the the input `string` in the reverse order, * `missing` if any argument is a `missing` value, * `null` if any argument is a `null` value but no argument is a `missing` value, * a type error will be raised if: * the first argument is any other non-string value * Example: reverse("hello"); * The expected result is: "olleh" * Example of multi-code-point character (Korean): reverse("한글"); * The expected result is (the Korean characters are splitted into code points and then the code points are reversed): "ᆯᅳᄀᆫᅡᄒ" ### rtrim ### * Syntax: rtrim(string[, chars]); * Returns a new string with all trailing characters that appear in `chars` removed. By default, white space is the character to trim. Note that here one character means one code point. For example, the emoji 4-people-family notation "👩‍👩‍👧‍👦" contains 7 code points, and it is possible to trim a few code points (such as a 2-people-family "👨‍👦") from it. See the following example for more details. * Arguments: * `string` : a `string` to be trimmed, * `chars` : a `string` that contains characters that are used to trim. * Return Value: * a trimmed, new `string`, * `missing` if any argument is a `missing` value, * `null` if any argument is a `null` value but no argument is a `missing` value, * any other non-string input value will cause a type error. * Related functions: see `trim()`, `ltrim()` * Example: { "v1": rtrim("i like x-phone", "x-phone"), "v2": rtrim("i like x-phone", "onexph") }; * The expected result is: { "v1": "i like ", "v2": "i like x-" } * Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy): rtrim("👨‍👩‍👧‍👦", "👨‍👦") * The expected result is (only man, woman and girl are left in the family): "👨‍👩‍👧" ### split ### * Syntax: split(string, sep) * Splits the input `string` into an array of substrings separated by the string `sep`. * Arguments: * `string` : a `string` to be split. * Return Value: * an array of substrings by splitting the input `string` by `sep`, * in case of two consecutive `sep`s in the `string`, the result of splitting the two consecutive `sep`s will be the empty string `""`, * `missing` if the argument is a `missing` value, * `null` if the argument is a `null` value, * any other non-string input value will cause a type error. * Example: split("test driven development", " "); * The expected result is: [ "test", "driven", "development" ] * Example with two consecutive `sep`s in the `string`: split("123//456", "/"); * The expected result is: [ "123", "", "456" ] ### starts_with ### * Syntax: starts_with(string, substring_to_start_with) * Checks whether the string `string` starts with the string `substring_to_start_with`. * Arguments: * `string` : a `string` that might start with the given string. * `substring_to_start_with` : a `string` that might be contained as the starting substring. * Return Value: * a `boolean`, returns `true` if `string` starts with the string `substring_to_start_with`, * `missing` if any argument is a `missing` value, * `null` if any argument is a `null` value but no argument is a `missing` value, * any other non-string input value will cause a type error, * `false` otherwise. * Example: { "v1" : starts_with(" like the plan, amazing", " like"), "v2" : starts_with("I like the plan, amazing", " like") }; * The expected result is: { "v1": true, "v2": false } ### substr ### * Syntax: substr(string, offset[, length]) * Returns the substring from the given string `string` based on the given start offset `offset` with the optional `length`. Note that both of the `offset` and `length` are in the unit of code point (e.g. the emoji family 👨‍👩‍👧‍👦 has 7 code points). The function uses the 0-based position. Another version of the function uses the 1-based position. Below are the aliases for each version: * Aliases: * 0-Based: `substring`, `substr`, `substring0`, `substr0`. * 1-Based: `substring1`, `substr1`. * Arguments: * `string` : a `string` to be extracted. * `offset` : an `tinyint`/`smallint`/`integer`/`bigint` value as the starting offset of the substring in `string` (starting at 0). If negative then counted from the end of the string. * `length` : (Optional) an an `tinyint`/`smallint`/`integer`/`bigint` value as the length of the substring. * Return Value: * a `string` that represents the substring, * `missing` if any argument is a `missing` value, * `null` if any argument is a `null` value but no argument is a `missing` value, or if the substring could not be obtained because the starting offset is not within string bounds or `length` is negative. * a `null` will be returned if: * the first argument is any other non-string value. * the second argument is not a `tinyint`, `smallint`, `integer`, or `bigint`. * the third argument is not a `tinyint`, `smallint`, `integer`, or `bigint` if the argument is present. * Example: { "v1": substr("test string", 6, 3), "v2": substr1("test string", 6, 3) }; * The expected result is: { "v1": "tri", "v2": "str" } The function has an alias `substring`. ### trim ### * Syntax: trim(string[, chars]); * Returns a new string with all leading and trailing characters that appear in `chars` removed. By default, white space is the character to trim. Note that here one character means one code point. For example, the emoji 4-people-family notation "👩‍👩‍👧‍👦" contains 7 code points, and it is possible to trim a few code points (such as a 2-people-family "👨‍👦") from it. See the following example for more details. * Arguments: * `string` : a `string` to be trimmed, * `chars` : a `string` that contains characters that are used to trim. * Return Value: * a trimmed, new `string`, * `missing` if any argument is a `missing` value, * `null` if any argument is a `null` value but no argument is a `missing` value, * any other non-string input value will cause a type error. * Related functions: see `ltrim()`, `rtrim()` * Example: trim("i like x-phone", "xphoen"); * The expected result is: " like " * Example with multi-codepoint notation (trim the man and boy from the family of man, woman, girl and boy): trim("👨‍👩‍👧‍👦", "👨‍👦") * The expected result is (only woman and girl are left in the family): "👩‍👧" ### upper ### * Syntax: upper(string) * Converts a given string `string` to its uppercase form. * Arguments: * `string` : a `string` to be converted. * Return Value: * a `string` as the uppercase form of the given `string`, * `missing` if the argument is a `missing` value, * `null` if the argument is a `null` value, * any other non-string input value will cause a type error. * Example: upper("hello") * The expected result is: "HELLO"
{ "content_hash": "5e6165948c8ae81e980e9130d6414be4", "timestamp": "", "source": "github", "line_count": 718, "max_line_length": 141, "avg_line_length": 32.6142061281337, "alnum_prop": 0.6428662937182389, "repo_name": "apache/incubator-asterixdb", "id": "b4a7a87c7e5c1abddeee5683af64d8f8240ce00d", "size": "23709", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "asterixdb/asterix-doc/src/main/markdown/builtins/2_string_common.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "6115" }, { "name": "C", "bytes": "421" }, { "name": "CSS", "bytes": "4763" }, { "name": "Crystal", "bytes": "453" }, { "name": "Gnuplot", "bytes": "89" }, { "name": "HTML", "bytes": "115120" }, { "name": "Java", "bytes": "10091258" }, { "name": "JavaScript", "bytes": "237719" }, { "name": "Python", "bytes": "281315" }, { "name": "Ruby", "bytes": "3078" }, { "name": "Scheme", "bytes": "1105" }, { "name": "Shell", "bytes": "186924" }, { "name": "Smarty", "bytes": "31412" } ], "symlink_target": "" }
const SITES_ADDED_MESSAGE = "sites_added"; const SITES_REMOVED_MESSAGE = "sites_removed"; const SITE_UPDATED_MESSAGE = "sites_updated"; const BACKGROUND_COLOR_UPDATED_MESSAGE = "background_color_updated"; // Create a site given the url, abbreviation, color, and a callback. // // Callback is required due to getting the site color requiring an async HTTP request // (only if color is no null) function createSite(url, abbreviation, color, callback) { var site = {}; if (url) { site.url = url; } else { site.url = ''; } if (abbreviation) { site.abbreviation = abbreviation; } else { site.abbreviation = getHostname(url); } site.abbreviation = makeAbbreviation(site.abbreviation); if (!color) { getFaviconColor(site.url, function(color) { setSiteColor(site, color); callback(site); }); } else { setSiteColor(site, color); callback(site); } } // Set the site color for a given site object function setSiteColor(site, color) { if (!color) { color = [0, 0, 0, 255]; } else { if (color.length != 4) { return; } } site.color = colorArrayToObject(color); } function getNextID(callback) { storage.get('nextID', function(items) { if (!items || !items.nextID) { return callback(0); } else { return callback(items.nextID); } }); } function storageKeyForID(id) { return "s" + id; } function updateSite(id, site, callback) { var key = storageKeyForID(id); var data = {}; data[key] = site; storage.set(data, function() { emitMessage(SITE_UPDATED_MESSAGE, id); callback(); }); } function addSites(sites, callback) { var data = {}; var newIDs = []; getNextID(function(id) { data.nextID = id + sites.length; loop(0, sites.length, function(iteration, callback) { sites[iteration].id = id; var siteKey = storageKeyForID(id); data[siteKey] = sites[iteration]; newIDs.push(id); id++; callback(); }, function() { getSortedSiteIDs(function(ids) { for (var j = 0; newIDs[j] != null; j++) { ids.push(newIDs[j]); } data.ids = ids; storage.set(data, function() { emitMessage(SITES_ADDED_MESSAGE); return callback(); }); }); }); }); } function getSitesCount(callback) { getSortedSiteIDs(function(ids) { return callback(ids.length); }); } function getSortedSiteIDs(callback) { storage.get('ids', function(items) { if (!items || !items.ids) { return callback([]); } else { return callback(items.ids); } }); } function setSortedSiteIDs(ids, callback) { storage.set({ 'ids': ids }, callback); } function reorderSite(oldIndex, newIndex, callback) { getSortedSiteIDs(function(ids) { var removed = ids.removeAtIndex(oldIndex); ids.insertAtIndex(removed, newIndex); setSortedSiteIDs(ids, function() { return callback(); }); }); } function getSite(id, callback) { storage.get(storageKeyForID(id), function(items) { if (!items || !items[storageKeyForID(id)]) { return callback(null); } else { return callback(items[storageKeyForID(id)]); } }); } function getAllSites(callback) { var storageKeys = []; var sites = []; getSortedSiteIDs(function(ids) { var storageKeys = []; for (var i = 0; i < ids.length; i++) { storageKeys.push(storageKeyForID(ids[i])); } storage.get(storageKeys, function(items) { if (!items) { return callback([]); } for (var i = 0; i < storageKeys.length; i++) { if (items[storageKeys[i]]) { sites.push(items[storageKeys[i]]); } } return callback(sites); }); }); } function removeSites(siteIDs, callback) { var storageKeys = []; for (var i = 0; i < siteIDs.length; i++) { storageKeys.push(storageKeyForID(siteIDs[i])); } storage.remove(storageKeys, function() { getSortedSiteIDs(function(ids) { for (var i = 0; i < siteIDs.length; i++) { ids.removeElementEqualTo(siteIDs[i]); } setSortedSiteIDs(ids, function() { emitMessage(SITES_REMOVED_MESSAGE); return callback(); }); }); }); } function updateSiteAbbreviation(id, abbreviation, callback) { getSite(id, function(site) { site.abbreviation = abbreviation; updateSite(id, site, function() { return callback(); }); }); } function updateSiteColor(id, color, callback) { if (color == null) { color = [0, 0, 0, 255]; } if (color instanceof Array) { color = colorArrayToObject(color); } if (!isValidColor(color)) { console.error("Invalid color in updateSiteColor", id, color); return callback(); } getSite(id, function(site) { site.color = color; updateSite(id, site, function() { return callback(); }); }); } function updateSiteCustomColor(id, color, callback) { if (color && color instanceof Array) { color = colorArrayToObject(color); } if (color && !isValidColor(color)) { console.error("Invalid color in updateSiteCustomColor", id, color); return callback(); } getSite(id, function(site) { if (!color) { delete site.customColor; } else { site.customColor = color; } updateSite(id, site, function() { return callback(); }); }); } function updateFaviconColorForAllSites(callback) { getAllSites(function(sites) { if (!sites) { callback(false); } async_loop(0, sites.length, function(iteration, callback) { getFaviconColor(sites[iteration].url, function(color) { var color = colorArrayToObject(color); if (!colorsAreEqual(sites[iteration].color, color)) { updateSiteColor(sites[iteration].id, color, function() { callback(); }); } else { callback(); } }); }, function() { callback(true); }); }); } function getSiteForURL(url, callback) { getAllSites(function(sites) { if (!sites || sites.length == 0) { return callback(null); } for (var i = 0; i < sites.length; i++) { if (sites[i].url == url) { return callback(sites[i]); } } return callback(null); }); } function getIDForURL(url, callback) { getSiteForURL(url, function(site) { return callback(site.id); }); } function getSiteAbbreviationForURL(url, callback) { var site = getSiteForURL(url, function(site) { return callback(site.abbreviation); }); } /** * Returns {true} if a tile exists with the URL. * @param {String} url The URL to check if it exists. * @param {Function} callback The callback to call with result. */ function siteExistsWithURL(url, callback) { getAllSites(function(sites) { if (sites) { for (var i = 0; i < sites.length; i++) { if (sites[i].url == url) { return callback(true); } } } return callback(false); }); } // Ensure a site contains a url, abbreviation, and color and that the color is valid. function isValidSite(site) { if (!site.url || !site.abbreviation || !site.color) { return false; } return isValidColor(site.color); } // Ensures the color does not have undefined or null properties. function isValidColor(color) { if (!color) { return false; } if (color.red == undefined || color.green == undefined || color.blue == undefined || color.alpha == undefined) { return false; } if (color.red == null || color.green == null || color.blue == null || color.alpha == null) { return false; } return true; } function setBackgroundColor(color, callback) { if (!color) { storage.remove('backgroundColor', function() { writeUserStylesheet(function() { emitMessage(BACKGROUND_COLOR_UPDATED_MESSAGE); return callback(null); }); }); } else { storage.set({ 'backgroundColor': color }, function() { writeUserStylesheet(function() { emitMessage(BACKGROUND_COLOR_UPDATED_MESSAGE); return callback(color); }); }); } } function getBackgroundColor(callback) { storage.get('backgroundColor', function(backgroundColorItems) { if (!backgroundColorItems || !backgroundColorItems.backgroundColor) { return callback(null); } return callback(backgroundColorItems.backgroundColor); }); } // Get the first two letters our of a string, make uppercase function makeAbbreviation(string) { string = string.trim(); return string.substring(0, 1).toUpperCase() + string.substring(1, 2).toLowerCase(); } function writeUserStylesheet(callback) { if (!callback) { callback = function() { }; } getFileSystem(function(fs) { getSitesCount(function(sitesCount) { if (sitesCount > 0) { getBackgroundColor(function(color) { if (!color) { writeToFile(fs, "user.css", "body { background: rgb(0, 0, 0) !important; }"); } else { writeToFile(fs, "user.css", "body { background: rgb(" + color['red'] + ", " + color['green'] + ", " + color['blue'] + ") !important; }"); } return callback(); }); } else { writeToFile(fs, "user.css", "body { background: rgb(0, 0, 0) !important; }"); } }); }); }
{ "content_hash": "cd6f3a1a33f6fd6d375a87a960178137", "timestamp": "", "source": "github", "line_count": 412, "max_line_length": 143, "avg_line_length": 21.228155339805824, "alnum_prop": 0.6453235764921107, "repo_name": "AntarcticApps/Tiles", "id": "f6b5556e054b3ed571c71c09bd0985ff20e72d85", "size": "8746", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "TILES_VERSION_ID_/shared/js/sites.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "226588" }, { "name": "Ruby", "bytes": "1486" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_35) on Sun Mar 31 19:35:54 BST 2013 --> <TITLE> XQueryTestCourses </TITLE> <META NAME="date" CONTENT="2013-03-31"> <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="XQueryTestCourses"; } } </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="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/XQueryTestCourses.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&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-files/index-1.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;<A HREF="../../../../../../uk/ac/ed/inf/proj/xmlnormaliser/XQueryTestCompany2.html" title="class in uk.ac.ed.inf.proj.xmlnormaliser"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../../uk/ac/ed/inf/proj/xmlnormaliser/XQueryTestDB.html" title="class in uk.ac.ed.inf.proj.xmlnormaliser"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?uk/ac/ed/inf/proj/xmlnormaliser/XQueryTestCourses.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="XQueryTestCourses.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> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> uk.ac.ed.inf.proj.xmlnormaliser</FONT> <BR> Class XQueryTestCourses</H2> <PRE> java.lang.Object <IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><B>uk.ac.ed.inf.proj.xmlnormaliser.XQueryTestCourses</B> </PRE> <HR> <DL> <DT><PRE>public class <B>XQueryTestCourses</B><DT>extends java.lang.Object</DL> </PRE> <P> Unit tests of XQuery generation for creating new element types <P> <P> <DL> <DT><B>Author:</B></DT> <DD>Tomas Tauber</DD> </DL> <HR> <P> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../../uk/ac/ed/inf/proj/xmlnormaliser/XQueryTestCourses.html#XQueryTestCourses()">XQueryTestCourses</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../uk/ac/ed/inf/proj/xmlnormaliser/XQueryTestCourses.html#setUpBeforeClass()">setUpBeforeClass</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reads the file and loads it into the parser</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../uk/ac/ed/inf/proj/xmlnormaliser/XQueryTestCourses.html#testPurgeCourses()">testPurgeCourses</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../uk/ac/ed/inf/proj/xmlnormaliser/XQueryTestCourses.html#testXQueryCreateNewET()">testXQueryCreateNewET</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> &nbsp; <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="XQueryTestCourses()"><!-- --></A><H3> XQueryTestCourses</H3> <PRE> public <B>XQueryTestCourses</B>()</PRE> <DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="setUpBeforeClass()"><!-- --></A><H3> setUpBeforeClass</H3> <PRE> public static void <B>setUpBeforeClass</B>() throws java.lang.Exception</PRE> <DL> <DD>Reads the file and loads it into the parser <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE>java.lang.Exception</CODE></DL> </DD> </DL> <HR> <A NAME="testPurgeCourses()"><!-- --></A><H3> testPurgeCourses</H3> <PRE> public void <B>testPurgeCourses</B>() throws java.lang.Exception</PRE> <DL> <DD><DL> <DT><B>Throws:</B> <DD><CODE>java.lang.Exception</CODE></DL> </DD> </DL> <HR> <A NAME="testXQueryCreateNewET()"><!-- --></A><H3> testXQueryCreateNewET</H3> <PRE> public void <B>testXQueryCreateNewET</B>() throws java.lang.Exception</PRE> <DL> <DD><DL> <DT><B>Throws:</B> <DD><CODE>java.lang.Exception</CODE></DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <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="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/XQueryTestCourses.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&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-files/index-1.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;<A HREF="../../../../../../uk/ac/ed/inf/proj/xmlnormaliser/XQueryTestCompany2.html" title="class in uk.ac.ed.inf.proj.xmlnormaliser"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../../uk/ac/ed/inf/proj/xmlnormaliser/XQueryTestDB.html" title="class in uk.ac.ed.inf.proj.xmlnormaliser"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../index.html?uk/ac/ed/inf/proj/xmlnormaliser/XQueryTestCourses.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="XQueryTestCourses.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> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
{ "content_hash": "defa4592e987f018b4b1777c9db11213", "timestamp": "", "source": "github", "line_count": 309, "max_line_length": 166, "avg_line_length": 37.983818770226534, "alnum_prop": 0.6183010990883531, "repo_name": "tomtau/xml_normaliser", "id": "aa8a33eb1eb7e277c9617900173ce53eb4aad7f3", "size": "11737", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/uk/ac/ed/inf/proj/xmlnormaliser/XQueryTestCourses.html", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "109028" }, { "name": "XQuery", "bytes": "6130" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_162) on Fri Sep 13 20:43:34 PDT 2019 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Class com.ctc.wstx.dtd.StructValidator (Woodstox 6.0.0 API)</title> <meta name="date" content="2019-09-13"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class com.ctc.wstx.dtd.StructValidator (Woodstox 6.0.0 API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">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"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/ctc/wstx/dtd/class-use/StructValidator.html" target="_top">Frames</a></li> <li><a href="StructValidator.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class com.ctc.wstx.dtd.StructValidator" class="title">Uses of Class<br>com.ctc.wstx.dtd.StructValidator</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#com.ctc.wstx.dtd">com.ctc.wstx.dtd</a></td> <td class="colLast"> <div class="block">Package that contains Woodstox classes that implement DTD handling.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="com.ctc.wstx.dtd"> <!-- --> </a> <h3>Uses of <a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a> in <a href="../../../../../com/ctc/wstx/dtd/package-summary.html">com.ctc.wstx.dtd</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation"> <caption><span>Subclasses of <a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a> in <a href="../../../../../com/ctc/wstx/dtd/package-summary.html">com.ctc.wstx.dtd</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/ctc/wstx/dtd/DFAValidator.html" title="class in com.ctc.wstx.dtd">DFAValidator</a></span></code> <div class="block">Validator class that is based on a DFA constructed from DTD content specification.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/ctc/wstx/dtd/EmptyValidator.html" title="class in com.ctc.wstx.dtd">EmptyValidator</a></span></code> <div class="block">Simple content model validator that accepts no elements, ever; this is true for pure #PCDATA content model as well as EMPTY content model.</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing fields, and an explanation"> <caption><span>Fields in <a href="../../../../../com/ctc/wstx/dtd/package-summary.html">com.ctc.wstx.dtd</a> declared as <a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Field and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>protected <a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a>[]</code></td> <td class="colLast"><span class="typeNameLabel">DTDValidator.</span><code><span class="memberNameLink"><a href="../../../../../com/ctc/wstx/dtd/DTDValidator.html#mValidators">mValidators</a></span></code> <div class="block">Stack of validators for open elements</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../com/ctc/wstx/dtd/package-summary.html">com.ctc.wstx.dtd</a> that return <a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a></code></td> <td class="colLast"><span class="typeNameLabel">TokenContentSpec.</span><code><span class="memberNameLink"><a href="../../../../../com/ctc/wstx/dtd/TokenContentSpec.html#getSimpleValidator--">getSimpleValidator</a></span>()</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a></code></td> <td class="colLast"><span class="typeNameLabel">SeqContentSpec.</span><code><span class="memberNameLink"><a href="../../../../../com/ctc/wstx/dtd/SeqContentSpec.html#getSimpleValidator--">getSimpleValidator</a></span>()</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>abstract <a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a></code></td> <td class="colLast"><span class="typeNameLabel">ContentSpec.</span><code><span class="memberNameLink"><a href="../../../../../com/ctc/wstx/dtd/ContentSpec.html#getSimpleValidator--">getSimpleValidator</a></span>()</code> <div class="block">Method called by input element stack to get validator for this content specification, if this specification is simple enough not to need full DFA-based validator.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a></code></td> <td class="colLast"><span class="typeNameLabel">ChoiceContentSpec.</span><code><span class="memberNameLink"><a href="../../../../../com/ctc/wstx/dtd/ChoiceContentSpec.html#getSimpleValidator--">getSimpleValidator</a></span>()</code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a></code></td> <td class="colLast"><span class="typeNameLabel">DTDElement.</span><code><span class="memberNameLink"><a href="../../../../../com/ctc/wstx/dtd/DTDElement.html#getValidator--">getValidator</a></span>()</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code>abstract <a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a></code></td> <td class="colLast"><span class="typeNameLabel">StructValidator.</span><code><span class="memberNameLink"><a href="../../../../../com/ctc/wstx/dtd/StructValidator.html#newInstance--">newInstance</a></span>()</code> <div class="block">Method that should be called to get the actual usable validator instance, from the 'template' validator.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a></code></td> <td class="colLast"><span class="typeNameLabel">EmptyValidator.</span><code><span class="memberNameLink"><a href="../../../../../com/ctc/wstx/dtd/EmptyValidator.html#newInstance--">newInstance</a></span>()</code> <div class="block">Simple; can always (re)use instance itself; no state information is kept.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a></code></td> <td class="colLast"><span class="typeNameLabel">DFAValidator.</span><code><span class="memberNameLink"><a href="../../../../../com/ctc/wstx/dtd/DFAValidator.html#newInstance--">newInstance</a></span>()</code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../com/ctc/wstx/dtd/package-summary.html">com.ctc.wstx.dtd</a> with parameters of type <a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>static <a href="../../../../../com/ctc/wstx/dtd/DTDElement.html" title="class in com.ctc.wstx.dtd">DTDElement</a></code></td> <td class="colLast"><span class="typeNameLabel">DTDElement.</span><code><span class="memberNameLink"><a href="../../../../../com/ctc/wstx/dtd/DTDElement.html#createDefined-com.ctc.wstx.api.ReaderConfig-javax.xml.stream.Location-com.ctc.wstx.util.PrefixedName-com.ctc.wstx.dtd.StructValidator-int-">createDefined</a></span>(<a href="../../../../../com/ctc/wstx/api/ReaderConfig.html" title="class in com.ctc.wstx.api">ReaderConfig</a>&nbsp;cfg, <a href="https://docs.oracle.com/javase/6/docs/api/javax/xml/stream/Location.html?is-external=true" title="class or interface in javax.xml.stream">Location</a>&nbsp;loc, <a href="../../../../../com/ctc/wstx/util/PrefixedName.html" title="class in com.ctc.wstx.util">PrefixedName</a>&nbsp;name, <a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a>&nbsp;val, int&nbsp;allowedContent)</code> <div class="block">Method called to create an actual element definition, matching an ELEMENT directive in a DTD subset.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../../com/ctc/wstx/dtd/DTDElement.html" title="class in com.ctc.wstx.dtd">DTDElement</a></code></td> <td class="colLast"><span class="typeNameLabel">DTDElement.</span><code><span class="memberNameLink"><a href="../../../../../com/ctc/wstx/dtd/DTDElement.html#define-javax.xml.stream.Location-com.ctc.wstx.dtd.StructValidator-int-">define</a></span>(<a href="https://docs.oracle.com/javase/6/docs/api/javax/xml/stream/Location.html?is-external=true" title="class or interface in javax.xml.stream">Location</a>&nbsp;loc, <a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">StructValidator</a>&nbsp;val, int&nbsp;allowedContent)</code> <div class="block">Method called on placeholder element, to create a real instance that has all attribute definitions placeholder had (it'll always have at least one -- otherwise no placeholder was needed).</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../com/ctc/wstx/dtd/StructValidator.html" title="class in com.ctc.wstx.dtd">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"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/ctc/wstx/dtd/class-use/StructValidator.html" target="_top">Frames</a></li> <li><a href="StructValidator.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2019 <a href="http://fasterxml.com">FasterXML</a>. All rights reserved.</small></p> </body> </html>
{ "content_hash": "4e9a08f9d47b54592dd8f756441d7e5c", "timestamp": "", "source": "github", "line_count": 274, "max_line_length": 443, "avg_line_length": 55.2992700729927, "alnum_prop": 0.6637407602956705, "repo_name": "FasterXML/woodstox", "id": "076d6ecc320066e8e16d23066240a8dddf0e84cb", "size": "15152", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/javadoc/6.0/com/ctc/wstx/dtd/class-use/StructValidator.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "2475" }, { "name": "Java", "bytes": "3239858" } ], "symlink_target": "" }
var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } __.prototype = b.prototype; d.prototype = new __(); }; var EndGate; (function (EndGate) { (function (Graphics) { /// <reference path="../../Assets/Vectors/Vector2d.ts" /> /// <reference path="../Graphic2d.ts" /> (function (Abstractions) { /** * Abstract drawable shape type that is used create customizable drawable graphics. */ var Shape = (function (_super) { __extends(Shape, _super); function Shape(position, color) { _super.call(this, position); this._type = "Shape"; this._fill = false; this._stroke = false; if (typeof color !== "undefined") { this.Color = color; } } Object.defineProperty(Shape.prototype, "Color", { get: /** * Gets or sets the current shape color. Valid colors are strings like "red" or "rgb(255,0,0)". */ function () { return this._State.FillStyle; }, set: function (color) { this._fill = true; this._State.FillStyle = color; }, enumerable: true, configurable: true }); Object.defineProperty(Shape.prototype, "BorderThickness", { get: /** * Gets or sets the current border thickness. */ function () { return this._State.LineWidth; }, set: function (thickness) { this._State.LineWidth = thickness; }, enumerable: true, configurable: true }); Object.defineProperty(Shape.prototype, "BorderColor", { get: /** * Gets or sets the current border color. Valid colors are strings like "red" or "rgb(255,0,0)". */ function () { return this._State.StrokeStyle; }, set: function (color) { this._stroke = true; this._State.StrokeStyle = color; }, enumerable: true, configurable: true }); Object.defineProperty(Shape.prototype, "ShadowColor", { get: /** * Gets or sets the current shadow color. Valid colors are strings like "red" or "rgb(255,0,0)". */ function () { return this._State.ShadowColor; }, set: function (color) { this._fill = true; this._State.ShadowColor = color; }, enumerable: true, configurable: true }); Object.defineProperty(Shape.prototype, "ShadowX", { get: /** * Gets or sets the current horizontal shadow position. */ function () { return this._State.ShadowOffsetX; }, set: function (x) { this._State.ShadowOffsetX = x; }, enumerable: true, configurable: true }); Object.defineProperty(Shape.prototype, "ShadowY", { get: /** * Gets or sets the current vertical shadow position. */ function () { return this._State.ShadowOffsetY; }, set: function (y) { this._State.ShadowOffsetY = y; }, enumerable: true, configurable: true }); Object.defineProperty(Shape.prototype, "ShadowBlur", { get: /** * Gets or sets the current shadow blur. */ function () { return this._State.ShadowBlur; }, set: function (blur) { this._State.ShadowBlur = blur; }, enumerable: true, configurable: true }); Object.defineProperty(Shape.prototype, "Opacity", { get: /** * Gets or sets the current opacity. Value is between 0 and 1. */ function () { return this._State.GlobalAlpha; }, set: function (alpha) { this._State.GlobalAlpha = alpha; }, enumerable: true, configurable: true }); /** * Sets the current borders thickness and color. * @param thickness The new border thickness in pixels. * @param color The new border color. Can be valid color strings, like "red" or "rgb(255,0,0)". */ Shape.prototype.Border = function (thickness, color) { this.BorderThickness = thickness; this.BorderColor = color; }; Shape.prototype.Shadow = function (x, y, color, blur) { this.ShadowX = x; this.ShadowY = y; this.ShadowColor = color; this.ShadowBlur = blur; }; Shape.prototype._StartDraw = function (context) { _super.prototype._StartDraw.call(this, context); context.beginPath(); }; Shape.prototype._EndDraw = function (context) { if (this._fill) { context.fill(); } if (this._stroke) { context.stroke(); } else { context.closePath(); } _super.prototype._EndDraw.call(this, context); }; // This should be overridden if you want to build a proper shape Shape.prototype._BuildPath = function (context) { }; /** * Draws the shape onto the given context. If this shape is part of a scene the Draw function will be called automatically. * @param context The canvas context to draw the shape onto. */ Shape.prototype.Draw = function (context) { this._StartDraw(context); this._BuildPath(context); this._EndDraw(context); }; return Shape; })(Abstractions.Graphic2d); Abstractions.Shape = Shape; })(Graphics.Abstractions || (Graphics.Abstractions = {})); var Abstractions = Graphics.Abstractions; })(EndGate.Graphics || (EndGate.Graphics = {})); var Graphics = EndGate.Graphics; })(EndGate || (EndGate = {}));
{ "content_hash": "f8a5cc1270509fd91e9e33d5dbc309b7", "timestamp": "", "source": "github", "line_count": 200, "max_line_length": 139, "avg_line_length": 39.185, "alnum_prop": 0.40806431032282764, "repo_name": "BorisKozo/EndGate", "id": "3053fee51aed9c1497a6d2459d3809efd67d10ee", "size": "7837", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "EndGate/EndGate.Core.JS/Graphics/Shapes/Shape.js", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "114" }, { "name": "C#", "bytes": "6828" }, { "name": "JavaScript", "bytes": "1780070" }, { "name": "PowerShell", "bytes": "3832" }, { "name": "Shell", "bytes": "298" }, { "name": "TypeScript", "bytes": "1226600" } ], "symlink_target": "" }
package com.commonsware.android.pagercolumns; import android.app.Activity; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.os.Bundle; import android.support.v4.view.ViewPager; import com.commonsware.cwac.pager.ArrayPagerAdapter; import com.commonsware.cwac.pager.PageDescriptor; import com.commonsware.cwac.pager.SimplePageDescriptor; import java.util.ArrayList; public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ViewPager pager=(ViewPager)findViewById(R.id.pager); if (pager == null) { if (getFragmentManager().findFragmentById(R.id.editor1) == null) { SamplePagerAdapter adapter=buildAdapter(); FragmentTransaction ft= getFragmentManager().beginTransaction(); populateColumn(getFragmentManager(), ft, adapter, 0, R.id.editor1); populateColumn(getFragmentManager(), ft, adapter, 1, R.id.editor2); populateColumn(getFragmentManager(), ft, adapter, 2, R.id.editor3); ft.commit(); } } else { SamplePagerAdapter adapter=buildAdapter(); pager.setAdapter(adapter); } } private SamplePagerAdapter buildAdapter() { ArrayList<PageDescriptor> pages=new ArrayList<PageDescriptor>(); for (int i=0; i < 3; i++) { pages.add(new SimplePageDescriptor(buildTag(i), buildTitle(i))); } return(new SamplePagerAdapter(getFragmentManager(), pages)); } private String buildTag(int position) { return("editor" + String.valueOf(position)); } private String buildTitle(int position) { return(String.format(getString(R.string.hint), position + 1)); } private void populateColumn(FragmentManager fm, FragmentTransaction ft, SamplePagerAdapter adapter, int position, int slot) { EditorFragment f=adapter.getExistingFragment(position); if (f == null) { f=adapter.createFragment(buildTitle(position)); } else { fm.beginTransaction().remove(f).commit(); fm.executePendingTransactions(); } ft.add(slot, f, buildTag(position)); } static class SamplePagerAdapter extends ArrayPagerAdapter<EditorFragment> { public SamplePagerAdapter(FragmentManager fragmentManager, ArrayList<PageDescriptor> descriptors) { super(fragmentManager, descriptors); } @Override protected EditorFragment createFragment(PageDescriptor desc) { return(createFragment(desc.getTitle())); } EditorFragment createFragment(String title) { return(EditorFragment.newInstance(title)); } } }
{ "content_hash": "7bfd4112277ad2bb8cbcc5794ad0e528", "timestamp": "", "source": "github", "line_count": 96, "max_line_length": 72, "avg_line_length": 29.760416666666668, "alnum_prop": 0.6685334266713335, "repo_name": "janzoner/cw-omnibus", "id": "54c47a42989a5589f9f76b3df5cc3542bca05c2d", "size": "3535", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ViewPager/FlexColumns/app/src/main/java/com/commonsware/android/pagercolumns/MainActivity.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "2322" }, { "name": "CSS", "bytes": "26082" }, { "name": "HTML", "bytes": "5302429" }, { "name": "Java", "bytes": "2588791" }, { "name": "JavaScript", "bytes": "209086" }, { "name": "Makefile", "bytes": "14011" }, { "name": "Python", "bytes": "546" }, { "name": "Shell", "bytes": "1056" } ], "symlink_target": "" }
<?php namespace MicrodataDOM; class DOMDocument extends \DOMDocument { /** * @var DOMXPath */ protected $xpath; /** * {@inheritDoc} */ public function __construct($version = null, $encoding = null) { parent::__construct($version, $encoding); $this->registerNodeClass('DOMDocument', __CLASS__); $this->registerNodeClass('DOMElement', 'MicrodataDOM\\DOMElement'); } /** * Return all, top-level microdata items whose types include all the types specified, or, if no types are specified, * all, top-level microdata items. * * @param array|string $typeNames * @return \DOMNodeList * @throws \InvalidArgumentException */ public function getItems($typeNames = []) { if (is_array($typeNames)) { $types = $typeNames; } elseif (is_string($typeNames)) { $types = preg_split('/\s+/', trim($typeNames)); } else { throw new \InvalidArgumentException('Expected array or string for argument 1'); } $xpathQuery = implode( ' and ', array_map( function ($type) { return 'contains(concat(" ", normalize-space(@itemtype), " "), " ' . htmlspecialchars(trim($type)) . ' ")'; }, $types ) ); return $this->xpathQuery('//*[@itemscope and not(@itemprop)' . ($xpathQuery ? ' and (' . $xpathQuery . ')' : '') . ']'); } /** * Return an array of all microdata items in a Microdata JSON structure. * * @see http://www.w3.org/TR/microdata/#json * @return mixed[string] */ public function toArray() { $results = []; foreach ($this->getItems() as $item) { $results['items'][] = $item->toArray(); } return $results; } /** * Execute an XPath query against the document and, optionally, within a specific node. * * @internal * @param string $expression * @param \DOMNode $contextnode * @return type */ public function xpathQuery($expression, \DOMNode $contextnode = null) { if (null === $this->xpath) { $this->xpath = new \DOMXpath($this); } return $this->xpath->query($expression, $contextnode); } /** * Attempt to convert possibly-relative URLs into an absolute URL based on the document context. * * @internal * @param string $url * @return string */ public function makeAbsoluteUrl($url) { if (null !== parse_url($url, PHP_URL_SCHEME)) { return $url; } elseif (null === $this->documentURI) { return $url; } $base = parse_url($this->documentURI); if ('//' == substr($url, 0, 2)) { return $base['scheme'] . ':' . $url; } $basepartial = $base['scheme'] . '://' . $base['host'] . (!empty($base['port']) ? (':' . $base['port']) : ''); if ('' == $url) { return $this->documentURI; } elseif ('/' == $url[0]) { return $basepartial . $url; } elseif ('#' == $url[0]) { return $basepartial . $base['path'] . (!empty($base['query']) ? ('?' . $base['query']) : '') . $url; } elseif ('?' == $url[0]) { return $basepartial . $base['path'] . $url; } elseif ('/' == substr($base['path'], -1)) { return $basepartial . $base['path'] . $url; } return $basepartial . dirname($base['path']) . '/' . $url; } }
{ "content_hash": "eb8bda60933b2e245b1c849a63667326", "timestamp": "", "source": "github", "line_count": 125, "max_line_length": 128, "avg_line_length": 28.896, "alnum_prop": 0.506921373200443, "repo_name": "dpb587/microdata-dom.php", "id": "6ec57dae3546b5d3439ffa9a211d5b7b679563c5", "size": "3612", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/MicrodataDOM/DOMDocument.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "52214" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <title>2048</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no, target-densityDpi=device-dpi"> <link href="../../common/css/ui/uicommon.css" rel="stylesheet"/> <link href="../../common/css/ui/widgetcommon.css" rel="stylesheet"/> <link href="fonts/clear-sans.css" rel="stylesheet"/> <style> html, body { background-color: #000000; width: 100%; height: 100%; margin: 0; } canvas { position: absolute; top: 1px; left: 1px; } </style> <!-- 3rd party lib --> <script type="text/javascript" src="/socket.io/socket.io.js"></script> <!-- dummy goog object --> <script type="text/javascript" src="../../common/js/org/goog/dummy_goog.js"></script> <!-- 3rd party lib --> <script type="text/javascript" src="../../common/js/org/puremvc/puremvc-1.0.js"></script> <script type="text/javascript" src="../../common/js/org/createjs/easeljs/easeljs-0.7.1.min.js"></script> <script type="text/javascript" src="../../common/js/org/createjs/tweenjs/tweenjs-0.5.1.min.js"></script> <script type="text/javascript" src="../../common/js/org/jsv/jsv.js"></script> <!-- lib source --> <script type="text/javascript" src="../../common/js/BOK.js"></script> <script type="text/javascript" src="../../common/js/event/Event.js"></script> <script type="text/javascript" src="../../common/js/Delegate.js"></script> <script type="text/javascript" src="../../common/js/EventDispatcher.js"></script> <script type="text/javascript" src="../../common/js/SingletonBase.js"></script> <script type="text/javascript" src="../../common/js/framework/util/frameworkUtil.js"></script> <script type="text/javascript" src="../../common/js/framework/core/BaseProxy.js"></script> <script type="text/javascript" src="../../common/js/framework/core/BaseMediator.js"></script> <script type="text/javascript" src="../../common/js/framework/core/BaseCommand.js"></script> <script type="text/javascript" src="../../common/js/framework/core/FeatureNotesCollection.js"></script> <script type="text/javascript" src="../../common/js/framework/core/MVCFeature.js"></script> <script type="text/javascript" src="../../common/js/framework/App.js"></script> <script type="text/javascript" src="../../common/js/easelui/EsUIComponent.js"></script> <script type="text/javascript" src="../../common/js/easelui/EsButton.js"></script> <script type="text/javascript" src="../../common/js/easelui/Stretcher.js"></script> <script type="text/javascript" src="../../common/js/util/EaselAnimationHelper.js"></script> <script type="text/javascript" src="../../common/js/net/AbstractSocketController.js"></script> <!-- common features --> <!-- common apps --> <script type="text/javascript" src="../../common/js/apps/preloader/interfaces/IPreloaderSkin.js"></script> <script type="text/javascript" src="../../common/js/apps/preloader/components/DefaultCanvasSkin.js"></script> <script type="text/javascript" src="../../common/js/apps/preloader/components/BlueCanvasSkin.js"></script> <script type="text/javascript" src="../../common/js/apps/preloader/loader/AbstractLoader.js"></script> <script type="text/javascript" src="../../common/js/apps/preloader/loader/TemplateLoader.js"></script> <script type="text/javascript" src="../../common/js/apps/preloader/loader/AssetsLoader.js"></script> <script type="text/javascript" src="../../common/js/apps/preloader/loader/FontLoader.js"></script> <script type="text/javascript" src="../../common/js/apps/preloader/AbstractPreloaderApp.js"></script> <script type="text/javascript" src="../../common/js/apps/preloader/CanvasPreloaderApp.js"></script> <!-- game features --> <script type="text/javascript" src="js/features/game/v/component/Grid.js"></script> <script type="text/javascript" src="js/features/game/v/component/Tile.js"></script> <script type="text/javascript" src="js/features/game/v/component/Label.js"></script> <script type="text/javascript" src="js/features/game/v/component/Button.js"></script> <script type="text/javascript" src="js/features/game/v/component/GameOver.js"></script> <script type="text/javascript" src="js/features/game/v/GameViewMediator.js"></script> <script type="text/javascript" src="js/features/game/MainGameFeature.js"></script> <script type="text/javascript" src="js/features/game/MainGameFeatureNotes.js"></script> <!-- game apps --> <script type="text/javascript" src="js/TzfeApp.js"></script> <!-- translation --> <!-- data --> <script type="text/javascript" src="assets/data/AssetsList.js"></script> <script type="text/javascript" src="config/CONST.js"></script> <!-- start-up script --> <script type="text/javascript" src="js/main.js"></script> </head> <body> <canvas id="canvas" width="960" height="540"></canvas> </body> </html>
{ "content_hash": "2e0d5754e586d5db404258a37380fa4a", "timestamp": "", "source": "github", "line_count": 100, "max_line_length": 154, "avg_line_length": 52.04, "alnum_prop": 0.6564181398923905, "repo_name": "BOKteam/games", "id": "bfd59cfb0545f48452dd07c400f60b29b16d783f", "size": "5204", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "2048/src/index_dev.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "3644" }, { "name": "JavaScript", "bytes": "325311" } ], "symlink_target": "" }
using LINQPad; using LiteDB; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LiteDBPad { public class DumpableBsonDocument : BsonDocument, ICustomMemberProvider { public static void RegisterSerializer() { BsonMapper.Global.RegisterType<DumpableBsonDocument> ( serialize: (doc) => doc, deserialize: (bson) => new DumpableBsonDocument(bson.AsDocument.RawValue) ); } Dictionary<string, BsonValue> _dict; public DumpableBsonDocument(Dictionary<string, BsonValue> dict) :base(dict) { _dict = dict; } public IEnumerable<string> GetNames() { return _dict.Keys; } public IEnumerable<Type> GetTypes() { foreach (var key in _dict.Keys) { var item = _dict[key]; if (item.IsDocument) yield return typeof(DumpableBsonDocument); else if (item.IsArray) yield return typeof(IEnumerable); else if (item.IsBinary) yield return typeof(byte[]); else if (item.IsBoolean) yield return typeof(bool); else if (item.IsDateTime) yield return typeof(DateTime); else if (item.IsDecimal) yield return typeof(decimal); else if (item.IsDouble) yield return typeof(double); else if (item.IsGuid) yield return typeof(Guid); else if (item.IsInt32) yield return typeof(int); else if (item.IsInt64) yield return typeof(long); else if (item.IsString) yield return typeof(string); else if (item.IsObjectId) yield return typeof(ObjectId); else if (item.IsNull) yield return typeof(object); else yield return typeof(BsonValue); } } public IEnumerable<object> GetValues() { foreach (var key in _dict.Keys) { var item = _dict[key]; yield return GetValueFromBson(item); } } private static object GetValueFromBson(BsonValue item) { if (item.IsDocument) return new DumpableBsonDocument(item.AsDocument); else if (item.IsArray) return item.AsArray.Select(_ => GetValueFromBson(_)); else if (item.IsBinary) return item.AsBinary; else if (item.IsBoolean) return item.AsBoolean; else if (item.IsDateTime) return item.AsDateTime; else if (item.IsDecimal) return item.AsDecimal; else if (item.IsDouble) return item.AsDouble; else if (item.IsGuid) return item.AsGuid; else if (item.IsInt32) return item.AsInt32; else if (item.IsInt64) return item.AsInt64; else if (item.IsString) return item.AsString; else if (item.IsObjectId) return item.AsObjectId; else if (item.IsNull) return null; else return item; } } }
{ "content_hash": "c2b4e7e9f4a320744131a24d4cdf819d", "timestamp": "", "source": "github", "line_count": 114, "max_line_length": 89, "avg_line_length": 32.07017543859649, "alnum_prop": 0.50054704595186, "repo_name": "adospace/litedbpad", "id": "b2dcd02c9ca26bbf1ce0960034ca58776598d8f1", "size": "3658", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "LiteDBPad/DumpableBsonDocument.cs", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C#", "bytes": "116029" } ], "symlink_target": "" }
octo-crypto-samurai =================== Pretended cryptocurrency marketplace
{ "content_hash": "e950cac5e76b34d93bf107d79390cfcb", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 36, "avg_line_length": 19.5, "alnum_prop": 0.6538461538461539, "repo_name": "sammyrulez/octo-crypto-samurai", "id": "ea1cafb560299b54b35785b58a8b1f6f93a660c0", "size": "78", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "200912" }, { "name": "JavaScript", "bytes": "19480" }, { "name": "Scala", "bytes": "10672" } ], "symlink_target": "" }
<!DOCTYPE frameset SYSTEM "frameset.dtd"> <frameset> <predicate lemma="fashion"> <note> Frames file for 'fashion' based on survey of sentences in the WSJ corpus. </note> <roleset id="fashion.01" name="to make out of components" vncls="26.1"> <roles> <role descr="maker, agent" n="0"> <vnrole vncls="26.1" vntheta="Agent"/> </role> <role descr="entity fashioned" n="1"> <vnrole vncls="26.1" vntheta="Product"/> </role> </roles> <example name="transitive"> <inflection aspect="perfect" form="participle" person="third" tense="present" voice="active"/> <text> Now [*-2] shifting his scene from the country [0] he left [*T*-1] at five to the England [0] he has lived in [*T*-3] for nearly 30 years , he has fashioned a novel in the mode of Henry James and E.M. Forster . </text> <arg n="0">he</arg> <rel>fashioned</rel> <arg n="1">a novel in the mode of Henry James and E.M. Forster</arg> </example> </roleset> </predicate> <note> frames created by Olga </note> </frameset>
{ "content_hash": "b967928089e029c2b28c4499cd6107e3", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 229, "avg_line_length": 36.55263157894737, "alnum_prop": 0.4838012958963283, "repo_name": "keenon/jamr", "id": "a78d1bebed352ea28e46d510ebe66ced98cc182c", "size": "1389", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "data/frames/fashion.xml", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Java", "bytes": "640454" }, { "name": "Perl", "bytes": "8697" }, { "name": "Python", "bytes": "76079" }, { "name": "Scala", "bytes": "353885" }, { "name": "Shell", "bytes": "41192" } ], "symlink_target": "" }
import { invalidArgumentsCheck } from '../../../../utilities/invalid-arguments-check'; import { EmptySequenceError, InvalidReturnTypeError } from '../../../errors/errors.index'; import { SelectionExpression } from '../../../expressions/expressions.index'; import { IEnumerable } from '../enumerable.index'; export interface IMaxSelectors<TSource, TResult> { valueSelector?: SelectionExpression<TSource, number>; resultSelector?: SelectionExpression<TSource, TResult>; } export function max<TSource, TResult>( source: IEnumerable<TSource>, selectors?: IMaxSelectors<TSource, TResult>): TResult { invalidArgumentsCheck(arguments, 1); const enumerator = source.getEnumerator(); const valueSelector = selectors.valueSelector ? selectors.valueSelector : (element: TSource) => element as any; const resultSelector = selectors.resultSelector ? selectors.resultSelector : (element: TSource) => element as any; if (!enumerator.moveNext()) { throw new EmptySequenceError(); } let maxItem = enumerator.current; while (enumerator.moveNext()) { const lastValue = valueSelector(maxItem); const currentValue = valueSelector(enumerator.current); if (isNaN(lastValue)) { throw new InvalidReturnTypeError('number', typeof lastValue); } if (isNaN(currentValue)) { throw new InvalidReturnTypeError('number', typeof currentValue); } if (lastValue < currentValue) { maxItem = currentValue; } } return resultSelector(maxItem); }
{ "content_hash": "fbb8515596f6de0a4babbd2b1bc978fe", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 90, "avg_line_length": 37.577777777777776, "alnum_prop": 0.6398580721466588, "repo_name": "rharris2825/skyll", "id": "b6e95d440397b5b25697b8c539e6079f0f1b5923", "size": "1691", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/common/aggregates/enumerable/operations/max.ts", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "2033" }, { "name": "TypeScript", "bytes": "149609" } ], "symlink_target": "" }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66b.c Label Definition File: CWE194_Unexpected_Sign_Extension.label.xml Template File: sources-sink-66b.tmpl.c */ /* * @description * CWE: 194 Unexpected Sign Extension * BadSource: listen_socket Read data using a listen socket (server side) * GoodSource: Positive integer * Sinks: malloc * BadSink : Allocate memory using malloc() with the size of data * Flow Variant: 66 Data flow: data passed in an array from one function to another in different source files * * */ #include "std_testcase.h" #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */ #define CLOSE_SOCKET closesocket #else #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #define INVALID_SOCKET -1 #define SOCKET_ERROR -1 #define CLOSE_SOCKET close #define SOCKET int #endif #define TCP_PORT 27015 #define LISTEN_BACKLOG 5 /* Must be at least 8 for atoi() to work properly */ #define CHAR_ARRAY_SIZE 8 #ifndef OMITBAD void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66b_badSink(short dataArray[]) { /* copy data out of dataArray */ short data = dataArray[2]; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); if (dataBuffer == NULL) {exit(-1);} /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66b_goodG2BSink(short dataArray[]) { short data = dataArray[2]; /* Assume we want to allocate a relatively small buffer */ if (data < 100) { /* POTENTIAL FLAW: malloc() takes a size_t (unsigned int) as input and therefore if it is negative, * the conversion will cause malloc() to allocate a very large amount of data or fail */ char * dataBuffer = (char *)malloc(data); if (dataBuffer == NULL) {exit(-1);} /* Do something with dataBuffer */ memset(dataBuffer, 'A', data-1); dataBuffer[data-1] = '\0'; printLine(dataBuffer); free(dataBuffer); } } #endif /* OMITGOOD */
{ "content_hash": "31873f7cd978b3c5c5aa3a2aa586073e", "timestamp": "", "source": "github", "line_count": 86, "max_line_length": 109, "avg_line_length": 32.45348837209303, "alnum_prop": 0.6553206735936941, "repo_name": "JianpingZeng/xcc", "id": "d754526e36b4d02c61d5cc3e13eb0a07b3ea2dec", "size": "2791", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "xcc/test/juliet/testcases/CWE194_Unexpected_Sign_Extension/s02/CWE194_Unexpected_Sign_Extension__listen_socket_malloc_66b.c", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
use steamworks; var result = db.DeepSpace2019.aggregate([ { $project: { "teamNumber": 1, //"autoScore.total": 1, "autoScore.cubes": 1, "autoScore.autoRun": 1, "autoScore.scalePoints": 1, "autoScore.switchPoints": 1, "teleScore.breakdown": 1, "teleScore.vaultPoints": 1, "teleScore.levitation": 1, "teleScore.cubes": 1, //"teleScore.total": 1, "teleScore.exchangeCube": 1, "teleScore.switchCube": 1, "teleScore.scaleCube": 1, "teleScore.fouls": 1, "teleScore.parking": 1, "teleScore.playStyle": 1, "teleScore.climbSuccess": 1, "teleScore.climbAttempt": 1, "autoScore.placement": 1 } }, { $group: { "_id": "$teamNumber", "avgAutoCubes": {"$avg": "$autoScore.cubes"}, "avgAutoRun": {"$avg": "$autoScore.autoRun"}, "autoPlacement": {"$addToSet": "$autoScore.placement"}, "avgTeleCubes": {"$avg": "teleScore.cubes"}, "avgVaultPoints": {"$avg": "$teleScore.vaultPoints"}, "fouls": {"$addToSet": "$teleScore.fouls"}, "avgExchangePoints": {"$avg": "teleScore.exchangeCube"}, "avgAutoScaleCubes": {"$avg": "autoScore.scalePoints"}, "avgAutoSwitchCubes": {"$avg": "autoScore.switchPoints"}, "avgTeleScaleCubes": {"$avg": "teleScore.scaleCube"}, "avgTeleSwitchCubes": {"$avg": "teleScore.switchCube"}, "breakdowns": {"$sum": "$teleScore.breakdown"}, "levitate": {"$sum": "$teleScore.levitation"}, "playStyle": {"$addToSet": "$teleScore.playStyle"}, "attemptedClimbs": {"$sum": {"$cond": ["$teleScore.climbAttempt", 1, 0]}}, "successfulClimbs": {"$sum": {"$cond": ["$teleScore.climbSuccess", 1, 0]}}, "matches": {"$sum": 1} } } ]); db.temp.insert(result.result);
{ "content_hash": "ffa9d64e175d87caf8e98397d11e0fd1", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 91, "avg_line_length": 36.82539682539682, "alnum_prop": 0.4521551724137931, "repo_name": "PikeRoboDevils/steamWorksScoutingDB", "id": "e8b7519d6fb7bac4187ac07c94a4f1a72683b456", "size": "2320", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "aggregate.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "4997" }, { "name": "Shell", "bytes": "422" } ], "symlink_target": "" }
require 'twilio-ruby' require 'sinatra' get '/sms-quickstart' do twiml = Twilio::TwiML::MessagingResponse.new do |r| r.Message(body: 'Hello, friend') do |message| message.media 'https://demo.twilio.com/owl.png' end end twiml.to_s end
{ "content_hash": "9c47f1b0f60128fa9696d1f0eade5b8b", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 53, "avg_line_length": 21.333333333333332, "alnum_prop": 0.67578125, "repo_name": "TwilioDevEd/api-snippets", "id": "20bb9651459e1cea92d29335e06389d98cede05d", "size": "327", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "quickstart/ruby/sms/example-4/mms_hello_friend.5.x.rb", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "637161" }, { "name": "C++", "bytes": "24856" }, { "name": "Go", "bytes": "7217" }, { "name": "HTML", "bytes": "335" }, { "name": "Java", "bytes": "912474" }, { "name": "JavaScript", "bytes": "512877" }, { "name": "M", "bytes": "147" }, { "name": "Objective-C", "bytes": "53325" }, { "name": "PHP", "bytes": "517186" }, { "name": "Python", "bytes": "442184" }, { "name": "Ruby", "bytes": "438928" }, { "name": "Shell", "bytes": "3854" }, { "name": "Swift", "bytes": "42345" }, { "name": "TypeScript", "bytes": "16767" } ], "symlink_target": "" }
export const mockData = { owner: 'default', widgetType: 'launchesTable', share: true, id: '5bd8b0949daec2000132daba', name: 'Temporary table', contentParameters: { contentFields: [ 'name', 'number', 'status', 'statistics$defects$product_bug$pb001', 'statistics$defects$automation_bug$ab001', 'statistics$defects$automation_bug$ab_1h7inqu51mgys', 'statistics$defects$automation_bug$ab_qecoiezu7sc8', 'statistics$defects$automation_bug$ab_1k1tyymqtlp46', 'statistics$defects$system_issue$si001', 'statistics$defects$system_issue$si_rhowwtmbonz6', 'statistics$defects$to_investigate$ti001', 'tags', 'user', 'startTime', 'endTime', 'description', 'statistics$executions$total', 'statistics$executions$passed', 'statistics$executions$failed', 'statistics$executions$skipped', ], itemsCount: 50, widgetOptions: { filterName: ['DEMO_FILTER#090090'], }, }, filter_id: '5b3e3d991aa8410001223a88', content: { result: [ { values: { statistics$defects$automation_bug$ab001: '11', statistics$executions$skipped: '22', statistics$executions$total: '119', endTime: 1533908750104, description: '### **Demonstration launch.**\n' + 'A typical *Launch structure* comprises the following elements: Suite > Test > Step > Log.\n' + 'Launch contains *randomly* generated `suites`, `tests`, `steps` with:\n' + '* random issues and statuses,\n' + '* logs,\n' + '* attachments with different formats.', statistics$defects$to_investigate$ti001: '26', statistics$defects$system_issue$si001: '5', statistics$defects$automation_bug$ab_qecoiezu7sc8: '0', tags: 'desktop,build:3.0.1.5,demo', statistics$defects$system_issue$si_rhowwtmbonz6: '0', statistics$executions$passed: '74', user: 'default', statistics$defects$automation_bug$ab_1h7inqu51mgys: '0', statistics$executions$failed: '23', statistics$defects$automation_bug$ab_1k1tyymqtlp46: '0', lastModified: '1540987067590', statistics$defects$product_bug$pb001: '11', status: 'FAILED', }, name: 'Demo Api Tests_214r2323adsddads123dsdsdsdsddsds', startTime: 1533908745504, number: '13', id: '5b6d9709857aba00013a5d92', }, { values: { statistics$defects$automation_bug$ab001: '2', statistics$executions$skipped: '11', statistics$executions$total: '76', endTime: 1533908746422, description: '### **Demonstration launch.**\n' + 'A typical *Launch structure* comprises the following elements: Suite > Test > Step > Log.\n' + 'Launch contains *randomly* generated `suites`, `tests`, `steps` with:\n' + '* random issues and statuses,\n' + '* logs,\n' + '* attachments with different formats.', statistics$defects$to_investigate$ti001: '10', statistics$defects$system_issue$si001: '6', statistics$defects$automation_bug$ab_qecoiezu7sc8: '0', tags: 'desktop,demo,build:3.0.1.4', statistics$defects$system_issue$si_rhowwtmbonz6: '0', statistics$executions$passed: '49', user: 'default', statistics$defects$automation_bug$ab_1h7inqu51mgys: '0', statistics$executions$failed: '16', statistics$defects$automation_bug$ab_1k1tyymqtlp46: '0', lastModified: '1533908746422', statistics$defects$product_bug$pb001: '6', status: 'FAILED', }, name: 'Demo Api Tests_214r2323adsddads123dsdsdsdsddsds', startTime: 1533908743770, number: '11', id: '5b6d9707857aba00013a4e51', }, { values: { statistics$defects$automation_bug$ab001: '3', statistics$executions$skipped: '11', statistics$executions$total: '76', endTime: 1533908745503, description: '### **Demonstration launch.**\n' + 'A typical *Launch structure* comprises the following elements: Suite > Test > Step > Log.\n' + 'Launch contains *randomly* generated `suites`, `tests`, `steps` with:\n' + '* random issues and statuses,\n' + '* logs,\n' + '* attachments with different formats.', statistics$defects$to_investigate$ti001: '13', statistics$defects$system_issue$si001: '3', statistics$defects$automation_bug$ab_qecoiezu7sc8: '0', tags: 'desktop,demo,build:3.0.1.4', statistics$defects$system_issue$si_rhowwtmbonz6: '0', statistics$executions$passed: '51', user: 'default', statistics$defects$automation_bug$ab_1h7inqu51mgys: '0', statistics$executions$failed: '14', statistics$defects$automation_bug$ab_1k1tyymqtlp46: '0', lastModified: '1533908745503', statistics$defects$product_bug$pb001: '11', status: 'FAILED', }, name: 'Demo Api Tests_214r2323adsddads123dsdsdsdsddsds', startTime: 1533908742771, number: '10', id: '5b6d9706857aba00013a4587', }, { values: { statistics$defects$automation_bug$ab001: '3', statistics$executions$skipped: '8', statistics$executions$total: '42', endTime: 1533908743999, description: '### **Demonstration launch.**\n' + 'A typical *Launch structure* comprises the following elements: Suite > Test > Step > Log.\n' + 'Launch contains *randomly* generated `suites`, `tests`, `steps` with:\n' + '* random issues and statuses,\n' + '* logs,\n' + '* attachments with different formats.', statistics$defects$to_investigate$ti001: '9', statistics$defects$system_issue$si001: '1', statistics$defects$automation_bug$ab_qecoiezu7sc8: '0', tags: 'desktop,demo,build:3.0.1.3', statistics$defects$system_issue$si_rhowwtmbonz6: '0', statistics$executions$passed: '24', user: 'default', statistics$defects$automation_bug$ab_1h7inqu51mgys: '0', statistics$executions$failed: '10', statistics$defects$automation_bug$ab_1k1tyymqtlp46: '0', lastModified: '1533908744009', statistics$defects$product_bug$pb001: '5', status: 'FAILED', }, name: 'Demo Api Tests_214r2323adsddads123dsdsdsdsddsds', startTime: 1533908742538, number: '9', id: '5b6d9706857aba00013a43b8', }, { values: { statistics$defects$automation_bug$ab001: '4', statistics$executions$skipped: '2', statistics$executions$total: '42', endTime: 1533908743769, description: '### **Demonstration launch.**\n' + 'A typical *Launch structure* comprises the following elements: Suite > Test > Step > Log.\n' + 'Launch contains *randomly* generated `suites`, `tests`, `steps` with:\n' + '* random issues and statuses,\n' + '* logs,\n' + '* attachments with different formats.', statistics$defects$to_investigate$ti001: '10', statistics$defects$system_issue$si001: '0', statistics$defects$automation_bug$ab_qecoiezu7sc8: '0', tags: 'desktop,demo,build:3.0.1.3', statistics$defects$system_issue$si_rhowwtmbonz6: '0', statistics$executions$passed: '28', user: 'default', statistics$defects$automation_bug$ab_1h7inqu51mgys: '0', statistics$executions$failed: '12', statistics$defects$automation_bug$ab_1k1tyymqtlp46: '0', lastModified: '1533908743769', statistics$defects$product_bug$pb001: '5', status: 'FAILED', }, name: 'Demo Api Tests_214r2323adsddads123dsdsdsdsddsds', startTime: 1533908742372, number: '8', id: '5b6d9706857aba00013a4251', }, { values: { statistics$defects$automation_bug$ab001: '1', statistics$executions$skipped: '1', statistics$executions$total: '20', endTime: 1533908742537, description: '### **Demonstration launch.**\n' + 'A typical *Launch structure* comprises the following elements: Suite > Test > Step > Log.\n' + 'Launch contains *randomly* generated `suites`, `tests`, `steps` with:\n' + '* random issues and statuses,\n' + '* logs,\n' + '* attachments with different formats.', statistics$defects$to_investigate$ti001: '6', statistics$defects$system_issue$si001: '1', statistics$defects$automation_bug$ab_qecoiezu7sc8: '0', tags: 'desktop,demo,build:3.0.1.2', statistics$defects$system_issue$si_rhowwtmbonz6: '0', statistics$executions$passed: '10', user: 'default', statistics$defects$automation_bug$ab_1h7inqu51mgys: '0', statistics$executions$failed: '9', statistics$defects$automation_bug$ab_1k1tyymqtlp46: '0', lastModified: '1533908742538', statistics$defects$product_bug$pb001: '5', status: 'FAILED', }, name: 'Demo Api Tests_214r2323adsddads123dsdsdsdsddsds', startTime: 1533908741784, number: '7', id: '5b6d9705857aba00013a3cf7', }, { values: { statistics$defects$automation_bug$ab001: '1', statistics$executions$skipped: '4', statistics$executions$total: '20', endTime: 1533908742371, description: '### **Demonstration launch.**\n' + 'A typical *Launch structure* comprises the following elements: Suite > Test > Step > Log.\n' + 'Launch contains *randomly* generated `suites`, `tests`, `steps` with:\n' + '* random issues and statuses,\n' + '* logs,\n' + '* attachments with different formats.', statistics$defects$to_investigate$ti001: '2', statistics$defects$system_issue$si001: '0', statistics$defects$automation_bug$ab_qecoiezu7sc8: '0', tags: 'desktop,demo,build:3.0.1.2', statistics$defects$system_issue$si_rhowwtmbonz6: '0', statistics$executions$passed: '11', user: 'default', statistics$defects$automation_bug$ab_1h7inqu51mgys: '0', statistics$executions$failed: '5', statistics$defects$automation_bug$ab_1k1tyymqtlp46: '0', lastModified: '1533908742371', statistics$defects$product_bug$pb001: '4', status: 'FAILED', }, name: 'Demo Api Tests_214r2323adsddads123dsdsdsdsddsds', startTime: 1533908741639, number: '6', id: '5b6d9705857aba00013a3bd3', }, { values: { statistics$defects$automation_bug$ab001: '0', statistics$executions$skipped: '0', statistics$executions$total: '5', endTime: 1533908741782, description: '### **Demonstration launch.**\n' + 'A typical *Launch structure* comprises the following elements: Suite > Test > Step > Log.\n' + 'Launch contains *randomly* generated `suites`, `tests`, `steps` with:\n' + '* random issues and statuses,\n' + '* logs,\n' + '* attachments with different formats.', statistics$defects$to_investigate$ti001: '0', statistics$defects$system_issue$si001: '1', statistics$defects$automation_bug$ab_qecoiezu7sc8: '0', tags: 'desktop,demo,build:3.0.1.1', statistics$defects$system_issue$si_rhowwtmbonz6: '0', statistics$executions$passed: '3', user: 'default', statistics$defects$automation_bug$ab_1h7inqu51mgys: '0', statistics$executions$failed: '2', statistics$defects$automation_bug$ab_1k1tyymqtlp46: '0', lastModified: '1533908741783', statistics$defects$product_bug$pb001: '2', status: 'FAILED', }, name: 'Demo Api Tests_214r2323adsddads123dsdsdsdsddsds', startTime: 1533908741587, number: '5', id: '5b6d9705857aba00013a3b61', }, ], }, }; export const state = { user: { info: { userId: 'default', email: 'examle@mail.com', photoId: '5b7584da97a1c00001e7fd1f', fullName: 'SuperTester', accountType: 'INTERNAL', userRole: 'ADMINISTRATOR', lastLogin: 1534867405428, photoLoaded: true, defaultProject: 'default_personal', assignedProjects: { amsterget_personal: { projectRole: 'PROJECT_MANAGER', proposedRole: 'PROJECT_MANAGER', entryType: 'PERSONAL', }, }, }, activeProject: 'amsterget_personal', settings: { startTimeFormat: 'relative', }, token: '6c0aaff9-f471-4a07-bad2-78440d4c354b', }, project: { info: { projectId: 'amsterget_personal', configuration: { externalSystem: [], entryType: 'PERSONAL', statisticCalculationStrategy: 'STEP_BASED', projectSpecific: 'DEFAULT', interruptedJob: '1 day', keepLogs: '3 months', keepScreenshots: '2 weeks', emailConfiguration: {}, analyzerConfiguration: {}, subTypes: { TO_INVESTIGATE: [ { locator: 'ti001', typeRef: 'TO_INVESTIGATE', longName: 'To Investigate', shortName: 'TI', color: '#ffb743', }, ], NO_DEFECT: [ { locator: 'nd001', typeRef: 'NO_DEFECT', longName: 'No Defect', shortName: 'ND', color: '#777777', }, ], AUTOMATION_BUG: [ { locator: 'ab001', typeRef: 'AUTOMATION_BUG', longName: 'Automation Bug', shortName: 'AB', color: '#f7d63e', }, ], PRODUCT_BUG: [ { locator: 'pb001', typeRef: 'PRODUCT_BUG', longName: 'Product Bug', shortName: 'PB', color: '#ec3900', }, ], SYSTEM_ISSUE: [ { locator: 'si001', typeRef: 'SYSTEM_ISSUE', longName: 'System Issue', shortName: 'SI', color: '#0274d1', }, ], }, }, users: [ { login: 'amsterget', projectRole: 'PROJECT_MANAGER', proposedRole: 'PROJECT_MANAGER', }, { login: 'default', projectRole: 'PROJECT_MANAGER', proposedRole: 'PROJECT_MANAGER', }, ], creationDate: 1526647676812, }, preferences: { filters: [], userRef: 'default', projectRef: 'amsterget_personal', }, }, location: { pathname: '/amsterget_personal/launches/all', type: 'PROJECT_LAUNCHES_PAGE', payload: { projectId: 'amsterget_personal', filterId: 'all', }, prev: { pathname: '/amsterget_personal/dashboard', type: 'PROJECT_DASHBOARD_PAGE', payload: { projectId: 'amsterget_personal', }, query: {}, }, kind: 'push', routesMap: { HOME_PAGE: { path: '/', }, LOGIN_PAGE: '/login', REGISTRATION_PAGE: '/registration', ADMINISTRATE_PAGE: '/administrate', USER_PROFILE_PAGE: '/user-profile', API_PAGE: '/api', PROJECT_PAGE: { path: '/:projectId', }, PROJECT_DASHBOARD_PAGE: { path: '/:projectId/dashboard', }, PROJECT_DASHBOARD_ITEM_PAGE: { path: '/:projectId/dashboard/:dashboardId', }, PROJECT_LAUNCHES_PAGE: { path: '/:projectId/launches/:filterId?', }, PROJECT_FILTERS_PAGE: { path: '/:projectId/filters', }, PROJECT_USERDEBUG_PAGE: { path: '/:projectId/userdebug/:filterId', }, PROJECT_USERDEBUG_TEST_ITEM_PAGE: { path: '/:projectId/userdebug/:filterId/:testItemIds+', }, PROJECT_MEMBERS_PAGE: { path: '/:projectId/members', }, PROJECT_SETTINGS_PAGE: { path: '/:projectId/settings', }, PROJECT_SETTINGS_TAB_PAGE: '/:projectId/settings/:settingTab', PROJECT_SANDBOX_PAGE: '/:projectId/sandbox', TEST_ITEM_PAGE: { path: '/:projectId/launches/:filterId/:testItemIds+', }, }, }, };
{ "content_hash": "86ddb2abed8b83d05b1932ead48ee6fe", "timestamp": "", "source": "github", "line_count": 466, "max_line_length": 107, "avg_line_length": 36.61158798283262, "alnum_prop": 0.5636832542054979, "repo_name": "reportportal/service-ui", "id": "d54903b218b9fcf3575b6689583d63c76318fbf5", "size": "17652", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/components/widgets/singleLevelWidgets/tables/launchesTable/data.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "386" }, { "name": "Groovy", "bytes": "1527" }, { "name": "HTML", "bytes": "1424" }, { "name": "JavaScript", "bytes": "5346532" }, { "name": "Makefile", "bytes": "1836" }, { "name": "SCSS", "bytes": "778741" }, { "name": "Shell", "bytes": "40" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Text; using Xamarin.Forms; namespace InsideInning.Pages { public class BaseViewPage : ContentPage { public BaseViewPage() { SetBinding(Page.TitleProperty, new Binding()); } public enum TabView { Balance, Calendar, Holidays } } }
{ "content_hash": "2a92e6d9737cd677119eef169cd80ebf", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 58, "avg_line_length": 19.047619047619047, "alnum_prop": 0.5675, "repo_name": "rzeem7/InsideInning", "id": "ec42a2c49d250081dcdd5e7b5ea7f356f74111a4", "size": "402", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "InsideInning/InsideInning/Pages/BaseViewPage.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "6070" }, { "name": "C#", "bytes": "662128" }, { "name": "CSS", "bytes": "30247" }, { "name": "JavaScript", "bytes": "1144" } ], "symlink_target": "" }
public class Super { } class Child extends Super { } class ChildChild extends Child { }
{ "content_hash": "d8ebfaa6062e214fbf35e6eafb5d71e2", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 32, "avg_line_length": 10.88888888888889, "alnum_prop": 0.6632653061224489, "repo_name": "joewalnes/idea-community", "id": "c8d653af0ae258c3d4850db009f4c9dbe5018ec0", "size": "98", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "java/java-tests/testData/refactoring/safeDelete/methodDeepHierarchy/after/Super.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ActionScript", "bytes": "387" }, { "name": "C", "bytes": "136045" }, { "name": "C#", "bytes": "103" }, { "name": "C++", "bytes": "40449" }, { "name": "Emacs Lisp", "bytes": "2507" }, { "name": "Erlang", "bytes": "10" }, { "name": "Groovy", "bytes": "361320" }, { "name": "Java", "bytes": "89694599" }, { "name": "JavaScript", "bytes": "978" }, { "name": "Objective-C", "bytes": "1877" }, { "name": "PHP", "bytes": "145" }, { "name": "Perl", "bytes": "6523" }, { "name": "Python", "bytes": "1699274" }, { "name": "Shell", "bytes": "6965" }, { "name": "VimL", "bytes": "5950" } ], "symlink_target": "" }
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <stddef.h> #include <memory> #include <string> #include "base/bind.h" #include "base/command_line.h" #include "base/memory/raw_ptr.h" #include "base/run_loop.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "base/threading/sequenced_task_runner_handle.h" #include "build/build_config.h" #include "components/permissions/features.h" #include "components/permissions/permission_request.h" #include "components/permissions/permission_request_manager.h" #include "components/permissions/permission_ui_selector.h" #include "components/permissions/permission_uma_util.h" #include "components/permissions/request_type.h" #include "components/permissions/test/mock_permission_prompt_factory.h" #include "components/permissions/test/mock_permission_request.h" #include "components/permissions/test/test_permissions_client.h" #include "content/public/test/test_renderer_host.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace permissions { namespace { using QuietUiReason = PermissionUiSelector::QuietUiReason; } class PermissionRequestManagerTest : public content::RenderViewHostTestHarness, public ::testing::WithParamInterface<bool> { public: PermissionRequestManagerTest() : request1_(RequestType::kGeolocation, PermissionRequestGestureType::GESTURE), request2_(RequestType::kMultipleDownloads, PermissionRequestGestureType::NO_GESTURE), request_mic_(RequestType::kMicStream, PermissionRequestGestureType::NO_GESTURE), request_camera_(RequestType::kCameraStream, PermissionRequestGestureType::NO_GESTURE), #if !defined(OS_ANDROID) request_ptz_(RequestType::kCameraPanTiltZoom, PermissionRequestGestureType::NO_GESTURE), #endif iframe_request_same_domain_(GURL("https://www.google.com/some/url"), RequestType::kMidiSysex), iframe_request_other_domain_(GURL("https://www.youtube.com"), RequestType::kGeolocation), iframe_request_camera_other_domain_(GURL("https://www.youtube.com"), RequestType::kStorageAccess), iframe_request_mic_other_domain_(GURL("https://www.youtube.com"), RequestType::kMicStream) { feature_list_.InitWithFeatureState(permissions::features::kPermissionChip, GetParam()); } void SetUp() override { content::RenderViewHostTestHarness::SetUp(); SetContents(CreateTestWebContents()); NavigateAndCommit(GURL(permissions::MockPermissionRequest::kDefaultOrigin)); PermissionRequestManager::CreateForWebContents(web_contents()); manager_ = PermissionRequestManager::FromWebContents(web_contents()); prompt_factory_ = std::make_unique<MockPermissionPromptFactory>(manager_); } void TearDown() override { prompt_factory_ = nullptr; content::RenderViewHostTestHarness::TearDown(); } void Accept() { manager_->Accept(); base::RunLoop().RunUntilIdle(); } void Deny() { manager_->Deny(); base::RunLoop().RunUntilIdle(); } void Closing() { manager_->Dismiss(); base::RunLoop().RunUntilIdle(); } void WaitForFrameLoad() { // PermissionRequestManager ignores all parameters. Yay? manager_->DOMContentLoaded(nullptr); base::RunLoop().RunUntilIdle(); } void WaitForBubbleToBeShown() { manager_->DocumentOnLoadCompletedInMainFrame(main_rfh()); base::RunLoop().RunUntilIdle(); } void MockTabSwitchAway() { manager_->OnVisibilityChanged(content::Visibility::HIDDEN); } void MockTabSwitchBack() { manager_->OnVisibilityChanged(content::Visibility::VISIBLE); } virtual void NavigationEntryCommitted( const content::LoadCommittedDetails& details) { manager_->NavigationEntryCommitted(details); } std::unique_ptr<MockPermissionRequest> CreateAndAddRequest( RequestType type, bool should_be_seen, int expected_request_count) { std::unique_ptr<MockPermissionRequest> request = std::make_unique<MockPermissionRequest>( type, PermissionRequestGestureType::GESTURE); manager_->AddRequest(web_contents()->GetMainFrame(), request.get()); WaitForBubbleToBeShown(); if (should_be_seen) { EXPECT_TRUE(prompt_factory_->RequestTypeSeen(type)); } else { EXPECT_FALSE(prompt_factory_->RequestTypeSeen(type)); } EXPECT_EQ(prompt_factory_->TotalRequestCount(), expected_request_count); return request; } void WaitAndAcceptPromptForRequest(MockPermissionRequest* request) { WaitForBubbleToBeShown(); EXPECT_FALSE(request->finished()); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(prompt_factory_->request_count(), 1); Accept(); EXPECT_TRUE(request->granted()); } protected: MockPermissionRequest request1_; MockPermissionRequest request2_; MockPermissionRequest request_mic_; MockPermissionRequest request_camera_; #if !defined(OS_ANDROID) MockPermissionRequest request_ptz_; #endif MockPermissionRequest iframe_request_same_domain_; MockPermissionRequest iframe_request_other_domain_; MockPermissionRequest iframe_request_camera_other_domain_; MockPermissionRequest iframe_request_mic_other_domain_; raw_ptr<PermissionRequestManager> manager_; std::unique_ptr<MockPermissionPromptFactory> prompt_factory_; TestPermissionsClient client_; base::test::ScopedFeatureList feature_list_; }; //////////////////////////////////////////////////////////////////////////////// // General //////////////////////////////////////////////////////////////////////////////// TEST_P(PermissionRequestManagerTest, NoRequests) { WaitForBubbleToBeShown(); EXPECT_FALSE(prompt_factory_->is_visible()); } TEST_P(PermissionRequestManagerTest, SingleRequest) { manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(prompt_factory_->request_count(), 1); Accept(); EXPECT_TRUE(request1_.granted()); } TEST_P(PermissionRequestManagerTest, SequentialRequests) { manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); Accept(); EXPECT_TRUE(request1_.granted()); EXPECT_FALSE(prompt_factory_->is_visible()); manager_->AddRequest(web_contents()->GetMainFrame(), &request2_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); Accept(); EXPECT_FALSE(prompt_factory_->is_visible()); EXPECT_TRUE(request2_.granted()); } TEST_P(PermissionRequestManagerTest, ForgetRequestsOnPageNavigation) { manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); manager_->AddRequest(web_contents()->GetMainFrame(), &request2_); manager_->AddRequest(web_contents()->GetMainFrame(), &iframe_request_other_domain_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(prompt_factory_->request_count(), 1); NavigateAndCommit(GURL("http://www2.google.com/")); WaitForBubbleToBeShown(); EXPECT_FALSE(prompt_factory_->is_visible()); EXPECT_TRUE(request1_.finished()); EXPECT_TRUE(request2_.finished()); EXPECT_TRUE(iframe_request_other_domain_.finished()); } TEST_P(PermissionRequestManagerTest, RequestsDontNeedUserGesture) { WaitForFrameLoad(); WaitForBubbleToBeShown(); manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); manager_->AddRequest(web_contents()->GetMainFrame(), &iframe_request_other_domain_); manager_->AddRequest(web_contents()->GetMainFrame(), &request2_); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(prompt_factory_->is_visible()); } TEST_P(PermissionRequestManagerTest, RequestsNotSupported) { manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); WaitForBubbleToBeShown(); Accept(); EXPECT_TRUE(request1_.granted()); manager_->set_web_contents_supports_permission_requests(false); manager_->AddRequest(web_contents()->GetMainFrame(), &request2_); EXPECT_TRUE(request2_.cancelled()); } //////////////////////////////////////////////////////////////////////////////// // Requests grouping //////////////////////////////////////////////////////////////////////////////// // Most requests should never be grouped. TEST_P(PermissionRequestManagerTest, TwoRequestsUngrouped) { // Grouping for chip feature is tested in ThreeRequestsStackOrderChip. if (GetParam()) return; manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); manager_->AddRequest(web_contents()->GetMainFrame(), &request2_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(prompt_factory_->request_count(), 1); Accept(); EXPECT_TRUE(request1_.granted()); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(prompt_factory_->request_count(), 1); Accept(); EXPECT_TRUE(request2_.granted()); ASSERT_EQ(prompt_factory_->show_count(), 2); } TEST_P(PermissionRequestManagerTest, ThreeRequestsStackOrderChip) { if (!GetParam()) return; // Test new permissions order, requests shouldn't be grouped. manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); manager_->AddRequest(web_contents()->GetMainFrame(), &request2_); manager_->AddRequest(web_contents()->GetMainFrame(), &request_mic_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); EXPECT_EQ(prompt_factory_->request_count(), 1); Accept(); EXPECT_TRUE(request_mic_.granted()); EXPECT_FALSE(request2_.granted()); EXPECT_FALSE(request1_.granted()); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); EXPECT_EQ(prompt_factory_->request_count(), 1); Accept(); EXPECT_TRUE(request2_.granted()); EXPECT_FALSE(request1_.granted()); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); EXPECT_EQ(prompt_factory_->request_count(), 1); Accept(); EXPECT_TRUE(request1_.granted()); } // Test new permissions order by adding requests one at a time. TEST_P(PermissionRequestManagerTest, ThreeRequestsOneByOneStackOrderChip) { if (!GetParam()) return; manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); WaitForBubbleToBeShown(); manager_->AddRequest(web_contents()->GetMainFrame(), &request2_); WaitForBubbleToBeShown(); manager_->AddRequest(web_contents()->GetMainFrame(), &request_mic_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); EXPECT_EQ(prompt_factory_->request_count(), 1); Accept(); EXPECT_TRUE(request_mic_.granted()); EXPECT_FALSE(request2_.granted()); EXPECT_FALSE(request1_.granted()); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); EXPECT_EQ(prompt_factory_->request_count(), 1); Accept(); EXPECT_TRUE(request2_.granted()); EXPECT_FALSE(request1_.granted()); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); EXPECT_EQ(prompt_factory_->request_count(), 1); Accept(); EXPECT_TRUE(request1_.granted()); } // Only mic/camera requests from the same origin should be grouped. TEST_P(PermissionRequestManagerTest, MicCameraGrouped) { manager_->AddRequest(web_contents()->GetMainFrame(), &request_mic_); manager_->AddRequest(web_contents()->GetMainFrame(), &request_camera_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(prompt_factory_->request_count(), 2); Accept(); EXPECT_TRUE(request_mic_.granted()); EXPECT_TRUE(request_camera_.granted()); } // If mic/camera requests come from different origins, they should not be // grouped. TEST_P(PermissionRequestManagerTest, MicCameraDifferentOrigins) { manager_->AddRequest(web_contents()->GetMainFrame(), &iframe_request_mic_other_domain_); manager_->AddRequest(web_contents()->GetMainFrame(), &request_camera_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(prompt_factory_->request_count(), 1); } #if !defined(OS_ANDROID) // Only camera/ptz requests from the same origin should be grouped. TEST_P(PermissionRequestManagerTest, CameraPtzGrouped) { manager_->AddRequest(web_contents()->GetMainFrame(), &request_camera_); manager_->AddRequest(web_contents()->GetMainFrame(), &request_ptz_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(prompt_factory_->request_count(), 2); Accept(); EXPECT_TRUE(request_camera_.granted()); EXPECT_TRUE(request_ptz_.granted()); } TEST_P(PermissionRequestManagerTest, CameraPtzDifferentOrigins) { // If camera/ptz requests come from different origins, they should not be // grouped. manager_->AddRequest(web_contents()->GetMainFrame(), &iframe_request_camera_other_domain_); manager_->AddRequest(web_contents()->GetMainFrame(), &request_ptz_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(prompt_factory_->request_count(), 1); } // Only mic/camera/ptz requests from the same origin should be grouped. TEST_P(PermissionRequestManagerTest, MicCameraPtzGrouped) { manager_->AddRequest(web_contents()->GetMainFrame(), &request_mic_); manager_->AddRequest(web_contents()->GetMainFrame(), &request_camera_); manager_->AddRequest(web_contents()->GetMainFrame(), &request_ptz_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(prompt_factory_->request_count(), 3); Accept(); EXPECT_TRUE(request_mic_.granted()); EXPECT_TRUE(request_camera_.granted()); EXPECT_TRUE(request_ptz_.granted()); } // If mic/camera/ptz requests come from different origins, they should not be // grouped. TEST_P(PermissionRequestManagerTest, MicCameraPtzDifferentOrigins) { manager_->AddRequest(web_contents()->GetMainFrame(), &iframe_request_mic_other_domain_); manager_->AddRequest(web_contents()->GetMainFrame(), &request_camera_); manager_->AddRequest(web_contents()->GetMainFrame(), &request_ptz_); WaitForBubbleToBeShown(); // Requests should be split into two groups and each one will contain less // than 3 requests (1 request + 2 request for current logic and 2 requests + 1 // request for chip). EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_LT(prompt_factory_->request_count(), 3); Accept(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_LT(prompt_factory_->request_count(), 3); } #endif // !defined(OS_ANDROID) // Tests mix of grouped media requests and non-groupable request. TEST_P(PermissionRequestManagerTest, MixOfMediaAndNotMediaRequests) { manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); manager_->AddRequest(web_contents()->GetMainFrame(), &request_camera_); manager_->AddRequest(web_contents()->GetMainFrame(), &request_mic_); WaitForBubbleToBeShown(); // Requests should be split into two groups and each one will contain less // than 3 requests (1 request + 2 request for current logic and 2 requests + 1 // request for chip). EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_LT(prompt_factory_->request_count(), 3); Accept(); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_LT(prompt_factory_->request_count(), 3); Accept(); } //////////////////////////////////////////////////////////////////////////////// // Tab switching //////////////////////////////////////////////////////////////////////////////// TEST_P(PermissionRequestManagerTest, TwoRequestsTabSwitch) { manager_->AddRequest(web_contents()->GetMainFrame(), &request_mic_); manager_->AddRequest(web_contents()->GetMainFrame(), &request_camera_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(prompt_factory_->request_count(), 2); MockTabSwitchAway(); #if defined(OS_ANDROID) EXPECT_TRUE(prompt_factory_->is_visible()); #else EXPECT_FALSE(prompt_factory_->is_visible()); #endif MockTabSwitchBack(); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(prompt_factory_->request_count(), 2); Accept(); EXPECT_TRUE(request_mic_.granted()); EXPECT_TRUE(request_camera_.granted()); } TEST_P(PermissionRequestManagerTest, PermissionRequestWhileTabSwitchedAway) { MockTabSwitchAway(); manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); WaitForBubbleToBeShown(); EXPECT_FALSE(prompt_factory_->is_visible()); MockTabSwitchBack(); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); } //////////////////////////////////////////////////////////////////////////////// // Duplicated requests //////////////////////////////////////////////////////////////////////////////// TEST_P(PermissionRequestManagerTest, SameRequestRejected) { manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); EXPECT_FALSE(request1_.finished()); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(prompt_factory_->request_count(), 1); Accept(); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(request1_.granted()); EXPECT_FALSE(prompt_factory_->is_visible()); } TEST_P(PermissionRequestManagerTest, DuplicateRequest) { manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); WaitForBubbleToBeShown(); manager_->AddRequest(web_contents()->GetMainFrame(), &request2_); auto dupe_request = request1_.CreateDuplicateRequest(); manager_->AddRequest(web_contents()->GetMainFrame(), dupe_request.get()); EXPECT_FALSE(dupe_request->finished()); EXPECT_FALSE(request1_.finished()); auto dupe_request2 = request2_.CreateDuplicateRequest(); manager_->AddRequest(web_contents()->GetMainFrame(), dupe_request2.get()); EXPECT_FALSE(dupe_request2->finished()); EXPECT_FALSE(request2_.finished()); WaitForBubbleToBeShown(); Accept(); if (GetParam()) { EXPECT_TRUE(dupe_request2->finished()); EXPECT_TRUE(request2_.finished()); } else { EXPECT_TRUE(dupe_request->finished()); EXPECT_TRUE(request1_.finished()); } WaitForBubbleToBeShown(); Accept(); if (GetParam()) { EXPECT_TRUE(dupe_request->finished()); EXPECT_TRUE(request1_.finished()); } else { EXPECT_TRUE(dupe_request2->finished()); EXPECT_TRUE(request2_.finished()); } } //////////////////////////////////////////////////////////////////////////////// // Requests from iframes //////////////////////////////////////////////////////////////////////////////// TEST_P(PermissionRequestManagerTest, MainFrameNoRequestIFrameRequest) { manager_->AddRequest(web_contents()->GetMainFrame(), &iframe_request_same_domain_); WaitForBubbleToBeShown(); WaitForFrameLoad(); EXPECT_TRUE(prompt_factory_->is_visible()); Closing(); EXPECT_TRUE(iframe_request_same_domain_.finished()); } TEST_P(PermissionRequestManagerTest, MainFrameAndIFrameRequestSameDomain) { manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); manager_->AddRequest(web_contents()->GetMainFrame(), &iframe_request_same_domain_); WaitForFrameLoad(); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(1, prompt_factory_->request_count()); Closing(); if (GetParam()) { EXPECT_TRUE(iframe_request_same_domain_.finished()); EXPECT_FALSE(request1_.finished()); } else { EXPECT_TRUE(request1_.finished()); EXPECT_FALSE(iframe_request_same_domain_.finished()); } WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(1, prompt_factory_->request_count()); Closing(); EXPECT_FALSE(prompt_factory_->is_visible()); if (GetParam()) EXPECT_TRUE(request1_.finished()); else EXPECT_TRUE(iframe_request_same_domain_.finished()); } TEST_P(PermissionRequestManagerTest, MainFrameAndIFrameRequestOtherDomain) { manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); manager_->AddRequest(web_contents()->GetMainFrame(), &iframe_request_other_domain_); WaitForFrameLoad(); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); Closing(); if (GetParam()) { EXPECT_TRUE(iframe_request_other_domain_.finished()); EXPECT_FALSE(request1_.finished()); } else { EXPECT_TRUE(request1_.finished()); EXPECT_FALSE(iframe_request_other_domain_.finished()); } EXPECT_TRUE(prompt_factory_->is_visible()); Closing(); EXPECT_TRUE(iframe_request_other_domain_.finished()); if (GetParam()) EXPECT_TRUE(request1_.finished()); else EXPECT_TRUE(iframe_request_other_domain_.finished()); } TEST_P(PermissionRequestManagerTest, IFrameRequestWhenMainRequestVisible) { manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); manager_->AddRequest(web_contents()->GetMainFrame(), &iframe_request_same_domain_); WaitForFrameLoad(); ASSERT_EQ(prompt_factory_->request_count(), 1); Closing(); if (GetParam()) { EXPECT_TRUE(iframe_request_same_domain_.finished()); EXPECT_FALSE(request1_.finished()); } else { EXPECT_TRUE(request1_.finished()); EXPECT_FALSE(iframe_request_same_domain_.finished()); } EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(prompt_factory_->request_count(), 1); Closing(); EXPECT_TRUE(iframe_request_same_domain_.finished()); if (GetParam()) EXPECT_TRUE(request1_.finished()); else EXPECT_TRUE(iframe_request_same_domain_.finished()); } TEST_P(PermissionRequestManagerTest, IFrameRequestOtherDomainWhenMainRequestVisible) { manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); manager_->AddRequest(web_contents()->GetMainFrame(), &iframe_request_other_domain_); WaitForFrameLoad(); Closing(); if (GetParam()) { EXPECT_TRUE(iframe_request_other_domain_.finished()); EXPECT_FALSE(request1_.finished()); } else { EXPECT_TRUE(request1_.finished()); EXPECT_FALSE(iframe_request_other_domain_.finished()); } EXPECT_TRUE(prompt_factory_->is_visible()); Closing(); if (GetParam()) EXPECT_TRUE(request1_.finished()); else EXPECT_TRUE(iframe_request_other_domain_.finished()); } //////////////////////////////////////////////////////////////////////////////// // UMA logging //////////////////////////////////////////////////////////////////////////////// // This code path (calling Accept on a non-merged bubble, with no accepted // permission) would never be used in actual Chrome, but its still tested for // completeness. TEST_P(PermissionRequestManagerTest, UMAForSimpleDeniedBubbleAlternatePath) { base::HistogramTester histograms; manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); WaitForBubbleToBeShown(); // No need to test UMA for showing prompts again, they were tested in // UMAForSimpleAcceptedBubble. Deny(); histograms.ExpectUniqueSample(PermissionUmaUtil::kPermissionsPromptDenied, static_cast<base::HistogramBase::Sample>( RequestTypeForUma::PERMISSION_GEOLOCATION), 1); } TEST_P(PermissionRequestManagerTest, UMAForTabSwitching) { base::HistogramTester histograms; manager_->AddRequest(web_contents()->GetMainFrame(), &request1_); WaitForBubbleToBeShown(); histograms.ExpectUniqueSample(PermissionUmaUtil::kPermissionsPromptShown, static_cast<base::HistogramBase::Sample>( RequestTypeForUma::PERMISSION_GEOLOCATION), 1); MockTabSwitchAway(); MockTabSwitchBack(); histograms.ExpectUniqueSample(PermissionUmaUtil::kPermissionsPromptShown, static_cast<base::HistogramBase::Sample>( RequestTypeForUma::PERMISSION_GEOLOCATION), 1); } //////////////////////////////////////////////////////////////////////////////// // UI selectors //////////////////////////////////////////////////////////////////////////////// // Simulate a PermissionUiSelector that simply returns a predefined |ui_to_use| // every time. class MockNotificationPermissionUiSelector : public PermissionUiSelector { public: explicit MockNotificationPermissionUiSelector( absl::optional<QuietUiReason> quiet_ui_reason, absl::optional<PermissionUmaUtil::PredictionGrantLikelihood> prediction_likelihood, bool async) : quiet_ui_reason_(quiet_ui_reason), prediction_likelihood_(prediction_likelihood), async_(async) {} void SelectUiToUse(PermissionRequest* request, DecisionMadeCallback callback) override { Decision decision(quiet_ui_reason_, Decision::ShowNoWarning()); if (async_) { base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), decision)); } else { std::move(callback).Run(decision); } } bool IsPermissionRequestSupported(RequestType request_type) override { return request_type == RequestType::kNotifications || request_type == RequestType::kGeolocation; } absl::optional<PermissionUmaUtil::PredictionGrantLikelihood> PredictedGrantLikelihoodForUKM() override { return prediction_likelihood_; } static void CreateForManager( PermissionRequestManager* manager, absl::optional<QuietUiReason> quiet_ui_reason, bool async, absl::optional<PermissionUmaUtil::PredictionGrantLikelihood> prediction_likelihood = absl::nullopt) { manager->add_permission_ui_selector_for_testing( std::make_unique<MockNotificationPermissionUiSelector>( quiet_ui_reason, prediction_likelihood, async)); } private: absl::optional<QuietUiReason> quiet_ui_reason_; absl::optional<PermissionUmaUtil::PredictionGrantLikelihood> prediction_likelihood_; bool async_; }; // Same as the MockNotificationPermissionUiSelector but handling only the // Camera stream request type class MockCameraStreamPermissionUiSelector : public MockNotificationPermissionUiSelector { public: explicit MockCameraStreamPermissionUiSelector( absl::optional<QuietUiReason> quiet_ui_reason, absl::optional<PermissionUmaUtil::PredictionGrantLikelihood> prediction_likelihood, bool async) : MockNotificationPermissionUiSelector(quiet_ui_reason, prediction_likelihood, async) {} bool IsPermissionRequestSupported(RequestType request_type) override { return request_type == RequestType::kCameraStream; } static void CreateForManager( PermissionRequestManager* manager, absl::optional<QuietUiReason> quiet_ui_reason, bool async, absl::optional<PermissionUmaUtil::PredictionGrantLikelihood> prediction_likelihood = absl::nullopt) { manager->add_permission_ui_selector_for_testing( std::make_unique<MockCameraStreamPermissionUiSelector>( quiet_ui_reason, prediction_likelihood, async)); } }; TEST_P(PermissionRequestManagerTest, UiSelectorNotUsedForPermissionsOtherThanNotification) { manager_->clear_permission_ui_selector_for_testing(); MockNotificationPermissionUiSelector::CreateForManager( manager_, PermissionUiSelector::QuietUiReason::kEnabledInPrefs, false /* async */); manager_->AddRequest(web_contents()->GetMainFrame(), &request_camera_); WaitForBubbleToBeShown(); ASSERT_TRUE(prompt_factory_->is_visible()); ASSERT_TRUE(prompt_factory_->RequestTypeSeen(request_camera_.request_type())); EXPECT_FALSE(manager_->ShouldCurrentRequestUseQuietUI()); Accept(); EXPECT_TRUE(request_camera_.granted()); } TEST_P(PermissionRequestManagerTest, UiSelectorUsedForNotifications) { const struct { absl::optional<PermissionUiSelector::QuietUiReason> quiet_ui_reason; bool async; } kTests[] = { {QuietUiReason::kEnabledInPrefs, true}, {PermissionUiSelector::Decision::UseNormalUi(), true}, {QuietUiReason::kEnabledInPrefs, false}, {PermissionUiSelector::Decision::UseNormalUi(), false}, }; for (const auto& test : kTests) { manager_->clear_permission_ui_selector_for_testing(); MockNotificationPermissionUiSelector::CreateForManager( manager_, test.quiet_ui_reason, test.async); MockPermissionRequest request(RequestType::kNotifications, PermissionRequestGestureType::GESTURE); manager_->AddRequest(web_contents()->GetMainFrame(), &request); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); EXPECT_TRUE(prompt_factory_->RequestTypeSeen(request.request_type())); EXPECT_EQ(!!test.quiet_ui_reason, manager_->ShouldCurrentRequestUseQuietUI()); Accept(); EXPECT_TRUE(request.granted()); } } TEST_P(PermissionRequestManagerTest, UiSelectionHappensSeparatelyForEachRequest) { manager_->clear_permission_ui_selector_for_testing(); MockNotificationPermissionUiSelector::CreateForManager( manager_, QuietUiReason::kEnabledInPrefs, true); MockPermissionRequest request1(RequestType::kNotifications, PermissionRequestGestureType::GESTURE); manager_->AddRequest(web_contents()->GetMainFrame(), &request1); WaitForBubbleToBeShown(); EXPECT_TRUE(manager_->ShouldCurrentRequestUseQuietUI()); Accept(); MockPermissionRequest request2(RequestType::kNotifications, PermissionRequestGestureType::GESTURE); manager_->clear_permission_ui_selector_for_testing(); MockNotificationPermissionUiSelector::CreateForManager( manager_, PermissionUiSelector::Decision::UseNormalUi(), true); manager_->AddRequest(web_contents()->GetMainFrame(), &request2); WaitForBubbleToBeShown(); EXPECT_FALSE(manager_->ShouldCurrentRequestUseQuietUI()); Accept(); } TEST_P(PermissionRequestManagerTest, MultipleUiSelectors) { const struct { std::vector<absl::optional<QuietUiReason>> quiet_ui_reasons; std::vector<bool> simulate_delayed_decision; absl::optional<QuietUiReason> expected_reason; } kTests[] = { // Simple sync selectors, first one should take priority. {{QuietUiReason::kTriggeredByCrowdDeny, QuietUiReason::kEnabledInPrefs}, {false, false}, QuietUiReason::kTriggeredByCrowdDeny}, // First selector is async but should still take priority even if it // returns later. {{QuietUiReason::kTriggeredByCrowdDeny, QuietUiReason::kEnabledInPrefs}, {true, false}, QuietUiReason::kTriggeredByCrowdDeny}, // The first selector that has a quiet ui decision should be used. {{absl::nullopt, absl::nullopt, QuietUiReason::kTriggeredDueToAbusiveContent, QuietUiReason::kEnabledInPrefs}, {false, true, true, false}, QuietUiReason::kTriggeredDueToAbusiveContent}, // If all selectors return a normal ui, it should use a normal ui. {{absl::nullopt, absl::nullopt}, {false, true}, absl::nullopt}, // Use a bunch of selectors both async and sync. {{absl::nullopt, absl::nullopt, absl::nullopt, absl::nullopt, absl::nullopt, QuietUiReason::kTriggeredDueToAbusiveRequests, absl::nullopt, QuietUiReason::kEnabledInPrefs}, {false, true, false, true, true, true, false, false}, QuietUiReason::kTriggeredDueToAbusiveRequests}, // Use a bunch of selectors all sync. {{absl::nullopt, absl::nullopt, absl::nullopt, absl::nullopt, absl::nullopt, QuietUiReason::kTriggeredDueToAbusiveRequests, absl::nullopt, QuietUiReason::kEnabledInPrefs}, {false, false, false, false, false, false, false, false}, QuietUiReason::kTriggeredDueToAbusiveRequests}, // Use a bunch of selectors all async. {{absl::nullopt, absl::nullopt, absl::nullopt, absl::nullopt, absl::nullopt, QuietUiReason::kTriggeredDueToAbusiveRequests, absl::nullopt, QuietUiReason::kEnabledInPrefs}, {true, true, true, true, true, true, true, true}, QuietUiReason::kTriggeredDueToAbusiveRequests}, }; for (const auto& test : kTests) { manager_->clear_permission_ui_selector_for_testing(); for (size_t i = 0; i < test.quiet_ui_reasons.size(); ++i) { MockNotificationPermissionUiSelector::CreateForManager( manager_, test.quiet_ui_reasons[i], test.simulate_delayed_decision[i]); } MockPermissionRequest request(RequestType::kNotifications, PermissionRequestGestureType::GESTURE); manager_->AddRequest(web_contents()->GetMainFrame(), &request); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); EXPECT_TRUE(prompt_factory_->RequestTypeSeen(request.request_type())); if (test.expected_reason.has_value()) { EXPECT_EQ(test.expected_reason, manager_->ReasonForUsingQuietUi()); } else { EXPECT_FALSE(manager_->ShouldCurrentRequestUseQuietUI()); } Accept(); EXPECT_TRUE(request.granted()); } } TEST_P(PermissionRequestManagerTest, SelectorsPredictionLikelihood) { using PredictionLikelihood = PermissionUmaUtil::PredictionGrantLikelihood; const auto VeryLikely = PredictionLikelihood:: PermissionPrediction_Likelihood_DiscretizedLikelihood_VERY_LIKELY; const auto Neutral = PredictionLikelihood:: PermissionPrediction_Likelihood_DiscretizedLikelihood_NEUTRAL; const struct { std::vector<bool> enable_quiet_uis; std::vector<absl::optional<PredictionLikelihood>> prediction_likelihoods; absl::optional<PredictionLikelihood> expected_prediction_likelihood; } kTests[] = { // Sanity check: prediction likelihood is populated correctly. {{true}, {VeryLikely}, VeryLikely}, {{false}, {Neutral}, Neutral}, // Prediction likelihood is populated only if the selector was considered. {{true, true}, {absl::nullopt, VeryLikely}, absl::nullopt}, {{false, true}, {absl::nullopt, VeryLikely}, VeryLikely}, {{false, false}, {absl::nullopt, VeryLikely}, VeryLikely}, // First considered selector is preserved. {{true, true}, {Neutral, VeryLikely}, Neutral}, {{false, true}, {Neutral, VeryLikely}, Neutral}, {{false, false}, {Neutral, VeryLikely}, Neutral}, }; for (const auto& test : kTests) { manager_->clear_permission_ui_selector_for_testing(); for (size_t i = 0; i < test.enable_quiet_uis.size(); ++i) { MockNotificationPermissionUiSelector::CreateForManager( manager_, test.enable_quiet_uis[i] ? absl::optional<QuietUiReason>(QuietUiReason::kEnabledInPrefs) : absl::nullopt, false /* async */, test.prediction_likelihoods[i]); } MockPermissionRequest request(RequestType::kNotifications, PermissionRequestGestureType::GESTURE); manager_->AddRequest(web_contents()->GetMainFrame(), &request); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); EXPECT_TRUE(prompt_factory_->RequestTypeSeen(request.request_type())); EXPECT_EQ(test.expected_prediction_likelihood, manager_->prediction_grant_likelihood_for_testing()); Accept(); EXPECT_TRUE(request.granted()); } } TEST_P(PermissionRequestManagerTest, SelectorRequestTypes) { const struct { RequestType request_type; bool should_request_use_quiet_ui; } kTests[] = { {RequestType::kNotifications, true}, {RequestType::kGeolocation, true}, {RequestType::kCameraStream, false}, }; manager_->clear_permission_ui_selector_for_testing(); MockNotificationPermissionUiSelector::CreateForManager( manager_, QuietUiReason::kEnabledInPrefs, true); for (const auto& test : kTests) { MockPermissionRequest request(test.request_type, PermissionRequestGestureType::GESTURE); manager_->AddRequest(web_contents()->GetMainFrame(), &request); WaitForBubbleToBeShown(); EXPECT_EQ(test.should_request_use_quiet_ui, manager_->ShouldCurrentRequestUseQuietUI()); Accept(); } // Adding a mock PermissionUiSelector that handles Camera stream. MockCameraStreamPermissionUiSelector::CreateForManager( manager_, QuietUiReason::kEnabledInPrefs, true); // Now the RequestType::kCameraStream should show a quiet UI as well MockPermissionRequest request2(RequestType::kCameraStream, PermissionRequestGestureType::GESTURE); manager_->AddRequest(web_contents()->GetMainFrame(), &request2); WaitForBubbleToBeShown(); EXPECT_TRUE(manager_->ShouldCurrentRequestUseQuietUI()); Accept(); } //////////////////////////////////////////////////////////////////////////////// // Quiet UI chip. Low priority for Notifications & Geolocation. //////////////////////////////////////////////////////////////////////////////// TEST_P(PermissionRequestManagerTest, NotificationsSingleBubbleAndChipRequest) { MockPermissionRequest request(RequestType::kNotifications, PermissionRequestGestureType::GESTURE); manager_->AddRequest(web_contents()->GetMainFrame(), &request); WaitForBubbleToBeShown(); EXPECT_TRUE(prompt_factory_->is_visible()); ASSERT_EQ(prompt_factory_->request_count(), 1); Accept(); EXPECT_TRUE(request.granted()); EXPECT_EQ(prompt_factory_->show_count(), 1); } // Quiet UI feature is disabled. Chip is disabled. No low priority requests, the // first request is always shown. // // Permissions requested in order: // 1. Notification (non abusive) // 2. Geolocation // 3. Camera // // Prompt display order: // 1. Notification request shown // 2. Geolocation request shown // 3. Camera request shown TEST_P(PermissionRequestManagerTest, NotificationsGeolocationCameraBubbleRequest) { // permissions::features::kPermissionChip is enabled based on `GetParam()`. // That test is only for the default bubble. if (GetParam()) return; std::unique_ptr<MockPermissionRequest> request_notifications = CreateAndAddRequest(RequestType::kNotifications, /*should_be_seen=*/true, 1); std::unique_ptr<MockPermissionRequest> request_geolocation = CreateAndAddRequest(RequestType::kGeolocation, /*should_be_seen=*/false, 1); std::unique_ptr<MockPermissionRequest> request_camera = CreateAndAddRequest( RequestType::kCameraStream, /*should_be_seen=*/false, 1); for (auto* kRequest : {request_notifications.get(), request_geolocation.get(), request_camera.get()}) { WaitAndAcceptPromptForRequest(kRequest); } EXPECT_EQ(prompt_factory_->show_count(), 3); } // Quiet UI feature is disabled, no low priority requests, the last request is // always shown. // // Permissions requested in order: // 1. Notification (non abusive) // 2. Geolocation // 3. Camera // // Prompt display order: // 1. Notifications request shown but is preempted // 2. Geolocation request shown but is preempted // 3. Camera request shown // 4. Geolocation request shown again // 5. Notifications request shown again TEST_P(PermissionRequestManagerTest, NotificationsGeolocationCameraChipRequest) { // permissions::features::kPermissionChip is enabled based on `GetParam()`. // That test is only for the chip UI. if (!GetParam()) return; std::unique_ptr<MockPermissionRequest> request_notifications = CreateAndAddRequest(RequestType::kNotifications, /*should_be_seen=*/true, 1); std::unique_ptr<MockPermissionRequest> request_geolocation = CreateAndAddRequest(RequestType::kGeolocation, /*should_be_seen=*/true, 2); std::unique_ptr<MockPermissionRequest> request_camera = CreateAndAddRequest( RequestType::kCameraStream, /*should_be_seen=*/true, 3); for (auto* kRequest : {request_camera.get(), request_geolocation.get(), request_notifications.get()}) { WaitAndAcceptPromptForRequest(kRequest); } EXPECT_EQ(prompt_factory_->show_count(), 5); } // Quiet UI feature is disabled, no low priority requests, the last request is // always shown. // // Permissions requested in order: // 1. Camera // 2. Notification (non abusive) // 3. Geolocation // // Prompt display order: // 1. Camera request shown but is preempted // 2. Notifications request shown but is preempted // 3. Geolocation request shown // 4. Notifications request shown again // 5. Camera request shown again TEST_P(PermissionRequestManagerTest, CameraNotificationsGeolocationChipRequest) { // permissions::features::kPermissionChip is enabled based on `GetParam()`. // That test is only for the chip. if (!GetParam()) return; std::unique_ptr<MockPermissionRequest> request_camera = CreateAndAddRequest( RequestType::kCameraStream, /*should_be_seen=*/true, 1); std::unique_ptr<MockPermissionRequest> request_notifications = CreateAndAddRequest(RequestType::kNotifications, /*should_be_seen=*/true, 2); std::unique_ptr<MockPermissionRequest> request_geolocation = CreateAndAddRequest(RequestType::kGeolocation, /*should_be_seen=*/true, 3); for (auto* kRequest : {request_geolocation.get(), request_notifications.get(), request_camera.get()}) { WaitAndAcceptPromptForRequest(kRequest); } EXPECT_EQ(prompt_factory_->show_count(), 5); } class PermissionRequestManagerTestQuietChip : public PermissionRequestManagerTest { public: PermissionRequestManagerTestQuietChip() { feature_list_.InitWithFeatureState( permissions::features::kPermissionQuietChip, true); } private: base::test::ScopedFeatureList feature_list_; }; // Verifies that the quiet UI chip is not ignored if another request came in // less than 8.5 seconds after. // Permissions requested in order: // 1. Notification (abusive) // 2. After less than 8.5 seconds Geolocation // // Prompt display order: // 1. Notifications request shown but is preempted because of quiet UI. // 2. Geolocation request shown // 3. Notifications request shown again TEST_P(PermissionRequestManagerTestQuietChip, AbusiveNotificationsGeolocationQuietUIChipRequest) { MockNotificationPermissionUiSelector::CreateForManager( manager_, PermissionUiSelector::QuietUiReason::kTriggeredDueToAbusiveRequests, false /* async */); std::unique_ptr<MockPermissionRequest> request_notifications = CreateAndAddRequest(RequestType::kNotifications, /*should_be_seen=*/true, 1); // Less then 8.5 seconds. manager_->set_current_request_first_display_time_for_testing( base::Time::Now() - base::Milliseconds(5000)); std::unique_ptr<MockPermissionRequest> request_geolocation = CreateAndAddRequest(RequestType::kGeolocation, /*should_be_seen=*/true, 2); WaitAndAcceptPromptForRequest(request_geolocation.get()); WaitAndAcceptPromptForRequest(request_notifications.get()); EXPECT_EQ(prompt_factory_->show_count(), 3); } // Verifies that the quiet UI chip is ignored if another request came in more // than 8.5 seconds after. // // Permissions requested in order: // 1. Notification (abusive) // 2. After more than 8.5 seconds Geolocation // // Prompt display order: // 1. Notifications request shown but is preempted because of quiet UI. // 2. Geolocation request shown TEST_P(PermissionRequestManagerTestQuietChip, AbusiveNotificationsShownLongEnough) { MockNotificationPermissionUiSelector::CreateForManager( manager_, PermissionUiSelector::QuietUiReason::kTriggeredDueToAbusiveRequests, false /* async */); std::unique_ptr<MockPermissionRequest> request_notifications = CreateAndAddRequest(RequestType::kNotifications, /*should_be_seen=*/true, 1); // More then 8.5 seconds. manager_->set_current_request_first_display_time_for_testing( base::Time::Now() - base::Milliseconds(9000)); std::unique_ptr<MockPermissionRequest> request_geolocation = CreateAndAddRequest(RequestType::kGeolocation, /*should_be_seen=*/true, 2); // The second permission was requested after 8.5 second window, the quiet UI // Notifiations request for an abusive origin is automatically ignored. EXPECT_FALSE(request_notifications->granted()); EXPECT_TRUE(request_notifications->finished()); WaitAndAcceptPromptForRequest(request_geolocation.get()); EXPECT_EQ(prompt_factory_->show_count(), 2); } // Verifies that the quiet UI chip is not ignored if another request came in // more than 8.5 seconds after. Verify different requests priority. Camera // request is shown despite being requested last. // // Permissions requested in order: // 1. Notification (abusive) // 2. After less than 8.5 seconds Geolocation // 3. Camera // // Prompt display order: // 1. Notifications request shown but is preempted because of quiet UI. // 2. Geolocation request shown but is preempted because of low priority. // 3. Camera request shown // 4. Geolocation request shown again // 5. Notifications quiet UI request shown again TEST_P(PermissionRequestManagerTestQuietChip, AbusiveNotificationsShownLongEnoughCamera) { MockNotificationPermissionUiSelector::CreateForManager( manager_, PermissionUiSelector::QuietUiReason::kTriggeredDueToAbusiveRequests, false /* async */); std::unique_ptr<MockPermissionRequest> request_notifications = CreateAndAddRequest(RequestType::kNotifications, /*should_be_seen=*/true, 1); // Less then 8.5 seconds. manager_->set_current_request_first_display_time_for_testing( base::Time::Now() - base::Milliseconds(5000)); std::unique_ptr<MockPermissionRequest> request_geolocation = CreateAndAddRequest(RequestType::kGeolocation, /*should_be_seen=*/true, 2); std::unique_ptr<MockPermissionRequest> request_camera = CreateAndAddRequest( RequestType::kCameraStream, /*should_be_seen=*/true, 3); // The second permission was requested in 8.5 second window, the quiet UI // Notifiations request for an abusive origin is not automatically ignored. EXPECT_FALSE(request_notifications->granted()); EXPECT_FALSE(request_notifications->finished()); for (auto* kRequest : {request_camera.get(), request_geolocation.get(), request_notifications.get()}) { WaitAndAcceptPromptForRequest(kRequest); } EXPECT_EQ(prompt_factory_->show_count(), 5); } // Verifies that the quiet UI chip is not ignored if another request came in // more than 8.5 seconds after. Verify different requests priority. Camera // request is not preemted. // // Permissions requested in order: // 1. Camera // 2. Notification (abusive) // 3. After less than 8.5 seconds Geolocation // // Prompt display order: // 1. Camera request shown // 2. Geolocation request shown // 3. Camera request shown TEST_P(PermissionRequestManagerTestQuietChip, CameraAbusiveNotificationsGeolocation) { MockNotificationPermissionUiSelector::CreateForManager( manager_, PermissionUiSelector::QuietUiReason::kTriggeredDueToAbusiveRequests, false /* async */); std::unique_ptr<MockPermissionRequest> request_camera = CreateAndAddRequest( RequestType::kCameraStream, /*should_be_seen=*/true, 1); // Quiet UI is not shown because Camera has higher priority. std::unique_ptr<MockPermissionRequest> request_notifications = CreateAndAddRequest(RequestType::kNotifications, /*should_be_seen=*/false, 1); // Less then 8.5 seconds. manager_->set_current_request_first_display_time_for_testing( base::Time::Now() - base::Milliseconds(5000)); // Geolocation is not shown because Camera has higher priority. std::unique_ptr<MockPermissionRequest> request_geolocation = CreateAndAddRequest(RequestType::kGeolocation, /*should_be_seen=*/false, 1); // The second permission after quiet UI was requested in 8.5 second window, // the quiet UI Notifiations request for an abusive origin is not // automatically ignored. EXPECT_FALSE(request_notifications->granted()); EXPECT_FALSE(request_notifications->finished()); for (auto* kRequest : {request_camera.get(), request_geolocation.get(), request_notifications.get()}) { WaitAndAcceptPromptForRequest(kRequest); } EXPECT_EQ(prompt_factory_->show_count(), 3); } // Verifies that the quiet UI chip is not ignored if another request came in // more than 8.5 seconds after. Verify different requests priority. Camera // request is not preemted. // // Permissions requested in order: // 1. Camera // 2. Notification (abusive) // 3. After less than 8.5 seconds Geolocation // 4. MIDI // // Prompt display order: // 1. Camera request shown // 2. MIDI request shown (or MIDI and then Camera, the order depends on // `GetParam()`) // 3. Geolocation request shown // 4. Notifications request shown // If Chip is enabled MIDI will replace Camera, hence 5 prompts will be // shown. Otherwise 4. TEST_P(PermissionRequestManagerTestQuietChip, CameraAbusiveNotificationsGeolocationMIDI) { MockNotificationPermissionUiSelector::CreateForManager( manager_, PermissionUiSelector::QuietUiReason::kTriggeredDueToAbusiveRequests, false /* async */); std::unique_ptr<MockPermissionRequest> request_camera = CreateAndAddRequest( RequestType::kCameraStream, /*should_be_seen=*/true, 1); // Quiet UI is not shown because Camera has higher priority. std::unique_ptr<MockPermissionRequest> request_notifications = CreateAndAddRequest(RequestType::kNotifications, /*should_be_seen=*/false, 1); // Less then 8.5 seconds. manager_->set_current_request_first_display_time_for_testing( base::Time::Now() - base::Milliseconds(5000)); // Geolocation is not shown because Camera has higher priority. std::unique_ptr<MockPermissionRequest> request_geolocation = CreateAndAddRequest(RequestType::kGeolocation, /*should_be_seen=*/false, 1); std::unique_ptr<MockPermissionRequest> request_midi; // If Chip is enabled, MIDI should be shown, otherwise MIDI should not be // shown. if (GetParam()) { request_midi = CreateAndAddRequest(RequestType::kMidiSysex, /*should_be_seen=*/true, 2); } else { request_midi = CreateAndAddRequest(RequestType::kMidiSysex, /*should_be_seen=*/false, 1); } // The second permission after quiet UI was requested in 8.5 second window, // the quiet UI Notifiations request for an abusive origin is not // automatically ignored. EXPECT_FALSE(request_notifications->granted()); EXPECT_FALSE(request_notifications->finished()); WaitAndAcceptPromptForRequest(GetParam() ? request_midi.get() : request_camera.get()); WaitAndAcceptPromptForRequest(GetParam() ? request_camera.get() : request_midi.get()); WaitAndAcceptPromptForRequest(request_geolocation.get()); WaitAndAcceptPromptForRequest(request_notifications.get()); EXPECT_EQ(prompt_factory_->show_count(), GetParam() ? 5 : 4); } // Verifies that non abusive chip behaves similar to others when Quiet UI Chip // is enabled. // // Permissions requested in order: // 1. Camera // 2. Notification (non abusive) // 3. After less than 8.5 seconds Geolocation // 4. MIDI // // Prompt display order: // 1. Camera request shown // 2. MIDI request shown (or MIDI and then Camera, the order depends on // `GetParam()`) // 3. Geolocation request shown // 4. Notifications request shown // If Chip is enabled MIDI will replace Camera, hence 5 prompts will be // shown. Otherwise 4. TEST_P(PermissionRequestManagerTestQuietChip, CameraNonAbusiveNotificationsGeolocationMIDI) { std::unique_ptr<MockPermissionRequest> request_camera = CreateAndAddRequest( RequestType::kCameraStream, /*should_be_seen=*/true, 1); // Quiet UI is not shown because Camera has higher priority. std::unique_ptr<MockPermissionRequest> request_notifications = CreateAndAddRequest(RequestType::kNotifications, /*should_be_seen=*/false, 1); // Less then 8.5 seconds. manager_->set_current_request_first_display_time_for_testing( base::Time::Now() - base::Milliseconds(5000)); // Geolocation is not shown because Camera has higher priority. std::unique_ptr<MockPermissionRequest> request_geolocation = CreateAndAddRequest(RequestType::kGeolocation, /*should_be_seen=*/false, 1); std::unique_ptr<MockPermissionRequest> request_midi; // If Chip is enabled, MIDI should be shown, otherwise MIDI should not be // shown. if (GetParam()) { request_midi = CreateAndAddRequest(RequestType::kMidiSysex, /*should_be_seen=*/true, 2); } else { request_midi = CreateAndAddRequest(RequestType::kMidiSysex, /*should_be_seen=*/false, 1); } // The second permission after quiet UI was requested in 8.5 second window, // the quiet UI Notifiations request for an abusive origin is not // automatically ignored. EXPECT_FALSE(request_notifications->granted()); EXPECT_FALSE(request_notifications->finished()); WaitAndAcceptPromptForRequest(GetParam() ? request_midi.get() : request_camera.get()); WaitAndAcceptPromptForRequest(GetParam() ? request_camera.get() : request_midi.get()); WaitAndAcceptPromptForRequest(request_geolocation.get()); WaitAndAcceptPromptForRequest(request_notifications.get()); EXPECT_EQ(prompt_factory_->show_count(), GetParam() ? 5 : 4); } INSTANTIATE_TEST_SUITE_P(All, PermissionRequestManagerTest, ::testing::Values(false, true)); INSTANTIATE_TEST_SUITE_P(All, PermissionRequestManagerTestQuietChip, ::testing::Values(false, true)); } // namespace permissions
{ "content_hash": "759866878282015da53512788f9bb191", "timestamp": "", "source": "github", "line_count": 1482, "max_line_length": 80, "avg_line_length": 37.22874493927125, "alnum_prop": 0.6825983723922934, "repo_name": "ric2b/Vivaldi-browser", "id": "79aa0f2347aa2989616e4bd2c10ac44ea13c2ef7", "size": "55173", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "chromium/components/permissions/permission_request_manager_unittest.cc", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // namespace FearTheCowboy.Iso19770.Test { using Support; using Xunit; using Xunit.Abstractions; public class TestInfrastructureTests : Tests { public TestInfrastructureTests(ITestOutputHelper outputHelper) : base(outputHelper) { } [Fact] public void ConsoleTest() { using (CaptureConsole) { Console.WriteLine("Hello World"); } } } }
{ "content_hash": "812025a44f81e88016bfe2e9753faca2", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 76, "avg_line_length": 33.67741935483871, "alnum_prop": 0.6484674329501916, "repo_name": "fearthecowboy/Swidtag", "id": "41f1181bfd2711e83b7e58740e94928ddaf33a68", "size": "1046", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Test/TestInfrastructureTests.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "183606" }, { "name": "HTML", "bytes": "1264" }, { "name": "PowerShell", "bytes": "2640" } ], "symlink_target": "" }
from irrexplorer import utils, report from irrexplorer.utils import Prefix, ASNumber, ASMacro import json from flask import Flask, render_template, request, flash, redirect, url_for, send_from_directory from flask_bootstrap import Bootstrap from flask_wtf import Form from wtforms import TextField, SubmitField from wtforms.validators import Required class InputForm(Form): field = TextField('Data', description='Input ASN, AS-SET or Prefix.', validators=[Required()]) submit_button = SubmitField('Submit') def create_app(pgdb, configfile=None): app = Flask('IRRExplorer') app.config.from_pyfile('appconfig.cfg') Bootstrap(app) @app.route("/robots.txt") def static_from_root(): return send_from_directory(app.static_folder, request.path[1:]) @app.route('/', methods=['GET', 'POST']) def index(): form = InputForm() if request.method == 'GET': return render_template('index.html', form=form) if request.method == 'POST': # note: the form won't submit with empty data, so we don't have to handle that data = form.field.data print 'Form data:', data try: sv = utils.classifySearchString(data) return redirect(url_for('search', data=sv.value)) except ValueError as e: flash('Invalid search data: ' + str(e)) return render_template('index.html', form=form) # -- search -- @app.route('/search/<path:data>') @app.route('/search/', defaults={'data': None}) @app.route('/search', defaults={'data': None}) def search(data): query_data = request.args.get('data') if query_data: # this means that we got search request print 'query data', query_data return redirect(url_for('search', data=query_data)) if not data: flash('No search data provided') return render_template('search.html') try: sv = utils.classifySearchString(data) # prevent people from killing the machine by searching through all prefixes in one query if type(sv) is Prefix and '/' in sv.value and int(sv.value.split('/',2)[-1]) < 15: flash('Only prefixes longer than /15 are searchable (kills the database)') return render_template('search.html') tables = [] # page: title (object type : data) # json url for each table, not per report... # stuff that is needed per table: # id (tables.key) # name # source url # column ordering (first, and last, we cannot do complete until we get results) # note (optional) if type(sv) is Prefix: title = 'Prefix: ' + sv.value tables.append({ 'id' : 'prefixes', 'title' : 'Matching prefixes', 'url' : '/json/prefix/' + sv.value, 'start_fields' : ["prefix", "bgp" ] }) if type(sv) is ASNumber: title = 'AS Number: ' + data tables.append({ 'id' : 'prefixes', 'title' : 'Prefixes', 'url' : '/json/as_prefixes/' + str(sv.value), 'start_fields' : ["prefix", "bgp" ], 'note' : 'Offending prefixes are only found if initial prefix sets is smaller than 1000' }) if type(sv) is ASMacro: title = 'AS Macro: ' + data tables.append({ 'id' : 'expanded', 'title' : 'Macro Expansion', 'url' : '/json/macro_expand/' + sv.value, 'start_fields' : ["as_macro", "depth", "path", "source", "members"], 'note' : 'AS Macro expansion is limited to 10K rows' }) if type(sv) in (ASNumber, ASMacro): key = 'AS' + str(sv.value) if type(sv) is ASNumber else str(sv.value) tables.append({ 'id' : 'macros', 'title' : 'Included in the following macros:', 'url' : '/json/macro_contain/' + key, 'start_fields' : ["as_macro" ] }) return render_template('search.html', title=title, tables=tables) except ValueError as e: flash('Invalid search data: ' + str(e)) return render_template('search.html') # -- json reports -- @app.route('/json/prefix/<path:prefix>') def prefix(prefix): data = report.prefix(pgdb, prefix) return json.dumps(data) @app.route('/json/as_prefixes/<path:as_number>') def as_prefixes(as_number): data = report.as_prefixes(pgdb, int(as_number)) return json.dumps(data) @app.route('/json/macro_expand/<path:as_macro>') def macro_expand(as_macro): data = report.macro_expand(pgdb, as_macro) return json.dumps(data) @app.route('/json/macro_contain/<path:as_object>') def as_contain(as_object): data = report.macro_contain(pgdb, as_object) return json.dumps(data) return app
{ "content_hash": "585d59f9688e058fcae88da6c5fd97ac", "timestamp": "", "source": "github", "line_count": 151, "max_line_length": 116, "avg_line_length": 36.019867549668874, "alnum_prop": 0.5282220996506711, "repo_name": "job/irrexplorer", "id": "044ed99c3bdece990a869bd6b4aebc8ee387bd8d", "size": "6847", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "irrexplorer/www.py", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "HTML", "bytes": "6168" }, { "name": "JavaScript", "bytes": "4977" }, { "name": "PLpgSQL", "bytes": "4253" }, { "name": "Python", "bytes": "67185" }, { "name": "Shell", "bytes": "2921" } ], "symlink_target": "" }
A sample rails application - used for examples only Provides a webpage that tests if rails is working: * rails and ruby info * db configuration test # Contributing - Fork the project and do your work in a topic branch. - Rebase your branch to make sure everything is up to date. - Commit your changes and send a pull request. # License [Stacker Project](http://stacker-project.github.io/) - Stack Management | | | |:---------------------|:----------------------------------------------------| | **Author:** | Stacker-Project (<stacker-project@phoenection.com>) | | **Copyright:** | Copyright (c) 2013 Phoenection | | **License:** | Apache License, Version 2.0 | 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.
{ "content_hash": "75ff418c63f3eb3cb8de9389935628bf", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 78, "avg_line_length": 38.17142857142857, "alnum_prop": 0.6302395209580839, "repo_name": "stacker-project/sample_rails", "id": "ee9626254566407630751460157bd202e3d2312d", "size": "1346", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "546" }, { "name": "JavaScript", "bytes": "664" }, { "name": "Ruby", "bytes": "14286" } ], "symlink_target": "" }
layout: base title: 'Statistics of Tense in UD_Munduruku-TuDeT' udver: '2' --- ## Treebank Statistics: UD_Munduruku-TuDeT: Features: `Tense` This feature is universal. It occurs with 1 different values: `Fut`. 1 tokens (0%) have a non-empty value of `Tense`. 1 types (0%) occur at least once with a non-empty value of `Tense`. 1 lemmas (0%) occur at least once with a non-empty value of `Tense`. The feature is used with 1 part-of-speech tags: <tt><a href="myu_tudet-pos-VERB.html">VERB</a></tt> (1; 0% instances). ### `VERB` 1 <tt><a href="myu_tudet-pos-VERB.html">VERB</a></tt> tokens (1% of all `VERB` tokens) have a non-empty value of `Tense`. The most frequent other feature values with which `VERB` and `Tense` co-occurred: <tt><a href="myu_tudet-feat-Aspect.html">Aspect</a></tt><tt>=EMPTY</tt> (1; 100%), <tt><a href="myu_tudet-feat-Number.html">Number</a></tt><tt>=Plur</tt> (1; 100%), <tt><a href="myu_tudet-feat-Person.html">Person</a></tt><tt>=EMPTY</tt> (1; 100%), <tt><a href="myu_tudet-feat-Rel.html">Rel</a></tt><tt>=EMPTY</tt> (1; 100%), <tt><a href="myu_tudet-feat-Voice.html">Voice</a></tt><tt>=EMPTY</tt> (1; 100%). `VERB` tokens may have the following values of `Tense`: * `Fut` (1; 100% of non-empty `Tense`): <em>jeedop</em> * `EMPTY` (189): <em>o'tobuxik, o'ju, o'e, oajẽm, io'e, imõg̃mõg̃, cum, muekabekbeg̃, muyuhum, o'yaoka</em>
{ "content_hash": "a9529a9368dc9081bd67b6e22f485f08", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 487, "avg_line_length": 52.53846153846154, "alnum_prop": 0.6610541727672035, "repo_name": "UniversalDependencies/docs", "id": "b18857e02afbc298d56b18ac8c44729fea13dfd7", "size": "1377", "binary": false, "copies": "1", "ref": "refs/heads/pages-source", "path": "treebanks/myu_tudet/myu_tudet-feat-Tense.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "64420" }, { "name": "HTML", "bytes": "1458943" }, { "name": "JavaScript", "bytes": "238859" }, { "name": "Perl", "bytes": "7788" }, { "name": "Python", "bytes": "21203" }, { "name": "Ruby", "bytes": "578" }, { "name": "Shell", "bytes": "7253" } ], "symlink_target": "" }
import * as models from './models'; export interface Reservation { unreadMessageCount?: number; id?: string; restaurant?: models.RestaurantContactInfo; created?: string; closed?: string; reservationTime?: string; status?: string; customerName?: string; groupSize?: number; phone?: string; notificationUrl?: string; areas?: string; note?: string; tableNumber?: string; highChair?: boolean; stroller?: boolean; email?: string; estimatedTurnOverTime?: number; messages?: Array<models.Message>; membership?: models.MembershipInfo; type?: Reservation.TypeEnum; party?: boolean; partyTypes?: Array<string>; customerProfile?: models.Profile; } export declare namespace Reservation { enum TypeEnum { Standard, Hybrid, } }
{ "content_hash": "04db6b12e55cb3f186032c0967da100f", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 46, "avg_line_length": 26.272727272727273, "alnum_prop": 0.6320645905420992, "repo_name": "HostMeApp/hostme-sdk-angular-mobile", "id": "8cfceca870018733098f78c9249b5b4848038438", "size": "867", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "dist/lib/model/Reservation.d.ts", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "JavaScript", "bytes": "1015" }, { "name": "Shell", "bytes": "1664" }, { "name": "TypeScript", "bytes": "111863" } ], "symlink_target": "" }
{-# LANGUAGE DoRec, GeneralizedNewtypeDeriving #-} module Main where import Language.RegisterMachine.Syntax.Macros import Language.RegisterMachine.Parser import Language.RegisterMachine.CompileToLoop import Language.RegisterMachine.CompileToLoop.Partitions import Language.Loop.CompileToBrainfuck import Language.Brainfuck.Pretty import IPPrint import System (getProgName) import System.Environment (getArgs) main = do args <- getArgs case args of [filename] -> do parseRes <- parseRegisterMachine filename case parseRes of Left err -> error (show err) Right p -> do let p' = processMacros p loop = toLoop p' bf = toBrainfuck loop print $ pPrintProgram bf _ -> do self <- getProgName error $ unwords ["Usage:", self, "filename.bf"]
{ "content_hash": "482a7e1f5e24caabb2bca8e0118d888f", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 99, "avg_line_length": 40.53846153846154, "alnum_prop": 0.5531309297912713, "repo_name": "gergoerdi/brainfuck", "id": "5647b7977b3104b7fdeda38c0850a179d105f9ec", "size": "1054", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "language-registermachine/src/RegisterToBrainfuck.hs", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Haskell", "bytes": "43924" } ], "symlink_target": "" }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Threading; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Structure; namespace Microsoft.CodeAnalysis.CSharp.Structure { internal class FieldDeclarationStructureProvider : AbstractSyntaxNodeStructureProvider<FieldDeclarationSyntax> { protected override void CollectBlockSpans( FieldDeclarationSyntax fieldDeclaration, ArrayBuilder<BlockSpan> spans, OptionSet options, CancellationToken cancellationToken) { CSharpStructureHelpers.CollectCommentBlockSpans(fieldDeclaration, spans); } } }
{ "content_hash": "08b3a2f3d27a13926dc5e950bb5c4e5b", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 114, "avg_line_length": 37.916666666666664, "alnum_prop": 0.756043956043956, "repo_name": "agocke/roslyn", "id": "9f8a74a4de64090f89dd08b0525668c8a08ccc4d", "size": "912", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/Features/CSharp/Portable/Structure/Providers/FieldDeclarationStructureProvider.cs", "mode": "33188", "license": "mit", "language": [ { "name": "1C Enterprise", "bytes": "289100" }, { "name": "Batchfile", "bytes": "9059" }, { "name": "C#", "bytes": "126326705" }, { "name": "C++", "bytes": "5602" }, { "name": "CMake", "bytes": "8276" }, { "name": "Dockerfile", "bytes": "2450" }, { "name": "F#", "bytes": "549" }, { "name": "PowerShell", "bytes": "237208" }, { "name": "Shell", "bytes": "94927" }, { "name": "Visual Basic .NET", "bytes": "70527543" } ], "symlink_target": "" }
<?php // Copyright 2018 Openprovider Authors. All rights reserved. // Use of this source code is governed by a license // that can be found in the LICENSE file. namespace Openprovider\Service\Http; class Response { /** * @var int */ private $httpCode; /** * @var string */ private $raw; /** * @var array */ private $header; /** * @var int */ private $headerSize; /** * @var int */ private $errorCode; /** * @var string */ private $errorDescription; public function __construct($raw, $httpCode, $headerSize, $errorCode = null, $errorDescription = '') { $this->httpCode = $httpCode; $this->raw = $raw; $this->headerSize = $headerSize; $this->header = explode("\n", substr($raw, 0, $headerSize)); $this->errorCode = $errorCode; $this->errorDescription = $errorDescription; } /** * @return string */ public function getRaw() { return $this->raw; } /** * @return array */ public function getHeader() { return $this->header; } /** * @return array|string */ public function getCookie($toString = true) { $cookie = array(); foreach ($this->getHeader() as $line) { if (preg_match('/^Set-Cookie: /i', $line)) { $line = preg_replace('/^Set-Cookie: /i', '', trim($line)); $csplit = explode(';', $line); $cdata = array(); foreach ($csplit as $data) { $cinfo = explode('=', $data); $cinfo[0] = trim($cinfo[0]); $loweredCinfo = strtolower($cinfo[0]); if ($loweredCinfo == 'expires') { $cinfo[1] = strtotime($cinfo[1]); } if ($loweredCinfo == 'secure') { $cinfo[1] = "true"; } if ($loweredCinfo == 'httponly') { $cinfo[1] = "true"; } if (in_array($loweredCinfo, array('domain', 'expires', 'path', 'secure', 'comment', 'httponly'))) { $cdata[trim($cinfo[0])] = $cinfo[1]; } else { $cdata['value']['key'] = $cinfo[0]; $cdata['value']['value'] = $cinfo[1]; } } $cookie[] = $cdata; } } if ($toString) { return self::cookieFromArray($cookie); } return $cookie; } /** * Convert cookie from array to string * * @param array $cookie * @return string */ public static function cookieFromArray(array $cookie) { $result = []; foreach ($cookie as $value) { $result[] = $value['value']['key'] . '=' . $value['value']['value']; } return trim(implode('; ', $result)); } /** * @return string */ public function getData() { return substr($this->raw, $this->headerSize); } /** * @return int */ public function getHttpStatusCode() { return $this->httpCode; } /** * @return bool */ public function isSuccess() { return !$this->isError(); } /** * @return bool */ public function isError() { $str = (string)$this->httpCode; if (($str[0] != '2' && $str[0] != '3') || $this->getErrorCode()) { return true; } return false; } /** * @return string */ public function getErrorCode() { return $this->errorCode; } /** * @return string */ public function getErrorDescription() { return $this->errorDescription; } }
{ "content_hash": "31b674e406fd7269bacb0b4790d0cb62", "timestamp": "", "source": "github", "line_count": 176, "max_line_length": 119, "avg_line_length": 22.392045454545453, "alnum_prop": 0.4470946460289267, "repo_name": "openprovider/http", "id": "c2fea8c9822324e9c1ba02f0862bbb4e835fabf2", "size": "3941", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Openprovider/Service/Http/Response.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "18655" } ], "symlink_target": "" }
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System.Reflection; namespace Wall.Tests.Localization.TestResourceFiles { /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class MyTestResource { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; internal MyTestResource() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Wall.Tests.Localization.TestResourceFiles.MyTestResource", typeof(MyTestResource).GetTypeInfo().Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] public static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// <summary> /// Looks up a localized string similar to Hello!. /// </summary> public static string Hello { get { return ResourceManager.GetString("Hello", resourceCulture); } } /// <summary> /// Looks up a localized string similar to World!. /// </summary> public static string World { get { return ResourceManager.GetString("World", resourceCulture); } } } }
{ "content_hash": "da34a5805e11ff82711784d830282234", "timestamp": "", "source": "github", "line_count": 91, "max_line_length": 220, "avg_line_length": 35.13186813186813, "alnum_prop": 0.5695964967156709, "repo_name": "josuedallagnese/Wall", "id": "79edea6310756d7d866d4a447eea5bd7fafbfdd5", "size": "3199", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/Wall.Tests/Localization/TestResourceFiles/MyTestResource.Designer.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "313856" } ], "symlink_target": "" }
TestSigninClient::TestSigninClient( PrefService* pref_service, network::TestURLLoaderFactory* test_url_loader_factory) : test_url_loader_factory_(test_url_loader_factory), pref_service_(pref_service), are_signin_cookies_allowed_(true), network_calls_delayed_(false), is_signout_allowed_(true) {} TestSigninClient::~TestSigninClient() {} void TestSigninClient::DoFinalInit() {} PrefService* TestSigninClient::GetPrefs() { return pref_service_; } void TestSigninClient::PreSignOut( base::OnceCallback<void(SignoutDecision)> on_signout_decision_reached, signin_metrics::ProfileSignout signout_source_metric) { std::move(on_signout_decision_reached) .Run(is_signout_allowed_ ? SignoutDecision::ALLOW_SIGNOUT : SignoutDecision::DISALLOW_SIGNOUT); } scoped_refptr<network::SharedURLLoaderFactory> TestSigninClient::GetURLLoaderFactory() { return GetTestURLLoaderFactory()->GetSafeWeakWrapper(); } network::mojom::CookieManager* TestSigninClient::GetCookieManager() { if (!cookie_manager_) cookie_manager_ = std::make_unique<network::TestCookieManager>(); return cookie_manager_.get(); } network::TestURLLoaderFactory* TestSigninClient::GetTestURLLoaderFactory() { if (test_url_loader_factory_) return test_url_loader_factory_; if (!default_test_url_loader_factory_) { default_test_url_loader_factory_ = std::make_unique<network::TestURLLoaderFactory>(); } return default_test_url_loader_factory_.get(); } void TestSigninClient::OverrideTestUrlLoaderFactory( network::TestURLLoaderFactory* factory) { DCHECK(!default_test_url_loader_factory_); DCHECK(!test_url_loader_factory_); test_url_loader_factory_ = factory; } void TestSigninClient::SetNetworkCallsDelayed(bool value) { network_calls_delayed_ = value; if (!network_calls_delayed_) { for (base::OnceClosure& call : delayed_network_calls_) std::move(call).Run(); delayed_network_calls_.clear(); } } bool TestSigninClient::AreSigninCookiesAllowed() { return are_signin_cookies_allowed_; } bool TestSigninClient::AreSigninCookiesDeletedOnExit() { return false; } void TestSigninClient::AddContentSettingsObserver( content_settings::Observer* observer) {} void TestSigninClient::RemoveContentSettingsObserver( content_settings::Observer* observer) {} void TestSigninClient::DelayNetworkCall(base::OnceClosure callback) { if (network_calls_delayed_) { delayed_network_calls_.push_back(std::move(callback)); } else { std::move(callback).Run(); } } std::unique_ptr<GaiaAuthFetcher> TestSigninClient::CreateGaiaAuthFetcher( GaiaAuthConsumer* consumer, gaia::GaiaSource source) { return std::make_unique<GaiaAuthFetcher>(consumer, source, GetURLLoaderFactory()); } #if BUILDFLAG(IS_CHROMEOS_LACROS) absl::optional<account_manager::Account> TestSigninClient::GetInitialPrimaryAccount() { return initial_primary_account_; } absl::optional<bool> TestSigninClient::IsInitialPrimaryAccountChild() const { return is_initial_primary_account_child_; } void TestSigninClient::SetInitialPrimaryAccountForTests( const account_manager::Account& account, const absl::optional<bool>& is_child) { initial_primary_account_ = absl::make_optional(account); is_initial_primary_account_child_ = is_child; } void TestSigninClient::RemoveAccount( const account_manager::AccountKey& account_key) {} void TestSigninClient::RemoveAllAccounts() {} #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
{ "content_hash": "b94f6c55bd3c7b8de727d661edddf15d", "timestamp": "", "source": "github", "line_count": 116, "max_line_length": 77, "avg_line_length": 30.810344827586206, "alnum_prop": 0.7308337996642418, "repo_name": "nwjs/chromium.src", "id": "5cf3ca054fad7373dba34d53bd47339b8a9f8668", "size": "4244", "binary": false, "copies": "1", "ref": "refs/heads/nw70", "path": "components/signin/public/base/test_signin_client.cc", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
int main(int argc, char *argv[]) { ros::init(argc, argv, "qualisys"); ros::NodeHandle nh("~"); qualisys::QualisysDriver qualisys_driver(nh); if(!qualisys_driver.init()) { ROS_INFO("Initialization of the qualisys driver failed!"); return -1; } while(ros::ok()) { qualisys_driver.run(); ros::spinOnce(); } ROS_INFO("Shutting down"); qualisys_driver.disconnect(); return 0; }
{ "content_hash": "3868b2942537ee5400d93c3778ee8c5e", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 62, "avg_line_length": 18.90909090909091, "alnum_prop": 0.6225961538461539, "repo_name": "kartikmohta/qualisys", "id": "3c6fb42354195befb880db7aa8943da884d34750", "size": "475", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/qualisys.cpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "4377" }, { "name": "C++", "bytes": "611074" }, { "name": "CMake", "bytes": "5231" } ], "symlink_target": "" }
package gov.nih.nci.protexpress.ui.actions.experiment.create; import gov.nih.nci.protexpress.ProtExpressRegistry; import gov.nih.nci.protexpress.ui.actions.ActionResultEnum; import gov.nih.nci.protexpress.util.SessionHelper; import org.apache.struts2.interceptor.validation.SkipValidation; import com.opensymphony.xwork2.Preparable; import com.opensymphony.xwork2.validator.annotations.RequiredStringValidator; import com.opensymphony.xwork2.validator.annotations.Validation; import com.opensymphony.xwork2.validator.annotations.Validations; /** * Action for managing protocols in an experiment. * * @author Krishna Kanchinadam */ @Validation public class ManageProtocolApplicationAction extends AbstractProtocolApplicationAction implements Preparable { private static final long serialVersionUID = 1L; /** * {@inheritDoc} */ public void prepare() throws Exception { this.prepareProtocolInputOutputAction(); if (getProtocolApplication() != null) { setProtocol(getProtocolApplication().getProtocol()); } } /** * Review Protocol Summary information. * * @return the directive for the next action / page to be directed to */ @SkipValidation public String viewProtocolSummary() { return getActionResult(ActionResultEnum.VIEW_PROTOCOL_SUMMARY); } /** * Loads the protocol and directs to the edit page. * * @return the directive for the next action / page to be directed to */ @SkipValidation public String editProtocol() { return getActionResult(ActionResultEnum.EDIT_PROTOCOL); } /** * Save/Updates the protocol application and protocol information. * * @return the directive for the next action / page to be directed to */ @Validations( requiredStrings = {@RequiredStringValidator(fieldName = "protocolApplication.protocol.name", key = "validator.notEmpty", message = "") } ) private void saveProtocol() { if (getProtocolApplication().getId() == null) { setSuccessMessage(ProtExpressRegistry.getApplicationResourceBundle().getString("protocol.save.success")); } else { setSuccessMessage(ProtExpressRegistry.getApplicationResourceBundle().getString("protocol.update.success")); } ProtExpressRegistry.getProtExpressService().saveOrUpdate(getProtocol()); ProtExpressRegistry.getProtExpressService().saveOrUpdate(getProtocolApplication()); SessionHelper.saveProtocolApplicationInSession(getProtocolApplication()); } /** * Saves the protocol application and protocol information, redirects to the view protocol screen. * * @return the directive for the next action / page to be directed to */ public String saveAndViewProtocol() { this.saveProtocol(); return getActionResult(ActionResultEnum.VIEW_PROTOCOL_SUMMARY); } /** * Updates the protocol application and protocol information. * * @return the directive for the next action / page to be directed to */ public String updateProtocol() { this.saveProtocol(); return getActionResult(ActionResultEnum.EDIT_PROTOCOL); } /** * Save/Updates the protocol application and protocol information, redirects to the add new protocol screen. * * @return the directive for the next action / page to be directed to */ public String saveAndAddNewProtocol() { this.saveProtocol(); SessionHelper.removeProtocolApplicationFromSession(); return getActionResult(ActionResultEnum.SAVE_AND_ADD_NEW_PROTOCOL); } /** * Save/Updates the protocol application and protocol information, redirects to the experiment summary screen. * * @return the directive for the next action / page to be directed to */ public String saveAndViewExperimentSummary() { this.saveProtocol(); SessionHelper.removeProtocolApplicationFromSession(); return getActionResult(ActionResultEnum.SAVE_AND_VIEW_EXPERIMENT_SUMMARY); } }
{ "content_hash": "0076a9fef1fa14ce0b88ed606ad50d66", "timestamp": "", "source": "github", "line_count": 150, "max_line_length": 119, "avg_line_length": 28.833333333333332, "alnum_prop": 0.6735260115606937, "repo_name": "NCIP/prot-express", "id": "b6b4385a42e8ca2b0a38f058aaf3d86805d63524", "size": "4501", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "software/src/main/java/gov/nih/nci/protexpress/ui/actions/experiment/create/ManageProtocolApplicationAction.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "DOT", "bytes": "685568" }, { "name": "Java", "bytes": "974572" }, { "name": "JavaScript", "bytes": "912542" }, { "name": "Logos", "bytes": "1739740" }, { "name": "Shell", "bytes": "3327" }, { "name": "XML", "bytes": "150476" } ], "symlink_target": "" }
<?php namespace Lib\Manifest\Type; use Lib\Manifest\Field\AbstractField; class StrictArray extends AbstractType { public function parse(AbstractField $objField = null) { $val = (array) $this->getValue(); if (!is_null($objField)) { foreach($val as $key=>$value) { $val[$key] = $objField->validate($value); } } return (array) $val; } } // Endfile
{ "content_hash": "7da3297a196246786d6d0a81a41e5150", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 57, "avg_line_length": 18.125, "alnum_prop": 0.5563218390804597, "repo_name": "php-carteblanche/core", "id": "92997640a6a104a65399dc4b6c524226ac05431c", "size": "776", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/CarteBlanche/Library/Manifest/Type/StrictArray.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "PHP", "bytes": "548572" } ], "symlink_target": "" }
<?xml version="1.0" encoding="ISO-8859-1"?> <LEOSimulation version="2.5.0"> <STELAVersion>2.5.1</STELAVersion> <SpaceObject> <mass unit="kg">6.0</mass> <dragArea>0.055</dragArea> <reflectingArea>0.22</reflectingArea> <reflectivityCoefficient>1.5</reflectivityCoefficient> <orbitType>LEO</orbitType> <ConstantDragCoef> <cstDragCoef>2.1</cstDragCoef> </ConstantDragCoef> <name>FN5JMNB7</name> </SpaceObject> <EphemerisManager version="2.5.0"> <initState> <bulletin version="2.5.0"> <date>2014-07-14T15:00:08.000</date> <Type2PosVel> <frame>CELESTIAL_MEAN_OF_DATE</frame> <nature>MEAN</nature> <semiMajorAxis unit="m">7000000.0</semiMajorAxis> <eccentricity>0.001</eccentricity> <inclination unit="rad">1.66678943565</inclination> <rAAN unit="rad">0.0</rAAN> <argOfPerigee unit="rad">0.0</argOfPerigee> <meanAnomaly unit="rad">0.0</meanAnomaly> </Type2PosVel> </bulletin> </initState> <finalState> <bulletin version="2.5.0"> <date>2035-12-13T10:50:28.854</date> <Type2PosVel> <frame>CELESTIAL_MEAN_OF_DATE</frame> <nature>MEAN</nature> <semiMajorAxis unit="m">6516581.577316407</semiMajorAxis> <eccentricity>4.652918618968331E-4</eccentricity> <inclination unit="rad">1.6656046016120696</inclination> <rAAN unit="rad">2.2114243918169354</rAAN> <argOfPerigee unit="rad">1.3437190193773265</argOfPerigee> <meanAnomaly unit="rad">0.6022959969361246</meanAnomaly> </Type2PosVel> </bulletin> </finalState> </EphemerisManager> <author>CNES</author> <comment>LEO example simulation</comment> <simulationDuration unit="years">100.0</simulationDuration> <ephemerisStep unit="s">86400.0</ephemerisStep> <ttMinusUT1 unit="s">67.184</ttMinusUT1> <srpSwitch>true</srpSwitch> <sunSwitch>true</sunSwitch> <moonSwitch>true</moonSwitch> <extrapolationDuration>16658</extrapolationDuration> <warningFlag>false</warningFlag> <iterativeMode>false</iterativeMode> <GTOIntegrator> <Integrator> <effective_duration unit="years">21.415678659181943</effective_duration> <LOSCriteria1 version="2.5.0"> <status_criteria1>1</status_criteria1> <comment_criteria1>Lifetime :21.42 years</comment_criteria1> </LOSCriteria1> <LOSCriteria2 version="2.5.0"> <status_criteria2>3</status_criteria2> </LOSCriteria2> <LOSCriteria3 version="2.5.0"> <status_criteria3>3</status_criteria3> </LOSCriteria3> <LOSCriteria4 version="2.5.0"> <status_criteria4>3</status_criteria4> </LOSCriteria4> </Integrator> </GTOIntegrator> <modelType>GTO</modelType> <atmosModel>NRLMSISE-00</atmosModel> <VariableSolarActivity> <solActType>VARIABLE</solActType> </VariableSolarActivity> <integrationStep unit="s">86400.0</integrationStep> <dragSwitch>true</dragSwitch> <dragQuadPoints>33</dragQuadPoints> <atmosDragRecomputeStep>1</atmosDragRecomputeStep> <srpQuadPoints>11</srpQuadPoints> <reentryAltitude unit="m">120000.0</reentryAltitude> <iterationData> <funcValueAccuracy unit="days">10.0</funcValueAccuracy> <expDuration unit="years">24.75</expDuration> <simMinusExpDuration unit="years">75.25</simMinusExpDuration> <iterationMethod>FrozenOrbit</iterationMethod> </iterationData> <nbIntegrationStepTesseral>5.0</nbIntegrationStepTesseral> <zonalOrder>7</zonalOrder> </LEOSimulation>
{ "content_hash": "340fea3bbc0fba97eab9b8970474186b", "timestamp": "", "source": "github", "line_count": 95, "max_line_length": 75, "avg_line_length": 35.4, "alnum_prop": 0.7270294380017841, "repo_name": "pouyana/satgen", "id": "d5e91d0a76d7ca9aba90e203a0f8f7010beae99e", "size": "3363", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sim/FN5JMNB7_a_sim.xml_out_sim.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "552816" }, { "name": "Matlab", "bytes": "1015" }, { "name": "Python", "bytes": "227028" } ], "symlink_target": "" }
{% assign class = include.class %} ## API Reference: {{class.namespace}}.{{class.name}} {{class.description | markdownify}} {% if class.exampleCoffeeScript || class.exampleJavaScript %} <div class="clearfix"> <div class="btn-group btn-group-xs pull-right" role="group" style="margin-top: 20px;"> <button type="button" data-role="type-switch" data-type="js" class="btn btn-primary active">JavaScript</button> <button type="button" data-role="type-switch" data-type="coffee" class="btn btn-default">CoffeeScript</button> </div> <h3>Example usage</h3> </div> <div data-role="example-code" data-type="js"> {% if class.exampleJavaScript %} {% highlight javascript %} {{class.exampleJavaScript}} {% endhighlight %} {% endif %} {% if !class.exampleJavaScript && class.usageJavaScript %} {% highlight javascript %} {{class.usageJavaScript}} {% endhighlight %} {% endif %} </div> <div data-role="example-code" data-type="coffee" style="display: none;"> {% if class.exampleCoffeeScript %} {% highlight coffeescript %} {{class.exampleCoffeeScript}} {% endhighlight %} {% endif %} {% if !class.exampleCoffeeScript && class.usageCoffeeScript %} {% highlight coffeescript %} {{class.usageCoffeeScript}} {% endhighlight %} {% endif %} </div> {% endif %} {% if class.params.size > 0 %} #### Class Properties {% if class.type %} {% highlight coffeescript %} {{class.type}} {% endhighlight %} {% endif %} <table class="table" style="margin:0;"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> {% for param in class.params %} <tr> <td class="highlight"> <code class="language-coffeescript" data-lang="coffeescript"> {{param.name}} </code> </td> <td class="highlight"> <code class="language-coffeescript" data-lang="coffeescript"> {{param.type | xml_escape}} </code> </td> <td>{{param.description | markdownify}}</td> </tr> {% for property in param.properties %} <tr> <td class="property">{{property.name}}</td> <td class="highlight"> <code class="language-coffeescript" data-lang="coffeescript"> {{property.type | xml_escape}} </code> </td> <td class="highlight"> <code class="language-coffeescript" data-lang="coffeescript"> {{property.defaultValue}} </code> </td> <td>{{property.description | markdownify}}</td> </tr> {% endfor %} {% endfor %} </tbody> </table> {% endif %}
{ "content_hash": "08761e090cd470a741549cc9fa45aa7f", "timestamp": "", "source": "github", "line_count": 99, "max_line_length": 115, "avg_line_length": 25.707070707070706, "alnum_prop": 0.6161100196463655, "repo_name": "AppGyver/supersonic", "id": "2eb5a6f373ce4a894b8cf28b691ecb863b730eb8", "size": "2545", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/_includes/api_class.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "302837" }, { "name": "CoffeeScript", "bytes": "445105" }, { "name": "HTML", "bytes": "94891" }, { "name": "JavaScript", "bytes": "355" }, { "name": "Makefile", "bytes": "229" }, { "name": "RAML", "bytes": "17970" }, { "name": "Ruby", "bytes": "3015" }, { "name": "Shell", "bytes": "2217" } ], "symlink_target": "" }
<?php namespace App\Model; use App\Entity\Performance; use JMS\Serializer\Annotation\Accessor; use JMS\Serializer\Annotation\ExclusionPolicy; use JMS\Serializer\Annotation\Expose; use JMS\Serializer\Annotation\Type; /** * Class PerformancesResponse * @package App\Model * @ExclusionPolicy("all") */ class PerformancesResponse extends AbstractPaginatedModel { /** * @var Performance[] * @Type("array") * @Expose */ protected $performances; /** * @var int * * @Type("integer") * @Accessor(getter="getCount") * @Expose */ protected $count; /** * @return mixed */ public function getPerformances() { return $this->performances; } /** * @param Performance[] $performances * @return $this */ public function setPerformances($performances) { $this->performances = $performances; return $this; } /** * @return int */ public function getCount() { return count($this->getPerformances()); } }
{ "content_hash": "e79962a655b477cf44bbb40ccfc9cd28", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 57, "avg_line_length": 17.933333333333334, "alnum_prop": 0.595724907063197, "repo_name": "geekhub-php/CheTheatre", "id": "18f2263c44c20a92cc65cbedc0438a8c079e65d2", "size": "1076", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "src/Model/PerformancesResponse.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "307379" }, { "name": "Shell", "bytes": "2233" }, { "name": "Twig", "bytes": "23344" } ], "symlink_target": "" }
layout: post title: Issue &#35;7 tags: - issue - development publishDate: "2016-08-30" desc: "" type: newsletter publish: true ---
{ "content_hash": "e9ec925647d6ff132cbb1602dd1603ec", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 25, "avg_line_length": 11.75, "alnum_prop": 0.6453900709219859, "repo_name": "jakartadev/jakartadev.github.io", "id": "a7bf23013fdf94d5b9fc8fa2d4dae9c35be9b73b", "size": "145", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/2016-08-20-newsletter-issue-7.md", "mode": "33188", "license": "mit", "language": [ { "name": "AGS Script", "bytes": "946" }, { "name": "CSS", "bytes": "187363" }, { "name": "HTML", "bytes": "1330938" }, { "name": "Ruby", "bytes": "70" }, { "name": "Shell", "bytes": "840" } ], "symlink_target": "" }
<menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/keyboard_select" android:title="@string/menu_keyboard_select" android:showAsAction="ifRoom"/> <item android:id="@+id/keyboard_setting" android:title="@string/menu_keyboard_setting" android:showAsAction="ifRoom"/> </menu>
{ "content_hash": "a869971ffdb634620bc4595d8e9de0a1", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 122, "avg_line_length": 79.5, "alnum_prop": 0.7421383647798742, "repo_name": "Viovie-com/webkeyboard", "id": "1d4314727d3f0f5809298389f575d2577532e66e", "size": "318", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/res/menu/activity_main.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1379" }, { "name": "HTML", "bytes": "5080" }, { "name": "Java", "bytes": "32782" }, { "name": "JavaScript", "bytes": "7309" } ], "symlink_target": "" }
<html> <head> <title>User agent detail - Instagram 4.2.6 Android (17/4.2.2; 240dpi; 480x800; HTC/generic; HTC Desire; bravo; bravo; de_DE)</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> </head> <body> <div class="container"> <div class="section"> <h1 class="header center orange-text">User agent detail</h1> <div class="row center"> <h5 class="header light"> Instagram 4.2.6 Android (17/4.2.2; 240dpi; 480x800; HTC/generic; HTC Desire; bravo; bravo; de_DE) </h5> </div> </div> <div class="section"> <table class="striped"><tr><th></th><th colspan="3">General</th><th colspan="5">Device</th><th colspan="3">Bot</th><th colspan="2"></th></tr><tr><th>Provider</th><th>Browser</th><th>Engine</th><th>OS</th><th>Brand</th><th>Model</th><th>Type</th><th>Is mobile</th><th>Is touch</th><th>Is bot</th><th>Name</th><th>Type</th><th>Parse time</th><th>Actions</th></tr><tr><th colspan="14" class="green lighten-3">Source result (test suite)</th></tr><tr><td>ua-parser/uap-core<br /><small>vendor/thadafinser/uap-core/tests/test_device.yaml</small></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">HTC</td><td>generic</td><td></td><td></td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td></td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-test">Detail</a> <!-- Modal Structure --> <div id="modal-test" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Testsuite result detail</h4> <p><pre><code class="php">Array ( [user_agent_string] => Instagram 4.2.6 Android (17/4.2.2; 240dpi; 480x800; HTC/generic; HTC Desire; bravo; bravo; de_DE) [family] => HTC generic [brand] => HTC [model] => generic ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><th colspan="14" class="green lighten-3">Providers</th></tr><tr><td>BrowscapPhp<br /><small>6012</small></td><td>Instagram App 4.2</td><td>WebKit </td><td>Android </td><td style="border-left: 1px solid #555">Apple</td><td></td><td>Mobile Device</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.013</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-215ac98d-ccf8-4615-916e-5a819d6a59c9">Detail</a> <!-- Modal Structure --> <div id="modal-215ac98d-ccf8-4615-916e-5a819d6a59c9" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>BrowscapPhp result detail</h4> <p><pre><code class="php">stdClass Object ( [browser_name_regex] => /^instagram 4\.2.* android.*$/ [browser_name_pattern] => instagram 4.2* android* [parent] => Instagram App 4.2 [comment] => Instagram App 4.2 [browser] => Instagram App [browser_type] => Application [browser_bits] => 32 [browser_maker] => Facebook [browser_modus] => unknown [version] => 4.2 [majorver] => 4 [minorver] => 2 [platform] => Android [platform_version] => unknown [platform_description] => Android OS [platform_bits] => 32 [platform_maker] => Google Inc [alpha] => [beta] => [win16] => [win32] => [win64] => [frames] => 1 [iframes] => 1 [tables] => 1 [cookies] => 1 [backgroundsounds] => [javascript] => 1 [vbscript] => [javaapplets] => 1 [activexcontrols] => [ismobiledevice] => 1 [istablet] => [issyndicationreader] => [crawler] => [cssversion] => 3 [aolversion] => 0 [device_name] => general Mobile Device [device_maker] => Apple Inc [device_type] => Mobile Device [device_pointing_method] => touchscreen [device_code_name] => general Mobile Device [device_brand_name] => Apple [renderingengine_name] => WebKit [renderingengine_version] => unknown [renderingengine_description] => For Google Chrome, iOS (including both mobile Safari, WebViews within third-party apps, and web clips), Safari, Arora, Midori, OmniWeb, Shiira, iCab since version 4, Web, SRWare Iron, Rekonq, and in Maxthon 3. [renderingengine_maker] => Apple Inc ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>DonatjUAParser<br /><small>v0.5.0</small></td><td>Instagram </td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-f1436016-fdf1-4aea-b4be-1d7c99ab0661">Detail</a> <!-- Modal Structure --> <div id="modal-f1436016-fdf1-4aea-b4be-1d7c99ab0661" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>DonatjUAParser result detail</h4> <p><pre><code class="php">Array ( [platform] => [browser] => Instagram [version] => ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>NeutrinoApiCom<br /><small></small></td><td>Android Browser </td><td><i class="material-icons">close</i></td><td>Android </td><td style="border-left: 1px solid #555">HTC</td><td>Desire</td><td>mobile-browser</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.26605</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-9b0fa449-ec1b-40c8-8b1c-9486eb3b9cbc">Detail</a> <!-- Modal Structure --> <div id="modal-9b0fa449-ec1b-40c8-8b1c-9486eb3b9cbc" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>NeutrinoApiCom result detail</h4> <p><pre><code class="php">stdClass Object ( [mobile_screen_height] => 0 [is_mobile] => 1 [type] => mobile-browser [mobile_brand] => HTC [mobile_model] => Desire [version] => [is_android] => 1 [browser_name] => Android Browser [operating_system_family] => Android [operating_system_version] => [is_ios] => [producer] => HTC [operating_system] => Android [mobile_screen_width] => 0 [mobile_browser] => ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>PiwikDeviceDetector<br /><small>3.5.2</small></td><td>Android Browser </td><td>WebKit </td><td>Android </td><td style="border-left: 1px solid #555">HTC</td><td>Desire</td><td>smartphone</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.004</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-21638055-738d-46ba-a1b1-f5114bc26475">Detail</a> <!-- Modal Structure --> <div id="modal-21638055-738d-46ba-a1b1-f5114bc26475" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>PiwikDeviceDetector result detail</h4> <p><pre><code class="php">Array ( [client] => Array ( [type] => browser [name] => Android Browser [short_name] => AN [version] => [engine] => WebKit ) [operatingSystem] => Array ( [name] => Android [short_name] => AND [version] => [platform] => ) [device] => Array ( [brand] => HT [brandName] => HTC [model] => Desire [device] => 1 [deviceName] => smartphone ) [bot] => [extra] => Array ( [isBot] => [isBrowser] => 1 [isFeedReader] => [isMobileApp] => [isPIM] => [isLibrary] => [isMediaPlayer] => [isCamera] => [isCarBrowser] => [isConsole] => [isFeaturePhone] => [isPhablet] => [isPortableMediaPlayer] => [isSmartDisplay] => [isSmartphone] => 1 [isTablet] => [isTV] => [isDesktop] => [isMobile] => 1 [isTouchEnabled] => ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>SinergiBrowserDetector<br /><small>6.0.0</small></td><td>Navigator </td><td><i class="material-icons">close</i></td><td>Android </td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td></td><td><i class="material-icons">close</i></td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.001</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-5415e7f2-ef7b-434c-abe0-b71ba9f6707c">Detail</a> <!-- Modal Structure --> <div id="modal-5415e7f2-ef7b-434c-abe0-b71ba9f6707c" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>SinergiBrowserDetector result detail</h4> <p><pre><code class="php">Array ( [browser] => Sinergi\BrowserDetector\Browser Object ( [userAgent:Sinergi\BrowserDetector\Browser:private] => Sinergi\BrowserDetector\UserAgent Object ( [userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Instagram 4.2.6 Android (17/4.2.2; 240dpi; 480x800; HTC/generic; HTC Desire; bravo; bravo; de_DE) ) [name:Sinergi\BrowserDetector\Browser:private] => Navigator [version:Sinergi\BrowserDetector\Browser:private] => unknown [isRobot:Sinergi\BrowserDetector\Browser:private] => [isChromeFrame:Sinergi\BrowserDetector\Browser:private] => ) [operatingSystem] => Sinergi\BrowserDetector\Os Object ( [name:Sinergi\BrowserDetector\Os:private] => Android [version:Sinergi\BrowserDetector\Os:private] => [isMobile:Sinergi\BrowserDetector\Os:private] => 1 [userAgent:Sinergi\BrowserDetector\Os:private] => Sinergi\BrowserDetector\UserAgent Object ( [userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Instagram 4.2.6 Android (17/4.2.2; 240dpi; 480x800; HTC/generic; HTC Desire; bravo; bravo; de_DE) ) ) [device] => Sinergi\BrowserDetector\Device Object ( [name:Sinergi\BrowserDetector\Device:private] => unknown [userAgent:Sinergi\BrowserDetector\Device:private] => Sinergi\BrowserDetector\UserAgent Object ( [userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Instagram 4.2.6 Android (17/4.2.2; 240dpi; 480x800; HTC/generic; HTC Desire; bravo; bravo; de_DE) ) ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>UAParser<br /><small>v3.4.5</small></td><td> </td><td><i class="material-icons">close</i></td><td>Android </td><td style="border-left: 1px solid #555">HTC</td><td>generic</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.009</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-346c1a98-5fd3-454f-b6c8-350f2f505d8b">Detail</a> <!-- Modal Structure --> <div id="modal-346c1a98-5fd3-454f-b6c8-350f2f505d8b" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>UAParser result detail</h4> <p><pre><code class="php">UAParser\Result\Client Object ( [ua] => UAParser\Result\UserAgent Object ( [major] => [minor] => [patch] => [family] => Other ) [os] => UAParser\Result\OperatingSystem Object ( [major] => [minor] => [patch] => [patchMinor] => [family] => Android ) [device] => UAParser\Result\Device Object ( [brand] => HTC [model] => generic [family] => HTC generic ) [originalUserAgent] => Instagram 4.2.6 Android (17/4.2.2; 240dpi; 480x800; HTC/generic; HTC Desire; bravo; bravo; de_DE) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>UserAgentStringCom<br /><small></small></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>WhatIsMyBrowserCom<br /><small></small></td><td>Stock Android Browser </td><td> </td><td>Android </td><td style="border-left: 1px solid #555"></td><td>HTC Desire</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.4771</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-9795f66f-7271-430e-973a-a5c0e14dc35a">Detail</a> <!-- Modal Structure --> <div id="modal-9795f66f-7271-430e-973a-a5c0e14dc35a" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>WhatIsMyBrowserCom result detail</h4> <p><pre><code class="php">stdClass Object ( [operating_system_name] => Android [simple_sub_description_string] => [simple_browser_string] => Stock Android Browser on Android [browser_version] => [extra_info] => Array ( ) [operating_platform] => HTC Desire [extra_info_table] => Array ( ) [layout_engine_name] => [detected_addons] => Array ( ) [operating_system_flavour_code] => [hardware_architecture] => [operating_system_flavour] => [operating_system_frameworks] => Array ( ) [browser_name_code] => stock-android-browser [operating_system_version] => [simple_operating_platform_string] => HTC Desire [is_abusive] => [layout_engine_version] => [browser_capabilities] => Array ( ) [operating_platform_vendor_name] => [operating_system] => Android [operating_system_version_full] => [operating_platform_code] => [browser_name] => Stock Android Browser [operating_system_name_code] => android [user_agent] => Instagram 4.2.6 Android (17/4.2.2; 240dpi; 480x800; HTC/generic; HTC Desire; bravo; bravo; de_DE) [browser_version_full] => [browser] => Stock Android Browser ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>WhichBrowser<br /><small>2.0.10</small></td><td>Android Browser </td><td> </td><td>Android </td><td style="border-left: 1px solid #555">HTC</td><td>Desire</td><td>mobile:smart</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.022</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-342c8d32-4765-40a8-8a5c-af3a38d19ae4">Detail</a> <!-- Modal Structure --> <div id="modal-342c8d32-4765-40a8-8a5c-af3a38d19ae4" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>WhichBrowser result detail</h4> <p><pre><code class="php">Array ( [browser] => Array ( [name] => Android Browser ) [os] => Array ( [name] => Android ) [device] => Array ( [type] => mobile [subtype] => smart [manufacturer] => HTC [model] => Desire ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>Woothee<br /><small>v1.2.0</small></td><td> </td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>smartphone</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-3f285ff5-314b-4db4-9948-54572e92e7b6">Detail</a> <!-- Modal Structure --> <div id="modal-3f285ff5-314b-4db4-9948-54572e92e7b6" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Woothee result detail</h4> <p><pre><code class="php">Array ( [category] => smartphone [os] => Android [name] => UNKNOWN [version] => UNKNOWN [vendor] => UNKNOWN [os_version] => UNKNOWN ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>Wurfl<br /><small>1.6.4</small></td><td>Android 3.6</td><td><i class="material-icons">close</i></td><td>Android 3.6</td><td style="border-left: 1px solid #555"></td><td></td><td>Feature Phone</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.067</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-1a1aee36-7ce7-4111-a391-8e2c501f1532">Detail</a> <!-- Modal Structure --> <div id="modal-1a1aee36-7ce7-4111-a391-8e2c501f1532" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Wurfl result detail</h4> <p><pre><code class="php">Array ( [virtual] => Array ( [is_android] => true [is_ios] => false [is_windows_phone] => false [is_app] => true [is_full_desktop] => false [is_largescreen] => false [is_mobile] => true [is_robot] => false [is_smartphone] => false [is_touchscreen] => true [is_wml_preferred] => false [is_xhtmlmp_preferred] => false [is_html_preferred] => true [advertised_device_os] => Android [advertised_device_os_version] => 3.6 [advertised_browser] => Android [advertised_browser_version] => 3.6 [complete_device_name] => Generic Android 2.0 [form_factor] => Feature Phone [is_phone] => true [is_app_webview] => false ) [all] => Array ( [brand_name] => Generic [model_name] => Android 2.0 [unique] => true [ununiqueness_handler] => [is_wireless_device] => true [device_claims_web_support] => true [has_qwerty_keyboard] => true [can_skip_aligned_link_row] => true [uaprof] => [uaprof2] => [uaprof3] => [nokia_series] => 0 [nokia_edition] => 0 [device_os] => Android [mobile_browser] => Android Webkit [mobile_browser_version] => [device_os_version] => 2.0 [pointing_method] => touchscreen [release_date] => 2009_october [marketing_name] => [model_extra_info] => [nokia_feature_pack] => 0 [can_assign_phone_number] => true [is_tablet] => false [manufacturer_name] => [is_bot] => false [is_google_glass] => false [proportional_font] => false [built_in_back_button_support] => false [card_title_support] => true [softkey_support] => false [table_support] => true [numbered_menus] => false [menu_with_select_element_recommended] => false [menu_with_list_of_links_recommended] => true [icons_on_menu_items_support] => false [break_list_of_links_with_br_element_recommended] => true [access_key_support] => false [wrap_mode_support] => false [times_square_mode_support] => false [deck_prefetch_support] => false [elective_forms_recommended] => true [wizards_recommended] => false [image_as_link_support] => false [insert_br_element_after_widget_recommended] => false [wml_can_display_images_and_text_on_same_line] => false [wml_displays_image_in_center] => false [opwv_wml_extensions_support] => false [wml_make_phone_call_string] => wtai://wp/mc; [chtml_display_accesskey] => false [emoji] => false [chtml_can_display_images_and_text_on_same_line] => false [chtml_displays_image_in_center] => false [imode_region] => none [chtml_make_phone_call_string] => tel: [chtml_table_support] => false [xhtml_honors_bgcolor] => true [xhtml_supports_forms_in_table] => true [xhtml_support_wml2_namespace] => false [xhtml_autoexpand_select] => false [xhtml_select_as_dropdown] => false [xhtml_select_as_radiobutton] => false [xhtml_select_as_popup] => false [xhtml_display_accesskey] => false [xhtml_supports_invisible_text] => false [xhtml_supports_inline_input] => false [xhtml_supports_monospace_font] => false [xhtml_supports_table_for_layout] => true [xhtml_supports_css_cell_table_coloring] => true [xhtml_format_as_css_property] => false [xhtml_format_as_attribute] => false [xhtml_nowrap_mode] => false [xhtml_marquee_as_css_property] => false [xhtml_readable_background_color1] => #FFFFFF [xhtml_readable_background_color2] => #FFFFFF [xhtml_allows_disabled_form_elements] => true [xhtml_document_title_support] => true [xhtml_preferred_charset] => iso-8859-1 [opwv_xhtml_extensions_support] => false [xhtml_make_phone_call_string] => tel: [xhtmlmp_preferred_mime_type] => text/html [xhtml_table_support] => true [xhtml_send_sms_string] => sms: [xhtml_send_mms_string] => mms: [xhtml_file_upload] => not_supported [cookie_support] => true [accept_third_party_cookie] => true [xhtml_supports_iframe] => full [xhtml_avoid_accesskeys] => true [xhtml_can_embed_video] => play_and_stop [ajax_support_javascript] => true [ajax_manipulate_css] => true [ajax_support_getelementbyid] => true [ajax_support_inner_html] => true [ajax_xhr_type] => standard [ajax_manipulate_dom] => true [ajax_support_events] => true [ajax_support_event_listener] => true [ajax_preferred_geoloc_api] => w3c_api [xhtml_support_level] => 4 [preferred_markup] => html_web_4_0 [wml_1_1] => false [wml_1_2] => false [wml_1_3] => false [html_wi_w3_xhtmlbasic] => true [html_wi_oma_xhtmlmp_1_0] => true [html_wi_imode_html_1] => false [html_wi_imode_html_2] => false [html_wi_imode_html_3] => false [html_wi_imode_html_4] => false [html_wi_imode_html_5] => false [html_wi_imode_htmlx_1] => false [html_wi_imode_htmlx_1_1] => false [html_wi_imode_compact_generic] => false [html_web_3_2] => true [html_web_4_0] => true [voicexml] => false [multipart_support] => false [total_cache_disable_support] => false [time_to_live_support] => false [resolution_width] => 320 [resolution_height] => 480 [columns] => 60 [max_image_width] => 320 [max_image_height] => 400 [rows] => 40 [physical_screen_width] => 34 [physical_screen_height] => 50 [dual_orientation] => true [density_class] => 1.0 [wbmp] => true [bmp] => false [epoc_bmp] => false [gif_animated] => false [jpg] => true [png] => true [tiff] => false [transparent_png_alpha] => true [transparent_png_index] => true [svgt_1_1] => false [svgt_1_1_plus] => false [greyscale] => false [gif] => true [colors] => 65536 [webp_lossy_support] => false [webp_lossless_support] => false [post_method_support] => true [basic_authentication_support] => true [empty_option_value_support] => true [emptyok] => false [nokia_voice_call] => false [wta_voice_call] => false [wta_phonebook] => false [wta_misc] => false [wta_pdc] => false [https_support] => true [phone_id_provided] => false [max_data_rate] => 200 [wifi] => true [sdio] => false [vpn] => false [has_cellular_radio] => true [max_deck_size] => 1000000 [max_url_length_in_requests] => 256 [max_url_length_homepage] => 0 [max_url_length_bookmark] => 0 [max_url_length_cached_page] => 0 [max_no_of_connection_settings] => 0 [max_no_of_bookmarks] => 0 [max_length_of_username] => 0 [max_length_of_password] => 0 [max_object_size] => 0 [downloadfun_support] => false [directdownload_support] => true [inline_support] => false [oma_support] => true [ringtone] => false [ringtone_3gpp] => false [ringtone_midi_monophonic] => false [ringtone_midi_polyphonic] => false [ringtone_imelody] => false [ringtone_digiplug] => false [ringtone_compactmidi] => false [ringtone_mmf] => false [ringtone_rmf] => false [ringtone_xmf] => false [ringtone_amr] => false [ringtone_awb] => false [ringtone_aac] => false [ringtone_wav] => false [ringtone_mp3] => false [ringtone_spmidi] => false [ringtone_qcelp] => false [ringtone_voices] => 1 [ringtone_df_size_limit] => 0 [ringtone_directdownload_size_limit] => 0 [ringtone_inline_size_limit] => 0 [ringtone_oma_size_limit] => 0 [wallpaper] => false [wallpaper_max_width] => 0 [wallpaper_max_height] => 0 [wallpaper_preferred_width] => 0 [wallpaper_preferred_height] => 0 [wallpaper_resize] => none [wallpaper_wbmp] => false [wallpaper_bmp] => false [wallpaper_gif] => false [wallpaper_jpg] => false [wallpaper_png] => false [wallpaper_tiff] => false [wallpaper_greyscale] => false [wallpaper_colors] => 2 [wallpaper_df_size_limit] => 0 [wallpaper_directdownload_size_limit] => 0 [wallpaper_inline_size_limit] => 0 [wallpaper_oma_size_limit] => 0 [screensaver] => false [screensaver_max_width] => 0 [screensaver_max_height] => 0 [screensaver_preferred_width] => 0 [screensaver_preferred_height] => 0 [screensaver_resize] => none [screensaver_wbmp] => false [screensaver_bmp] => false [screensaver_gif] => false [screensaver_jpg] => false [screensaver_png] => false [screensaver_greyscale] => false [screensaver_colors] => 2 [screensaver_df_size_limit] => 0 [screensaver_directdownload_size_limit] => 0 [screensaver_inline_size_limit] => 0 [screensaver_oma_size_limit] => 0 [picture] => false [picture_max_width] => 0 [picture_max_height] => 0 [picture_preferred_width] => 0 [picture_preferred_height] => 0 [picture_resize] => none [picture_wbmp] => false [picture_bmp] => false [picture_gif] => false [picture_jpg] => false [picture_png] => false [picture_greyscale] => false [picture_colors] => 2 [picture_df_size_limit] => 0 [picture_directdownload_size_limit] => 0 [picture_inline_size_limit] => 0 [picture_oma_size_limit] => 0 [video] => false [oma_v_1_0_forwardlock] => false [oma_v_1_0_combined_delivery] => false [oma_v_1_0_separate_delivery] => false [streaming_video] => true [streaming_3gpp] => true [streaming_mp4] => true [streaming_mov] => false [streaming_video_size_limit] => 0 [streaming_real_media] => none [streaming_flv] => false [streaming_3g2] => false [streaming_vcodec_h263_0] => 10 [streaming_vcodec_h263_3] => -1 [streaming_vcodec_mpeg4_sp] => 2 [streaming_vcodec_mpeg4_asp] => -1 [streaming_vcodec_h264_bp] => 3.0 [streaming_acodec_amr] => nb [streaming_acodec_aac] => lc [streaming_wmv] => none [streaming_preferred_protocol] => rtsp [streaming_preferred_http_protocol] => progressive_download [wap_push_support] => false [connectionless_service_indication] => false [connectionless_service_load] => false [connectionless_cache_operation] => false [connectionoriented_unconfirmed_service_indication] => false [connectionoriented_unconfirmed_service_load] => false [connectionoriented_unconfirmed_cache_operation] => false [connectionoriented_confirmed_service_indication] => false [connectionoriented_confirmed_service_load] => false [connectionoriented_confirmed_cache_operation] => false [utf8_support] => true [ascii_support] => false [iso8859_support] => false [expiration_date] => false [j2me_cldc_1_0] => false [j2me_cldc_1_1] => false [j2me_midp_1_0] => false [j2me_midp_2_0] => false [doja_1_0] => false [doja_1_5] => false [doja_2_0] => false [doja_2_1] => false [doja_2_2] => false [doja_3_0] => false [doja_3_5] => false [doja_4_0] => false [j2me_jtwi] => false [j2me_mmapi_1_0] => false [j2me_mmapi_1_1] => false [j2me_wmapi_1_0] => false [j2me_wmapi_1_1] => false [j2me_wmapi_2_0] => false [j2me_btapi] => false [j2me_3dapi] => false [j2me_locapi] => false [j2me_nokia_ui] => false [j2me_motorola_lwt] => false [j2me_siemens_color_game] => false [j2me_siemens_extension] => false [j2me_heap_size] => 0 [j2me_max_jar_size] => 0 [j2me_storage_size] => 0 [j2me_max_record_store_size] => 0 [j2me_screen_width] => 0 [j2me_screen_height] => 0 [j2me_canvas_width] => 0 [j2me_canvas_height] => 0 [j2me_bits_per_pixel] => 0 [j2me_audio_capture_enabled] => false [j2me_video_capture_enabled] => false [j2me_photo_capture_enabled] => false [j2me_capture_image_formats] => none [j2me_http] => false [j2me_https] => false [j2me_socket] => false [j2me_udp] => false [j2me_serial] => false [j2me_gif] => false [j2me_gif89a] => false [j2me_jpg] => false [j2me_png] => false [j2me_bmp] => false [j2me_bmp3] => false [j2me_wbmp] => false [j2me_midi] => false [j2me_wav] => false [j2me_amr] => false [j2me_mp3] => false [j2me_mp4] => false [j2me_imelody] => false [j2me_rmf] => false [j2me_au] => false [j2me_aac] => false [j2me_realaudio] => false [j2me_xmf] => false [j2me_wma] => false [j2me_3gpp] => false [j2me_h263] => false [j2me_svgt] => false [j2me_mpeg4] => false [j2me_realvideo] => false [j2me_real8] => false [j2me_realmedia] => false [j2me_left_softkey_code] => 0 [j2me_right_softkey_code] => 0 [j2me_middle_softkey_code] => 0 [j2me_select_key_code] => 0 [j2me_return_key_code] => 0 [j2me_clear_key_code] => 0 [j2me_datefield_no_accepts_null_date] => false [j2me_datefield_broken] => false [receiver] => false [sender] => false [mms_max_size] => 0 [mms_max_height] => 0 [mms_max_width] => 0 [built_in_recorder] => false [built_in_camera] => true [mms_jpeg_baseline] => false [mms_jpeg_progressive] => false [mms_gif_static] => false [mms_gif_animated] => false [mms_png] => false [mms_bmp] => false [mms_wbmp] => false [mms_amr] => false [mms_wav] => false [mms_midi_monophonic] => false [mms_midi_polyphonic] => false [mms_midi_polyphonic_voices] => 0 [mms_spmidi] => false [mms_mmf] => false [mms_mp3] => false [mms_evrc] => false [mms_qcelp] => false [mms_ota_bitmap] => false [mms_nokia_wallpaper] => false [mms_nokia_operatorlogo] => false [mms_nokia_3dscreensaver] => false [mms_nokia_ringingtone] => false [mms_rmf] => false [mms_xmf] => false [mms_symbian_install] => false [mms_jar] => false [mms_jad] => false [mms_vcard] => false [mms_vcalendar] => false [mms_wml] => false [mms_wbxml] => false [mms_wmlc] => false [mms_video] => false [mms_mp4] => false [mms_3gpp] => false [mms_3gpp2] => false [mms_max_frame_rate] => 0 [nokiaring] => false [picturemessage] => false [operatorlogo] => false [largeoperatorlogo] => false [callericon] => false [nokiavcard] => false [nokiavcal] => false [sckl_ringtone] => false [sckl_operatorlogo] => false [sckl_groupgraphic] => false [sckl_vcard] => false [sckl_vcalendar] => false [text_imelody] => false [ems] => false [ems_variablesizedpictures] => false [ems_imelody] => false [ems_odi] => false [ems_upi] => false [ems_version] => 0 [siemens_ota] => false [siemens_logo_width] => 101 [siemens_logo_height] => 29 [siemens_screensaver_width] => 101 [siemens_screensaver_height] => 50 [gprtf] => false [sagem_v1] => false [sagem_v2] => false [panasonic] => false [sms_enabled] => true [wav] => false [mmf] => false [smf] => false [mld] => false [midi_monophonic] => false [midi_polyphonic] => false [sp_midi] => false [rmf] => false [xmf] => false [compactmidi] => false [digiplug] => false [nokia_ringtone] => false [imelody] => false [au] => false [amr] => false [awb] => false [aac] => true [mp3] => true [voices] => 1 [qcelp] => false [evrc] => false [flash_lite_version] => [fl_wallpaper] => false [fl_screensaver] => false [fl_standalone] => false [fl_browser] => false [fl_sub_lcd] => false [full_flash_support] => false [css_supports_width_as_percentage] => true [css_border_image] => webkit [css_rounded_corners] => webkit [css_gradient] => none [css_spriting] => true [css_gradient_linear] => none [is_transcoder] => false [transcoder_ua_header] => user-agent [rss_support] => false [pdf_support] => true [progressive_download] => true [playback_vcodec_h263_0] => 10 [playback_vcodec_h263_3] => -1 [playback_vcodec_mpeg4_sp] => 0 [playback_vcodec_mpeg4_asp] => -1 [playback_vcodec_h264_bp] => -1 [playback_real_media] => none [playback_3gpp] => true [playback_3g2] => false [playback_mp4] => true [playback_mov] => false [playback_acodec_amr] => nb [playback_acodec_aac] => none [playback_df_size_limit] => 0 [playback_directdownload_size_limit] => 0 [playback_inline_size_limit] => 0 [playback_oma_size_limit] => 0 [playback_acodec_qcelp] => false [playback_wmv] => none [hinted_progressive_download] => true [html_preferred_dtd] => html4 [viewport_supported] => true [viewport_width] => device_width_token [viewport_userscalable] => no [viewport_initial_scale] => [viewport_maximum_scale] => [viewport_minimum_scale] => [mobileoptimized] => false [handheldfriendly] => false [canvas_support] => full [image_inlining] => true [is_smarttv] => false [is_console] => false [nfc_support] => false [ux_full_desktop] => false [jqm_grade] => C [is_sencha_touch_ok] => false [controlcap_is_smartphone] => default [controlcap_is_ios] => default [controlcap_is_android] => default [controlcap_is_robot] => default [controlcap_is_app] => default [controlcap_advertised_device_os] => default [controlcap_advertised_device_os_version] => default [controlcap_advertised_browser] => default [controlcap_advertised_browser_version] => default [controlcap_is_windows_phone] => default [controlcap_is_full_desktop] => default [controlcap_is_largescreen] => default [controlcap_is_mobile] => default [controlcap_is_touchscreen] => default [controlcap_is_wml_preferred] => default [controlcap_is_xhtmlmp_preferred] => default [controlcap_is_html_preferred] => default [controlcap_form_factor] => default [controlcap_complete_device_name] => default ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr></table> </div> <div class="section"> <h1 class="header center orange-text">About this comparison</h1> <div class="row center"> <h5 class="header light"> The primary goal of this project is simple<br /> I wanted to know which user agent parser is the most accurate in each part - device detection, bot detection and so on...<br /> <br /> The secondary goal is to provide a source for all user agent parsers to improve their detection based on this results.<br /> <br /> You can also improve this further, by suggesting ideas at <a href="https://github.com/ThaDafinser/UserAgentParserComparison">ThaDafinser/UserAgentParserComparison</a><br /> <br /> The comparison is based on the abstraction by <a href="https://github.com/ThaDafinser/UserAgentParser">ThaDafinser/UserAgentParser</a> </h5> </div> </div> <div class="card"> <div class="card-content"> Comparison created <i>2016-02-13 13:35:49</i> | by <a href="https://github.com/ThaDafinser">ThaDafinser</a> </div> </div> </div> <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/list.js/1.1.1/list.min.js"></script> <script> $(document).ready(function(){ // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered $('.modal-trigger').leanModal(); }); </script> </body> </html>
{ "content_hash": "eb1f5333dd5fe09dbb70a67b931b6973", "timestamp": "", "source": "github", "line_count": 1087, "max_line_length": 745, "avg_line_length": 40.81232750689973, "alnum_prop": 0.5332371570903681, "repo_name": "ThaDafinser/UserAgentParserComparison", "id": "55b73698d3c1377f487c6464c890d3baac192c66", "size": "44364", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "v4/user-agent-detail/96/85/96853893-895f-49f2-b874-26a05b1e6228.html", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "2060859160" } ], "symlink_target": "" }
ActionController::Routing::Routes.draw do |map| map.connect 'broken', :controller => 'welcome', :action => 'broken' # Sample of named route: # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' # This route can be invoked with purchase_url(:id => product.id) # Sample resource route (maps HTTP verbs to controller actions automatically): # map.resources :products # Sample resource route with options: # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get } # Sample resource route with sub-resources: # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller # Sample resource route with more complex sub-resources # map.resources :products do |products| # products.resources :comments # products.resources :sales, :collection => { :recent => :get } # end # Sample resource route within a namespace: # map.namespace :admin do |admin| # # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb) # admin.resources :products # end map.root :controller => "welcome" # See how all your routes lay out with "rake routes" # Install the default routes as the lowest priority. # Note: These default routes make all actions in every controller accessible via GET requests. You should # consider removing or commenting them out if you're using named routes and resources. # map.connect ':controller/:action/:id' # map.connect ':controller/:action/:id.:format' end
{ "content_hash": "7f77682c5342a434a50534d5b4602ac1", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 112, "avg_line_length": 42.31578947368421, "alnum_prop": 0.6896766169154229, "repo_name": "crashlog/crashlog", "id": "adc9b71c1bf177994efbd530f3e1616b42cecca3", "size": "1608", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spec/dummy_rails_2/config/routes.rb", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "599" }, { "name": "Ruby", "bytes": "119888" } ], "symlink_target": "" }
#ifndef AVCODEC_PPC_DSPUTIL_ALTIVEC_H #define AVCODEC_PPC_DSPUTIL_ALTIVEC_H #include <stdint.h> #include "libavcodec/dsputil.h" void ff_put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); void ff_avg_pixels16_altivec(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); void ff_fdct_altivec(int16_t *block); void ff_gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h, int x16, int y16, int rounder); void ff_idct_put_altivec(uint8_t *dest, int line_size, int16_t *block); void ff_idct_add_altivec(uint8_t *dest, int line_size, int16_t *block); void ff_dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx); void ff_int_init_altivec(DSPContext* c, AVCodecContext *avctx); #endif /* AVCODEC_PPC_DSPUTIL_ALTIVEC_H */
{ "content_hash": "8de8af6865f53aa412132253526b208c", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 96, "avg_line_length": 36.72727272727273, "alnum_prop": 0.719059405940594, "repo_name": "jasonchuang/SoftwareVideoPlayer", "id": "3ac76c5117dfc94c9bd3645ec3999ce7371245f2", "size": "1707", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "jni/ffmpeg-2.2/libavcodec/ppc/dsputil_altivec.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "2009909" }, { "name": "C", "bytes": "31979307" }, { "name": "C++", "bytes": "959912" }, { "name": "CSS", "bytes": "2494" }, { "name": "Groff", "bytes": "99" }, { "name": "HTML", "bytes": "1616" }, { "name": "Java", "bytes": "234941" }, { "name": "Makefile", "bytes": "407463" }, { "name": "Objective-C", "bytes": "1143" }, { "name": "Perl", "bytes": "21810" }, { "name": "Python", "bytes": "1743" }, { "name": "Shell", "bytes": "48750" }, { "name": "Verilog", "bytes": "2733" } ], "symlink_target": "" }
import numpy as np #samplerate: Choose a sample rate of 44.1 KHz, the same sample rate used for audio CDs # From Nyquist, this samplerate will capture 20 KHz roughly the limit of human hearing #chunk: The size of each packet read from the microphone and the points of the subsequent FFT #num_columns: The number of columns of LEDs that will display our spectrum # # Use this function to precompute the bin mapping and save the results outside # of the main audio processing loop. def find_bin_mapping_np(num_columns, min_freq, max_freq, chunk=4096, samplerate=44100): #Need to group and assign output bins of the FFT to each column #Since sound is logarithmic, we will assign equal amounts of log(spectrum) # to each column which will result in fewer bins for the lower columns #Audible frequency range is 20Hz - 20KHz #If we only had one column, it would cover the entire range bin_mapping = np.array([min_freq, max_freq]) num_cols_mapped = 1 #First, take the log of each entry bin_mapping = np.log10(bin_mapping) #As we add bins, insert values into bin_mapping while num_cols_mapped < num_columns: new_vals = np.array([]) for i in range(num_cols_mapped): new_vals = np.append(new_vals, sum(bin_mapping[i:i+2]) / 2.0) #Interleave these values into bin_mapping bin_mapping = np.insert(bin_mapping, list(range(1,num_cols_mapped+1)), new_vals) #Double the number of columns mapped each iteration num_cols_mapped = num_cols_mapped * 2 #Done mapping, but the bin_mapping list is still in log form #Use NumPy power() to convert back to frequency in Hz bin_freqs = np.power(10, bin_mapping) #Based on the number of points in our FFT, find the closest bin index to each frequency entry #Only the first half of the bins contain useful information and each bin has width of # (sampling_rate / chunk) bin_mapping = [int(round(x / (samplerate / chunk))) for x in bin_freqs] print("Selected Bin Mapping: ", bin_mapping) print("Selected Bin Freqs: ", bin_freqs) #So now, each column will average the FFT bins between each pair of indexes in bin_mapping return bin_mapping # Data: Should be a chunk-length array of real samples to compute spectral data for # bin_mapping: An array of bin indexes. This function will scale and then sum the FFT output # between each bin_index and append to the output array # chunk: Size of the FFT and the number of values in data # scale: Optional argument with a default of 4. Scales fft output by powers of 2 # If set to 4 and the input is full scale 16-bit audio, should produce values between 0 and 8 # Increase this parameter for audio data with low volume, or decrease to drive more than 8 LEDs per column def get_spectrum(data, bin_mapping, chunk, scale=4): #Use the rfft function which only computes half of the FFT # Since our input is all real data, only the one half is useful y_fft = np.fft.rfft(data) # FFT returns complex float # Use abs() to get magnitude and then cast to int # Eventually mapping to just 8 LEDs, so okay to cast now and lose precision y_amp = (np.abs(y_fft)).astype(int) #After the FFT, the amplitudes are large. On the order of 2^15 (Max input from Mic) * chunk # Dividing by (2^15 * chunk) would scale to between 0 and 1 # But we want to drive LEDs of height 8, so don't divide by quite as much # Use right_shift to perform a faster divide-by-power-of-two y_shift = np.right_shift(y_amp, int(np.log2(chunk) + 15 - scale)) bin_amplitudes = np.array([], dtype='i2') #Iterate through every item pair in bin_mapping using zip # Returns one item from each range on each iteration # bin_mapping[:-1] iterates from beginning to last-1 item # bin_mapping[1:] iterates from second to last item for x,y in zip(bin_mapping[:-1],bin_mapping[1:]): #Sum energy between the indexes [x, y) and append to output array # Python [x:y] indexing does not include the y-th item amplitude = (np.sum(y_shift[x:y])) bin_amplitudes = np.append(bin_amplitudes, amplitude) # Loudness is logarithmic, so take the log2 of the bin powers bin_amplitudes = np.add(bin_amplitudes, np.ones(len(bin_amplitudes), int)) bin_amplitudes = np.log2(bin_amplitudes).astype(int) return bin_amplitudes
{ "content_hash": "50daf89a69df5b2c0a3d7e7d4514fea7", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 113, "avg_line_length": 52.63095238095238, "alnum_prop": 0.7018774033024203, "repo_name": "parrisha/raspi-visualizer", "id": "d1304af77b7d374232d1c1701ed65b9fc43b1809", "size": "4654", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spectrum/spectrum.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "20045" } ], "symlink_target": "" }
(function(window, jQuery, unipooleUtils){ var yaftHelper = window.yaftHelper; Handlebars.registerHelper('messageCount', function(forum) { return getMessageCountForDiscussion(forum); }); Handlebars.registerHelper('unreadCount', function(forum) { return getUnreadMessageCountForDiscussion(forum); }); Handlebars.registerHelper('lastMessage', function(forum) { return getLastMessageDateForDiscussion(forum); }); /** * Invoked when the page is ready just before it is shown */ jQuery(document).ready(function() { initialise(); }); function initialise(){ var forum_id = unipooleUtils.getURLParameter('id'); yaftHelper.getForum(forum_id, function(forum){ if (forum === undefined){ // TODO warn forum not found console.log("Could not find forum id:" + forum_id); return; }else{ updateBreadCrumb(forum); loadTable(forum.discussions); jQuery("a#createTopicLink").attr("href", "createTopic.html?id=" + forum.key); } }); } /** * Update the forum title on the page * @param {type} forum The forum object * @returns {undefined} */ function updateBreadCrumb(forum){ jQuery("span#forumTitle").html(forum.title); } /** * Builds the template * @param {type} discussions Discussions to display in the table. * @returns {undefined} */ function loadTable(discussions){ var tableTemplate = unipooleUtils.getTemplate('templates/yaft.discussionsTable.handlebars'); jQuery(tableTemplate(discussions)).appendTo('div#tableContainer'); jQuery.fn.dataTableExt.oJUIClasses.sSortAsc = "yaftSortableTableHeaderSortUp"; jQuery.fn.dataTableExt.oJUIClasses.sSortDesc = "yaftSortableTableHeaderSortDown"; jQuery.fn.dataTableExt.oStdClasses.sSortAsc = "yaftSortableTableHeaderSortUp"; jQuery.fn.dataTableExt.oStdClasses.sSortDesc = "yaftSortableTableHeaderSortDown"; jQuery('table#yaft_forum_table').dataTable({ "fnDrawCallback": function() { setMainFrameHeight(UNIPOOLE_GLOBAL.IFRAME_ID); }, "iDisplayLength": -1, // Show all "aaSorting" : [[0, 'asc']], "aoColumnDefs": [ { "aTargets": [ 0 ], "bSortable": true }, { "aTargets": [ 1 ], "bSortable": true }, { "aTargets": [ 2 ], "bSortable": true }, { "aTargets": [ 3 ], "bSortable": true }, { "aTargets": [ 4 ], "bSortable": true }, { "aTargets": [ 5 ], "bSortable": false } ], "sDom": '' }); unipooleUtils.resizeFrame(); } function getMessageCountForDiscussion(discussion){ if(!discussion.messages){ return 1; } var discussionArray = yaftHelper.objectToArray(discussion.messages); return discussionArray.length + 1; } function getUnreadMessageCountForDiscussion(discussion){ var unreadMessageCount = 0; if(discussion.messages){ var messageArray = yaftHelper.objectToArray(discussion.messages); for(var idx2 = 0 ; idx2 < messageArray.length ; idx2++){ /** * If the current user is the creator of a message, it does not count * as unread. */ if (messageArray[idx2].creator_id == window.parent.UNIPOOLE_GLOBAL.unipooleData.lms_id){ continue; } /** * If the message doesnt have a read flag, it is unread */ else if(! messageArray[idx2].read){ unreadMessageCount++; } /** * The message does have a read flag, but is it set to yes? */ else if (messageArray[idx2].read != "yes"){ unreadMessageCount++; } } } return unreadMessageCount; } function getLastMessageDateForDiscussion(discussion){ var latestMessage = moment(discussion.create_date); if(discussion.messages){ var messageArray = yaftHelper.objectToArray(discussion.messages); for(var idx2 = 0 ; idx2 < messageArray.length ; idx2++){ var messageMoment = moment(messageArray[idx2].create_date); if (latestMessage == null || messageMoment.isAfter(latestMessage)){ latestMessage = messageMoment; } } } return latestMessage.format("YYYY MMM DD @ HH:mm"); } })(window, jQuery, window.unipooleUtils);
{ "content_hash": "9e1f031bfe79d96a8ba87832c9040025", "timestamp": "", "source": "github", "line_count": 134, "max_line_length": 100, "avg_line_length": 34.75373134328358, "alnum_prop": 0.5879321451578269, "repo_name": "Unipoole/unipoole-client", "id": "b6e590d0a81cec84a16c2b00e83eacd0712aa9bf", "size": "4657", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "public_html/tools/sakai.yaft/js/yaft.viewForum.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "30817" }, { "name": "Batchfile", "bytes": "790" }, { "name": "CSS", "bytes": "330618" }, { "name": "HTML", "bytes": "192870" }, { "name": "JavaScript", "bytes": "1109013" }, { "name": "PHP", "bytes": "31660" } ], "symlink_target": "" }
package ru.amizichenko.tracker.start; import ru.amizichenko.tracker.models.*; public class Tracker { public Item[] items = new Item[10]; private int position = 0; //Добовление public Item add(Item item) { item.setId(this.generateId()); this.items[position++] = item; return item; } //Редактирование public void edit(Item item) { for (int i =0; i < this.items.length; i++) { if (this.items[i].getId().equals(item.getId())) { this.items[i] = item; break; } else System.out.println("Such Id is not found"); } } //Удаление public void remove(String id) { int index = 0; for (int i = 0; i < this.items.length; i++) { if(this.items[i].getId().equals(id)) { index = i; break; } else System.out.println("Such Id is not found"); } if (index >= 0 && index < this.items.length) { Item[] copy = new Item[this.items.length-1]; System.arraycopy(this.items, 0, copy, 0, index); System.arraycopy(this.items, index+1, copy, index, this.items.length-index-1); this.items = copy; this.position--; } } //Поиск по Id public Item findById(String id) { Item result = null; for(Item item : items) { if(item != null && item.getId().equals(id)) { result = item; break; } } return result; } String generateId() { return String.valueOf(Math.round(Math.random() * 100)); } //Вернуть все public Item[] getAll() { Item[] result = new Item[position]; for(int index = 0; index != this.position; index++) { result[index] = this.items[index]; } return result; } //Показть все public void show(Item[] arr) { System.out.println("================================================================================"); int cell = 1; for (Item item : arr) { if (item != null) { System.out.printf("%s \tName: %s \n\tDescription: %s\n", item.getId(),item.getName(),item.getDescription()); System.out.println(); } } System.out.println("================================================================================"); } //Ищет все объекты с заданным словом public Item[] sort(String word) { Item[] sorted = new Item[this.items.length]; int filterIndex = 0; for (int i = 0; i < this.items.length; i++) { if (this.items[i] != null && (this.items[i].getName().equals(word) | this.items[i].getDescription().equals(word))) { sorted[filterIndex++] = this.items[i]; } } return sorted; } }
{ "content_hash": "451a730cebab33f71bb95efa1d8f2d96", "timestamp": "", "source": "github", "line_count": 96, "max_line_length": 120, "avg_line_length": 26.1875, "alnum_prop": 0.5568814638027049, "repo_name": "Defo82/Mizichenko", "id": "f5a22323830366e73ceebcf9676cde801090d313", "size": "2602", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "part2/lesson8/src/main/java/ru/amizichenko/tracker/start/Tracker.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "7965" } ], "symlink_target": "" }
/* eslint-disable class-methods-use-this */ import filterAsync from 'node-filter-async'; import { throwIfFalsy } from 'throw-if-arg-empty'; import * as colors from 'ansi-colors'; import * as ProgressBar from 'progress'; import { performance } from 'perf_hooks'; import * as prettyMS from 'pretty-ms'; import log from './log'; export interface DataObject { [key: string]: unknown; } export type MapFn = (obj: DataObject) => Promise<DataObject>; export type ForEachFn = (obj: DataObject) => Promise<void>; export type FilterFn = (obj: DataObject) => Promise<boolean>; export type ResetFn = (objs: DataObject[]) => Promise<DataObject[]>; export default class DataList { static logging = true; static all(values: unknown[], key: string): DataList { if (!values) { return new DataList(); } return new DataList(values.map((value) => ({ [key]: value }))); } list: DataObject[]; // Enables debug output. verbose = false; // defaults to -1 (not set). private prevLength = -1; private startTime = 0; constructor(list?: DataObject[]) { this.list = list || []; const name = 'Job started'; this.onActionStarted(name); this.onActionEnded(name); } get count(): number { return this.list.length; } values(key: string): unknown { throwIfFalsy(key, 'key'); return this.list.map((d) => d[key]); } async map(name: string, fn: MapFn): Promise<void> { throwIfFalsy(fn, 'fn'); this.onActionStarted(name); const promises = this.progressive(this.list.map(fn)); this.list = await Promise.all(promises); this.onActionEnded(name); } async reset(name: string, fn: ResetFn): Promise<void> { throwIfFalsy(fn, 'fn'); this.onActionStarted(name); this.list = await fn(this.list); this.onActionEnded(name); } async filter(name: string, fn: FilterFn): Promise<void> { throwIfFalsy(fn, 'fn'); this.onActionStarted(name); const progBar = this.progressBar(); this.list = await filterAsync(this.list, fn, () => progBar.tick()); this.onActionEnded(name); } async forEach(name: string, fn: ForEachFn): Promise<void> { throwIfFalsy(fn, 'fn'); this.onActionStarted(name); const promises = this.progressive(this.list.map(fn)); await Promise.all(promises); this.onActionEnded(name); } logList() { log(this.list); } private onActionStarted(name: string) { this.logName(name); this.startTime = performance.now(); } private onActionEnded(_: string) { this.logLength(); if (this.verbose) { this.logList(); } const duration = performance.now() - this.startTime; this.logTime(prettyMS(duration)); } private logName(name: string) { throwIfFalsy(name, 'name'); log(colors.cyan(`🦁 ${name}`)); } private logTime(s: string) { log(colors.gray(`> Done in ${s}`)); } private logLength() { if (this.prevLength !== this.list.length) { let msg = this.prevLength >= 0 ? `${this.prevLength} --> ${this.list.length}` : `${this.list.length}`; msg += ' item(s)'; log(colors.yellow(`> ${msg}`)); this.prevLength = this.list.length; } } private progressBar(): ProgressBar { return new ProgressBar('[:bar]', { complete: '=', incomplete: ' ', width: process.stdout.columns ? process.stdout.columns - 2 : 20, total: this.count, clear: true, }); } private progressive<T>(promises: Array<Promise<T>>): Array<Promise<T>> { const bar = this.progressBar(); return promises.map(async (p) => { const result = await p; bar.tick(); return result; }); } }
{ "content_hash": "28b3c9bb22519a8a5df2a3cf6f88e10d", "timestamp": "", "source": "github", "line_count": 151, "max_line_length": 74, "avg_line_length": 24.397350993377483, "alnum_prop": 0.6226927252985885, "repo_name": "mgenware/makhulu", "id": "80ef9e0762007768873cc8fae5bf3c738dcda797", "size": "3687", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "src/dataList.ts", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "2293" }, { "name": "TypeScript", "bytes": "15719" } ], "symlink_target": "" }
package es.bsc.mobile.data.actions; import es.bsc.mobile.data.DataManager.DMUser; public class OwnedData extends DataAction { private final String data; public OwnedData(String data, DMUser user) { super(user); this.data = data; } @Override public void perform() { user.notifyDataHosting(data); } }
{ "content_hash": "574047195b53d0f27bbbe5e05393adbe", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 48, "avg_line_length": 19.555555555555557, "alnum_prop": 0.6590909090909091, "repo_name": "flordan/final", "id": "ca38b9292eca1bc9a36c1aa484f6fc7b9bb7954d", "size": "352", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "code/runtime/commons/src/main/java/es/bsc/mobile/data/actions/OwnedData.java", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Groovy", "bytes": "14" }, { "name": "Java", "bytes": "611417" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>mathcomp-character: 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.8.2 / mathcomp-character - 1.15.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> mathcomp-character <small> 1.15.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-09-22 01:18:02 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-09-22 01:18:02 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-ocamlbuild base OCamlbuild binary and libraries distributed with the OCaml compiler 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.8.2 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.02.3 The OCaml compiler (virtual package) ocaml-base-compiler 4.02.3 Official 4.02.3 release 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;Mathematical Components &lt;mathcomp-dev@sympa.inria.fr&gt;&quot; homepage: &quot;https://math-comp.github.io/&quot; bug-reports: &quot;https://github.com/math-comp/math-comp/issues&quot; dev-repo: &quot;git+https://github.com/math-comp/math-comp.git&quot; license: &quot;CECILL-B&quot; build: [ make &quot;-C&quot; &quot;mathcomp/character&quot; &quot;-j&quot; &quot;%{jobs}%&quot; ] install: [ make &quot;-C&quot; &quot;mathcomp/character&quot; &quot;install&quot; ] depends: [ &quot;coq-mathcomp-field&quot; { = version } ] tags: [ &quot;keyword:algebra&quot; &quot;keyword:character&quot; &quot;keyword:small scale reflection&quot; &quot;keyword:mathematical components&quot; &quot;keyword:odd order theorem&quot; &quot;logpath:mathcomp.character&quot; ] authors: [ &quot;Jeremy Avigad &lt;&gt;&quot; &quot;Andrea Asperti &lt;&gt;&quot; &quot;Stephane Le Roux &lt;&gt;&quot; &quot;Yves Bertot &lt;&gt;&quot; &quot;Laurence Rideau &lt;&gt;&quot; &quot;Enrico Tassi &lt;&gt;&quot; &quot;Ioana Pasca &lt;&gt;&quot; &quot;Georges Gonthier &lt;&gt;&quot; &quot;Sidi Ould Biha &lt;&gt;&quot; &quot;Cyril Cohen &lt;&gt;&quot; &quot;Francois Garillot &lt;&gt;&quot; &quot;Alexey Solovyev &lt;&gt;&quot; &quot;Russell O&#39;Connor &lt;&gt;&quot; &quot;Laurent Théry &lt;&gt;&quot; &quot;Assia Mahboubi &lt;&gt;&quot; ] synopsis: &quot;Mathematical Components Library on character theory&quot; description:&quot;&quot;&quot; This library contains definitions and theorems about group representations, characters and class functions. &quot;&quot;&quot; url { src: &quot;https://github.com/math-comp/math-comp/archive/mathcomp-1.15.0.tar.gz&quot; checksum: &quot;sha256=33105615c937ae1661e12e9bc00e0dbad143c317a6ab78b1a15e1d28339d2d95&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-mathcomp-character.1.15.0 coq.8.8.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.8.2). The following dependencies couldn&#39;t be met: - coq-mathcomp-character -&gt; coq-mathcomp-field &gt;= 1.15.0 -&gt; coq-mathcomp-solvable &gt;= 1.15.0 -&gt; coq-mathcomp-algebra &gt;= 1.15.0 -&gt; coq-mathcomp-fingroup &gt;= 1.15.0 -&gt; coq-mathcomp-ssreflect &gt;= 1.15.0 -&gt; coq &gt;= dev -&gt; ocaml &gt;= 4.05.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-mathcomp-character.1.15.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "32e24260028d882fcedcda867ca9042f", "timestamp": "", "source": "github", "line_count": 162, "max_line_length": 554, "avg_line_length": 48.660493827160494, "alnum_prop": 0.5647596092858049, "repo_name": "coq-bench/coq-bench.github.io", "id": "8d3f74bfb38afe1699155e2493213c169384373e", "size": "7909", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.02.3-2.0.6/released/8.8.2/mathcomp-character/1.15.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <feature id="com.b2international.snowowl.api.rest.feature" label="Snow Owl Administrative RESTful API Feature" version="6.16.4" provider-name="B2i Healthcare"> <description url="http://b2i.sg"> Snow Owl Terminology Server Administrative RESTful API feature. Visit us at http://b2i.sg </description> <copyright> Copyright 2011-2015 B2i Healthcare Pte Ltd, http://b2i.sg </copyright> <plugin id="com.b2international.snowowl.api.rest" download-size="0" install-size="0" version="0.0.0" unpack="false"/> </feature>
{ "content_hash": "9cd4f27fada110a7463f3ab56b5aca8a", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 69, "avg_line_length": 27.083333333333332, "alnum_prop": 0.6369230769230769, "repo_name": "IHTSDO/snow-owl", "id": "ba8394ac6e4656e6d57ba0ba7c872018f35288e0", "size": "650", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "core/com.b2international.snowowl.api.rest.feature/feature.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "12031" }, { "name": "CSS", "bytes": "97278" }, { "name": "ECL", "bytes": "27450" }, { "name": "GAP", "bytes": "215641" }, { "name": "Groovy", "bytes": "71763" }, { "name": "HTML", "bytes": "11708" }, { "name": "Java", "bytes": "15201642" }, { "name": "JavaScript", "bytes": "5838380" }, { "name": "Prolog", "bytes": "6673" }, { "name": "Shell", "bytes": "107759" }, { "name": "Xtend", "bytes": "13494" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>coqeal: 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.12.1 / coqeal - 1.0.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> coqeal <small> 1.0.0 <span class="label label-info">Not compatible 👼</span> </small> </h1> <p>📅 <em><script>document.write(moment("2022-11-02 04:17:47 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-11-02 04:17:47 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils coq 8.12.1 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.07.1 The OCaml compiler (virtual package) ocaml-base-compiler 4.07.1 Official release 4.07.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;cyril.cohen@inria.fr&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;CoqEAL - The Coq Effective Algebra Library&quot; description: &quot;&quot;&quot; This Coq library contains a subset of the work that was developed in the context of the ForMath EU FP7 project (2009-2013). It has two parts: - theory, which contains developments in algebra and optimized algorithms on mathcomp data structures. - refinements, which is a framework to ease change of data representations during a proof.&quot;&quot;&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] depends: [ &quot;coq&quot; {(&gt;= &quot;8.7&quot; &amp; &lt; &quot;8.10~&quot;)} &quot;coq-bignums&quot; {(&gt;= &quot;8.7&quot; &amp; &lt; &quot;8.10~&quot;)} &quot;coq-paramcoq&quot; {(&gt;= &quot;1.1.1&quot;)} &quot;coq-mathcomp-multinomials&quot; {(&gt;= &quot;1.2&quot; &amp; &lt; &quot;1.4~&quot;)} &quot;coq-mathcomp-algebra&quot; {(&gt;= &quot;1.8.0&quot; &amp; &lt; &quot;1.9.0~&quot;)} ] tags: [ &quot;category:Computer Science/Decision Procedures and Certified Algorithms/Correctness proofs of algorithms&quot; &quot;keyword:effective algebra&quot; &quot;keyword:elementary divisor rings&quot; &quot;keyword:Smith normal form&quot; &quot;keyword:mathematical components&quot; &quot;keyword:Bareiss&quot; &quot;keyword:Karatsuba multiplication&quot; &quot;keyword:refinements&quot; &quot;logpath:CoqEAL&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/archive/refs/tags/1.0.0.tar.gz&quot; checksum: &quot;sha512=22a55872541ac4f664577fc3b194e21bd22188c429e0fe51fea41eb6f193a72e5909a2ed8bd353c1b7121e44e06a1188486b1a4e730d32396a93e806d7713e41&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.1.0.0 coq.8.12.1</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.12.1). The following dependencies couldn&#39;t be met: - coq-coqeal -&gt; coq &lt; 8.10~ -&gt; ocaml &lt; 4.06.0 base of this switch (use `--unlock-base&#39; to force) Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-coqeal.1.0.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install 🚀</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall 🧹</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣 </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "be1de7527c148a9566eea1ed23eeb8bf", "timestamp": "", "source": "github", "line_count": 183, "max_line_length": 159, "avg_line_length": 42.202185792349724, "alnum_prop": 0.5653243558202771, "repo_name": "coq-bench/coq-bench.github.io", "id": "19592af91876c7ad622dde8fb7dfb4ea64352361", "size": "7751", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.07.1-2.0.6/released/8.12.1/coqeal/1.0.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
<?php /** * @file * Contains \Triquanta\IziTravel\DataType\StoryNavigationInterface. */ namespace Triquanta\IziTravel\DataType; /** * Defines a story navigation data type. */ interface StoryNavigationInterface extends MtgObjectInterface { }
{ "content_hash": "d8e2d346017672d37ee05005203e920e", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 67, "avg_line_length": 16.6, "alnum_prop": 0.7590361445783133, "repo_name": "Triquanta/libizi", "id": "2a9579364e34c04e844e3cf9b3081793f4a385e6", "size": "249", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/DataType/StoryNavigationInterface.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "364515" } ], "symlink_target": "" }
#include "RouteInfo.h" #include "Buffer.h" #include "nav2util.h" #include "Log.h" namespace isab{ /******************************************************/ /************ RouteInfoParts::Segment ****************/ /******************************************************/ void RouteInfoParts::Segment::writeToBuf(Buffer *buf) const { buf->writeNextCharString(streetName); buf->writeNextUnaligned16bit(speedLimit); buf->writeNext8bit(flags); buf->writeNext8bit( (valid?0x01:0) | (changed?0x02:0) ); } void RouteInfoParts::Segment::readFromBuf(Buffer *buf) { if (ownStreetName) { delete[] (char *)(streetName); } streetName = buf->getNextCharStringAlloc(); ownStreetName = true; speedLimit = buf->readNextUnaligned16bit(); flags = buf->readNext8bit(); uint8 tmp = buf->readNext8bit(); valid = tmp & 0x01; changed = (tmp & 0x02) != 0; } RouteInfoParts::Segment::~Segment() { // Sort of hackish. If the name is created from readFromBuf() // then we may delete the string pointer. Hack! if (ownStreetName) { delete[] (char *)(streetName); } } RouteInfoParts::Segment::Segment() : streetName(NULL), ownStreetName(false) { } RouteInfoParts::Segment::Segment(const Segment &old) : streetName(strdup_new(old.streetName)), speedLimit(old.speedLimit), flags(old.flags), valid(old.valid), changed(old.changed), ownStreetName(true) { } RouteInfoParts::Segment::Segment(Buffer *buf) : streetName(NULL), ownStreetName(false) { ownStreetName = false; readFromBuf(buf); } RouteInfoParts::Segment & RouteInfoParts::Segment::operator= (const RouteInfoParts::Segment & old) { if (ownStreetName) { delete[] const_cast<char *>(streetName); } streetName = NULL; streetName = strdup_new(old.streetName); speedLimit = old.speedLimit; flags = old.flags; valid = old.valid; changed = old.changed; ownStreetName = true; return *this; } int RouteInfoParts::Segment::log(Log* log, const char* name) const { #ifndef NO_LOG_OUTPUT log->debug("%s : streetName : %s", name, streetName); log->debugDump("streetName", (uint8*)streetName, strlen(streetName) + 1); log->debug("%s : speedLimit : %"PRId16, name, speedLimit); log->debug("%s : flags : %"PRIu8, name, flags); log->debug("%s : valid : %s", name, valid ? "yes" : "no"); log->debug("%s : changed : %s", name, changed ? "yes" : "no"); log->debug("%s : ownStreetName : %s", name, ownStreetName ? "yes" :"no"); #endif return 0; } /******************************************************/ /************ RouteInfoParts::Landmark ***************/ /******************************************************/ RouteInfoParts::Landmark::Landmark(const RouteInfoParts::Landmark& other ) { // Do not delete infostring ownInfo = false; info = NULL; *this = other; } RouteInfoParts::Landmark& RouteInfoParts::Landmark::operator=( const RouteInfoParts::Landmark& other) { if ( this != &other ) { Buffer buf(256); other.writeToBuf( &buf ); this->readFromBuf( &buf ); } return *this; } void RouteInfoParts::Landmark::writeToBuf(Buffer *buf) const { buf->writeNextCharString(info); buf->writeNextUnaligned16bit(type); buf->writeNext8bit(side); buf->writeNext8bit( (start?0x01:0) | (stop?0x02:0) | (disturbedRoute?0x04:0) ); buf->writeNextUnaligned32bit(startDistance); buf->writeNextUnaligned32bit(stopDistance); } void RouteInfoParts::Landmark::readFromBuf(Buffer *buf) { if (ownInfo) { delete[] (char *)(info); } info = buf->getNextCharStringAlloc(); ownInfo = true; type = LandmarkType(buf->readNextUnaligned16bit()); side = LandmarkSide(buf->readNext8bit()); uint8 tmp = buf->readNext8bit(); start = tmp & 0x01; stop = (tmp & 0x02) != 0; disturbedRoute = (tmp & 0x04) != 0; startDistance = buf->readNextUnaligned32bit(); stopDistance = buf->readNextUnaligned32bit(); } int RouteInfoParts::Landmark::log(class Log* log, int order) const { #ifndef NO_LOG_OUTPUT log->debug("%d : info : %s", order, info); log->debugDump("info : ", (uint8*)info, strlen(info) + 1); log->debug("%d : side : %u", order, side); log->debug("%d : type : %u", order, type); log->debug("%d : disturbedRoute : %s", order, disturbedRoute ? "yes" : "no"); log->debug("%d : start : %s", order, start ? "yes" : "no"); log->debug("%d : stop : %s", order, stop ? "yes" : "no"); log->debug("%d : startDistance : %"PRId32, order, startDistance); log->debug("%d : stopDistance : %"PRId32, order, stopDistance); log->debug("%d : ownInfo : %s", order, ownInfo ? "yes" : "no"); #endif return 0; } RouteInfoParts::Landmark::Landmark(const char *ainfo, bool astart, bool astop, bool adetour, enum LandmarkSide aside, enum LandmarkType atype, int32 astartDistance, int32 astopDistance) : info(ainfo), side(aside), type(atype), disturbedRoute(adetour), start(astart), stop(astop), startDistance(astartDistance), stopDistance(astopDistance), ownInfo(false) { } RouteInfoParts::Landmark::Landmark(Buffer *buf) { ownInfo = false; readFromBuf(buf); } RouteInfoParts::Landmark::~Landmark() { if (ownInfo) { delete[] (char *)(info); } } bool RouteInfoParts::Landmark::matchesStartStop(enum Landmark::StartStopQuery q, int32 currdist) const { switch (q) { case ActiveNow: if (start && (startDistance>=0) && (currdist > startDistance) ) { return false; } if (stop && (stopDistance>=0) && (currdist < stopDistance) ) { return false; } return true; // Neither before the start nor after the end. case ActiveOnWpt: return true; case Begins: return (start); case Ends: return (stop); } return false; } bool RouteInfoParts::Landmark::isDetour(enum Landmark::StartStopQuery q, int32 currDist) const { if (! matchesStartStop(q, currDist)) { return false; } return disturbedRoute; } bool RouteInfoParts::Landmark::isSpeedCamera(enum Landmark::StartStopQuery q, int32 currDist) const { if (! matchesStartStop(q, currDist)) { return false; } return (type == cameraLM); } const char * RouteInfoParts::Landmark::getDescription() const { return info; } /******************************************************/ /************ RouteInfoParts::Lane *******************/ /******************************************************/ RouteInfoParts::Lane::Lane( uint8 lane ) { m_lane = lane; } RouteInfoParts::Lane::Lane( Buffer *buf ) { readFromBuf(buf); } RouteInfoParts::Lane::Lane( const Lane& other ) { m_lane = other.m_lane; } bool RouteInfoParts::Lane::isPreferred() { return (m_lane >> 7 & 0x1) != 0; } bool RouteInfoParts::Lane::isAllowed() { return (m_lane >> 6 & 0x1) == 0; } RouteInfoParts::Lane::Direction RouteInfoParts::Lane::direction() { return (Direction)(m_lane & 0x1F); } void RouteInfoParts::Lane::writeToBuf(Buffer *buf) const { buf->writeNext8bit(m_lane); } void RouteInfoParts::Lane::readFromBuf(Buffer *buf) { m_lane = buf->readNext8bit(); } int RouteInfoParts::Lane::log(class Log* log, int order) const { #ifndef NO_LOG_OUTPUT #endif return 0; } /******************************************************/ /************ RouteInfoParts::SignPost ***************/ /******************************************************/ RouteInfoParts::SignPost::SignPost() : m_text(""), m_distance(0), ownInfo(false) { m_textColor.red = 0xff; m_textColor.green = 0xff; m_textColor.blue = 0xff; m_backColor.red = 0; m_backColor.green = 0; m_backColor.blue = 0xff; m_frontColor.red = 0; m_frontColor.green = 0xff; m_frontColor.blue = 0xff; } RouteInfoParts::SignPost::SignPost( const char *atext, int32 adist, uint8 atextRed, uint8 atextGreen, uint8 atextBlue, uint8 abgRed, uint8 abgGreen, uint8 abgBlue, uint8 afgRed, uint8 afgGreen, uint8 afgBlue) : m_text(atext), m_distance(adist), ownInfo(false) { m_textColor.red = atextRed; m_textColor.green = atextGreen; m_textColor.blue = atextBlue; m_backColor.red = abgRed; m_backColor.green = abgGreen; m_backColor.blue = abgBlue; m_frontColor.red = afgRed; m_frontColor.green = afgGreen; m_frontColor.blue = afgBlue; } RouteInfoParts::SignPost::SignPost(Buffer *buf) { ownInfo = false; readFromBuf(buf); } RouteInfoParts::SignPost::~SignPost() { if (ownInfo) { delete[] (char *)(m_text); } } RouteInfoParts::SignPost& RouteInfoParts::SignPost::operator=( const RouteInfoParts::SignPost& other ) { if (ownInfo) { delete[] (char *)(m_text); } m_text = NULL; m_text = strdup_new(other.m_text); ownInfo = true; // Allocated on line above m_textColor = other.m_textColor; m_backColor = other.m_backColor; m_frontColor = other.m_frontColor; return *this; } void RouteInfoParts::SignPost::writeToBuf(Buffer *buf) const { buf->writeNextCharString(m_text); buf->writeNext8bit( m_textColor.red ); buf->writeNext8bit( m_textColor.green ); buf->writeNext8bit( m_textColor.blue ); buf->writeNext8bit( m_backColor.red ); buf->writeNext8bit( m_backColor.green ); buf->writeNext8bit( m_backColor.blue ); buf->writeNext8bit( m_frontColor.red ); buf->writeNext8bit( m_frontColor.green ); buf->writeNext8bit( m_frontColor.blue ); buf->writeNextUnaligned32bit(m_distance); } void RouteInfoParts::SignPost::readFromBuf(Buffer *buf) { if (ownInfo) { delete[] (char *)(m_text); } m_text = buf->getNextCharStringAlloc(); ownInfo = true; m_textColor.red = buf->readNext8bit(); m_textColor.green = buf->readNext8bit(); m_textColor.blue = buf->readNext8bit(); m_backColor.red = buf->readNext8bit(); m_backColor.green = buf->readNext8bit(); m_backColor.blue = buf->readNext8bit(); m_frontColor.red = buf->readNext8bit(); m_frontColor.green = buf->readNext8bit(); m_frontColor.blue = buf->readNext8bit(); m_distance = buf->readNextUnaligned32bit(); } int RouteInfoParts::SignPost::log(class Log* log, int order) const { #ifndef NO_LOG_OUTPUT #endif return 0; } const char* RouteInfoParts::SignPost::getText() const { return m_text; } /******************************************************/ /************ RouteInfoParts::Crossing ***************/ /******************************************************/ void RouteInfoParts::Crossing::writeToBuf(Buffer *buf) const { buf->writeNextUnaligned32bit(action); buf->writeNextUnaligned32bit(distToNextCrossing); buf->writeNextUnaligned32bit(lat); buf->writeNextUnaligned32bit(lon); buf->writeNext8bit(crossingType); buf->writeNext8bit(exitCount); buf->writeNext8bit( (valid?0x01:0) | (changed?0x02:0) ); } void RouteInfoParts::Crossing::readFromBuf(Buffer *buf) { action = buf->readNextUnaligned32bit(); distToNextCrossing = buf->readNextUnaligned32bit(); lat=buf->readNextUnaligned32bit(); lon=buf->readNextUnaligned32bit(); crossingType = buf->readNext8bit(); exitCount = buf->readNext8bit(); uint8 tmp = buf->readNext8bit(); valid = tmp & 0x01; changed = (tmp & 0x02) != 0; } int RouteInfoParts::Crossing::log(class Log* log, const char* name) const { #ifndef NO_LOG_OUTPUT log->debug("%s : action : %"PRIu32, name, action); log->debug("%s : distToNextCrossing : %"PRIu32, name, distToNextCrossing); log->debug("%s : crossingType : %"PRIu8, name, crossingType); log->debug("%s : exitCount : %"PRIu8, name, exitCount); log->debug("%s : lat : %"PRId32, name, lat); log->debug("%s : lon : %"PRId32, name, lon); log->debug("%s : valid : %s", name, valid ? "yes" : "no"); log->debug("%s : changed : %s", name, changed ? "yes" : "no"); #endif return 0; } void RouteInfoParts::RouteListCrossing::writeToBuf(Buffer *buf) const { buf->writeNextUnaligned16bit(wptNo); buf->writeNext8bit(toTarget); buf->writeNextUnaligned32bit(distToGoal); buf->writeNextUnaligned32bit(timeToGoal); crossing.writeToBuf(buf); buf->writeNext8bit(segments.size()); // One Segment before the next crossing buf->writeNext8bit(rlc_landmarks.size()); // No landmarks segment_container::const_iterator i; for (i=segments.begin(); i!=segments.end(); ++i) { (*i)->writeToBuf(buf); } landmark_container::const_iterator j; for (j=rlc_landmarks.begin(); j!=rlc_landmarks.end(); ++j) { (*j)->writeToBuf(buf); } buf->writeNext8bit(rlc_lanes.noLanes); buf->writeNextUnaligned32bit(rlc_lanes.distance); buf->writeNext8bit(rlc_lanes.m_laneVector.size()); RouteInfoParts::Lanes::rip_lane_vector::const_iterator k; for( k=rlc_lanes.m_laneVector.begin(); k!=rlc_lanes.m_laneVector.end(); ++k ) { (*k)->writeToBuf(buf); } } void RouteInfoParts::RouteListCrossing::readFromBuf(Buffer *buf) { wptNo=buf->readNextUnaligned16bit(); toTarget=buf->readNext8bit(); distToGoal=buf->readNextUnaligned32bit(); timeToGoal=buf->readNextUnaligned32bit(); crossing.readFromBuf(buf); int numSegments = buf->readNext8bit(); int numLandmarks = buf->readNext8bit(); int i; segments.resize(numSegments); for (i=0; i<numSegments; ++i) { segments[i]=new Segment(buf); } rlc_landmarks.resize(numLandmarks); for (i=0; i<numLandmarks; ++i) { rlc_landmarks[i]=new Landmark(buf); } rlc_lanes.noLanes = buf->readNext8bit()==1; rlc_lanes.distance = buf->readNextUnaligned32bit(); int numLanes = buf->readNext8bit(); rlc_lanes.m_laneVector.resize(numLanes); for( i=0; i<numLanes; ++i ){ RouteInfoParts::Lane* lane = new RouteInfoParts::Lane(buf); rlc_lanes.m_laneVector[i] = lane; } } RouteInfoParts::RouteListCrossing::~RouteListCrossing() { std::vector<Segment*>::iterator i; for (i=segments.begin(); i!=segments.end(); ++i) { delete *i; } segments.clear(); std::vector<Landmark*>::iterator j; for (j=rlc_landmarks.begin(); j!=rlc_landmarks.end(); ++j) { delete *j; } rlc_landmarks.clear(); RouteInfoParts::Lanes::rip_lane_vector::iterator k; for( k = rlc_lanes.m_laneVector.begin(); k != rlc_lanes.m_laneVector.end(); ++k ) { delete *k; } rlc_lanes.m_laneVector.clear(); } const char * RouteInfoParts::RouteListCrossing::hasDetourLandmark(enum Landmark::StartStopQuery q) const { landmark_container::const_iterator i = rlc_landmarks.begin(); while (i != rlc_landmarks.end()) { if ((*i)->isDetour(q, -1)) { return (*i)->getDescription(); } ++i; } return NULL; } const char * RouteInfoParts::RouteListCrossing::hasSpeedCameraLandmark(enum Landmark::StartStopQuery q) const { landmark_container::const_iterator i = rlc_landmarks.begin(); while (i != rlc_landmarks.end()) { if ((*i)->isSpeedCamera(q, -1)) { return (*i)->getDescription();; } ++i; } return NULL; } /******************************************************/ /**************** RouteInfo **************************/ /******************************************************/ void RouteInfo::writeToBuf(Buffer *buf) const { buf->writeNext8bit (onTrackStatus); buf->writeNextUnaligned16bit(simInfoStatus); buf->writeNextUnaligned32bit(timeToGoal); buf->writeNextUnaligned32bit(distToWpt); buf->writeNextUnaligned32bit(distToGoal); buf->writeNextUnaligned32bit(distToTrack); buf->writeNextUnaligned32bit(lat); buf->writeNextUnaligned32bit(lon); // buf->writeNextUnaligned32bit(origLat); // buf->writeNextUnaligned32bit(origLon); // buf->writeNextUnaligned32bit(destLat); // buf->writeNextUnaligned32bit(destLon); buf->writeNext8bit (toOnTrackTurn); buf->writeNext8bit (toTrackTurn); buf->writeNextUnaligned16bit(timeToWpt); buf->writeNextUnaligned16bit(latency); buf->writeNextUnaligned16bit(speed); buf->writeNext8bit(overSpeed); buf->writeNext8bit(toTarget); buf->writeNextUnaligned16bit(crossingNo); currSeg.writeToBuf(buf); buf->writeNextUnaligned32bit(distToAltAttribSegment); altAttribSegment.writeToBuf(buf); currCrossing.writeToBuf(buf); nextSeg1.writeToBuf(buf); nextCrossing1.writeToBuf(buf); nextSeg2.writeToBuf(buf); buf->writeNext8bit(rip_landmarks.size()); landmark_container::const_iterator j; for (j=rip_landmarks.begin(); j!=rip_landmarks.end(); ++j) { (*j)->writeToBuf(buf); } buf->writeNext8bit(rip_lanes.noLanes); buf->writeNextUnaligned32bit(rip_lanes.distance); buf->writeNext8bit(rip_lanes.m_laneVector.size()); RouteInfoParts::Lanes::rip_lane_vector::const_iterator k; for( k=rip_lanes.m_laneVector.begin(); k!=rip_lanes.m_laneVector.end(); ++k ) { (*k)->writeToBuf(buf); } rip_signpost.writeToBuf(buf); } void RouteInfo::readFromBuf(Buffer *buf) { onTrackStatus = OnTrackEnum(buf->readNext8bit()); simInfoStatus = buf->readNextUnaligned16bit(); timeToGoal = buf->readNextUnaligned32bit(); distToWpt = buf->readNextUnaligned32bit(); distToGoal = buf->readNextUnaligned32bit(); distToTrack = buf->readNextUnaligned32bit(); lat = buf->readNextUnaligned32bit(); lon = buf->readNextUnaligned32bit(); // origLat = buf->readNextUnaligned32bit(); // origLon = buf->readNextUnaligned32bit(); // destLat = buf->readNextUnaligned32bit(); // destLon = buf->readNextUnaligned32bit(); toOnTrackTurn = buf->readNext8bit(); toTrackTurn = buf->readNext8bit(); timeToWpt = buf->readNextUnaligned16bit(); latency = buf->readNextUnaligned16bit(); speed = buf->readNextUnaligned16bit(); overSpeed = buf->readNext8bit() != 0; toTarget = buf->readNext8bit(); crossingNo = buf->readNextUnaligned16bit(); currSeg.readFromBuf(buf); distToAltAttribSegment = buf->readNextUnaligned32bit(); altAttribSegment.readFromBuf(buf); currCrossing.readFromBuf(buf); nextSeg1.readFromBuf(buf); nextCrossing1.readFromBuf(buf); nextSeg2.readFromBuf(buf); int numLandmarks = buf->readNext8bit(); int i; landmark_container::iterator lmIt; for( lmIt = rip_landmarks.begin(); lmIt != rip_landmarks.end(); ++lmIt ) { delete *lmIt; } rip_landmarks.resize(numLandmarks); for (i=0; i<numLandmarks; ++i) { rip_landmarks[i]=new RouteInfoParts::Landmark(buf); } rip_lanes.noLanes = buf->readNext8bit()==1; rip_lanes.distance = buf->readNextUnaligned32bit(); int numLanes = buf->readNext8bit(); RouteInfoParts::Lanes::rip_lane_vector::iterator lvIt; for( lvIt = rip_lanes.m_laneVector.begin(); lvIt != rip_lanes.m_laneVector.end(); ++lvIt ) { delete *lvIt; } rip_lanes.m_laneVector.resize(numLanes); for( i=0; i<numLanes; ++i ){ RouteInfoParts::Lane* lane = new RouteInfoParts::Lane(buf); rip_lanes.m_laneVector[i] = lane; } rip_signpost = RouteInfoParts::SignPost(buf); } RouteInfo& RouteInfo::operator=( const RouteInfo& other ) { if ( this != &other ) { Buffer buf(100); other.writeToBuf( &buf ); this->readFromBuf( &buf ); } return *this; } RouteInfo::RouteInfo( const RouteInfo& other ) { *this = other; } RouteInfo::~RouteInfo() { landmark_container::iterator lmIt; for( lmIt = rip_landmarks.begin(); lmIt != rip_landmarks.end(); ++lmIt ) { delete *lmIt; } RouteInfoParts::Lanes::rip_lane_vector::iterator lnIt; for( lnIt = rip_lanes.m_laneVector.begin(); lnIt != rip_lanes.m_laneVector.end(); ++lnIt ) { delete *lnIt; } rip_lanes.m_laneVector.clear(); } int RouteInfo::log(class Log* log) const { #ifndef NO_LOG_OUTPUT log->debug("--- Start of Routeinfo %p ---", (void*)this); log->debug(" onTrackStatus: %u", onTrackStatus); log->debug(" simInfoStatus: %"PRIu16, simInfoStatus); log->debug(" timeToGoal : %"PRId32, timeToGoal); log->debug(" distToWpt : %"PRId32, distToWpt); log->debug(" distToGoal : %"PRId32, distToGoal); log->debug(" distToTrack : %"PRId32, distToTrack); log->debug(" lat : %"PRId32, lat); log->debug(" lon : %"PRId32, lon); log->debug(" toOnTrackTurn: %"PRIu8, toOnTrackTurn); log->debug(" toTrackTurn : %"PRIu8, toTrackTurn); log->debug(" timeToWpt : %"PRIu16, timeToWpt); log->debug(" latency : %"PRIu16, latency); log->debug(" speed : %"PRIu16, speed); log->debug(" overSpeed : %s", overSpeed ? "yes" : "no"); log->debug(" toTarget : %"PRIu8, toTarget); log->debug(" crossingNo : %"PRId16, crossingNo); currSeg.log(log, "currSeg"); log->debug(" distToAltAttribSegment: %"PRId32, distToAltAttribSegment); altAttribSegment.log(log, "altAttribSegment"); currCrossing.log(log, "currCrossing"); nextSeg1.log(log, "nextSeg1"); nextCrossing1.log(log, "nextCrossing1"); nextSeg2.log(log, "nextSeg2"); log->debug(" rip_landmarks (%u):", rip_landmarks.size()); for(landmark_container::const_iterator q = rip_landmarks.begin(); q != rip_landmarks.end(); ++q){ (*q)->log(log, std::distance(rip_landmarks.begin(), q)); } log->debug("--- End of Routeinfo %p ---", (void*)this); #endif return 0; } const char * RouteInfo::hasDetourLandmark(enum RouteInfoParts::Landmark::StartStopQuery q) const { landmark_container::const_iterator i = rip_landmarks.begin(); while (i != rip_landmarks.end()) { if ((*i)->isDetour(q, distToWpt)) { return (*i)->getDescription(); } ++i; } return NULL; } const char * RouteInfo::hasSpeedCameraLandmark( enum RouteInfoParts::Landmark::StartStopQuery q) const { landmark_container::const_iterator i = rip_landmarks.begin(); while (i != rip_landmarks.end()) { if ((*i)->isSpeedCamera(q, distToWpt)) { return (*i)->getDescription();; } ++i; } return NULL; } /******************************************************/ /**************** RouteList **************************/ /******************************************************/ RouteList::RouteList(Buffer *buf) { const int numCrossings = buf->readNextUnaligned16bit(); crossings.resize(numCrossings); for (int i=0; i<numCrossings; ++i) { RouteInfoParts::RouteListCrossing *tmpcrossing = new RouteInfoParts::RouteListCrossing; tmpcrossing->readFromBuf(buf); crossings[i]=tmpcrossing; } } void RouteList::writeToBuf(Buffer *buf) const { buf->writeNextUnaligned16bit(crossings.size()); std::vector<RouteInfoParts::RouteListCrossing *>::const_iterator i; for (i=crossings.begin(); i!=crossings.end(); ++i) { (*i)->writeToBuf(buf); } } RouteList::~RouteList() { std::vector<RouteInfoParts::RouteListCrossing *>::iterator i; for (i=crossings.begin(); i!=crossings.end(); ++i) { delete *i; } } }
{ "content_hash": "e76606bc51233d21bf112a8de7e7eea4", "timestamp": "", "source": "github", "line_count": 793, "max_line_length": 112, "avg_line_length": 32.23203026481715, "alnum_prop": 0.5643974960876369, "repo_name": "wayfinder/Wayfinder-CppCore-v2", "id": "74045ddb92cf1b0fd39097553a25b921eb7cde27", "size": "27088", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "cpp/Shared/RouteInfo.cpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "7768867" }, { "name": "C++", "bytes": "10721081" }, { "name": "Objective-C", "bytes": "320116" }, { "name": "Shell", "bytes": "7147" } ], "symlink_target": "" }
VaST finds the minimum number of variant site targets that are required to differentiate a collection of strains. VaST is specifically designed to assist with generating panels for amplicon sequencing (AmpSeq). ## Clone VaST ``` git clone https://TaraFurstenau@bitbucket.org/fofanovlab/vast.git cd vast ``` ## Create Conda Environment ``` conda env create -f vast_env.yml source activate vast_env ``` ## Preprocessing Module The preprocessing module includes the Amplicon Filter and the Pattern Discovery steps and outputs a JSON file which can be passed to the Pattern Selection Module. The Amplicon Filter treates each variant site as a potential amplicon, combining adjacent sites as necessary and filters out any amplicons that may be difficult to amplify in all strains. During Pattern Discovery, amplicons are divided into groups based on their resolution patterns which describes how the strains vary at the amplicon. ### Inputs VaST must be provided a variant site matrix (`VAR_MATRIX_PATH`) where each row represents a genomic site that varies across the columns of strains; the values in the marix characterize the state of each strain at the variable sites. Many different types of genomic variation can be included in this matrix (SNPs, indels, VNTRs) provided that the variable region is short enough to be captured in an AmpSeq reaction. The first column of the variant site matrix should contain a genome identifier, a start position, and an end position separated by two colons, (e.g genome123::115::115). The start and end position should be the same for SNPs and for VNTRs, the stopping position should be based on the longest repeat. To run the Amplicon Filter Module, VaST requires information about the regions upstream and downstream of each of the variable sites. Therefore, either a full genome matrix (`FULL_MATRIX_PATH`) must be provided which should include a call for each position in the genome for all of the strains or a previously generated flag file (`FLAG_FILE_PATH`) must be provided. The full genome matrix can be generated through the alignment of genome assemblies to a reference genome (same reference that was used to identify variant sites) or from VCF files that contain calls for each position in the genome. The first column of the full genome matrix should have a genome ID and the position separated by two colons, (e.g genome123::115). See `./example` for examples. ### Usage ``` $ python ./VaST/preprocessing.py --help usage: AMPLICON_FILTER [-h] (--full_matrix_path FULL_MATRIX_PATH | --flag_file_path FLAG_FILE_PATH) [-d {tab,comma,space}] [-w WINDOW] [-s] [-c STRAIN_CUTOFF] [-z PZ_SIZE] [-l PZ_FILTER_LENGTH] [-p PZ_FILTER_PERCENT] [--log {DEBUG,INFO,WARNING}] [-x EXCLUDE_STRAINS] [-t THREADS] PROJECT_NAME PROJECT_DIR VAR_MATRIX_PATH Parses a variant site matrix to find candidate amplicons positional arguments: PROJECT_NAME Project name and output file prefix PROJECT_DIR Project directory VAR_MATRIX_PATH Path to variant site matrices optional arguments: -h, --help show this help message and exit -d {tab,comma,space}, --sep {tab,comma,space} Specify the file delimiter of variant site matrix (default: tab) -w WINDOW, --window WINDOW Size of window for variable region. (HINT: Should be small enough to fit in desired amplicon with room for upstream and downstream primer zone) (default: 50) -s, --strict Strict mode ignores sites with missing or ambiguous data (default: False) -c STRAIN_CUTOFF, --strain_cutoff STRAIN_CUTOFF The number of strains at a primer zone site that can have a non-conserved call before the site is flagged (default: 1) -z PZ_SIZE, --pz_size PZ_SIZE Size of the primer zone (default: 200) -l PZ_FILTER_LENGTH, --pz_filter_length PZ_FILTER_LENGTH The length of un-flagged primer zone segments that count toward the primer zone filter percent (default: 25) -p PZ_FILTER_PERCENT, --pz_filter_percent PZ_FILTER_PERCENT The percent of primer zone positions that must be present in un-flagged segments of the primer zone that are longer than the primer zone filter length (default: 25) --log {DEBUG,INFO,WARNING} Set logging level (default: INFO) -x EXCLUDE_STRAINS, --exclude_strains EXCLUDE_STRAINS Path to file containing a list of strains to exclude from analysis in a single column (default: None) -t THREADS, --threads THREADS Number of threads for multiprocessing (default: 1) Filter file type: Provide full genome matrix or an already calculated flag file --full_matrix_path FULL_MATRIX_PATH Path to full genome matrix (includes calls at every site in the genome) (default: None) --flag_file_path FLAG_FILE_PATH Path to precomputed flag file (default: None) ``` ### Parameters | Parameter | Description | Notes | |---|---|---| | Strict mode | VaST ignores missing or ambiguous data in input matrix | Speeds up preprocessing but some sites are lost | | Window Size | Maximum distance between adjacent sites that can be combined into a single amplicon |The desired amplicon length should be considered when setting the window size. A larger window may increase the number of variant sites that are included in the amplicons making them more efficient | | Primer Zone Size | Size of the region upstream and downstream of the target to evaluate in the amplicon filter | The primer zones begin immediately before the first and immediately after the last target site in the window, so the maximum amplicon size is 2 x primer zone size + window size. A smaller primer zone may limit the number of primer options. | |Strain Cutoff |The number of strains at a primer zone site that can have a non-conserved call before the site is flagged | A strain cutoff greater than one will not guarantee that the primer zone sequences are conserved across all of the strains but it may be appropriate in cases where one or a few strains have low sequence coverage| |Primer Zone Filter Percent|The percent of primer zone positions that must be present in un-flagged segments of the primer zone that are longer than the primer zone filter length| A higher primer zone filter percent will increase the total number of primer options in amplicons that pass the filter| |Primer Zone Filter Length | The length of un-flagged primer zone segments that count toward the primer zone filter percent |The primer zone filter length should be at least as long as the minimum acceptable primer length to ensure that conserved primers can be found within the primer zone.| ## Pattern Selection Module The Pattern Selection Module uses the patterns from Pattern Discovery and finds the minimum number of patterns that maximize strain resolution. ### Inputs The Pattern Selection Module requires a project name and the path to the root of the Preprocessing project directory that contains the desired pattern JSON file. The output of the Pattern Selection Module will be placed in a directory within the Preprocessing project directory. ### Usage ``` $ python ./VaST/pattern_selection.py --help usage: PATTERN_SELECTION [-h] [--res RES] [--stop_at_res] [--log {DEBUG,INFO,WARNING}] [-t THREADS] [--reps REPS] [--max_loci MAX_LOCI | --max_res MAX_RES] [--required_loci [REQUIRED_LOCI [REQUIRED_LOCI ...]] | --req_loci_file REQ_LOCI_FILE] [--exclude_loci [EXCLUDE_LOCI [EXCLUDE_LOCI ...]] | --excl_loci_file EXCL_LOCI_FILE] [--exclude_strains [EXCLUDE_STRAINS [EXCLUDE_STRAINS ...]] | --excl_strains_file EXCL_STRAINS_FILE] PROJECT_NAME PROJECT_DIR Find the minimum set of patterns that uniquely identify all strains positional arguments: PROJECT_NAME Project name and output file prefix PROJECT_DIR Path to preprocessing directory optional arguments: -h, --help show this help message and exit --res RES Path to file which defines the desired level of resolution for each of the strains (the default if full strain resolution) The resolution file should be a csv table with each row starting with a strain name (exactly as it appears in the variant site matrix) followed by a group ID. Strains with the same group ID will not be resolved. Multiple columns of group IDs may be present but must start with the lowest resolution grouping and increase to higher resolution groupings and must be consistent. (default: None) --stop_at_res Force solution to stop once the maximum level specified in resolution file has been reached. Otherwise, the solution will continue towards full strain resolution once it has achieved the level of resolution defined in the file. It will only terminate early when MAX_LOCI is reached or no more resolution is achievable. (default: False) --log {DEBUG,INFO,WARNING} Set logging level (default: INFO) -t THREADS, --threads THREADS Set number of threads (default: 1) --reps REPS Run N sets at a time and pick the best (default: 1) Early Termination: Options for creating early stopping points --max_loci MAX_LOCI Stop after MAX_LOCI is reached. If required loci are added, MAX_LOCI must be greater than or equal to the number of required loci. (default: inf) --max_res MAX_RES Stop when the resolution has reached MAX_RES percent of total resolution. (default: 100) Add required loci to solution: Add loci that must be included in the solution either from command line or from file. Names should match the locus ID given in the variant site matrix. --required_loci [REQUIRED_LOCI [REQUIRED_LOCI ...]] List of locus IDs that must be included in solution. (default: []) --req_loci_file REQ_LOCI_FILE Path to file containing list of locus IDs (in a single column) that must be included in solution. (default: None) Exclude loci from consideration: Add loci either from command line or from file. These loci will removed from consideration when building the solution. Names should match the locus ID given in the variant site matrix. --exclude_loci [EXCLUDE_LOCI [EXCLUDE_LOCI ...]] List of loci that must be excluded from solution (default: []) --excl_loci_file EXCL_LOCI_FILE Path to file containing list of locus IDs (in a single column) that must be excluded from solution. (default: None) Exclude strains from consideration: Add strains either from command line or from file. Names should match the variant site matrix. --exclude_strains [EXCLUDE_STRAINS [EXCLUDE_STRAINS ...]] List of strains to be excluded (default: []) --excl_strains_file EXCL_STRAINS_FILE Path to file containing list of strains (in a single column) that should be excluded (default: None) ``` ### Output The pattern selection module outputs 3 main files: amplicons_{TIMESTAMP}.csv, haplotypes_{TIMESTAMP}.csv, and patterns_{TIMESTAMP}.csv. #### Haplotypes | | Amplicon_Order | Amplicon_ID | Reference | example_1 | example_1_L001::BWA-mem | |-------------------------|----------------|-------------|-----------|-----------|-------------------------| | 500WT1_test::1373::1373 | 1 | 0 | X | G | G | | 500WT1_test::1374::1374 | 1 | 0 | C | T | T | - **First Column:** The site ids - **Amplicon_Order:** The order in which each amplicon was added to the set - **Amplicon_ID:** A unique identifier for the amplicon which corresponds to information in amplicons_{TIMESTAMP}.csv. Multiple sites may belong to the same amplicon id. - **Remaining Columns:** Each remaining column represents the haplotype of the given genome at each site. #### Amplicons | Amplicon_ID | Sequence_ID | Start_Position | End_Position | Target_Size | Resolution_Score | Num_of_Sites | Sites | Upstream_Primerzone | Downstream_Primerzone | |-------------|-------------|----------------|--------------|-------------|------------------|--------------|-------------------------------------------------|---------------------|-----------------------| | 0 | 500WT1_test | 1373 | 1374 | 2 | 66.6666666667 | 2 | 500WT1_test::1373::1373 500WT1_test::1374::1374 | 0,0,0,0,0,0,... | 0,0,0,0,0,... | - **Amplicon_ID:** A unique identifier for each amplicon - **Sequence_ID:** The name of the sequence where the amplicon was discovered. - **Start_Position:** The start position of the amplicon target in the sequence. - **End_Position:** The last position of the amplicon target in the sequence. - **Target_Size:** The total length of the target region. - **Resolution_Score:** The cumulative resolution score for each additional amplicon. - **Num_of_sites:** The total number of variant sites that are included in the target. - **Sites:** The site ids for each variant site. This corresponds to the first column in haplotypes_{TIMESTAMP}.csv. - **Upstream_Primerzone:** A list where each value represents a position in the upstream primer region. The counts provide how many genomes have non-conserved calls at each position. These regions may be avoided for subsequent primer design efforts. - **Downstream_Primerzone:** A list where each value represents a position in the downstream primer region. The counts provide how many genomes have non-conserved calls at each position. These regions may be avoided for subsequent primer design efforts. #### Patterns | | 0 | |-------------------------|------| | Reference | (0,) | | example_1 | (1,) | | example_1_L001::BWA-mem | (1,) | -**First Column:** Genome ids -**Remaining Columns:** Each column represents the pattern of differentiation provided by each amplicon. The column header is the amplicon id that corresponds to the other output files. The differentiation pattern is within the context of all the previous amplicons (i.e. it is not their independent differentiation pattern). Genomes that share the same group number have not been resolved. Some genomes may be members of multiple groups due to ambiguous base calls and will therefore have multiple numbers in the tuple.
{ "content_hash": "5cd0a605d7e733308260883df5fefd7c", "timestamp": "", "source": "github", "line_count": 236, "max_line_length": 759, "avg_line_length": 67.16949152542372, "alnum_prop": 0.6445874337623013, "repo_name": "FofanovLab/VaST", "id": "6d0178e9680841392a18d325f0881b61920a352f", "size": "15913", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "readme.md", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "100395" } ], "symlink_target": "" }
#!/usr/bin/env python # # Copyright 2012 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # * Neither the name of Google Inc. nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # # Emits a C++ file to be compiled and linked into libv8 to support postmortem # debugging tools. Most importantly, this tool emits constants describing V8 # internals: # # v8dbg_type_CLASS__TYPE = VALUE Describes class type values # v8dbg_class_CLASS__FIELD__TYPE = OFFSET Describes class fields # v8dbg_parent_CLASS__PARENT Describes class hierarchy # v8dbg_frametype_NAME = VALUE Describes stack frame values # v8dbg_off_fp_NAME = OFFSET Frame pointer offsets # v8dbg_prop_NAME = OFFSET Object property offsets # v8dbg_NAME = VALUE Miscellaneous values # # These constants are declared as global integers so that they'll be present in # the generated libv8 binary. # import re import sys # # Miscellaneous constants such as tags and masks used for object identification, # enumeration values used as indexes in internal tables, etc.. # consts_misc = [ { 'name': 'FirstNonstringType', 'value': 'FIRST_NONSTRING_TYPE' }, { 'name': 'APIObjectType', 'value': 'JS_API_OBJECT_TYPE' }, { 'name': 'SpecialAPIObjectType', 'value': 'JS_SPECIAL_API_OBJECT_TYPE' }, { 'name': 'IsNotStringMask', 'value': 'kIsNotStringMask' }, { 'name': 'StringTag', 'value': 'kStringTag' }, { 'name': 'NotStringTag', 'value': 'kNotStringTag' }, { 'name': 'StringEncodingMask', 'value': 'kStringEncodingMask' }, { 'name': 'TwoByteStringTag', 'value': 'kTwoByteStringTag' }, { 'name': 'OneByteStringTag', 'value': 'kOneByteStringTag' }, { 'name': 'StringRepresentationMask', 'value': 'kStringRepresentationMask' }, { 'name': 'SeqStringTag', 'value': 'kSeqStringTag' }, { 'name': 'ConsStringTag', 'value': 'kConsStringTag' }, { 'name': 'ExternalStringTag', 'value': 'kExternalStringTag' }, { 'name': 'SlicedStringTag', 'value': 'kSlicedStringTag' }, { 'name': 'HeapObjectTag', 'value': 'kHeapObjectTag' }, { 'name': 'HeapObjectTagMask', 'value': 'kHeapObjectTagMask' }, { 'name': 'SmiTag', 'value': 'kSmiTag' }, { 'name': 'SmiTagMask', 'value': 'kSmiTagMask' }, { 'name': 'SmiValueShift', 'value': 'kSmiTagSize' }, { 'name': 'SmiShiftSize', 'value': 'kSmiShiftSize' }, { 'name': 'PointerSizeLog2', 'value': 'kPointerSizeLog2' }, { 'name': 'OddballFalse', 'value': 'Oddball::kFalse' }, { 'name': 'OddballTrue', 'value': 'Oddball::kTrue' }, { 'name': 'OddballTheHole', 'value': 'Oddball::kTheHole' }, { 'name': 'OddballNull', 'value': 'Oddball::kNull' }, { 'name': 'OddballArgumentsMarker', 'value': 'Oddball::kArgumentsMarker' }, { 'name': 'OddballUndefined', 'value': 'Oddball::kUndefined' }, { 'name': 'OddballUninitialized', 'value': 'Oddball::kUninitialized' }, { 'name': 'OddballOther', 'value': 'Oddball::kOther' }, { 'name': 'OddballException', 'value': 'Oddball::kException' }, { 'name': 'prop_idx_first', 'value': 'DescriptorArray::kFirstIndex' }, { 'name': 'prop_type_field', 'value': 'DATA' }, { 'name': 'prop_type_const_field', 'value': 'DATA_CONSTANT' }, { 'name': 'prop_type_mask', 'value': 'PropertyDetails::TypeField::kMask' }, { 'name': 'prop_index_mask', 'value': 'PropertyDetails::FieldIndexField::kMask' }, { 'name': 'prop_index_shift', 'value': 'PropertyDetails::FieldIndexField::kShift' }, { 'name': 'prop_representation_mask', 'value': 'PropertyDetails::RepresentationField::kMask' }, { 'name': 'prop_representation_shift', 'value': 'PropertyDetails::RepresentationField::kShift' }, { 'name': 'prop_representation_integer8', 'value': 'Representation::Kind::kInteger8' }, { 'name': 'prop_representation_uinteger8', 'value': 'Representation::Kind::kUInteger8' }, { 'name': 'prop_representation_integer16', 'value': 'Representation::Kind::kInteger16' }, { 'name': 'prop_representation_uinteger16', 'value': 'Representation::Kind::kUInteger16' }, { 'name': 'prop_representation_smi', 'value': 'Representation::Kind::kSmi' }, { 'name': 'prop_representation_integer32', 'value': 'Representation::Kind::kInteger32' }, { 'name': 'prop_representation_double', 'value': 'Representation::Kind::kDouble' }, { 'name': 'prop_representation_heapobject', 'value': 'Representation::Kind::kHeapObject' }, { 'name': 'prop_representation_tagged', 'value': 'Representation::Kind::kTagged' }, { 'name': 'prop_representation_external', 'value': 'Representation::Kind::kExternal' }, { 'name': 'prop_desc_key', 'value': 'DescriptorArray::kDescriptorKey' }, { 'name': 'prop_desc_details', 'value': 'DescriptorArray::kDescriptorDetails' }, { 'name': 'prop_desc_value', 'value': 'DescriptorArray::kDescriptorValue' }, { 'name': 'prop_desc_size', 'value': 'DescriptorArray::kDescriptorSize' }, { 'name': 'elements_fast_holey_elements', 'value': 'FAST_HOLEY_ELEMENTS' }, { 'name': 'elements_fast_elements', 'value': 'FAST_ELEMENTS' }, { 'name': 'elements_dictionary_elements', 'value': 'DICTIONARY_ELEMENTS' }, { 'name': 'bit_field2_elements_kind_mask', 'value': 'Map::ElementsKindBits::kMask' }, { 'name': 'bit_field2_elements_kind_shift', 'value': 'Map::ElementsKindBits::kShift' }, { 'name': 'bit_field3_dictionary_map_shift', 'value': 'Map::DictionaryMap::kShift' }, { 'name': 'bit_field3_number_of_own_descriptors_mask', 'value': 'Map::NumberOfOwnDescriptorsBits::kMask' }, { 'name': 'bit_field3_number_of_own_descriptors_shift', 'value': 'Map::NumberOfOwnDescriptorsBits::kShift' }, { 'name': 'off_fp_context', 'value': 'StandardFrameConstants::kContextOffset' }, { 'name': 'off_fp_constant_pool', 'value': 'StandardFrameConstants::kConstantPoolOffset' }, { 'name': 'off_fp_function', 'value': 'JavaScriptFrameConstants::kFunctionOffset' }, { 'name': 'off_fp_args', 'value': 'JavaScriptFrameConstants::kLastParameterOffset' }, { 'name': 'scopeinfo_idx_nparams', 'value': 'ScopeInfo::kParameterCount' }, { 'name': 'scopeinfo_idx_nstacklocals', 'value': 'ScopeInfo::kStackLocalCount' }, { 'name': 'scopeinfo_idx_ncontextlocals', 'value': 'ScopeInfo::kContextLocalCount' }, { 'name': 'scopeinfo_idx_first_vars', 'value': 'ScopeInfo::kVariablePartIndex' }, { 'name': 'sharedfunctioninfo_start_position_mask', 'value': 'SharedFunctionInfo::kStartPositionMask' }, { 'name': 'sharedfunctioninfo_start_position_shift', 'value': 'SharedFunctionInfo::kStartPositionShift' }, { 'name': 'jsarray_buffer_was_neutered_mask', 'value': 'JSArrayBuffer::WasNeutered::kMask' }, { 'name': 'jsarray_buffer_was_neutered_shift', 'value': 'JSArrayBuffer::WasNeutered::kShift' }, { 'name': 'context_idx_closure', 'value': 'Context::CLOSURE_INDEX' }, { 'name': 'context_idx_native', 'value': 'Context::NATIVE_CONTEXT_INDEX' }, { 'name': 'context_idx_prev', 'value': 'Context::PREVIOUS_INDEX' }, { 'name': 'context_idx_ext', 'value': 'Context::EXTENSION_INDEX' }, { 'name': 'context_min_slots', 'value': 'Context::MIN_CONTEXT_SLOTS' }, { 'name': 'namedictionaryshape_prefix_size', 'value': 'NameDictionaryShape::kPrefixSize' }, { 'name': 'namedictionaryshape_entry_size', 'value': 'NameDictionaryShape::kEntrySize' }, { 'name': 'globaldictionaryshape_entry_size', 'value': 'GlobalDictionaryShape::kEntrySize' }, { 'name': 'namedictionary_prefix_start_index', 'value': 'NameDictionary::kPrefixStartIndex' }, { 'name': 'seedednumberdictionaryshape_prefix_size', 'value': 'SeededNumberDictionaryShape::kPrefixSize' }, { 'name': 'seedednumberdictionaryshape_entry_size', 'value': 'SeededNumberDictionaryShape::kEntrySize' }, { 'name': 'unseedednumberdictionaryshape_prefix_size', 'value': 'UnseededNumberDictionaryShape::kPrefixSize' }, { 'name': 'unseedednumberdictionaryshape_entry_size', 'value': 'UnseededNumberDictionaryShape::kEntrySize' } ]; # # The following useful fields are missing accessors, so we define fake ones. # Please note that extra accessors should _only_ be added to expose offsets that # can be used to access actual V8 objects' properties. They should not be added # for exposing other values. For instance, enumeration values or class' # constants should be exposed by adding an entry in the "consts_misc" table, not # in this "extras_accessors" table. # extras_accessors = [ 'JSFunction, context, Context, kContextOffset', 'HeapObject, map, Map, kMapOffset', 'JSObject, elements, Object, kElementsOffset', 'JSObject, internal_fields, uintptr_t, kHeaderSize', 'FixedArray, data, uintptr_t, kHeaderSize', 'JSArrayBuffer, backing_store, Object, kBackingStoreOffset', 'JSArrayBufferView, byte_offset, Object, kByteOffsetOffset', 'JSTypedArray, length, Object, kLengthOffset', 'Map, instance_attributes, int, kInstanceAttributesOffset', 'Map, inobject_properties_or_constructor_function_index, int, kInObjectPropertiesOrConstructorFunctionIndexOffset', 'Map, instance_size, int, kInstanceSizeOffset', 'Map, bit_field, char, kBitFieldOffset', 'Map, bit_field2, char, kBitField2Offset', 'Map, bit_field3, int, kBitField3Offset', 'Map, prototype, Object, kPrototypeOffset', 'Oddball, kind_offset, int, kKindOffset', 'HeapNumber, value, double, kValueOffset', 'ConsString, first, String, kFirstOffset', 'ConsString, second, String, kSecondOffset', 'ExternalString, resource, Object, kResourceOffset', 'SeqOneByteString, chars, char, kHeaderSize', 'SeqTwoByteString, chars, char, kHeaderSize', 'SharedFunctionInfo, code, Code, kCodeOffset', 'SharedFunctionInfo, scope_info, ScopeInfo, kScopeInfoOffset', 'SlicedString, parent, String, kParentOffset', 'Code, instruction_start, uintptr_t, kHeaderSize', 'Code, instruction_size, int, kInstructionSizeOffset', ]; # # The following is a whitelist of classes we expect to find when scanning the # source code. This list is not exhaustive, but it's still useful to identify # when this script gets out of sync with the source. See load_objects(). # expected_classes = [ 'ConsString', 'FixedArray', 'HeapNumber', 'JSArray', 'JSFunction', 'JSObject', 'JSRegExp', 'JSValue', 'Map', 'Oddball', 'Script', 'SeqOneByteString', 'SharedFunctionInfo' ]; # # The following structures store high-level representations of the structures # for which we're going to emit descriptive constants. # types = {}; # set of all type names typeclasses = {}; # maps type names to corresponding class names klasses = {}; # known classes, including parents fields = []; # field declarations header = ''' /* * This file is generated by %s. Do not edit directly. */ #include "src/v8.h" #include "src/frames.h" #include "src/frames-inl.h" /* for architecture-specific frame constants */ #include "src/contexts.h" using namespace v8::internal; extern "C" { /* stack frame constants */ #define FRAME_CONST(value, klass) \ int v8dbg_frametype_##klass = StackFrame::value; STACK_FRAME_TYPE_LIST(FRAME_CONST) #undef FRAME_CONST ''' % sys.argv[0]; footer = ''' } ''' # # Get the base class # def get_base_class(klass): if (klass == 'Object'): return klass; if (not (klass in klasses)): return None; k = klasses[klass]; return get_base_class(k['parent']); # # Loads class hierarchy and type information from "objects.h". # def load_objects(): objfilename = sys.argv[2]; objfile = open(objfilename, 'r'); in_insttype = False; typestr = ''; # # Construct a dictionary for the classes we're sure should be present. # checktypes = {}; for klass in expected_classes: checktypes[klass] = True; # # Iterate objects.h line-by-line to collect type and class information. # For types, we accumulate a string representing the entire InstanceType # enum definition and parse it later because it's easier to do so # without the embedded newlines. # for line in objfile: if (line.startswith('enum InstanceType {')): in_insttype = True; continue; if (in_insttype and line.startswith('};')): in_insttype = False; continue; line = re.sub('//.*', '', line.strip()); if (in_insttype): typestr += line; continue; match = re.match('class (\w[^:]*)(: public (\w[^{]*))?\s*{\s*', line); if (match): klass = match.group(1).strip(); pklass = match.group(3); if (pklass): pklass = pklass.strip(); klasses[klass] = { 'parent': pklass }; # # Process the instance type declaration. # entries = typestr.split(','); for entry in entries: types[re.sub('\s*=.*', '', entry).lstrip()] = True; # # Infer class names for each type based on a systematic transformation. # For example, "JS_FUNCTION_TYPE" becomes "JSFunction". We find the # class for each type rather than the other way around because there are # fewer cases where one type maps to more than one class than the other # way around. # for type in types: # # Symbols and Strings are implemented using the same classes. # usetype = re.sub('SYMBOL_', 'STRING_', type); # # REGEXP behaves like REG_EXP, as in JS_REGEXP_TYPE => JSRegExp. # usetype = re.sub('_REGEXP_', '_REG_EXP_', usetype); # # Remove the "_TYPE" suffix and then convert to camel case, # except that a "JS" prefix remains uppercase (as in # "JS_FUNCTION_TYPE" => "JSFunction"). # if (not usetype.endswith('_TYPE')): continue; usetype = usetype[0:len(usetype) - len('_TYPE')]; parts = usetype.split('_'); cctype = ''; if (parts[0] == 'JS'): cctype = 'JS'; start = 1; else: cctype = ''; start = 0; for ii in range(start, len(parts)): part = parts[ii]; cctype += part[0].upper() + part[1:].lower(); # # Mapping string types is more complicated. Both types and # class names for Strings specify a representation (e.g., Seq, # Cons, External, or Sliced) and an encoding (TwoByte/OneByte), # In the simplest case, both of these are explicit in both # names, as in: # # EXTERNAL_ONE_BYTE_STRING_TYPE => ExternalOneByteString # # However, either the representation or encoding can be omitted # from the type name, in which case "Seq" and "TwoByte" are # assumed, as in: # # STRING_TYPE => SeqTwoByteString # # Additionally, sometimes the type name has more information # than the class, as in: # # CONS_ONE_BYTE_STRING_TYPE => ConsString # # To figure this out dynamically, we first check for a # representation and encoding and add them if they're not # present. If that doesn't yield a valid class name, then we # strip out the representation. # if (cctype.endswith('String')): if (cctype.find('Cons') == -1 and cctype.find('External') == -1 and cctype.find('Sliced') == -1): if (cctype.find('OneByte') != -1): cctype = re.sub('OneByteString$', 'SeqOneByteString', cctype); else: cctype = re.sub('String$', 'SeqString', cctype); if (cctype.find('OneByte') == -1): cctype = re.sub('String$', 'TwoByteString', cctype); if (not (cctype in klasses)): cctype = re.sub('OneByte', '', cctype); cctype = re.sub('TwoByte', '', cctype); # # Despite all that, some types have no corresponding class. # if (cctype in klasses): typeclasses[type] = cctype; if (cctype in checktypes): del checktypes[cctype]; if (len(checktypes) > 0): for klass in checktypes: print('error: expected class \"%s\" not found' % klass); sys.exit(1); # # For a given macro call, pick apart the arguments and return an object # describing the corresponding output constant. See load_fields(). # def parse_field(call): # Replace newlines with spaces. for ii in range(0, len(call)): if (call[ii] == '\n'): call[ii] == ' '; idx = call.find('('); kind = call[0:idx]; rest = call[idx + 1: len(call) - 1]; args = re.split('\s*,\s*', rest); consts = []; if (kind == 'ACCESSORS' or kind == 'ACCESSORS_GCSAFE'): klass = args[0]; field = args[1]; dtype = args[2]; offset = args[3]; return ({ 'name': 'class_%s__%s__%s' % (klass, field, dtype), 'value': '%s::%s' % (klass, offset) }); assert(kind == 'SMI_ACCESSORS' or kind == 'ACCESSORS_TO_SMI'); klass = args[0]; field = args[1]; offset = args[2]; return ({ 'name': 'class_%s__%s__%s' % (klass, field, 'SMI'), 'value': '%s::%s' % (klass, offset) }); # # Load field offset information from objects-inl.h. # def load_fields(): inlfilename = sys.argv[3]; inlfile = open(inlfilename, 'r'); # # Each class's fields and the corresponding offsets are described in the # source by calls to macros like "ACCESSORS" (and friends). All we do # here is extract these macro invocations, taking into account that they # may span multiple lines and may contain nested parentheses. We also # call parse_field() to pick apart the invocation. # prefixes = [ 'ACCESSORS', 'ACCESSORS_GCSAFE', 'SMI_ACCESSORS', 'ACCESSORS_TO_SMI' ]; current = ''; opens = 0; for line in inlfile: if (opens > 0): # Continuation line for ii in range(0, len(line)): if (line[ii] == '('): opens += 1; elif (line[ii] == ')'): opens -= 1; if (opens == 0): break; current += line[0:ii + 1]; continue; for prefix in prefixes: if (not line.startswith(prefix + '(')): continue; if (len(current) > 0): fields.append(parse_field(current)); current = ''; for ii in range(len(prefix), len(line)): if (line[ii] == '('): opens += 1; elif (line[ii] == ')'): opens -= 1; if (opens == 0): break; current += line[0:ii + 1]; if (len(current) > 0): fields.append(parse_field(current)); current = ''; for body in extras_accessors: fields.append(parse_field('ACCESSORS(%s)' % body)); # # Emit a block of constants. # def emit_set(out, consts): # Fix up overzealous parses. This could be done inside the # parsers but as there are several, it's easiest to do it here. ws = re.compile('\s+') for const in consts: name = ws.sub('', const['name']) value = ws.sub('', str(const['value'])) # Can be a number. out.write('int v8dbg_%s = %s;\n' % (name, value)) out.write('\n'); # # Emit the whole output file. # def emit_config(): out = file(sys.argv[1], 'w'); out.write(header); out.write('/* miscellaneous constants */\n'); emit_set(out, consts_misc); out.write('/* class type information */\n'); consts = []; keys = typeclasses.keys(); keys.sort(); for typename in keys: klass = typeclasses[typename]; consts.append({ 'name': 'type_%s__%s' % (klass, typename), 'value': typename }); emit_set(out, consts); out.write('/* class hierarchy information */\n'); consts = []; keys = klasses.keys(); keys.sort(); for klassname in keys: pklass = klasses[klassname]['parent']; bklass = get_base_class(klassname); if (bklass != 'Object'): continue; if (pklass == None): continue; consts.append({ 'name': 'parent_%s__%s' % (klassname, pklass), 'value': 0 }); emit_set(out, consts); out.write('/* field information */\n'); emit_set(out, fields); out.write(footer); if (len(sys.argv) < 4): print('usage: %s output.cc objects.h objects-inl.h' % sys.argv[0]); sys.exit(2); load_objects(); load_fields(); emit_config();
{ "content_hash": "b53d189461123c65cf1674e2ef239fde", "timestamp": "", "source": "github", "line_count": 639, "max_line_length": 119, "avg_line_length": 39.30203442879499, "alnum_prop": 0.547901568846062, "repo_name": "joerg84/arangodb", "id": "c883b3f8cbf1159675f6cd20e7f6a99a23038bc6", "size": "25114", "binary": false, "copies": "1", "ref": "refs/heads/devel", "path": "3rdParty/V8/v5.7.0.0/tools/gen-postmortem-metadata.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Ada", "bytes": "89079" }, { "name": "Assembly", "bytes": "399979" }, { "name": "Awk", "bytes": "7502" }, { "name": "Batchfile", "bytes": "62496" }, { "name": "C", "bytes": "8969003" }, { "name": "C#", "bytes": "96431" }, { "name": "C++", "bytes": "276709880" }, { "name": "CMake", "bytes": "647521" }, { "name": "CSS", "bytes": "582111" }, { "name": "CWeb", "bytes": "174166" }, { "name": "Cuda", "bytes": "52444" }, { "name": "DIGITAL Command Language", "bytes": "259402" }, { "name": "Emacs Lisp", "bytes": "14637" }, { "name": "Fortran", "bytes": "1856" }, { "name": "Gherkin", "bytes": "31082" }, { "name": "Groovy", "bytes": "131" }, { "name": "HTML", "bytes": "2415147" }, { "name": "Java", "bytes": "1048556" }, { "name": "JavaScript", "bytes": "53976140" }, { "name": "LLVM", "bytes": "24169" }, { "name": "Lex", "bytes": "1231" }, { "name": "Lua", "bytes": "17899" }, { "name": "M4", "bytes": "658700" }, { "name": "Makefile", "bytes": "522586" }, { "name": "Max", "bytes": "36857" }, { "name": "Module Management System", "bytes": "1545" }, { "name": "NSIS", "bytes": "40920" }, { "name": "Objective-C", "bytes": "122447" }, { "name": "Objective-C++", "bytes": "2503" }, { "name": "PHP", "bytes": "111847" }, { "name": "Pascal", "bytes": "150599" }, { "name": "Perl", "bytes": "915273" }, { "name": "Perl 6", "bytes": "17347" }, { "name": "PowerShell", "bytes": "15315" }, { "name": "Python", "bytes": "4536513" }, { "name": "QMake", "bytes": "16692" }, { "name": "R", "bytes": "5123" }, { "name": "Rebol", "bytes": "354" }, { "name": "Roff", "bytes": "1089418" }, { "name": "Ruby", "bytes": "1045468" }, { "name": "SAS", "bytes": "1847" }, { "name": "Scheme", "bytes": "10604" }, { "name": "Shell", "bytes": "492324" }, { "name": "Swift", "bytes": "116" }, { "name": "Tcl", "bytes": "1172" }, { "name": "TeX", "bytes": "32117" }, { "name": "Visual Basic", "bytes": "11568" }, { "name": "XSLT", "bytes": "567028" }, { "name": "Yacc", "bytes": "53072" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <resources> <style name="app_theme" parent="android:style/Theme.Holo.Light"/> <style name="main_row"> <item name="android:layout_width">match_parent</item> <item name="android:layout_height">wrap_content</item> <item name="android:layout_marginBottom">10dp</item> <item name="android:gravity">center_vertical</item> <item name="android:orientation">horizontal</item> </style> <style name="main_label"> <item name="android:layout_width">0dp</item> <item name="android:layout_height">wrap_content</item> <item name="android:layout_marginEnd">10dp</item> <item name="android:layout_weight">1</item> <item name="android:textSize">16sp</item> <item name="android:textColor">#555555</item> </style> <style name="main_switch"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> </style> <style name="main_spinner"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> </style> <style name="main_numberInput"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content</item> <item name="android:inputType">numberDecimal</item> <item name="android:gravity">right</item> <item name="android:minWidth">60dp</item> </style> <style name="main_colorDisplayer"> <item name="android:layout_width">36dp</item> <item name="android:layout_height">36dp</item> <item name="android:background">#000000</item> </style> </resources>
{ "content_hash": "4bef89bf3d298b6b59d9d705511c5393", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 69, "avg_line_length": 37.212765957446805, "alnum_prop": 0.6375071469411092, "repo_name": "mauriciotogneri/watch-face-sectors", "id": "7e1f7f502a9e8bf178c5fc118173fa779a64ff96", "size": "1749", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "mobile/src/main/res/values/styles.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "64023" } ], "symlink_target": "" }
/** An extension (with only very basic functionality) * for creating VRML files from NetLogo. * The main application I have in mind is creating files * that can then be printed on a 3D printer. * * The X3D/VRML Java library that I'm interfacing to has a lot * more capability than what I'm using. So... this extension * could be fleshed out to do a lot more. * */ /* ;; Here's a netlogo procedure to export a network as VRML. to export-vrml vrml:clear-scene ask turtles [ let rgbcol color if (not is-list? rgbcol) [ set rgbcol extract-rgb color ] vrml:set-color (item 0 rgbcol) (item 1 rgbcol) (item 2 rgbcol) vrml:add-sphere xcor ycor zcor (size / 2) ] ask links [ let rgbcol color if (not is-list? rgbcol) [ set rgbcol extract-rgb color ] vrml:set-color (item 0 rgbcol) (item 1 rgbcol) (item 2 rgbcol) vrml:add-cylinder [xcor] of end1 [ycor] of end1 [zcor] of end1 [xcor] of end2 [ycor] of end2 [zcor] of end2 0.6 ] vrml:save-scene "network.wrl" end */ package org.nlogo.extensions.vrml; import org.nlogo.api.Argument; import org.nlogo.api.Context; import org.nlogo.api.DefaultClassManager; import org.nlogo.api.DefaultCommand; import org.nlogo.api.ExtensionException; import org.nlogo.api.LogoException; import org.nlogo.api.PrimitiveManager; import org.nlogo.api.Syntax; import org.cybergarage.x3d.SceneGraph; import org.cybergarage.x3d.node.AppearanceNode; import org.cybergarage.x3d.node.CylinderNode; import org.cybergarage.x3d.node.MaterialNode; import org.cybergarage.x3d.node.ShapeNode; import org.cybergarage.x3d.node.SphereNode; import org.cybergarage.x3d.node.TransformNode; import org.cybergarage.x3d.node.BoxNode; public class VRMLExtension extends DefaultClassManager { @Override public void load( PrimitiveManager primitiveManager ) { primitiveManager.addPrimitive( "clear-scene" , new ClearScene() ) ; primitiveManager.addPrimitive( "set-color" , new SetColor() ) ; primitiveManager.addPrimitive( "add-sphere" , new AddSphere() ) ; primitiveManager.addPrimitive( "add-box" , new AddBox() ) ; primitiveManager.addPrimitive( "add-cylinder" , new AddCylinder() ) ; primitiveManager.addPrimitive( "save-scene" , new SaveScene() ) ; primitiveManager.addPrimitive( "save-scene-x3d" , new SaveSceneX3D() ) ; } private static SceneGraph sceneGraph = new SceneGraph(); // the default color of any created objects is light gray // the user may change the color used by using the "set-color" command. private static float[] currentColor = { 0.7f, 0.7f, 0.7f }; private static ShapeNode makeDefaultShapeNode() { ShapeNode shape = new ShapeNode() ; AppearanceNode app = new AppearanceNode(); MaterialNode mat = new MaterialNode(); mat.setDiffuseColor(currentColor); app.addChildNode(mat); shape.addChildNode(app); return shape; } public static class ClearScene extends DefaultCommand { @Override public Syntax getSyntax() { return Syntax.commandSyntax ( new int[] { } ) ; } @Override public String getAgentClassString() { return "OTPL" ; } public void perform( Argument args[] , Context context ) //throws ExtensionException , LogoException { sceneGraph.clear(); } } public static class SetColor extends DefaultCommand { @Override public Syntax getSyntax() { return Syntax.commandSyntax ( new int[] {Syntax.NumberType(), Syntax.NumberType(), Syntax.NumberType() } ) ; } @Override public String getAgentClassString() { return "OTPL" ; } public void perform( Argument args[] , Context context ) throws ExtensionException , LogoException { double r = args[ 0 ].getDoubleValue() ; double g = args[ 1 ].getDoubleValue() ; double b = args[ 2 ].getDoubleValue() ; currentColor[0] = (float) (r / 255.0); currentColor[1] = (float) (g / 255.0); currentColor[2] = (float) (b / 255.0); } } public static class AddSphere extends DefaultCommand { @Override public Syntax getSyntax() { return Syntax.commandSyntax ( new int[] {Syntax.NumberType() , Syntax.NumberType() , Syntax.NumberType() , Syntax.NumberType()} ) ; } @Override public String getAgentClassString() { return "OTPL" ; } public void perform( Argument args[] , Context context ) throws ExtensionException , LogoException { double x = args[ 0 ].getDoubleValue() ; double y = args[ 1 ].getDoubleValue() ; double z = args[ 2 ].getDoubleValue() ; double radius = args[ 3 ].getDoubleValue() ; TransformNode trans = new TransformNode() ; trans.setTranslation( (float) x , (float) y , (float) z ) ; ShapeNode shape = makeDefaultShapeNode(); SphereNode sphere = new SphereNode() ; sphere.setRadius( (float) radius ) ; sceneGraph.addNode( trans ) ; trans.addChildNode( shape ) ; shape.addChildNode( sphere ) ; } } public static class AddBox extends DefaultCommand { @Override public Syntax getSyntax() { return Syntax.commandSyntax ( new int[] {Syntax.NumberType() , Syntax.NumberType() , Syntax.NumberType() , Syntax.NumberType() , Syntax.NumberType() , Syntax.NumberType()} ) ; } @Override public String getAgentClassString() { return "OTPL" ; } public void perform( Argument args[] , Context context ) throws ExtensionException , LogoException { double x = args[ 0 ].getDoubleValue() ; double y = args[ 1 ].getDoubleValue() ; double z = args[ 2 ].getDoubleValue() ; double xWidth = args[ 3 ].getDoubleValue() ; double yWidth = args[ 4 ].getDoubleValue() ; double zWidth = args[ 5 ].getDoubleValue() ; TransformNode trans = new TransformNode() ; trans.setTranslation( (float) x , (float) y , (float) z ) ; ShapeNode shape = makeDefaultShapeNode(); BoxNode box = new BoxNode() ; box.setSize( (float) xWidth , (float) yWidth , (float) zWidth); sceneGraph.addNode( trans ) ; trans.addChildNode( shape ) ; shape.addChildNode( box ) ; } } private static double[] crossProduct(double a1, double a2, double a3, double b1, double b2, double b3) { double[] result = new double[3]; result[0] = a2 * b3 - a3 * b2; result[1] = a3 * b1 - a1 * b3; result[2] = a1 * b2 - a2 * b1; return result; } private static double dotProduct(double a1, double a2, double a3, double b1, double b2, double b3) { return a1 * b1 + a2 * b2 + a3 * b3; } public static class AddCylinder extends DefaultCommand { @Override public Syntax getSyntax() { return Syntax.commandSyntax ( new int[] {Syntax.NumberType() , Syntax.NumberType() , Syntax.NumberType() , Syntax.NumberType() , Syntax.NumberType() , Syntax.NumberType() , Syntax.NumberType() } ) ; } @Override public String getAgentClassString() { return "OTPL" ; } public void perform( Argument args[] , Context context ) throws ExtensionException , LogoException { double x1 = args[ 0 ].getDoubleValue() ; double y1 = args[ 1 ].getDoubleValue() ; double z1 = args[ 2 ].getDoubleValue() ; double x2 = args[ 3 ].getDoubleValue() ; double y2= args[ 4 ].getDoubleValue() ; double z2 = args[ 5 ].getDoubleValue() ; double radius = args[ 6 ].getDoubleValue() ; double x = (x1 + x2) / 2; double y = (y1 + y2) / 2; double z = (z1 + z2) / 2; double dx = x2 - x1; double dy = y2 - y1; double dz = z2 - z1; double rotAxis[] = crossProduct(dx, dy, dz, 0, 1, 0); double cHeight = StrictMath.sqrt( dx * dx + dy * dy + dz * dz ); double rotAngle = - StrictMath.acos(dotProduct(dx,dy,dz,0,1,0) / cHeight); TransformNode trans = new TransformNode() ; trans.setTranslation( (float) x , (float) y , (float) z ) ; trans.setRotation( (float) rotAxis[0] , (float) rotAxis[1], (float) rotAxis[2] , (float) rotAngle ); ShapeNode shape = makeDefaultShapeNode(); CylinderNode cyl = new CylinderNode(); cyl.setHeight( (float) cHeight ); cyl.setRadius( (float) radius ); sceneGraph.addNode( trans ) ; trans.addChildNode( shape ) ; shape.addChildNode( cyl ) ; } } /** * Highly recommended that you save your VMRL files with a * .WRL filename extension so that VRML viewers, etc, recognize it. */ public static class SaveScene extends DefaultCommand { @Override public Syntax getSyntax() { return Syntax.commandSyntax ( new int[] { Syntax.StringType() } ) ; } @Override public String getAgentClassString() { return "OTPL" ; } public void perform( Argument args[] , Context context ) throws ExtensionException , LogoException { String filename = args[0].getString(); sceneGraph.saveVRML( filename ); } } /** * Highly recommendeded that you save your X3D files * with a .x3d or .xml file extension. */ public static class SaveSceneX3D extends DefaultCommand { @Override public Syntax getSyntax() { return Syntax.commandSyntax ( new int[] { Syntax.StringType() } ) ; } @Override public String getAgentClassString() { return "OTPL" ; } public void perform( Argument args[] , Context context ) throws ExtensionException , LogoException { String filename = args[0].getString(); sceneGraph.saveXML( filename ); } } @Override public java.util.List<String> additionalJars() { return new java.util.ArrayList<String>() {{ add("cx3djava100a.jar"); }}; } }
{ "content_hash": "b4f881c306e0729b4da91d6897ab8ba4", "timestamp": "", "source": "github", "line_count": 316, "max_line_length": 174, "avg_line_length": 30.265822784810126, "alnum_prop": 0.6621706398996235, "repo_name": "NetLogo/VRML-Extension", "id": "b67b2cbc6161b6f7775d12c5488401f766132790", "size": "9564", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/VRMLExtension.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Java", "bytes": "9564" } ], "symlink_target": "" }
// Copyright (C) 2015 sails Authors. // All rights reserved. // // Official git repository and contact information can be found at // https://github.com/sails/sails and http://www.sailsxu.com/. // // Filename: client_rpc_channel.cc // // Author: sailsxu <sailsxu@gmail.com> // Created: 2015-04-23 16:03:07 #include "src/rpc_channel.h" #include <stdio.h> #include <limits.h> #include <assert.h> #include <iostream> #include <sstream> #include "sails/base/thread_queue.h" #include "sails/net/connector.h" #include "src/saf_packet.pb.h" #include "src/saf_const.h" #include "src/saf_version.h" #include "google/protobuf/message.h" #include "google/protobuf/descriptor.h" using namespace google::protobuf; // NOLINT // 注册销毁protobuf bool HasRegisterDestoryProtobuffer = false; void destory_protobuf() { google::protobuf::ShutdownProtobufLibrary(); } void HandleSigpipe(int ) { } namespace sails { RpcChannelImp::RpcChannelImp(string ip, int port): ip(ip), port(port) { connector = new net::Connector(); request_list = new base::ThreadQueue<RequestPacket*>(); sn = 0; stop = false; keeplive = false; recv_thread = NULL; send_thread = NULL; isbreak = true; HasRegisterDestoryProtobuffer = false; timer = NULL; timeout = 10; } RpcChannelImp::~RpcChannelImp() { if (!stop) { stop = true; shutdown(connector->get_connector_fd(), 2); connector->close(); if (recv_thread != NULL) { // recv线程会马上返回 recv_thread->join(); } if (send_thread != NULL) { // 发送一个空的,放pop返回 RequestPacket *packet = new RequestPacket(); request_list->push_back(packet); send_thread->join(); } } if (timer != NULL) { delete timer; timer = NULL; } if (recv_thread != NULL) { delete recv_thread; } if (send_thread != NULL) { delete send_thread; } if (connector != NULL) { delete connector; connector = NULL; } for (auto& session : ticketManager) { if (session.second != NULL) { delete session.second; session.second = NULL; } } if (request_list != NULL) { delete request_list; request_list = NULL; } } bool RpcChannelImp::init() { if (!connector->connect(this->ip.c_str(), this->port, true)) { return false; } recv_thread = new std::thread(recv_response, this); send_thread = new std::thread(send_request, this); if (!HasRegisterDestoryProtobuffer) { HasRegisterDestoryProtobuffer = true; atexit(destory_protobuf); } isbreak = false; // 当连接关闭时,还在发数据,会导致sigpipe信号 sigpipe_action.sa_handler = HandleSigpipe; sigemptyset(&sigpipe_action.sa_mask); sigpipe_action.sa_flags = 0; sigaction(SIGPIPE, &sigpipe_action, NULL); timer = new base::Timer(1); timer->init(RpcChannelImp::check_call_timeout, this, 1); now = time(NULL); return true; } void RpcChannelImp::CallMethod(const MethodDescriptor* method, RpcController *controller, const Message *request, Message *response, Closure *done) { if (done != NULL) { // 异步 this->async_all(method, controller, request, response, done); } else { // 同步 if (this->sync_call(method, controller, request, response) != 0) { printf("sync call error\n"); } } } std::string RpcChannelImp::RawCallMethod(const std::string& service_name, const std::string& method_name, const std::string& request_data, int data_type) { if (stop || isbreak) { return ""; } std::unique_lock<std::mutex> locker(request_mutex); sn++; RequestPacket *packet = new RequestPacket(); packet->set_version(SAF_VERSION_HEXA); if (data_type == 1) { packet->set_type(MessageType::RPC_REQUEST); } else { packet->set_type(MessageType::RPC_REQUEST_JSON); } packet->set_sn(sn); packet->set_servicename(service_name); packet->set_funcname(method_name); // packet->mutable_detail()->PackFrom(*request); packet->set_detail(request_data); packet->set_timeout(timeout); ticketManager[sn] = new TicketSession(sn, NULL, NULL); ticketManager[sn]->calltime = now; request_list->push_back(packet); // wait notify while (ticketManager[sn]->errcode == 1) { ticketManager[sn]->notify.wait(locker); } std::string response = ticketManager[sn]->response_raw; delete ticketManager[sn]; ticketManager.erase(sn); return response; } sails::ResponsePacket* RpcChannelImp::parser( net::Connector *connector) { if (connector->readable() < sizeof(int)) { return NULL; } const char* buffer = connector->peek(); int packetLen = *(reinterpret_cast<const int*>(buffer)); if (connector->readable() < packetLen + sizeof(int)) { return NULL; } // printf("parse packet len:%d\n", packetLen); ResponsePacket* response = new ResponsePacket(); if (response->ParseFromArray(buffer+sizeof(int), packetLen)) { connector->retrieve(packetLen + sizeof(int)); return response; } else { // 出错 delete response; connector->retrieve(connector->readable()); } return NULL; } void RpcChannelImp::async_all(const google::protobuf::MethodDescriptor *method, google::protobuf::RpcController* , const google::protobuf::Message* request, google::protobuf::Message* response, google::protobuf::Closure* done) { if (stop || isbreak) { done->Run(); return; } std::unique_lock<std::mutex> locker(request_mutex); sn++; RequestPacket *packet = new RequestPacket(); packet->set_version(SAF_VERSION_HEXA); packet->set_type(MessageType::RPC_REQUEST); packet->set_sn(sn); packet->set_servicename(method->service()->name()); packet->set_funcname(method->name()); // packet->mutable_detail()->PackFrom(*request); packet->set_detail(request->SerializeAsString()); packet->set_timeout(timeout); ticketManager[sn] = new TicketSession(sn, response, done); ticketManager[sn]->calltime = now; if (!request_list->push_back(packet)) { perror("async call too fast"); delete ticketManager[sn]; ticketManager[sn] = NULL; } } int RpcChannelImp::sync_call(const google::protobuf::MethodDescriptor *method, google::protobuf::RpcController *, const google::protobuf::Message *request, google::protobuf::Message *response) { if (stop || isbreak) { return -1; } std::unique_lock<std::mutex> locker(request_mutex); sn++; RequestPacket *packet = new RequestPacket(); packet->set_version(SAF_VERSION_HEXA); packet->set_type(MessageType::RPC_REQUEST); packet->set_sn(sn); packet->set_servicename(method->service()->name()); packet->set_funcname(method->name()); // packet->mutable_detail()->PackFrom(*request); packet->set_detail(request->SerializeAsString()); packet->set_timeout(timeout); ticketManager[sn] = new TicketSession(sn, response, NULL); ticketManager[sn]->calltime = now; request_list->push_back(packet); // wait notify while (ticketManager[sn]->errcode == 1) { ticketManager[sn]->notify.wait(locker); } int errorcode = ticketManager[sn]->errcode; delete ticketManager[sn]; ticketManager.erase(sn); return errorcode; } void RpcChannelImp::send_request(RpcChannelImp* channel) { while (!channel->stop) { RequestPacket *request = NULL; static int empty_request = 0; channel->request_list->pop_front(request, 100); if (request != NULL) { if (channel->stop) { // 说明是一个空包 delete request; continue; } empty_request = 0; std::string data = request->SerializeAsString(); int len = data.length(); channel->connector->write(reinterpret_cast<char*>(&len), sizeof(int)); channel->connector->write(data.c_str(), data.length()); if (channel->connector->send() > 0) { delete request; } else { // 0表示连接关闭,小于0表示出错 // 这里不主动设置stop的标识,由recv_response来设置,这样可以由它来 // 处理后续回调和通知 channel->reset_ticket(); delete request; } } else { empty_request++; // 超过50次,也就是5s没有发送过数据,则发送一个心跳包 if (empty_request > 50) { empty_request = 0; if (!channel->keeplive) { continue; } RequestPacket heartbeat; heartbeat.set_version(SAF_VERSION_HEXA); heartbeat.set_type(MessageType::PING); heartbeat.set_sn(0); heartbeat.set_servicename(""); heartbeat.set_funcname(""); std::string data = heartbeat.SerializeAsString(); int len = data.length(); channel->connector->write(reinterpret_cast<char*>(&len), sizeof(int)); channel->connector->write(data.c_str(), data.length()); if (channel->connector->send() > 0) { // 成功 } else { // 失败 } } } } } void RpcChannelImp::recv_response(RpcChannelImp* channel) { while (!channel->stop) { // 为了结束时防止阻塞到这里不能返回,通过调用close使它返回 int n = channel->connector->read(); if (n > 0) { bool continueParse = false; do { continueParse = false; if (channel->connector->readable() == 0) { break; // 解析一次完成 } ResponsePacket *resp = RpcChannelImp::parser(channel->connector); if (resp != NULL) { if (resp->ret() == ErrorCode::ERR_SUCCESS) { if (resp->type() == MessageType::PING) { delete(resp); continue; } std::unique_lock<std::mutex> locker(channel->request_mutex); if (channel->ticketManager[resp->sn()] != NULL) { /* resp->detail().UnpackTo( channel->ticketManager[resp->sn()]->response); */ channel->ticketManager[resp->sn()]->response_raw = resp->detail(); if (channel->ticketManager[resp->sn()]->response != NULL) { channel->ticketManager[resp->sn()]->response->ParseFromString( resp->detail()); } channel->ticketManager[resp->sn()]->errcode = 0; if (channel->ticketManager[resp->sn()]->done != NULL) { // 异步,那么就在这里调用 channel->ticketManager[resp->sn()]->done->Run(); delete channel->ticketManager[resp->sn()]; channel->ticketManager.erase(resp->sn()); } else { // 同步,通知调用线程 channel->ticketManager[resp->sn()]->notify.notify_all(); } continueParse = true; } } else { char msg[50] = {'\0'}; snprintf(msg, sizeof(msg), "get a response for error_code %d", resp->ret()); perror(msg); } delete(resp); } else { // 接收的数据不够,等待再次接收后再解析 continueParse = false; } } while (continueParse); } else { // 0表示连接被关闭, 小于0,出错 // perror("recv"); // printf("read N:%d\n", n); // 由于response是一个自定义的结构 // 所以没有errcode之类的标识,这里就只能由用户自己通过response没有 // 设置来得知是出错了 if (n == -1 && errno == EAGAIN) { // 可能被中断了,重新接收 } else { // 出错 channel->isbreak = true; channel->reset_ticket(); if (channel->keeplive && !channel->stop) { // 连接关闭了 // 重连 while (!channel->stop) { sleep(2); channel->connector->close(); if (channel->connector->connect( channel->ip.c_str(), channel->port, true)) { channel->isbreak = false; break; } else { } } } } } } } void RpcChannelImp::reset_ticket() { std::unique_lock<std::mutex> locker(request_mutex); for (auto& ticket : ticketManager) { if (ticket.second != NULL) { ticket.second->errcode = -1; if (ticket.second->done == NULL) { // 是同步,通知主线程返回 ticketManager[ticket.first]->notify.notify_all(); } else { // 异步 ticket.second->done->Run(); delete ticket.second; ticket.second = NULL; } } } } void RpcChannelImp::check_call_timeout(void * data) { if (data != NULL) { RpcChannelImp* channel = reinterpret_cast<RpcChannelImp*>(data); if (channel->timeout <= 0) { return; } channel->now = time(NULL); std::unique_lock<std::mutex> locker(channel->request_mutex); for (auto iter = channel->ticketManager.begin(); iter != channel->ticketManager.end(); ) { // 超时 TicketSession* session = iter->second; if (session != NULL && channel->now - session->calltime > channel->timeout) { session->errcode = -3; if (session->done == NULL) { // 是同步,通知主线程返回 session->notify.notify_all(); ++iter; } else { // 异步 session->done->Run(); delete session; iter->second = NULL; iter = channel->ticketManager.erase(iter); } } else { ++iter; } } } } } // namespace sails
{ "content_hash": "d6d1bb35de0da89c3c4f9528e498584b", "timestamp": "", "source": "github", "line_count": 445, "max_line_length": 80, "avg_line_length": 29.72359550561798, "alnum_prop": 0.5841082634006199, "repo_name": "sails/saf", "id": "c29fa800f8b5b338725599f6a5a5fb55c72fa263", "size": "13819", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/rpc_channel.cc", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "104488" }, { "name": "CMake", "bytes": "7511" }, { "name": "CSS", "bytes": "814" }, { "name": "HTML", "bytes": "3285" }, { "name": "Java", "bytes": "13515" }, { "name": "Makefile", "bytes": "8059" }, { "name": "PHP", "bytes": "1212" }, { "name": "Protocol Buffer", "bytes": "6199" }, { "name": "Shell", "bytes": "713" } ], "symlink_target": "" }
package com.jivesoftware.os.tasmo.test; import com.jivesoftware.os.tasmo.event.api.write.EventWriter; /** * * Hack to allow testng data provider stuff to run before underlying system is really set up. */ public interface EventWriterProvider { EventWriter eventWriter(); }
{ "content_hash": "cb85cbf4a72ba42a7c0441ae89bbda10", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 93, "avg_line_length": 23.5, "alnum_prop": 0.7624113475177305, "repo_name": "jivesoftware/tasmo", "id": "5f64d8623e4037cc8ffc381987813d2887314c58", "size": "282", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "code/com/jivesoftware/os/tasmo/tasmo-test/src/main/java/com/jivesoftware/os/tasmo/test/EventWriterProvider.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "1244080" }, { "name": "Shell", "bytes": "3102" } ], "symlink_target": "" }
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /* | ------------------------------------------------------------------- | AUTO-LOADER | ------------------------------------------------------------------- | This file specifies which systems should be loaded by default. | | In order to keep the framework as light-weight as possible only the | absolute minimal resources are loaded by default. For example, | the database is not connected to automatically since no assumption | is made regarding whether you intend to use it. This file lets | you globally define which systems you would like loaded with every | request. | | ------------------------------------------------------------------- | Instructions | ------------------------------------------------------------------- | | These are the things you can load automatically: | | 1. Packages | 2. Libraries | 3. Helper files | 4. Custom config files | 5. Language files | 6. Models | */ /* | ------------------------------------------------------------------- | Auto-load Packges | ------------------------------------------------------------------- | Prototype: | | $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared'); | */ $autoload['packages'] = array(); /* | ------------------------------------------------------------------- | Auto-load Libraries | ------------------------------------------------------------------- | These are the classes located in the system/libraries folder | or in your application/libraries folder. | | Prototype: | | $autoload['libraries'] = array('database', 'session', 'xmlrpc'); */ $autoload['libraries'] = array('database','session','form_validation'); /* | ------------------------------------------------------------------- | Auto-load Helper Files | ------------------------------------------------------------------- | Prototype: | | $autoload['helper'] = array('url', 'file'); */ $autoload['helper'] = array('url','form','file'); /* | ------------------------------------------------------------------- | Auto-load Config files | ------------------------------------------------------------------- | Prototype: | | $autoload['config'] = array('config1', 'config2'); | | NOTE: This item is intended for use ONLY if you have created custom | config files. Otherwise, leave it blank. | */ $autoload['config'] = array(); /* | ------------------------------------------------------------------- | Auto-load Language files | ------------------------------------------------------------------- | Prototype: | | $autoload['language'] = array('lang1', 'lang2'); | | NOTE: Do not include the "_lang" part of your file. For example | "codeigniter_lang.php" would be referenced as array('codeigniter'); | */ $autoload['language'] = array(); /* | ------------------------------------------------------------------- | Auto-load Models | ------------------------------------------------------------------- | Prototype: | | $autoload['model'] = array('model1', 'model2'); | */ $autoload['model'] = array(); /* End of file autoload.php */ /* Location: ./application/config/autoload.php */
{ "content_hash": "dbe06e48097f4ce12aab582789f4d256", "timestamp": "", "source": "github", "line_count": 116, "max_line_length": 77, "avg_line_length": 27.112068965517242, "alnum_prop": 0.4365659777424483, "repo_name": "Dimasdanz/BiotechProject", "id": "3aaf02f335f1ad4eafc52e9fc5e21406d3c9f9c1", "size": "3145", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "BiotechWeb/application/config/autoload.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Arduino", "bytes": "27115" }, { "name": "CSS", "bytes": "104846" }, { "name": "JavaScript", "bytes": "434212" }, { "name": "PHP", "bytes": "1325828" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <ListView android:id="@+id/rules_list" android:layout_width="match_parent" android:layout_height="match_parent"/> <TextView android:id="@+id/empty_rules_list" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="4dp" android:gravity="center" android:text="@string/empty_rules" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="?android:attr/textColorPrimary" android:textStyle="bold" android:visibility="gone"/> </LinearLayout>
{ "content_hash": "27ddb77acf29ddbd51717cc6f8115f1c", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 72, "avg_line_length": 35.166666666666664, "alnum_prop": 0.6670616113744076, "repo_name": "inverse/sls", "id": "9105ff1500ed6cf7f76c28af103289e94bc6a5d3", "size": "844", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "app/src/main/res/layout/correction_rules_list.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "596672" } ], "symlink_target": "" }
package ersatz type Embedded interface { OtherErsatz() Return } type Return interface{}
{ "content_hash": "7cbaf8a41c7b56d7349c8eac5bd29774", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 25, "avg_line_length": 13, "alnum_prop": 0.7692307692307693, "repo_name": "golang/mock", "id": "9ca639148941aa41108608a4a410c0a13efd4a2f", "size": "679", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "mockgen/internal/tests/import_embedded_interface/other/ersatz/ersatz.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Go", "bytes": "196268" }, { "name": "Shell", "bytes": "1673" } ], "symlink_target": "" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html><head><title></title> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <link rel="stylesheet" type="text/css" href="search.css"/> <script type="text/javascript" src="search.js"></script> </head> <body class="SRPage"> <div id="SRIndex"> <div class="SRStatus" id="Loading">Loading...</div> <div class="SRResult" id="SR_allannotations"> <div class="SREntry"> <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../interface_o_c_map_view.html#adadb36904f1ee3a57c09067cb6202cd9" target="_parent">allAnnotations</a> <span class="SRScope">OCMapView</span> </div> </div> <div class="SRResult" id="SR_annotationsincluster"> <div class="SREntry"> <a id="Item1" onkeydown="return searchResults.Nav(event,1)" onkeypress="return searchResults.Nav(event,1)" onkeyup="return searchResults.Nav(event,1)" class="SRSymbol" href="../interface_o_c_annotation.html#ad9449e4c93edf0863c7c557256e2927b" target="_parent">annotationsInCluster</a> <span class="SRScope">OCAnnotation</span> </div> </div> <div class="SRStatus" id="Searching">Searching...</div> <div class="SRStatus" id="NoMatches">No Matches</div> <script type="text/javascript"><!-- document.getElementById("Loading").style.display="none"; document.getElementById("NoMatches").style.display="none"; var searchResults = new SearchResults("searchResults"); searchResults.Search(); --></script> </div> </body> </html>
{ "content_hash": "6c7887345fae968d42dbbcdd31080b46", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 285, "avg_line_length": 51.15625, "alnum_prop": 0.7330482590103848, "repo_name": "BYTEPOETS/OCMapView", "id": "a2feb3c9a39757a6f863ad1566bf7ea6c5d3be3a", "size": "1637", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "Documentation/html/search/variables_61.html", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "CSS", "bytes": "17452" }, { "name": "JavaScript", "bytes": "21911" }, { "name": "Objective-C", "bytes": "51824" }, { "name": "Perl", "bytes": "2517" }, { "name": "Ruby", "bytes": "1054" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="wang.raye.http" > <uses-permission android:name="android.permission.INTERNET" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
{ "content_hash": "3b4175374bffce62b5c459630bf83769", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 76, "avg_line_length": 33.95454545454545, "alnum_prop": 0.6050870147255689, "repo_name": "RayeWang/RocketHttp", "id": "8ee722f94fe16f85f54b0bd36381d564bc9f5f28", "size": "747", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/AndroidManifest.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "67752" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; // The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 namespace Meridian.View.VK { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class SelectPlaylistView : Page { public SelectPlaylistView() { this.InitializeComponent(); } } }
{ "content_hash": "a8602f7c1c5828ec26174b855e580926", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 95, "avg_line_length": 27.8, "alnum_prop": 0.7290167865707434, "repo_name": "Stealth2012/meridian-uwp", "id": "da661805862b30fe8b477eeb538c2d749097aac3", "size": "836", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Meridian/View/VK/SelectPlaylistView.xaml.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "579244" }, { "name": "CSS", "bytes": "6756" }, { "name": "HTML", "bytes": "3883" }, { "name": "JavaScript", "bytes": "4709" } ], "symlink_target": "" }
<?php require_once __DIR__ . '/../../../../../config.php'; require_once __DIR__ . '/../../../../../lib/gradelib.php'; require_once __DIR__ . '/../../../../../grade/querylib.php'; require_once __DIR__ . '/../../../../../mod/forum/lib.php'; require_once(dirname(__FILE__) . '/../../../locallib.php'); require_once __DIR__ . '/../../../classes/common.php'; require_once __DIR__ . '/../../../classes/forum.php'; require_once __DIR__ . '/../../../classes/grade.php'; require_login(); /* @var $DB moodle_database */ /* @var $USER object */ /* @var $OUTPUT core_renderer */ /* @var $CFG object */ /* @var $PAGE object */ global $DB, $USER, $OUTPUT, $CFG, $PAGE; $courseid = required_param('courseid', PARAM_INT); $context = context_course::instance($courseid); $PAGE->set_context($context); echo html_writer::start_tag('html', array('lang' => 'ja')); echo html_writer::start_tag('head'); echo html_writer::empty_tag('meta', array('charset' => 'UTF-8')); echo html_writer::empty_tag('meta', array('http-equiv' => 'content-language', 'content' => 'ja')); echo html_writer::empty_tag('meta', array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0')); echo html_writer::tag('title', get_string('pluginname', 'block_mamiline') . '/' . get_string('forum', 'block_mamiline'), array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1.0')); echo html_writer::empty_tag('link', array('href' => new moodle_url('/blocks/mamiline/css/bootstrap.min.css'), 'rel' => 'stylesheet')); echo html_writer::empty_tag('link', array('href' => new moodle_url('/blocks/mamiline/css/sb-admin.css'), 'rel' => 'stylesheet')); echo html_writer::empty_tag('link', array('href' => new moodle_url('/blocks/mamiline/css/profile.css'), 'rel' => 'stylesheet')); echo html_writer::start_tag('body'); echo html_writer::start_tag('nav', array('class' => 'navbar navbar-default', 'role' => 'navigation')); echo html_writer::start_tag('div', array('class' => 'navbar-header')); echo html_writer::tag('a', get_string('pluginname', 'block_mamiline') . '/' . get_string('forum', 'block_mamiline'), array('href' => new moodle_url('/blocks/mamiline/index.php'), 'class' => 'navbar-brand')); echo html_writer::end_tag('div'); echo html_writer::start_tag('div', array('class' => 'collapse navbar-collapse', 'id' => 'bs-example-navbar-collapse-1')); echo html_writer::start_tag('ul', array('class' => 'nav navbar-nav navbar-right')); echo html_writer::tag('li', html_writer::link(new moodle_url('/blocks/mamiline/index.php'), get_string('top', 'block_mamiline'))); echo html_writer::tag('li', html_writer::link(new moodle_url('/blocks/mamiline/index.php'), get_string('close', 'block_mamiline'))); echo html_writer::end_tag('ul'); echo html_writer::end_tag('div'); echo html_writer::end_tag('nav'); //左側メニューここから echo html_writer::start_tag('nav', array('id' => 'sidebar', 'class' => 'navbar-default navbar-static-side')); echo html_writer::start_tag('section', array('class' => 'row')); echo html_writer::start_tag('article', array('class' => 'col-sm-12 col-md-12 col-lg-12')); echo html_writer::start_tag('div', array('class' => 'profile')); echo html_writer::tag('div', $OUTPUT->user_picture($USER, array('size' => 140, 'class' => 'img-circle')), array('id' => 'userinfo')); echo html_writer::tag('p', fullname($USER)); if (has_capability('block/mamiline:viewteacher', $context)) { //ロール(学生/教員)を表示 echo html_writer::tag('p', get_string('roleasteacher', 'block_mamiline')); } else { echo html_writer::tag('p', get_string('roleasstudent', 'block_mamiline')); } echo html_writer::end_tag('div'); echo html_writer::start_tag('ul', array('class' => 'list-group', 'id' => 'side-menu')); echo html_writer::tag('li', html_writer::link('/blocks/mamiline/index.php', get_string('top', 'block_mamiline')), array('class' => 'list-group-item') ); echo html_writer::tag('li', html_writer::link('/blocks/mamiline/view/student/timeline/', get_string('timeline', 'block_mamiline')), array('class' => 'list-group-item') ); echo html_writer::tag('li', html_writer::link('/blocks/mamiline/view/student/quiz/', get_string('quiz', 'block_mamiline')), array('class' => 'list-group-item') ); echo html_writer::tag('li', html_writer::link('/blocks/mamiline/view/student/assign/', get_string('assign', 'block_mamiline')), array('class' => 'list-group-item') ); echo html_writer::tag('li', html_writer::link('/blocks/mamiline/view/student/forum/', get_string('forum', 'block_mamiline')), array('class' => 'list-group-item active') ); echo html_writer::end_tag('ul'); echo html_writer::end_tag('article'); echo html_writer::end_tag('section'); echo html_writer::end_tag('nav'); //左側メニューここまで //フォーラムページここから開始 echo html_writer::start_tag('div', array('id' => 'page-wrapper')); echo html_writer::start_tag('div', array('class' => 'row')); //「投稿したフォーラム一覧」 $posts = mamiline\forum::posts($USER->id, $courseid); $course = mamiline\common::course($courseid); echo html_writer::start_tag('div', array('class' => 'col-lg-12')); echo html_writer::tag('h3', get_string('forum_list', 'block_mamiline') . '(' . $course->fullname . ')'); echo html_writer::start_tag('div', array('class' => 'panel panel-default')); echo html_writer::start_tag('table', array('class' => 'table table-striped')); echo html_writer::start_tag('tr'); echo html_writer::start_tag('thread'); echo html_writer::tag('th', get_string('forum_name', 'block_mamiline')); echo html_writer::tag('th', get_string('forum_subject', 'block_mamiline')); echo html_writer::tag('th', get_string('forum_timemodified', 'block_mamiline')); echo html_writer::tag('th', get_string('grade', 'block_mamiline')); echo html_writer::tag('th', get_string('forum_view_discussions', 'block_mamiline')); echo html_writer::end_tag('thread'); echo html_writer::end_tag('tr'); foreach ($posts as $post) { $course = mamiline\common::course($post->course); $obj_forum = mamiline\forum::forum($post->fid); $js_title = s($post->subject); $js_subject = $post->message; $grade = forum_get_user_grades($obj_forum, $USER->id); $grade = array_shift($grade); echo html_writer::start_tag('tr'); echo html_writer::tag('td', html_writer::link(new moodle_url('/mod/forum/view.php', array('id' => $post->id)), $post->name), array('class' => 'subscribelink')); echo html_writer::tag('td', $post->subject, array('class' => 'modal_forum', 'id' => $post->id)); echo html_writer::tag('td', userdate($post->created)); echo html_writer::tag('td', $grade->rawgrade); echo html_writer::tag('td', html_writer::link(new moodle_url('/blocks/mamiline/view/student/forum/forum.php', array('discussionid' => $post->id, 'forumid' => $post->fid)), get_string('forum_view_discussions', 'block_mamiline'), array('class' => 'btn btn-success'))); echo html_writer::end_tag('tr'); } echo html_writer::end_tag('table'); echo html_writer::end_tag('div'); echo html_writer::end_tag('div'); //Script echo html_writer::script(null, new moodle_url('/blocks/mamiline/js/jquery.min.js')); echo html_writer::script(null, new moodle_url('/blocks/mamiline/js/raphael-min.js')); echo html_writer::script(null, new moodle_url('/blocks/mamiline/js/morris-0.4.3.min.js')); echo html_writer::script(null, new moodle_url('/blocks/mamiline/js/ccchart.js')); echo html_writer::end_tag('body'); echo html_writer::end_tag('html');
{ "content_hash": "ed4595446413cf7cc6ca1ab7644b1372", "timestamp": "", "source": "github", "line_count": 138, "max_line_length": 270, "avg_line_length": 53.492753623188406, "alnum_prop": 0.6536169059875373, "repo_name": "yuesan/moodle-block_mamiline", "id": "23a6633f37eadb2c82c83528036e46020ba23f38", "size": "7496", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "view/student/forum/list.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "33435" }, { "name": "JavaScript", "bytes": "7235" }, { "name": "PHP", "bytes": "185578" } ], "symlink_target": "" }
actions :enable, :disable state_attrs :arguments, :class_name, :source, :supports attribute :class_name, :kind_of => String, :name_attribute => true attribute :source, :default => nil, :kind_of => String attribute :arguments, :default => [] attribute :supports, :kind_of => Hash, :default => { :report => true, :exception => true } # we have to set default for the supports attribute # in initializer since it is a 'reserved' attribute name def initialize(*args) super @action = :enable @supports = { :report => true, :exception => true } end
{ "content_hash": "ae9db531cc7bd4acc8e1a35421ccc6ce", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 90, "avg_line_length": 30.94736842105263, "alnum_prop": 0.6479591836734694, "repo_name": "h4ck3rm1k3/chef_handler", "id": "47ae2de96cd23ef7a07b9a265499037b2524645e", "size": "1298", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "resources/default.rb", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Ruby", "bytes": "14710" } ], "symlink_target": "" }
@protocol CRExecCommand <NSObject> - (void) execute:(int) argc arguments:(const char * []) argv; @end
{ "content_hash": "b6ced1b5803d17e84f328b78c684b257", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 61, "avg_line_length": 34, "alnum_prop": 0.7058823529411765, "repo_name": "sbkro/crem", "id": "440c7ac9c97d8ef8ef94158963ce732ff92b1210", "size": "462", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "crem/CRExecCommand.h", "mode": "33188", "license": "mit", "language": [ { "name": "D", "bytes": "1298" }, { "name": "JavaScript", "bytes": "27392" }, { "name": "Objective-C", "bytes": "22592" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" /> <title>sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell &#8212; Spark NLP 4.0.0 documentation</title> <script> document.documentElement.dataset.mode = localStorage.getItem("mode") || ""; document.documentElement.dataset.theme = localStorage.getItem("theme") || "light"; </script> <!-- Loaded before other Sphinx assets --> <link href="../../../../../../static/styles/theme.css?digest=1e1de1a1873e13ef5536" rel="stylesheet"> <link href="../../../../../../static/styles/pydata-sphinx-theme.css?digest=1e1de1a1873e13ef5536" rel="stylesheet"> <link rel="stylesheet" href="../../../../../../static/vendor/fontawesome/6.1.2/css/all.min.css"> <link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../static/vendor/fontawesome/6.1.2/webfonts/fa-solid-900.woff2"> <link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../static/vendor/fontawesome/6.1.2/webfonts/fa-brands-400.woff2"> <link rel="preload" as="font" type="font/woff2" crossorigin href="../../../../../../static/vendor/fontawesome/6.1.2/webfonts/fa-regular-400.woff2"> <link rel="stylesheet" type="text/css" href="../../../../../../static/pygments.css" /> <link rel="stylesheet" type="text/css" href="../../../../../../static/graphviz.css" /> <link rel="stylesheet" type="text/css" href="../../../../../../static/css/custom.css" /> <!-- Pre-loaded scripts that we'll load fully later --> <link rel="preload" as="script" href="../../../../../../static/scripts/pydata-sphinx-theme.js?digest=1e1de1a1873e13ef5536"> <script data-url_root="../../../../../../" id="documentation_options" src="../../../../../../static/documentation_options.js"></script> <script src="../../../../../../static/jquery.js"></script> <script src="../../../../../../static/underscore.js"></script> <script src="../../../../../../static/_sphinx_javascript_frameworks_compat.js"></script> <script src="../../../../../../static/doctools.js"></script> <script src="../../../../../../static/sphinx_highlight.js"></script> <script src="../../../../../../static/toggleprompt.js"></script> <script>DOCUMENTATION_OPTIONS.pagename = 'reference/autosummary/sparknlp_jsl/_tf_graph_builders/tf2contrib/fused_rnn_cell/index';</script> <link rel="shortcut icon" href="../../../../../../static/fav.ico"/> <link rel="index" title="Index" href="../../../../../../genindex.html" /> <link rel="search" title="Search" href="../../../../../../search.html" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="docsearch:language" content="en"> </head> <body data-spy="scroll" data-target="#bd-toc-nav" data-offset="180" data-default-mode=""> <input type="checkbox" class="sidebar-toggle" name="__primary" id="__primary"> <label class="overlay overlay-primary" for="__primary"></label> <input type="checkbox" class="sidebar-toggle" name="__secondary" id="__secondary"> <label class="overlay overlay-secondary" for="__secondary"></label> <div class="search-button__wrapper"> <div class="search-button__overlay"></div> <div class="search-button__search-container"> <form class="bd-search d-flex align-items-center" action="../../../../../../search.html" method="get"> <i class="fa-solid fa-magnifying-glass"></i> <input type="search" class="form-control" name="q" id="search-input" placeholder="Search the docs ..." aria-label="Search the docs ..." autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"> <span class="search-button__kbd-shortcut"><kbd class="kbd-shortcut__modifier">Ctrl</kbd>+<kbd>K</kbd></span> </form> </div> </div> <nav class="bd-header navbar navbar-expand-lg bd-navbar" id="navbar-main"><div class="bd-header__inner bd-page-width"> <label class="sidebar-toggle primary-toggle" for="__primary"> <span class="fa-solid fa-bars"></span> </label> <div id="navbar-start"> <a class="navbar-brand logo" href="../../../../../../index.html"> <img src="../../../../../../static/logo.png" class="logo__image only-light" alt="Logo image"> <img src="../../../../../../static/logo.png" class="logo__image only-dark" alt="Logo image"> </a> </div> <div class="col-lg-9 navbar-header-items"> <div id="navbar-center" class="mr-auto"> <div class="navbar-center-item"> <nav class="navbar-nav"> <p class="sidebar-header-items__title" role="heading" aria-level="1" aria-label="Site Navigation"> Site Navigation </p> <ul id="navbar-main-elements" class="navbar-nav"> <li class="nav-item"> <a class="nav-link" href="../../../../../../getting_started/index.html"> Getting Started </a> </li> <li class="nav-item"> <a class="nav-link" href="../../../../../index.html"> API Reference </a> </li> </ul> </nav> </div> </div> <div id="navbar-end"> <div class="navbar-end-item navbar-end__search-button-container"> <button class="btn btn-sm navbar-btn search-button search-button__button" title="Search" data-toggle="tooltip"> <i class="fa-solid fa-magnifying-glass"></i> </button> </div> <div class="navbar-end-item"> <span class="theme-switch-button btn btn-sm btn-outline-primary navbar-btn rounded-circle" title="light/dark" data-toggle="tooltip"> <a class="theme-switch" data-mode="light"><i class="fa-solid fa-sun"></i></a> <a class="theme-switch" data-mode="dark"><i class="fa-regular fa-moon"></i></a> <a class="theme-switch" data-mode="auto"><i class="fa-solid fa-circle-half-stroke"></i></a> </span> </div> <div class="navbar-end-item"> <ul id="navbar-icon-links" class="navbar-nav" aria-label="Icon Links"> </ul> </div> </div> </div> <div class="search-button-container--mobile"> <button class="btn btn-sm navbar-btn search-button search-button__button" title="Search" data-toggle="tooltip"> <i class="fa-solid fa-magnifying-glass"></i> </button> </div> <label class="sidebar-toggle secondary-toggle" for="__secondary"> <span class="fa-solid fa-outdent"></span> </label> </div> </nav> <div class="bd-container"> <div class="bd-container__inner bd-page-width"> <div class="bd-sidebar-primary bd-sidebar"> <div class="sidebar-header-items sidebar-primary__section"> <div class="sidebar-header-items__center"> <div class="navbar-center-item"> <nav class="navbar-nav"> <p class="sidebar-header-items__title" role="heading" aria-level="1" aria-label="Site Navigation"> Site Navigation </p> <ul id="navbar-main-elements" class="navbar-nav"> <li class="nav-item"> <a class="nav-link" href="../../../../../../getting_started/index.html"> Getting Started </a> </li> <li class="nav-item"> <a class="nav-link" href="../../../../../index.html"> API Reference </a> </li> </ul> </nav> </div> </div> <div class="sidebar-header-items__end"> <div class="navbar-end-item"> <span class="theme-switch-button btn btn-sm btn-outline-primary navbar-btn rounded-circle" title="light/dark" data-toggle="tooltip"> <a class="theme-switch" data-mode="light"><i class="fa-solid fa-sun"></i></a> <a class="theme-switch" data-mode="dark"><i class="fa-regular fa-moon"></i></a> <a class="theme-switch" data-mode="auto"><i class="fa-solid fa-circle-half-stroke"></i></a> </span> </div> <div class="navbar-end-item"> <ul id="navbar-icon-links" class="navbar-nav" aria-label="Icon Links"> </ul> </div> </div> </div> <div class="sidebar-start-items sidebar-primary__section"> <div class="sidebar-start-items__item"><nav class="bd-links" id="bd-docs-nav" aria-label="Section navigation"> <p class="bd-links__title" role="heading" aria-level="1"> Section Navigation </p> <div class="bd-toc-item navbar-nav"> <ul class="current nav bd-sidenav"> <li class="toctree-l1"><a class="reference internal" href="../core_rnn_cell/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sparknlp_jsl._tf_graph_builders.tf2contrib.core_rnn_cell</span></code></a></li> <li class="toctree-l1 current active"><a class="current reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell</span></code></a></li> <li class="toctree-l1"><a class="reference internal" href="../gru_ops/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sparknlp_jsl._tf_graph_builders.tf2contrib.gru_ops</span></code></a></li> <li class="toctree-l1"><a class="reference internal" href="../lstm_ops/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sparknlp_jsl._tf_graph_builders.tf2contrib.lstm_ops</span></code></a></li> <li class="toctree-l1"><a class="reference internal" href="../rnn/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sparknlp_jsl._tf_graph_builders.tf2contrib.rnn</span></code></a></li> <li class="toctree-l1"><a class="reference internal" href="../rnn_cell/index.html"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sparknlp_jsl._tf_graph_builders.tf2contrib.rnn_cell</span></code></a></li> </ul> </div> </nav> </div> </div> <div class="sidebar-end-items sidebar-primary__section"> <div class="sidebar-end-items__item"> </div> </div> </div> <main class="bd-main"> <div class="bd-content"> <div class="bd-article-container"> <div class="bd-header-article"> </div> <article class="bd-article" role="main"> <section id="module-sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell"> <span id="sparknlp-jsl-tf-graph-builders-tf2contrib-fused-rnn-cell"></span><h1><a class="reference internal" href="#module-sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell" title="sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell</span></code></a><a class="headerlink" href="#module-sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell" title="Permalink to this heading">#</a></h1> <p>Module for constructing fused RNN cells.</p> <section id="module-contents"> <h2>Module Contents<a class="headerlink" href="#module-contents" title="Permalink to this heading">#</a></h2> <section id="classes"> <h3>Classes<a class="headerlink" href="#classes" title="Permalink to this heading">#</a></h3> <table class="autosummary longtable table autosummary"> <tbody> <tr class="row-odd"><td><p><a class="reference internal" href="#sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.FusedRNNCell" title="sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.FusedRNNCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">FusedRNNCell</span></code></a></p></td> <td><p>Abstract object representing a fused RNN cell.</p></td> </tr> <tr class="row-even"><td><p><a class="reference internal" href="#sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.FusedRNNCellAdaptor" title="sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.FusedRNNCellAdaptor"><code class="xref py py-obj docutils literal notranslate"><span class="pre">FusedRNNCellAdaptor</span></code></a></p></td> <td><p>This is an adaptor for RNNCell classes to be used with <cite>FusedRNNCell</cite>.</p></td> </tr> <tr class="row-odd"><td><p><a class="reference internal" href="#sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.TimeReversedFusedRNN" title="sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.TimeReversedFusedRNN"><code class="xref py py-obj docutils literal notranslate"><span class="pre">TimeReversedFusedRNN</span></code></a></p></td> <td><p>This is an adaptor to time-reverse a FusedRNNCell.</p></td> </tr> </tbody> </table> <dl class="py class"> <dt class="sig sig-object py" id="sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.FusedRNNCell"> <em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">FusedRNNCell</span></span><a class="reference internal" href="../../../../../../modules/sparknlp_jsl/_tf_graph_builders/tf2contrib/fused_rnn_cell.html#FusedRNNCell"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.FusedRNNCell" title="Permalink to this definition">#</a></dt> <dd><p>Abstract object representing a fused RNN cell.</p> <p>A fused RNN cell represents the entire RNN expanded over the time dimension. In effect, this represents an entire recurrent network.</p> <p>Unlike RNN cells which are subclasses of <cite>rnn_cell.RNNCell</cite>, a <cite>FusedRNNCell</cite> operates on the entire time sequence at once, by putting the loop over time inside the cell. This usually leads to much more efficient, but more complex and less flexible implementations.</p> <p>Every <cite>FusedRNNCell</cite> must implement <cite>__call__</cite> with the following signature.</p> </dd></dl> <dl class="py class"> <dt class="sig sig-object py" id="sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.FusedRNNCellAdaptor"> <em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">FusedRNNCellAdaptor</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cell</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">use_dynamic_rnn</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../../modules/sparknlp_jsl/_tf_graph_builders/tf2contrib/fused_rnn_cell.html#FusedRNNCellAdaptor"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.FusedRNNCellAdaptor" title="Permalink to this definition">#</a></dt> <dd><p>This is an adaptor for RNNCell classes to be used with <cite>FusedRNNCell</cite>.</p> </dd></dl> <dl class="py class"> <dt class="sig sig-object py" id="sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.TimeReversedFusedRNN"> <em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">TimeReversedFusedRNN</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">cell</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../../../../modules/sparknlp_jsl/_tf_graph_builders/tf2contrib/fused_rnn_cell.html#TimeReversedFusedRNN"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.TimeReversedFusedRNN" title="Permalink to this definition">#</a></dt> <dd><p>This is an adaptor to time-reverse a FusedRNNCell.</p> <p>For example,</p> <p><code class="docutils literal notranslate"><span class="pre">`python</span> <span class="pre">cell</span> <span class="pre">=</span> <span class="pre">tf.compat.v1.nn.rnn_cell.BasicRNNCell(10)</span> <span class="pre">fw_lstm</span> <span class="pre">=</span> <span class="pre">tf.contrib.rnn.FusedRNNCellAdaptor(cell,</span> <span class="pre">use_dynamic_rnn=True)</span> <span class="pre">bw_lstm</span> <span class="pre">=</span> <span class="pre">tf.contrib.rnn.TimeReversedFusedRNN(fw_lstm)</span> <span class="pre">fw_out,</span> <span class="pre">fw_state</span> <span class="pre">=</span> <span class="pre">fw_lstm(inputs)</span> <span class="pre">bw_out,</span> <span class="pre">bw_state</span> <span class="pre">=</span> <span class="pre">bw_lstm(inputs)</span> <span class="pre">`</span></code></p> </dd></dl> </section> </section> </section> </article> <footer class="bd-footer-article"> <!-- Previous / next buttons --> <div class='prev-next-area'> </div> </footer> </div> <div class="bd-sidebar-secondary bd-toc"> <div class="toc-item"> <div class="tocsection onthispage"> <i class="fa-solid fa-list"></i> On this page </div> <nav id="bd-toc-nav" class="page-toc"> <ul class="visible nav section-nav flex-column"> <li class="toc-h2 nav-item toc-entry"> <a class="reference internal nav-link" href="#module-contents"> Module Contents </a> <ul class="nav section-nav flex-column"> <li class="toc-h3 nav-item toc-entry"> <a class="reference internal nav-link" href="#classes"> Classes </a> <ul class="nav section-nav flex-column"> <li class="toc-h4 nav-item toc-entry"> <a class="reference internal nav-link" href="#sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.FusedRNNCell"> <code class="docutils literal notranslate"> <span class="pre"> FusedRNNCell </span> </code> </a> </li> <li class="toc-h4 nav-item toc-entry"> <a class="reference internal nav-link" href="#sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.FusedRNNCellAdaptor"> <code class="docutils literal notranslate"> <span class="pre"> FusedRNNCellAdaptor </span> </code> </a> </li> <li class="toc-h4 nav-item toc-entry"> <a class="reference internal nav-link" href="#sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.TimeReversedFusedRNN"> <code class="docutils literal notranslate"> <span class="pre"> TimeReversedFusedRNN </span> </code> </a> </li> <li class="toc-h4 nav-item toc-entry"> <a class="reference internal nav-link" href="#sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.FusedRNNCell"> FusedRNNCell </a> </li> <li class="toc-h4 nav-item toc-entry"> <a class="reference internal nav-link" href="#sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.FusedRNNCellAdaptor"> FusedRNNCellAdaptor </a> </li> <li class="toc-h4 nav-item toc-entry"> <a class="reference internal nav-link" href="#sparknlp_jsl._tf_graph_builders.tf2contrib.fused_rnn_cell.TimeReversedFusedRNN"> TimeReversedFusedRNN </a> </li> </ul> </li> </ul> </li> </ul> </nav> </div> <div class="toc-item"> <div id="searchbox"></div> </div> <div class="toc-item"> </div> <div class="toc-item"> <div class="tocsection sourcelink"> <a href="../../../../../../_sources/reference/autosummary/sparknlp_jsl/_tf_graph_builders/tf2contrib/fused_rnn_cell/index.rst.txt"> <i class="fa-solid fa-file-lines"></i> Show Source </a> </div> </div> </div> </div> <footer class="bd-footer-content"> <div class="bd-footer-content__inner"> </div> </footer> </main> </div> </div> <!-- Scripts loaded after <body> so the DOM is not blocked --> <script src="../../../../../../static/scripts/pydata-sphinx-theme.js?digest=1e1de1a1873e13ef5536"></script> <footer class="bd-footer"><div class="bd-footer__inner container"> <div class="footer-item"> <p class="copyright"> &copy; Copyright 2022, John Snow Labs.<br> </p> </div> <div class="footer-item"> <p class="sphinx-version"> Created using <a href="http://sphinx-doc.org/">Sphinx</a> 5.3.0.<br> </p> </div> </div> </footer> </body> </html>
{ "content_hash": "f57ab383f7b651c8d1ac93c6cd10d7b4", "timestamp": "", "source": "github", "line_count": 480, "max_line_length": 885, "avg_line_length": 43.74583333333333, "alnum_prop": 0.6283455567196876, "repo_name": "JohnSnowLabs/spark-nlp", "id": "4dc4eae548664a15ca5a9fa20e159e675c7d5c51", "size": "20999", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/licensed/api/python/reference/autosummary/sparknlp_jsl/_tf_graph_builders/tf2contrib/fused_rnn_cell/index.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "14452" }, { "name": "Java", "bytes": "223289" }, { "name": "Makefile", "bytes": "819" }, { "name": "Python", "bytes": "1694517" }, { "name": "Scala", "bytes": "4116435" }, { "name": "Shell", "bytes": "5286" } ], "symlink_target": "" }
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.intellij.images.vfs; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Ref; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.reference.SoftReference; import com.intellij.ui.scale.ScaleContext; import com.intellij.util.LogicalRoot; import com.intellij.util.LogicalRootsManager; import com.intellij.util.SVGLoader; import org.apache.commons.imaging.ImageReadException; import org.apache.commons.imaging.common.bytesource.ByteSourceArray; import org.apache.commons.imaging.formats.ico.IcoImageParser; import org.intellij.images.editor.ImageDocument; import org.intellij.images.editor.ImageDocument.ScaledImageProvider; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.imageio.ImageIO; import javax.imageio.ImageReadParam; import javax.imageio.ImageReader; import javax.imageio.stream.ImageInputStream; import java.awt.*; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.Iterator; import static com.intellij.ui.scale.ScaleType.OBJ_SCALE; /** * Image loader utility. * * @author <a href="mailto:aefimov.box@gmail.com">Alexey Efimov</a> */ public final class IfsUtil { private static final Logger LOG = Logger.getInstance("#org.intellij.images.vfs.IfsUtil"); public static final String ICO_FORMAT = "ico"; public static final String SVG_FORMAT = "svg"; private static final Key<Long> TIMESTAMP_KEY = Key.create("Image.timeStamp"); private static final Key<String> FORMAT_KEY = Key.create("Image.format"); private static final Key<SoftReference<ScaledImageProvider>> IMAGE_PROVIDER_REF_KEY = Key.create("Image.bufferedImageProvider"); private static final IcoImageParser ICO_IMAGE_PARSER = new IcoImageParser(); /** * Load image data for file and put user data attributes into file. * * @param file File * @return true if file image is loaded. * @throws java.io.IOException if image can not be loaded */ private static boolean refresh(@NotNull VirtualFile file) throws IOException { Long loadedTimeStamp = file.getUserData(TIMESTAMP_KEY); SoftReference<ScaledImageProvider> imageProviderRef = file.getUserData(IMAGE_PROVIDER_REF_KEY); if (loadedTimeStamp == null || loadedTimeStamp.longValue() != file.getTimeStamp() || SoftReference.dereference(imageProviderRef) == null) { try { final byte[] content = file.contentsToByteArray(); file.putUserData(IMAGE_PROVIDER_REF_KEY, null); if (ICO_FORMAT.equalsIgnoreCase(file.getExtension())) { try { final BufferedImage image = ICO_IMAGE_PARSER.getBufferedImage(new ByteSourceArray(content), null); file.putUserData(FORMAT_KEY, ICO_FORMAT); file.putUserData(IMAGE_PROVIDER_REF_KEY, new SoftReference<>((scale, ancestor) -> image)); return true; } catch (ImageReadException ignore) { } } if (isSVG(file)) { final Ref<URL> url = Ref.create(); try { url.set(new File(file.getPath()).toURI().toURL()); } catch (MalformedURLException ex) { LOG.warn(ex.getMessage()); } try { // ensure svg can be displayed SVGLoader.load(url.get(), new ByteArrayInputStream(content), 1.0f); } catch (Throwable t) { LOG.warn(url.get() + " " + t.getMessage()); return false; } file.putUserData(FORMAT_KEY, SVG_FORMAT); file.putUserData(IMAGE_PROVIDER_REF_KEY, new SoftReference<>(new ImageDocument.CachedScaledImageProvider() { final ScaleContext.Cache<BufferedImage> cache = new ScaleContext.Cache<>((ctx) -> { try { return SVGLoader.loadHiDPI(url.get(), new ByteArrayInputStream(content), ctx); } catch (Throwable t) { LOG.warn(url.get() + " " + t.getMessage()); return null; } }); @Override public void clearCache() { cache.clear(); } @Override public BufferedImage apply(Double zoom, Component ancestor) { ScaleContext ctx = ScaleContext.create(ancestor); ctx.setScale(OBJ_SCALE.of(zoom)); return cache.getOrProvide(ctx); } })); return true; } InputStream inputStream = new ByteArrayInputStream(content, 0, content.length); try (ImageInputStream imageInputStream = ImageIO.createImageInputStream(inputStream)) { Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(imageInputStream); if (imageReaders.hasNext()) { ImageReader imageReader = imageReaders.next(); try { file.putUserData(FORMAT_KEY, imageReader.getFormatName()); ImageReadParam param = imageReader.getDefaultReadParam(); imageReader.setInput(imageInputStream, true, true); int minIndex = imageReader.getMinIndex(); BufferedImage image = imageReader.read(minIndex, param); file.putUserData(IMAGE_PROVIDER_REF_KEY, new SoftReference<>((zoom, ancestor) -> image)); return true; } finally { imageReader.dispose(); } } } } finally { // We perform loading no more needed file.putUserData(TIMESTAMP_KEY, file.getTimeStamp()); } } return false; } @Nullable public static BufferedImage getImage(@NotNull VirtualFile file) throws IOException { return getImage(file, null); } @Nullable public static BufferedImage getImage(@NotNull VirtualFile file, @Nullable Component ancestor) throws IOException { ScaledImageProvider imageProvider = getImageProvider(file); if (imageProvider == null) return null; return imageProvider.apply(1d, ancestor); } @Nullable public static ScaledImageProvider getImageProvider(@NotNull VirtualFile file) throws IOException { refresh(file); SoftReference<ScaledImageProvider> imageProviderRef = file.getUserData(IMAGE_PROVIDER_REF_KEY); return SoftReference.dereference(imageProviderRef); } public static boolean isSVG(@Nullable VirtualFile file) { return file != null && SVG_FORMAT.equalsIgnoreCase(file.getExtension()); } @Nullable public static String getFormat(@NotNull VirtualFile file) throws IOException { refresh(file); return file.getUserData(FORMAT_KEY); } public static String getReferencePath(Project project, VirtualFile file) { final LogicalRoot logicalRoot = LogicalRootsManager.getLogicalRootsManager(project).findLogicalRoot(file); if (logicalRoot != null) { return getRelativePath(file, logicalRoot.getVirtualFile()); } ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); VirtualFile sourceRoot = fileIndex.getSourceRootForFile(file); if (sourceRoot != null) { return getRelativePath(file, sourceRoot); } VirtualFile root = fileIndex.getContentRootForFile(file); if (root != null) { return getRelativePath(file, root); } return file.getPath(); } private static String getRelativePath(final VirtualFile file, final VirtualFile root) { if (root.equals(file)) { return file.getPath(); } return "/" + VfsUtilCore.getRelativePath(file, root, '/'); } }
{ "content_hash": "e5863b3035be4a7f8bd6c141f33c995f", "timestamp": "", "source": "github", "line_count": 207, "max_line_length": 143, "avg_line_length": 38.869565217391305, "alnum_prop": 0.6829480487198608, "repo_name": "leafclick/intellij-community", "id": "557400e0eaf0cbe443370c8323d6329cf497b378", "size": "8046", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "images/src/org/intellij/images/vfs/IfsUtil.java", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package org.apache.bookkeeper.proto; import org.apache.bookkeeper.bookie.Bookie; import org.apache.bookkeeper.bookie.BookieException; import org.apache.bookkeeper.bookie.ReadOnlyBookie; import org.apache.bookkeeper.conf.ServerConfiguration; import org.apache.zookeeper.KeeperException; import java.io.IOException; public class ReadOnlyBookieServer extends BookieServer { public ReadOnlyBookieServer(ServerConfiguration conf) throws IOException, KeeperException, InterruptedException, BookieException { super(conf); } @Override protected Bookie newBookie(ServerConfiguration conf) throws IOException, KeeperException, InterruptedException, BookieException { return new ReadOnlyBookie(conf); } }
{ "content_hash": "eb47c9e31a93a075e8f3e00ac5530eb9", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 88, "avg_line_length": 33, "alnum_prop": 0.7812911725955204, "repo_name": "fengshao0907/bookkeeper", "id": "5242990c9c7bbe2dd6d96be0758973d1a77ad501", "size": "759", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/ReadOnlyBookieServer.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "3546" }, { "name": "C++", "bytes": "323853" }, { "name": "CMake", "bytes": "11444" }, { "name": "Java", "bytes": "4740622" }, { "name": "Protocol Buffer", "bytes": "15021" }, { "name": "Shell", "bytes": "105976" } ], "symlink_target": "" }
package se.citerus.cqrs.bookstore.ordercontext.application.infrastructure; import se.citerus.cqrs.bookstore.GenericId; import se.citerus.cqrs.bookstore.domain.AggregateRoot; import se.citerus.cqrs.bookstore.domain.Repository; import se.citerus.cqrs.bookstore.event.DomainEvent; import se.citerus.cqrs.bookstore.event.DomainEventBus; import se.citerus.cqrs.bookstore.event.DomainEventStore; import java.util.List; import static java.lang.String.format; public class DefaultRepository implements Repository { private final DomainEventBus domainEventBus; private final DomainEventStore domainEventStore; public DefaultRepository(DomainEventBus domainEventBus, DomainEventStore domainEventStore) { this.domainEventBus = domainEventBus; this.domainEventStore = domainEventStore; } @Override public <AR extends AggregateRoot> void save(AR aggregateRoot) { if (aggregateRoot.hasUncommittedEvents()) { List<DomainEvent> newEvents = aggregateRoot.getUncommittedEvents(); domainEventStore.save(aggregateRoot.id(), aggregateRoot.getClass(), newEvents); domainEventBus.publish(newEvents); } } @Override public <AR extends AggregateRoot, ID extends GenericId> AR load(ID id, Class<AR> aggregateType) { try { AR aggregateRoot = aggregateType.newInstance(); aggregateRoot.loadFromHistory(domainEventStore.loadEvents(id)); return aggregateRoot; } catch (IllegalArgumentException iae) { String message = format("Aggregate of type [%s] does not exist, ID: %s", aggregateType.getSimpleName(), id); throw new IllegalArgumentException(message); } catch (Exception ex) { throw new RuntimeException(ex); } } }
{ "content_hash": "7d1ccaa3d89c09ca0446c4b619c2e33d", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 114, "avg_line_length": 36.212765957446805, "alnum_prop": 0.7667450058754407, "repo_name": "citerus/bookstore-cqrs-example", "id": "84ed65bd427916f24173dd3cb849561f337c05d7", "size": "1702", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "order-context-parent/order-application/src/main/java/se/citerus/cqrs/bookstore/ordercontext/application/infrastructure/DefaultRepository.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "14828" }, { "name": "Java", "bytes": "120732" } ], "symlink_target": "" }
<template name="roomListItem"> <div class="draggableRoomItem link item {{isSelectedClass}} violet setRoomLink" data-id="{{_id}}"> {{#if unreadCount}} <div class="ui label">{{unreadCount}}</div> {{/if}} {{#if isPrivate}} <i class="fa fa-lock"></i> {{/if}} #{{name}} <a href="#" class="room-leave-link {{leaveLinkEnabled}}" alt="Leave #{{name}}."><i class="fa fa-remove"></i></a> </div> </template>
{ "content_hash": "ac4ba51b3a7bb144f0c8cdf6562adc98", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 120, "avg_line_length": 39.666666666666664, "alnum_prop": 0.5315126050420168, "repo_name": "praneybehl/nullchat", "id": "ab4576fbb3d9b52dd31cb1e7962bac32f89acda8", "size": "476", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "client/views/rooms/room-list-item.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "24300" }, { "name": "HTML", "bytes": "34834" }, { "name": "JavaScript", "bytes": "508350" } ], "symlink_target": "" }
#include <iostream> #include "securemessage/util.h" using std::unique_ptr; namespace securemessage { unique_ptr<string> Util::MakeUniquePtrString(const void* data, size_t length) { return unique_ptr<string>(new string((const char*)data, length)); } void Util::LogError(const string& error_message) { std::cerr << "[ERROR] " << error_message << std::endl; } void Util::LogErrorAndAbort(const string& error_message) { LogError(error_message); abort(); } Util::~Util() {} } // namespace securemessage
{ "content_hash": "fb55940a6b8a322b876775caed987fd8", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 79, "avg_line_length": 19.884615384615383, "alnum_prop": 0.7001934235976789, "repo_name": "google/securemessage", "id": "d18171b89f471815a949c30cb906bda5962bba22", "size": "1132", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "cpp/src/securemessage/util.cc", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C++", "bytes": "194423" }, { "name": "CMake", "bytes": "8175" }, { "name": "Makefile", "bytes": "7167" } ], "symlink_target": "" }
#ifndef _MD5_H #define _MD5_H 1 #include "../include/stdio.h" #if defined HAVE_LIMITS_H || _LIBC # include "../include/limits.h" #endif /* The following contortions are an attempt to use the C preprocessor to determine an unsigned integral type that is 32 bits wide. An alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but doing that would require that the configure script compile and *run* the resulting executable. Locally running cross-compiled executables is usually not possible. */ #ifdef _LIBC typedef u_int32_t md5_uint32; #else # define INT_MAX_32_BITS 2147483647 /* If UINT_MAX isn't defined, assume it's a 32-bit type. This should be valid for all systems GNU cares about because that doesn't include 16-bit systems, and only modern systems (that certainly have <limits.h>) have 64+-bit integral types. */ # ifndef INT_MAX # define INT_MAX INT_MAX_32_BITS # endif # if INT_MAX == INT_MAX_32_BITS typedef unsigned int md5_uint32; # else # if SHRT_MAX == INT_MAX_32_BITS typedef unsigned short md5_uint32; # else # if LONG_MAX == INT_MAX_32_BITS typedef unsigned long md5_uint32; # else /* The following line is intended to evoke an error. Using #error is not portable enough. */ "Cannot determine unsigned 32-bit data type." # endif # endif # endif #endif #undef __P #if defined (__STDC__) && __STDC__ #define __P(x) x #else #define __P(x) () #endif /* Structure to save state of computation between the single steps. */ struct md5_ctx { md5_uint32 A; md5_uint32 B; md5_uint32 C; md5_uint32 D; md5_uint32 total[2]; md5_uint32 buflen; char buffer[128]; }; /* * The following three functions are build up the low level used in * the functions `md5_stream' and `md5_buffer'. */ /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ extern void md5_init_ctx __P ((struct md5_ctx *ctx)); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is necessary that LEN is a multiple of 64!!! */ extern void md5_process_block __P ((const void *buffer, size_t len, struct md5_ctx *ctx)); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ extern void md5_process_bytes __P ((const void *buffer, size_t len, struct md5_ctx *ctx)); /* Process the remaining bytes in the buffer and put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf)); /* Put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf)); /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ extern int md5_stream __P ((FILE *stream, void *resblock)); /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ extern void *md5_buffer __P ((const char *buffer, size_t len, void *resblock)); #endif
{ "content_hash": "6c37c663e9eb8a9e63c351531caf3b15", "timestamp": "", "source": "github", "line_count": 123, "max_line_length": 79, "avg_line_length": 32.03252032520325, "alnum_prop": 0.7088832487309644, "repo_name": "Oss9935/MakitOS", "id": "1d0557b9cd63ee64dbb73f6f3dcb6df95d0a33e2", "size": "4936", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "osproj/omake/tolsrc/go_0023s/include/md5.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Assembly", "bytes": "41621" }, { "name": "Batchfile", "bytes": "52225" }, { "name": "C", "bytes": "28851885" }, { "name": "C++", "bytes": "838924" }, { "name": "Go", "bytes": "813" }, { "name": "Groff", "bytes": "11655" }, { "name": "Makefile", "bytes": "785631" } ], "symlink_target": "" }
 #pragma once #include <aws/appmesh/AppMesh_EXPORTS.h> #include <aws/appmesh/model/AccessLog.h> #include <utility> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace AppMesh { namespace Model { /** * <p>An object that represents the logging information for a virtual * node.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/appmesh-2019-01-25/Logging">AWS API * Reference</a></p> */ class AWS_APPMESH_API Logging { public: Logging(); Logging(Aws::Utils::Json::JsonView jsonValue); Logging& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p>The access log configuration for a virtual node.</p> */ inline const AccessLog& GetAccessLog() const{ return m_accessLog; } /** * <p>The access log configuration for a virtual node.</p> */ inline bool AccessLogHasBeenSet() const { return m_accessLogHasBeenSet; } /** * <p>The access log configuration for a virtual node.</p> */ inline void SetAccessLog(const AccessLog& value) { m_accessLogHasBeenSet = true; m_accessLog = value; } /** * <p>The access log configuration for a virtual node.</p> */ inline void SetAccessLog(AccessLog&& value) { m_accessLogHasBeenSet = true; m_accessLog = std::move(value); } /** * <p>The access log configuration for a virtual node.</p> */ inline Logging& WithAccessLog(const AccessLog& value) { SetAccessLog(value); return *this;} /** * <p>The access log configuration for a virtual node.</p> */ inline Logging& WithAccessLog(AccessLog&& value) { SetAccessLog(std::move(value)); return *this;} private: AccessLog m_accessLog; bool m_accessLogHasBeenSet; }; } // namespace Model } // namespace AppMesh } // namespace Aws
{ "content_hash": "6e2174c25eefaf5c20c8b4aba41a52a1", "timestamp": "", "source": "github", "line_count": 76, "max_line_length": 113, "avg_line_length": 25.460526315789473, "alnum_prop": 0.6578811369509044, "repo_name": "jt70471/aws-sdk-cpp", "id": "a952daa41ca9d7326c6665cdf58db11860ea71ee", "size": "2054", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "aws-cpp-sdk-appmesh/include/aws/appmesh/model/Logging.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "13452" }, { "name": "C++", "bytes": "278594037" }, { "name": "CMake", "bytes": "653931" }, { "name": "Dockerfile", "bytes": "5555" }, { "name": "HTML", "bytes": "4471" }, { "name": "Java", "bytes": "302182" }, { "name": "Python", "bytes": "110380" }, { "name": "Shell", "bytes": "4674" } ], "symlink_target": "" }
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Begin Form Interaction Functions function ninja_forms_insert_field( $form_id, $args = array() ){ global $wpdb; $insert_array = array(); $insert_array['type'] = $args['type']; $insert_array['form_id'] = $form_id; if( isset( $args['data'] ) ){ $insert_array['data'] = $args['data']; }else{ $insert_array['data'] = ''; } if( isset( $args['order'] ) ){ $insert_array['order'] = $args['order']; }else{ $insert_array['order'] = 999; } if( isset( $args['fav_id'] ) ){ $insert_array['fav_id'] = $args['fav_id']; } if( isset( $args['def_id'] ) ){ $insert_array['def_id'] = $args['def_id']; } $new_field = $wpdb->insert( NINJA_FORMS_FIELDS_TABLE_NAME, $insert_array ); $new_id = $wpdb->insert_id; return $new_id; } function ninja_forms_get_form_ids_by_post_id( $post_id ){ global $wpdb; $form_ids = array(); if( is_page( $post_id ) ){ $form_results = ninja_forms_get_all_forms(); if(is_array($form_results) AND !empty($form_results)){ foreach($form_results as $form){ $form_data = $form['data']; if(isset($form_data['append_page']) AND !empty($form_data['append_page'])){ if($form_data['append_page'] == $post_id){ $form_ids[] = $form['id']; } } } } $form_id = get_post_meta( $post_id, 'ninja_forms_form', true ); if( !empty( $form_id ) ){ $form_ids[] = $form_id; } }else if( is_single( $post_id ) ){ $form_id = get_post_meta( $post_id, 'ninja_forms_form', true ); if( !empty( $form_id ) ){ $form_ids[] = $form_id; } } return $form_ids; } function ninja_forms_get_form_by_sub_id( $sub_id ){ global $wpdb; $form_id = Ninja_Forms()->sub( $sub_id )->form_id; $form_row = ninja_forms_get_form_by_id( $form_id ); return $form_row; } // The ninja_forms_delete_form( $form_id ) function is in includes/deprecated.php // Begin Field Interaction Functions function ninja_forms_get_field_by_id($field_id){ global $wpdb; $field_row = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".NINJA_FORMS_FIELDS_TABLE_NAME." WHERE id = %d", $field_id), ARRAY_A); if( $field_row != null ){ $field_row['data'] = unserialize($field_row['data']); return $field_row; }else{ return false; } } function ninja_forms_get_fields_by_form_id($form_id, $orderby = 'ORDER BY `order` ASC'){ global $wpdb; $field_results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".NINJA_FORMS_FIELDS_TABLE_NAME." WHERE form_id = %d ".$orderby, $form_id), ARRAY_A); if(is_array($field_results) AND !empty($field_results)){ $x = 0; $count = count($field_results) - 1; while($x <= $count){ $field_results[$x]['data'] = unserialize($field_results[$x]['data']); $x++; } } return $field_results; } function ninja_forms_get_all_fields(){ global $wpdb; $field_results = $wpdb->get_results("SELECT * FROM ".NINJA_FORMS_FIELDS_TABLE_NAME, ARRAY_A); if(is_array($field_results) AND !empty($field_results)){ $x = 0; $count = count($field_results) - 1; while($x <= $count){ $field_results[$x]['data'] = unserialize($field_results[$x]['data']); $x++; } } return $field_results; } function ninja_forms_update_field($args){ global $wpdb; $update_array = $args['update_array']; $where = $args['where']; $wpdb->update(NINJA_FORMS_FIELDS_TABLE_NAME, $update_array, $where); } function ninja_forms_delete_field( $field_id ){ global $wpdb; $wpdb->query($wpdb->prepare("DELETE FROM ".NINJA_FORMS_FIELDS_TABLE_NAME." WHERE id = %d", $field_id), ARRAY_A); } // Begin Favorite Fields Interaction Functions function ninja_forms_get_fav_by_id($fav_id){ global $wpdb; $fav_row = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE id = %d", $fav_id), ARRAY_A); $fav_row['data'] = unserialize($fav_row['data']); return $fav_row; } function ninja_forms_delete_fav_by_id($fav_id){ global $wpdb; $wpdb->query($wpdb->prepare("DELETE FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE id = %d", $fav_id), ARRAY_A); } function ninja_forms_get_all_favs(){ global $wpdb; $fav_results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE row_type = %d ORDER BY name ASC", 1), ARRAY_A); if(is_array($fav_results) AND !empty($fav_results)){ $x = 0; $count = count($fav_results) - 1; while($x <= $count){ $fav_results[$x]['data'] = unserialize($fav_results[$x]['data']); $x++; } } return $fav_results; } // Begin Defined Fields Functions function ninja_forms_get_def_by_id($def_id){ global $wpdb; $def_row = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE id = %d", $def_id), ARRAY_A); $def_row['data'] = unserialize($def_row['data']); return $def_row; } function ninja_forms_get_all_defs(){ global $wpdb; $def_results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".NINJA_FORMS_FAV_FIELDS_TABLE_NAME." WHERE row_type = %d", 0), ARRAY_A); if(is_array($def_results) AND !empty($def_results)){ $x = 0; $count = count($def_results) - 1; while($x <= $count){ $def_results[$x]['data'] = unserialize($def_results[$x]['data']); $x++; } } return $def_results; } function ninja_forms_addslashes_deep( $value ){ $value = is_array($value) ? array_map('ninja_forms_addslashes_deep', $value) : addslashes($value); return $value; } function utf8_encode_recursive( $input ){ if ( is_array( $input ) ) { return array_map( __FUNCTION__, $input ); }else{ return utf8_encode( $input ); } } function ninja_forms_str_replace_deep($search, $replace, $subject){ if( is_array( $subject ) ){ foreach( $subject as &$oneSubject ) $oneSubject = ninja_forms_str_replace_deep($search, $replace, $oneSubject); unset($oneSubject); return $subject; } else { return str_replace($search, $replace, $subject); } } function ninja_forms_html_entity_decode_deep( $value, $flag = ENT_COMPAT ){ $value = is_array($value) ? array_map('ninja_forms_html_entity_decode_deep', $value) : html_entity_decode( $value, $flag ); return $value; } function ninja_forms_htmlspecialchars_deep( $value ){ $value = is_array($value) ? array_map('ninja_forms_htmlspecialchars_deep', $value) : htmlspecialchars( $value ); return $value; } function ninja_forms_stripslashes_deep( $value ){ $value = is_array($value) ? array_map('ninja_forms_stripslashes_deep', $value) : stripslashes($value); return $value; } function ninja_forms_esc_html_deep( $value ){ $value = is_array($value) ? array_map('ninja_forms_esc_html_deep', $value) : esc_html($value); return $value; } function nf_wp_kses_post_deep( $value ){ $value = is_array( $value ) ? array_map( 'nf_wp_kses_post_deep', $value ) : wp_kses_post($value); return $value; } function ninja_forms_strip_tags_deep($value ){ $value = is_array($value) ? array_map('ninja_forms_strip_tags_deep', $value) : strip_tags($value); return $value; } function ninja_forms_json_response(){ global $ninja_forms_processing; $form_id = $ninja_forms_processing->get_form_ID(); $errors = $ninja_forms_processing->get_all_errors(); $success = $ninja_forms_processing->get_all_success_msgs(); $fields = $ninja_forms_processing->get_all_fields(); $form_settings = $ninja_forms_processing->get_all_form_settings(); $extras = $ninja_forms_processing->get_all_extras(); // Success will default to false if there is not success message. if ( ! $success && ! $errors ) $success = true; if( version_compare( phpversion(), '5.3', '>=' ) ){ $json = json_encode( array( 'form_id' => $form_id, 'errors' => $errors, 'success' => $success, 'fields' => $fields, 'form_settings' => $form_settings, 'extras' => $extras ), JSON_HEX_QUOT | JSON_HEX_TAG ); }else{ $errors = ninja_forms_html_entity_decode_deep( $errors ); $success = ninja_forms_html_entity_decode_deep( $success ); $fields = ninja_forms_html_entity_decode_deep( $fields ); $form_settings = ninja_forms_html_entity_decode_deep( $form_settings ); $extras = ninja_forms_html_entity_decode_deep( $extras ); $errors = utf8_encode_recursive( $errors ); $success = utf8_encode_recursive( $success ); $fields = utf8_encode_recursive( $fields ); $form_settings = utf8_encode_recursive( $form_settings ); $extras = utf8_encode_recursive( $extras ); $errors = ninja_forms_str_replace_deep( '"', "\u0022", $errors ); $errors = ninja_forms_str_replace_deep( "'", "\u0027", $errors ); $errors = ninja_forms_str_replace_deep( '<', "\u003C", $errors ); $errors = ninja_forms_str_replace_deep( '>', "\u003E", $errors ); $success = ninja_forms_str_replace_deep( '"', "\u0022", $success ); $success = ninja_forms_str_replace_deep( "'", "\u0027", $success ); $success = ninja_forms_str_replace_deep( '<', "\u003C", $success ); $success = ninja_forms_str_replace_deep( '>', "\u003E", $success ); $fields = ninja_forms_str_replace_deep( '"', "\u0022", $fields ); $fields = ninja_forms_str_replace_deep( "'", "\u0027", $fields ); $fields = ninja_forms_str_replace_deep( '<', "\u003C", $fields ); $fields = ninja_forms_str_replace_deep( '>', "\u003E", $fields ); $form_settings = ninja_forms_str_replace_deep( '"', "\u0022", $form_settings ); $form_settings = ninja_forms_str_replace_deep( "'", "\u0027", $form_settings ); $form_settings = ninja_forms_str_replace_deep( '<', "\u003C", $form_settings ); $form_settings = ninja_forms_str_replace_deep( '>', "\u003E", $form_settings ); $extras = ninja_forms_str_replace_deep( '"', "\u0022", $extras ); $extras = ninja_forms_str_replace_deep( "'", "\u0027", $extras ); $extras = ninja_forms_str_replace_deep( '<', "\u003C", $extras ); $extras = ninja_forms_str_replace_deep( '>', "\u003E", $extras ); $json = json_encode( array( 'form_id' => $form_id, 'errors' => $errors, 'success' => $success, 'fields' => $fields, 'form_settings' => $form_settings, 'extras' => $extras ) ); $json = str_replace( "\\\u0022", "\\u0022", $json ); $json = str_replace( "\\\u0027", "\\u0027", $json ); $json = str_replace( "\\\u003C", "\\u003C", $json ); $json = str_replace( "\\\u003E", "\\u003E", $json ); } return $json; } /* * * Function that sets up our transient variable. * * @since 2.2.45 * @return void */ function ninja_forms_set_transient(){ global $ninja_forms_processing; $form_id = $ninja_forms_processing->get_form_ID(); // Setup our transient variable. $transient = array(); $transient['form_id'] = $form_id; $transient['field_values'] = $ninja_forms_processing->get_all_fields(); $transient['form_settings'] = $ninja_forms_processing->get_all_form_settings(); $transient['extra_values'] = $ninja_forms_processing->get_all_extras(); $all_fields_settings = array(); if ( $ninja_forms_processing->get_all_fields() ) { foreach ( $ninja_forms_processing->get_all_fields() as $field_id => $user_value ) { $field_settings = $ninja_forms_processing->get_field_settings( $field_id ); $all_fields_settings[$field_id] = $field_settings; } } $transient['field_settings'] = $all_fields_settings; // Set errors and success messages as $_SESSION variables. $success = $ninja_forms_processing->get_all_success_msgs(); $errors = $ninja_forms_processing->get_all_errors(); $transient['success_msgs'] = $success; $transient['error_msgs'] = $errors; if ( ! isset ( $_SESSION['ninja_forms_transient_id'] ) ) ninja_forms_set_transient_id(); if ( isset ( $_SESSION['ninja_forms_transient_id'] ) ) { $transient_id = $_SESSION['ninja_forms_transient_id']; } //delete_transient( 'ninja_forms_test' ); set_transient( $transient_id, $transient, DAY_IN_SECONDS ); } /* * * Function that deletes our transient variable * * @since 2.2.45 * @return void */ function ninja_forms_delete_transient(){ if( isset( $_SESSION['ninja_forms_transient_id'] ) ) { delete_transient( $_SESSION['ninja_forms_transient_id'] ); } } /** * Get a count of submissions for a form * * @since 2.7 * @param int $post_id * @return int $count */ function nf_get_sub_count( $form_id, $post_status = 'publish' ) { global $wpdb; $meta_key = '_form_id'; $meta_value = $form_id; $sql = "SELECT count(DISTINCT pm.post_id) FROM $wpdb->postmeta pm JOIN $wpdb->posts p ON (p.ID = pm.post_id) WHERE pm.meta_key = '$meta_key' AND pm.meta_value = '$meta_value' AND p.post_type = 'nf_sub' AND p.post_status = '$post_status'"; $count = $wpdb->get_var($sql); return $count; } /** * Get an array of our fields by form ID. * The returned array has the field_ID as the key. * * @since 2.7 * @param int $form_id * @return array $tmp_array */ function nf_get_fields_by_form_id( $form_id, $orderby = 'ORDER BY `order` ASC' ){ global $wpdb; $tmp_array = array(); $field_results = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".NINJA_FORMS_FIELDS_TABLE_NAME." WHERE form_id = %d ".$orderby, $form_id), ARRAY_A); if ( is_array( $field_results ) && ! empty( $field_results ) ) { foreach ( $field_results as $field ) { $field_id = $field['id']; $field['data'] = unserialize( $field['data'] ); $tmp_array[ $field_id ] = $field; } } return $tmp_array; }
{ "content_hash": "bc00fff8afa1b2767d8e4d8d49468723", "timestamp": "", "source": "github", "line_count": 423, "max_line_length": 208, "avg_line_length": 31.404255319148938, "alnum_prop": 0.6277476663655526, "repo_name": "MSPSpain/DotNetClub-Website", "id": "42018eb2b7cb40a96f2a3245fc204d11056a4c1d", "size": "13284", "binary": false, "copies": "31", "ref": "refs/heads/master", "path": "wp-content/plugins/ninja-forms/includes/database.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "137" }, { "name": "CSS", "bytes": "1543598" }, { "name": "HTML", "bytes": "33039" }, { "name": "JavaScript", "bytes": "1857634" }, { "name": "Modelica", "bytes": "33302" }, { "name": "PHP", "bytes": "10644612" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <documents> <document uid="fa0654e85e181cff6334eaf975328378"> <field name="title"><![CDATA[Einführung in Kubernetes]]></field> <field name="subline"><![CDATA[]]></field> <field name="teaser"><![CDATA[<p>Die Container-Orchestrierungs-Lösung Kubernetes ist eines der am stärksten gewachsenen Open-Source-Projekte der letzten Jahre. Alle großen Cloud-Anbieter wie Google, Amazon, Microsoft und weitere bieten heutzutage Kubernetes-Instanzen an und unzählige Firmen lagern ihre Anwendungen auf Cluster in der Cloud aus, die mit Kubernetes betrieben werden. Grund genug, sich einmal näher mit Kubernetes und den Konzepten dahinter zu beschäftigen.</p> ]]></field> <field name="language_multi_keyword"><![CDATA[de]]></field> <field name="content_type_multi_keyword"><![CDATA[blog]]></field> <field name="mime_type_multi_keyword"><![CDATA[text/html]]></field> <field name="category_multi_keyword"><![CDATA[Softwareentwicklung]]></field> <field name="tag_multi_keyword"><![CDATA[cloud]]></field> <field name="tag_multi_keyword"><![CDATA[kubernetes]]></field> <field name="date_date"><![CDATA[2018-01-08T11:00:00+01:00]]></field> <field name="date_l"><![CDATA[1515405600000]]></field> <field name="change_date"><![CDATA[1515405600000]]></field> <!--Picture--> <!-- Not in use at the moment--> <!--Author Information--> <field name="author_first_name"><![CDATA[Thomas]]></field> <field name="author_last_name"><![CDATA[Buß]]></field> <field name="author_id"><![CDATA[t-buss]]></field> <field name="author_picture_stored_only"><![CDATA[http://localhost:4000/assets/images/avatars/tbuss.jpg]]></field> <!--Postcontent--> <field name="headlines"><![CDATA[Einführung in Kubernetes]]></field> <field name="display_content"><![CDATA[<div class="i2-intro p-t-1"> <p>Die Container-Orchestrierungs-Lösung Kubernetes ist eines der am stärksten gewachsenen Open-Source-Projekte der letzten Jahre. Alle großen Cloud-Anbieter wie Google, Amazon, Microsoft und weitere bieten heutzutage Kubernetes-Instanzen an und unzählige Firmen lagern ihre Anwendungen auf Cluster in der Cloud aus, die mit Kubernetes betrieben werden. Grund genug, sich einmal näher mit Kubernetes und den Konzepten dahinter zu beschäftigen.</p> </div>]]></field> <field name="content"><![CDATA[<div class="adesso-text-formate"> <div class="row p-t-2"> <div class="adesso-container"> <div class="col-xl-8 adesso-center p-b-1 p-l-0 p-r-0"> <p>Die Container-Orchestrierungs-Lösung Kubernetes ist eines der am stärksten gewachsenen Open-Source-Projekte der letzten Jahre. Alle großen Cloud-Anbieter wie Google, Amazon, Microsoft und weitere bieten heutzutage Kubernetes-Instanzen an und unzählige Firmen lagern ihre Anwendungen auf Cluster in der Cloud aus, die mit Kubernetes betrieben werden. Grund genug, sich einmal näher mit Kubernetes und den Konzepten dahinter zu beschäftigen.</p> <p>Der <a href="https://octoverse.github.com/projects">Octoverse-Report</a> von Github zeigt, dass man sich mit Kubernetes beschäftigen sollte, um am Ball der Container-Technologien zu bleiben. In diesem Blogpost geht es um die grundlegenden Konzepte, mit denen die Container-Orchestrierung Kubernetes arbeitet. Container-Orchestrierung bedeutet das Management von hunderten lose gekoppelten Anwendungs-Containern, die zusammen miteinander interagieren müssen. Unser Fokus liegt auf der Sicht eines Entwicklers, nicht der eines Cluster-Operators. Wir betrachten ein kleines Beispiel, indem wir eine triviale Spring-Boot-Anwendung in dem lokalen Kubernetes-Cluster Minikube ausführen.</p> <p>Ein kurzes Wort der Warnung: Minikube eignet sich zwar, um grundlegende Konzepte von Kubernetes-Clustern zu erklären, ist jedoch weiterführend in vielerlei Hinsicht nicht mit einem <em>echten</em>, produktionsreifen Cluster in der Cloud vergleichbar. An den Stellen, wo Minikube sich von anderen Clustern unterscheidet, wird explizit darauf hingewiesen.</p> <p>Desweiteren sollte man beachten, das Kubernetes sich schnell weiterentwickelt und unter Umständen einige der Beispiele aus diesem Artikel aufgrund von Änderungen an der Kubernetes-API nicht mehr funktionieren könnten. Es ist daher ratsam, sowohl die Versionsnummern (hier v1.10.0) als auch die <a href="https://kubernetes.io/docs/home/">Kubernetes-Dokumentation</a> und den <a href="https://kubernetes.io/blog/">Entwickler-Blog</a> im Auge zu behalten.</p> <p>Bevor wir zum Praxisteil kommen, klären wir aber erst einmal die Begrifflichkeiten.</p> <h4 id="cluster-nodes-und-pods">Cluster, Nodes und Pods</h4> <p>Kubernetes ist eine verteilte Anwendung, wird also auf mehreren physikalischen (oder virtuellen) Rechnern ausgeführt, die man als <em>Nodes</em> bezeichnet und die zusammen den Kubernetes <em>Cluster</em> bilden. Mindestens ein Node nimmt dabei die Rolle des Masters ein, der den Cluster verwaltet und die Befehle des Benutzers entgegen nimmt.</p> <p>Auf den Nodes laufen sogenannte <em>Pods</em>. Sie sind die kleinste Ressource in Kubernetes. Ein Pod führt einen oder mehrere Container aus, die zusammen als Einheit gestartet werden. Die Wörtchen “oder mehrere” können dabei leicht zu Verwirrung führen. In einer Microservices-Anwendung korrespondiert ein Pod zu einem Microservice, also meistens auch einem Container. Es gibt verschiedene Fälle, in denen man gleich mehrere Container in einem Pod starten möchte; zum Beispiel um Pod-zu-Pod-Kommunikation über ein Service-Mesh wie <em>Istio</em> zu betreiben. Dies soll jedoch nicht Inhalt dieses Blogposts sein. Da die Nodes miteinander ein virtuelles Netzwerk bilden und verbunden sind, kann es uns (als Entwickler) grundsätzlich egal sein, auf welchem Node ein Pod läuft. Kubernetes verteilt automatisch die Pods auf solche Nodes, die im Moment weniger Last haben als die anderen.</p> <p>Pods sind kurzlebig. Sie werden erstellt, bekommen eine interne IP im virtuellen Netzwerk und führen ihre Container aus. Wenn ein Pod beendet wird oder abstürzt, werden lokale Daten und Speicher gelöscht (dieses Problem lässt sich durch Verwendung von verschiedenen Persistent-Storage-Ansätzen lösen, die wir hier allerdings nicht betrachten). Die IP des Pods kann nun von beliebigen anderen Pods, die der Cluster startet, verwendet werden.</p> <p>Es stellt sich also die Frage, wie man eine Anwendung erreichen kann, wenn die interne IP nicht als fest angenommen werden kann. Zudem ist es für Anwendungen mit hoher Last nicht möglich, alle Anfragen von nur einer Container-Instanz abwickeln zu lassen. Zur Skalierung müssen mehrere identische Pods gestartet werden, unter denen sich die Last aufteilt. Diese Lösungen für diese Probleme nennt man “Service Discovery” und “Load Balancing”. Wir wollen uns in diesem Blogpost anschauen, wie Kubernetes diese Probleme löst.</p> <h4 id="zielsetzung">Zielsetzung</h4> <p>Konkretisieren wir unser Ziel noch einmal mit den neuen Begriffen, die wir gerade kennen gelernt haben. <strong>Das Ziel in diesem Blogpost soll es sein, einen REST-Service in einem Kubernetes-Cluster bereitzustellen</strong>. Clients im selben Cluster können eine URI aufrufen und erhalten die erwartete Antwort. Wir programmieren eine einfache Anwendung, die den Wert einer Konfigurationsvariablen ausgibt. Diese packen wir in einige Pods, die in unserem Cluster laufen.</p> <p>Es soll sichergestellt werden, dass beim Absturz eines Pods automatisch ein neuer Pod gestartet wird. Zudem soll gewährleistet werden, dass die Last auf alle aktiven Pods verteilt wird, sodass der Ausfall eines Pods von außen quasi nicht zu erkennen ist. Zuletzt wollen wir noch ein Update der Anwendung durchführen.</p> <h4 id="die-tools">Die Tools</h4> <p>Schauen wir uns die Tools an, mit denen wir unser Beispiel durchführen werden.</p> <h5 id="minikube">Minikube</h5> <p>Allen voran brauchen wir einen Cluster, auf dem wir unsere Beispielanwendung laufen lassen. Für die lokale Entwicklung eignet sich <a href="https://kubernetes.io/docs/setup/minikube/">Minikube</a> sehr gut. Ich verwende die Version v0.28.2.</p> <p><em><strong>Achtung</strong>: Obwohl V-Sphere offiziell von Minikube als Virtualisierungs-Lösung unterstützt wird, hatte ich einige Probleme, es damit zu starten. Mit VirtualBox habe ich wesentlich bessere Erfahrungen gemacht und möchte es daher jedem ans Herz legen.</em></p> <p><strong>Minkube stellt einen “Cluster” mit nur einem Node in einer virtuellen Maschine bereit</strong>. Dieser unterscheidet sich von einem “echten” Kubernetes Cluster unter anderem darin, dass auf dem einen Node sowohl die Pods als auch die Master-Prozesse zur Verwaltung des Clusters laufen. Normalerweise sind die Master-Prozesse auf designierten Nodes, um für Ausfallsicherheit zu sorgen.</p> <p>Nachdem ein lokaler Cluster nach den Anweisungen auf der <a href="https://kubernetes.io/docs/setup/minikube/">Minikube-Website</a> installiert und mit <code>minikube start</code> gestartet wurde, können wir uns schon ein wenig in unserem Cluster umsehen.</p> <p>Dazu dient das Kommandozeilentool <code>kubectl</code>, dass bei der Installation von Minikube mit installiert wird. Mit <code>kubectl get pods</code> können wir uns beispielsweise alle Pods anzeigen lassen, die gerade laufen. Wer kein Freund von Kommandozeilentools ist, kann sich mit dem Kubernetes Dashboard weiterhelfen. Dazu gibt man das Kommando <code>minikube dashboard</code> ein, woraufhin sich der Browser öffnet und das Dashboard anzeigt. Hier lassen sich Informationen zu allen Kubernetes Ressourcen anzeigen, die aktuell auf dem Cluster ausgeführt werden. Wir kennen bereits Nodes und Pods. Auf einige andere Arten von Ressourcen wird später noch eingegangen.</p> <h5 id="kotlin-und-spring">Kotlin und Spring</h5> <p>Als Programmiersprache für unsere Beispielanwendung werden wir Kotlin verwenden. Kotlin ist eine moderne Programmiersprache für die JVM und alle coolen Kinder benutzen sie, also machen wir das auch! Spring ist ein sehr beliebtes Framework für Webanwendungen auf Basis der JVM und eignet sich perfekt für unsere Zwecke: Wir benötigen einen einfachen REST-Endpunkt und müssen eine Umgebungsvariable auslesen. Beides lässt sich mit Spring relativ leicht bewerkstelligen.</p> <h5 id="docker">Docker</h5> <p>Kubernetes verwaltet Container und die beliebteste Software für Container ist <a href="https://www.docker.com/">Docker</a>, welches auch Minikube verwendet. Andere Container-Lösungen wie <a href="https://coreos.com/rkt/docs/latest/"><em>rkt</em></a> sind ebenfalls möglich. Docker an sich ist bereits ein riesiges Themengebiet, weshalb wir an dieser Stelle nicht weiter darauf eingehen können. Soviel sei gesagt: Wir erstellen ein Docker-Image (eine Art Container-Blaupause) für unsere Spring-Anwendung und laden sie in eine Registry hoch (ich verwende Docker Hub). Der Cluster wird bei der Erstellung von Pods dieses Image runterladen und für die Container verwenden.</p> <h4 id="lets-go">Let’s Go!</h4> <p>Genug der Theorie, gehen wir ans Werk.</p> <h5 id="die-spring-anwendung">Die Spring Anwendung</h5> <p>Die Anwendung ist denkbar simpel, sodass wir uns nicht lange mit Erklärungen aufhalten. Die interessante Stelle im Quellcode ist die Folgende:</p> <pre><code class="language-kotlin">@RestController class EnvironmentVariableController { @Value("\${SOME_ENV_VAR}") lateinit var envVar: String @GetMapping("/getenv") fun getEnvironmentVariable() = this.envVar } </code></pre> <p>Das Repository mit dem gesamten Quellcode ist <a href="https://gitlab.com/tbuss/sample-sck">hier</a> zu finden, das Docker-Image findet sich <a href="https://hub.docker.com/r/tbuss93/sample-sck/">hier</a>.</p> <h5 id="pods-manuell-starten-und-prüfen">Pods manuell starten und prüfen</h5> <p>Wir können jetzt einen oder mehrere Pods in unserem Cluster manuell erstellen. Für alle Kubernetes-Ressourcen benutzen wir deklarative YAML-Dateien. Kubernetes liest den gewünschten Status aus den Dateien aus und kümmert sich für uns darum, dass dieser Status aufrecht erhalten wird. Einfach ausgedrückt: “Was will ich haben?” anstatt “Was muss passieren?”.</p> <p>Erstellen wir uns einen neuen Ordner außerhalb unseres Code-Repositories. Manche Teams speichern die Kubernetes-Konfiguration ihrer Anwendung innerhalb des gleichen Git-Repositories, aber ich persönlich finde eine strikte Trennung zwischen Anwendungscode und Deployment eleganter.</p> <p>Wir wählen als Ordnernamen “sample-sck-minikube”, also eine Kombination aus Anwendungsnamen und Deployment-Umgebung. Darin erstellen wir die Datei <code>sample-sck-pod-1.yaml</code> für einen einfachen Pod. Die YAML-Datei dafür sieht folgendermaßen aus:</p> <pre><code class="language-yaml">apiVersion: v1 kind: Pod metadata: name: sample-sck-pod-1 spec: containers: - name: sample-sck image: tbuss93/sample-sck:v1 ports: - containerPort: 5000 env: - name: SOME_ENV_VAR value: Foo </code></pre> <p>Die YAML-Dateien in Kubernetes beginnen immer mit Meta-Informationen über die <a href="https://kubernetes.io/docs/concepts/overview/kubernetes-api/">API</a>, die benutzt wird und mit der Art von Ressource, die erstellt werden soll. Auch ein Name wird angegeben. Danach folgt die Spezifizierung des Pods, wo wir nicht nur das Image und den Namen angeben, sondern auch den Port der Anwendung (den müssen wir vorher wissen!) und die Umgebungsvariable, die wir nachher ausgeben möchten.</p> <p>Um den spezifizierten Pod zu erstellen, muss man den Befehl</p> <blockquote> <p><code>kubectl create -f sample-sck-pod-1.yaml</code></p> </blockquote> <p>ausführen. Alternativ kann man auch im Dashboard rechts oben auf “Create” klicken und die Datei dort hochladen. Mit <code>kubectl get pods</code> oder dem Dashboard kann man sehen, dass der Pod ausgeführt wird.</p> <p>Der Pod läuft also, aber wie lässt sich erkennen, dass alles wie erwartet funktioniert? Die IP des Pods ist schließlich eine interne IP des Clusters, worauf man von außen keinen Zugriff hat. Dazu kann man den Befehl</p> <blockquote> <p><code>kubectl port-forward sample-sck-pod-1 8080:5000</code></p> </blockquote> <p>verwenden. Dadurch werden Requests an <code>localhost:8080</code> weitergeleitet an den Port 5000 des angegebenen Pods. Wenn man also <code>http://localhost:8080/getenv</code> im Browser öffnet, sollte das Wort “Foo” angezeigt werden, den Wert der Umgebungsvariable, die wir in der Definition des Pods angebenen haben. Abbildung 1 zeigt den einfachen Aufbau:</p> <p><img src="/assets/images/posts/intro-zu-kubernetes/k8s-0.png" alt="Clients wenden ich direkt an Pod" title="Abbildung 1" /></p> <p>Wenn wir den Pods wieder löschen wollen, geht das mit</p> <blockquote> <p><code>kubectl delete pod sample-sck-pod-1</code></p> </blockquote> <p>oder über das Dashboard.</p> <h5 id="services">Services</h5> <p>Wir können noch einige weitere Pods auf diese Weise erstellen. Dazu kopieren wir die Datei mit dem neuen Namen “sample-sck-pod-2.yaml”.</p> <p>Innerhalb der Konfiguration machen wir zwei Änderungen: Wir ändern den Namen des Pods auf <code>sample-sck-pod-2</code>, da der vorherige Name ja schon von dem anderen Pod belegt ist. Wir werden später einen Mechanismus kennen lernen, der uns diese Umbenennung bei der Erstellung vieler Pods abnimmt. Außerdem ändern wir den Wert der Umgebungsvariablen auf <code>Bar</code>, damit wir sehen können, welchen Pod wir erreicht haben.</p> <p>Mit</p> <blockquote> <p><code>kubectl create -f sample-sck-pod-2.yaml</code></p> </blockquote> <p>wird der neue Pod erstellt. Die Pods haben immer noch unterschiedliche IPs. Daher kann ein Client unserer Anwendung nicht zu einem zentralen Punkt im Cluster navigieren und dort die Anwendung aufrufen. Wir benötigen also einen Mechanismus zur Service Discovery. Dafür gibt es in Kubernetes sogenannte <em>Services</em>.</p> <p><strong>Ein Service ist nichts anderes als ein Fixpunkt im Cluster, der die Anfragen an die damit verknüpften Pods weiterleitet</strong>. Dabei berücksichtigt ein Service alle Pods, die ein bestimmtes <em>Label</em> haben, und leitet die Requests an einen dieser Pods weiter.</p> <p>Labels sind ein mächtiges Werkzeug in Kubernetes. Diese Key-Value-Paare können an alle Arten von Ressourcen angehängt werden und bieten eine flexible Möglichhkeit zur Gruppierung von Ressourcen, inklusive Pods.</p> <p>Wenn wir die Pod-Definition in den beiden Dateien um das Label <code>app: sample-sck</code> erweitern, können wir alle Pods als Gruppe identifizieren:</p> <pre><code class="language-yaml"> ... metadata: name: sample-sck-pod-1 # oder 2 labels: app: sample-sck ... </code></pre> <p>Mit diesem Wissen lässt sich ein Service definieren. Als Dateinamen verwenden wir <code>sample-sck-service.yaml</code>.</p> <pre><code class="language-yaml">apiVersion: v1 kind: Service metadata: name: sample-sck-service spec: selector: app: sample-sck type: NodePort ports: - port: 8080 targetPort: 5000 </code></pre> <p>Die Selector-Direktive beschreibt die Labels, die die Pods haben müssen, um von diesem Service berücksichtigt zu werden. Der Typ <code>NodePort</code> zeigt an, dass Kubernetes für diesen Service auf jedem Node (bei Minikube nur der eine) einen Port öffnen soll, über den man den Service ansprechen kann.</p> <p>In einem “richtigen” Kubernetes-Cluster hätten wir auch noch andere Möglichkeiten, den Service öffentlich zugänglich zu machen. Port und targetPort zeigen an, das der Service auf Port 8080 läuft und auf die Ports 5000 der Pods weiterleitet. Diese Grafik zeigt den momentanen Aufbau:</p> <p><img src="/assets/images/posts/intro-zu-kubernetes/k8s-1.png" alt="Service leitet an Pods weiter" /></p> <p>Speichern wir die Datei ab und erstellen den Service mit</p> <blockquote> <p><code>kubectl create -f sample-sck-service.yaml</code></p> </blockquote> <p>oder über “Create” im Dashboard. Unsere Pods von vorhin sollten ebenfalls noch laufen, damit der Service an die Pods weiterleiten kann.</p> <p>Wir können die Funktion des Services leider nicht auf die selbe Weise testen, wie die Funktion eines Pods. Es lässt sich zwar ein Port-Forwarding auf einen Service einrichten, jedoch wird dabei implizit ein einzelner Pod ausgewählt, an den “geforwarded” wird. Sollte dieser Pod ausfallen, wird der Service nicht automatisch an einen anderen Pod weiterleiten und der Vorteil unseres Services ist dahin. Glücklicherweise können wir über Minikube schnell an die URL kommen, über die wir den Service erreichen:</p> <blockquote> <p><code>minikube service sample-sck-service --url</code><br /> <code>http://192.168.99.100:31862</code></p> </blockquote> <p>Unter dieser Adresse plus Pfad <code>/getenv</code> sollte jetzt “Foo” oder “Bar” zu sehen sein. Wenn wir nun ein paar mal die URL des Service aufrufen, wird manchmal der eine, manchmal der andere Wert angezeigt (eventuell muss man die URL <strong>sehr</strong> oft aufrufen). Wir können auch beobachten, was passiert, wenn ein Pod entfernt wird:</p> <blockquote> <p><code>kubectl delete pod -f sample-sck-pod-1.yaml</code></p> </blockquote> <p>Der Service leitet die Anfragen an den verbleibenden Pod weiter, ohne dass zwischenzeitlich ein Ausfall zu vermerken ist. Unser Service funktioniert also.</p> <h5 id="deployments">Deployments</h5> <p>Bisher haben wir Pods immer nur manuell erstellt. Das dies auf Dauer zu mühselig wird, kann man sich denken. Wir können auf diese Weise nicht automatisch Pods starten und müssen ständig den Namen ändern. Um diese Probleme zu lösen gibt es <em>Deployments</em>. Mit Deployments geben wir einerseits eine “Schablone” für unsere Pods an (wie bei der manuellen Definition von Pods) und andererseits die gewünschte Anzahl der Pods.</p> <p>Erstellen wir eine Deployment-Konfiguration unter dem Namen <code>sample-sck-deployment.yaml</code>:</p> <pre><code class="language-yaml">apiVersion: apps/v1 kind: Deployment metadata: name: sample-sck-deployment spec: replicas: 4 selector: matchLabels: app: sample-sck template: metadata: labels: app: sample-sck spec: containers: - name: sample-sck image: tbuss93/sample-sck:v1 ports: - containerPort: 5000 </code></pre> <p>Der größte Teil der Definition sollte uns schon bekannt vorkommen und selbsterklärend sein (ansonsten siehe <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/">Doku</a>). Wir beschreiben die gewünschte Anzahl mit <code>replicas</code>; hier sind es vier. Mit <code>selector</code> legen wir fest, wie das Deployment “seine” Pods erkennt. Die Labels im Selector sollten denen im Template gleichen.</p> <p>Bevor wir das Deployment erstellen, sollten wir sicherstellen, dass keine Pods mit desem Label in unserem Cluster laufen, da dies zu unerwünschten Seiteneffekten führen könnte.</p> <blockquote> <p><code>kubectl delete -f sample-sck-pod-1.yaml -f sample-sck-pod-2.yaml</code></p> </blockquote> <p>Jetzt erstellen wir das Deployment:</p> <blockquote> <p><code>kubectl create -f sample-sck-deployment.yaml</code></p> </blockquote> <p>Mit <code>kubectl get pods</code> oder im Dashboard unter “Pods” kann man sehen, dass die gewünschten Pods automatisch erstellt wurden. Der Name der jeweiligen Pods ergibt sich aus dem Namen, der im Deployment im Template angegeben wurde, einem Hash für das Deployment und einem Hash für den Container selbst. Hier ist der momentane Status als Grafik (die IP des Services muss natürlich angepasst werden; siehe oben bei Services): <img src="/assets/images/posts/intro-zu-kubernetes/k8s-2.png" alt="Deployment kümmert sich um Pods" /></p> <p>Da wir keine Umgebungsvariable angegeben haben, wird im Browser der Standardwert ausgegeben, der auch die Versionsnummer der Anwendung enthält. Wenn nun ein Pod abstürzt (oder wir ihn manuell löschen) können wir sehen, wie über das Deployment ein neuer Pod erstellt wird, um den Platz des alten einzunehmen. Das Deployment arbeitet also genau so, wie es soll.</p> <h4 id="update-ausführen">Update ausführen</h4> <p>Wenn wir im Dashboard auf “Workloads” gehen, dann sehen wir die Ressourcen, die durch das Deployment erstellt wurden. Darunter sind nicht nur das Deployment, sondern auch die Pods und ein sogenanntes <em>ReplicaSet</em>. ReplicaSets werden intern von Deployments genutzt, um die gewünschte Anzahl der Pods zu einem Deployment sicherzustellen. Dieses Konzept ist von Bedeutung, wenn es um das Updaten von einem Deployment geht. Unter “Update” verstehen wir hierbei das Aktualisieren des Docker-Images auf eine neue Version der Anwendung. Dies wollen wir uns jetzt einmal anschauen.</p> <h5 id="szenario">Szenario</h5> <p>Nehmen wir an, wir haben ein neue Version unserer Anwendung entwickelt. Das dazugehörige Docker-Image haben wir bereits in eine Registry hochgeladen. Nun wollen wir die Pods in unserem Cluster aktualisieren, und zwar ohne zwischenzeitlich offline zu sein.</p> <h5 id="update-durch-kommandozeile">Update durch Kommandozeile</h5> <p>Wir haben zwei Möglichkeiten, dieses Szenario durchzuführen: Wir können das Image direkt mit einem Befehl von der Kommandozeile setzen oder die YAML-Datei ändern und die Änderungen anschließend anwenden. Sehen wir uns zunächst das Updaten über die Kommandozeile an. Kubectl bietet den Befehl <code>kubectl set</code> an, um Änderungen an bestehenden Ressourcen anzuwenden, auch Container-Images. Bevor wir den Befehl eingeben, können wir mit</p> <blockquote> <p><code>watch kubectl get replicasets</code></p> </blockquote> <p>beobachten, wie das Update durchgeführt wird (auf Windows gibt es das Programm <code>watch</code> leider nicht; dann einfach nur oft hintereinander <code>kubectl get replicasets</code> ausführen). Es sollte nur ein ReplicaSet für unser Deployment angezeigt werden.</p> <p>Nun führen wir in einem anderen Terminal den Befehl zum Update aus:</p> <blockquote> <p><code>kubectl set image deployment sample-sck-deployment sample-sck=tbuss93/sample-sck:v2</code></p> </blockquote> <p>Wir geben dabei die Aktion und das Deployment an und spezifizieren für den Container <code>sample-sck</code> den Pfad für das neue Image, den wir bei Docker Hub finden. Wer lieber sein eigenes Image verwenden möchte, muss natürlich den Pfad zum Docker-Image ersetzen.</p> <p>Jetzt können wir im ersten Terminal das Update-Verfahren beobachten: Ein zweites ReplicaSet wird für das Deployment erstellt. Die Spalten DESIRED, CURRENT und READY geben die Anzahl und Status der Pods an, die von diesem ReplicaSet verwaltet werden.</p> <p>Den Status während eines Updates zeigt diese Grafik:</p> <p><img src="/assets/images/posts/intro-zu-kubernetes/k8s-3.png" alt="Mehrere ReplicaSets" /></p> <p>Nach und nach werden neue Pods durch das zweite ReplicaSet gestartet. Parallel dazu werden Pods aus dem alten ReplicaSet heruntergefahren. Die Geschwindigkeit und Anzahl der Pods innerhalb dieses Vorgangs kann durch Parameter innerhalb der Deployment-Konfigurationsdatei angepasst werden, aber wir begnügen uns in diesem Falle mit den default-Werten (maximal ein Pod nicht verfügbar, maximal ein Pod mehr gestartet als angefordert). Irgendwann sind alle Pods des alten ReplicaSets gelöscht und die des neuen ReplicaSets gestartet. Im Browser sollte nun auch die neue Versionsnummer angezeigt werden. Unser Update war erfolgreich.</p> <p>Mit <code>kubectl rollout undo deployment sample-sck-deployment</code> kann man das Update wieder rückgängig machen. Das ist sehr praktisch, wenn man bemerkt, dass ein Fehler vorliegt und man auf einen alten Stand zurückkehren möchte. Führen wir den Befehl einmal aus, damit wir im Folgenden auch das Update per Konfigurationsdatei testen können.</p> <h5 id="update-durch-datei">Update durch Datei</h5> <p>Die zweite Möglichkeit, das Szenario durchzuführen, ist über die YAML-Konfigurationsdateien. Dazu bearbeiten wir die Datei <code>sample-sck-deployment.yaml</code> und tragen das neue Image im <code>template</code> ein:</p> <pre><code class="language-yaml">... containers: - name: sample-sck image: tbuss93/sample-sck:v2 ... </code></pre> <p>Wieder können wir mit <code>watch kubectl get replicasets</code> den Fortschritt des Updates verfolgen, während es ausgeführt wird. Geben wir jetzt in einem anderen Terminal den Befehl zum Update:</p> <blockquote> <p><code>kubectl apply -f sample-sck-deployment.yaml</code></p> </blockquote> <p>Genau wie bei dem Update per Kommandozeile wird ein zweites ReplicaSet erstellt und übernimmt nach und nach die Last des rrsprünglichen ReplicaSets. Im Browserfenster wird nun ebenfalls die neue Versionsnummer angezeigt. Auch hier hat also das Update geklappt. Jedoch haben wir bei dem Befehl <code>kubectl apply ...</code> eine Warnung bekommen:</p> <blockquote> <p><code>Warning: kubectl apply should be used on resource created by either kubectl create --save-config or kubectl apply</code></p> </blockquote> <p>Der Hintergrund ist, dass Kubernetes bei dem Befehl <code>kubectl create ...</code> einige Standardwerte annimmt, welche sich je nach Version ändern können. Wenn wir die Änderungen an einer Datei mit <code>kubectl apply</code> anwenden, weiß Kubernetes nicht mehr, was wir in der alten Konfiguration explizit angegeben haben und was als “Default” angenommen wurde. Mit dem Flag <code>--save-config</code> speichert Kubernetes unsere Konfiguration so ab, dass es diese Unterscheidung machen kann.</p> <h4 id="fazit">Fazit</h4> <p>In diesem Blogpost haben wir die grundlegenden Konzepte von Kubernetes kennen gelernt. Wir haben erfahren, was Pods sind, wie Services die Anfragen an Pods weiterleiten und wie Deployments die Anzahl der gewünschten Pods aufrecht erhalten. Zudem haben wir gesehen, wie wir Updates durchführen können und Kubernetes diese umsetzt.</p> <p>Dies war natürlich nur ein kleiner Einstieg in die riesige Welt von Kubernetes. In kommenden Blogposts werden wir weitere Konzepte und Techniken kennen lernen, um Applikationen in Kubernetes zu verwalten.</p> </div> </div> </div> </div>]]></field> </document> </documents>
{ "content_hash": "45374c438d3ef9832912b5bede972038", "timestamp": "", "source": "github", "line_count": 442, "max_line_length": 293, "avg_line_length": 63.89819004524887, "alnum_prop": 0.7750593067308713, "repo_name": "silasmahler/devblog", "id": "719585ce0807a0e876163259e3be420c3bc293fb", "size": "28551", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "assets/first-spirit-xml/2018-01-08/2018-01-08-Intro_zu_Kubernetes12.xml", "mode": "33261", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "30" }, { "name": "CSS", "bytes": "12170" }, { "name": "HTML", "bytes": "57427" }, { "name": "JavaScript", "bytes": "61717" }, { "name": "Ruby", "bytes": "8311" }, { "name": "Shell", "bytes": "104" } ], "symlink_target": "" }
TEST(Multisigning, Basic) { IOTA::Models::Address msa(IOTA::Models::Address::MULTISIG); auto api = IOTA::API::Extended{ get_proxy_host(), get_proxy_port() }; auto firstKey = IOTA::Crypto::MultiSigning::key(IOTA::Types::trytesToBytes(ACCOUNT_1_SEED), 0, 3); auto firstDigest = IOTA::Crypto::MultiSigning::digests(firstKey); EXPECT_EQ( IOTA::Types::bytesToTrytes(firstDigest), "GU9ZRLULWQRZWNHBLUYGDNURQXUFPBULCL9IECYWSNNFLNSDRXTUUFVHWKAOBPQBWQABPQGS9HXEVGPFXFIEUIGGEZQK" "9NVQNNPUCJIP9UL9HFEHCQF9EUKOFBRDMXTYEVA9PTAQGQWTJSFSPNG9MVCN9WKAUPCMHCPROSOJXGRAVOVKBCLOSDCP" "EMZTZEASAOQVT9JSTATWUZRPBXQCRAPMWGKOXBRSGPMUWAYDPYRLUWALURC"); auto secondKey = IOTA::Crypto::MultiSigning::key(IOTA::Types::trytesToBytes(ACCOUNT_2_SEED), 0, 3); auto secondDigest = IOTA::Crypto::MultiSigning::digests(secondKey); EXPECT_EQ( IOTA::Types::bytesToTrytes(secondDigest), "RBORTXIJFOBZZ9Z9UPMLKMFWFSNIPUDAYCAQOZNHKQ9XRZCZTCCWRJHXAXARSUXCPIHSIEYPPGFGHCADBR9YVOBNQNVE" "MVPPSRNZYFSGXSKAKCLYMKJRZJHXRUXUTAYS9YBNKHVVVOANLAMKPPGXSEWQZOVBFQPAZAGNXBMYIUGPDRJMVQGXFZAI" "APTLAMPW9BFEHTWEL9UIB9XHVEAGSFATCDYLYLHOAVPCKPNSVVJRGXOYZ9C"); msa.absorbDigests(firstDigest); msa.absorbDigests(secondDigest); msa.finalize(); // TODO add in constants.hpp EXPECT_EQ(msa.toTrytes(), "IZRSJJABYOJ9ZGMIDQPEYLIORMSJBHLIYVBOCOYG9CKKCCJG99MDZYANLWQFEIBGUA9QJSXXKTACDHSSZ"); EXPECT_TRUE(msa.validate({ firstDigest, secondDigest })); IOTA::Models::Transfer tf{ ACCOUNT_5_ADDRESS_1_HASH, 1, "", IOTA::EmptyTag }; auto txs = api.initiateTransfer(msa, msa.toTrytes(), { tf }); EXPECT_EQ(txs.size(), 8UL); IOTA::Models::Bundle bundle(txs); IOTA::Crypto::MultiSigning::addSignature(bundle, msa, firstKey); IOTA::Crypto::MultiSigning::addSignature(bundle, msa, secondKey); EXPECT_TRUE(IOTA::Crypto::MultiSigning::validateSignatures(bundle, msa)); }
{ "content_hash": "a015eb970aef35209adcc2597122bd2d", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 100, "avg_line_length": 43.84090909090909, "alnum_prop": 0.7594608605495076, "repo_name": "thibault-martinez/iota.lib.cpp", "id": "cac68b31569fe3222440c69dde15893191eea5b0", "size": "3436", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/source/crypto/multi_signing_test.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "1032492" }, { "name": "CMake", "bytes": "23623" }, { "name": "Python", "bytes": "38652" }, { "name": "Shell", "bytes": "7662" } ], "symlink_target": "" }
Originally published: 2013-02-25 11:58:04 Last updated: 2013-02-25 11:58:05 Author: James Mills Simple function calculating Swatch Internet Time (or no. of beats).
{ "content_hash": "6bbe097d89ac66958bb2f37144a94542", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 67, "avg_line_length": 34.4, "alnum_prop": 0.7441860465116279, "repo_name": "ActiveState/code", "id": "e762b9372178872588ea13484c01f8eb9212c8ab", "size": "221", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "recipes/Python/578473_Calculating_Swatch_Internet_Time_or/README.md", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "35894" }, { "name": "C", "bytes": "56048" }, { "name": "C++", "bytes": "90880" }, { "name": "HTML", "bytes": "11656" }, { "name": "Java", "bytes": "57468" }, { "name": "JavaScript", "bytes": "181218" }, { "name": "PHP", "bytes": "250144" }, { "name": "Perl", "bytes": "37296" }, { "name": "Perl 6", "bytes": "9914" }, { "name": "Python", "bytes": "17387779" }, { "name": "Ruby", "bytes": "40233" }, { "name": "Shell", "bytes": "190732" }, { "name": "Tcl", "bytes": "674650" } ], "symlink_target": "" }