text
stringlengths 2
1.04M
| meta
dict |
---|---|
/*
* Portions of this file are based on pieces of Yahoo User Interface Library
* Copyright (c) 2007, Yahoo! Inc. All rights reserved.
* YUI licensed under the BSD License:
* http://developer.yahoo.net/yui/license.txt
*/
Ext.lib.Ajax = function() {
var activeX = ['MSXML2.XMLHTTP.3.0',
'MSXML2.XMLHTTP',
'Microsoft.XMLHTTP'],
CONTENTTYPE = 'Content-Type';
// private
function setHeader(o) {
var conn = o.conn,
prop;
function setTheHeaders(conn, headers){
for (prop in headers) {
if (headers.hasOwnProperty(prop)) {
conn.setRequestHeader(prop, headers[prop]);
}
}
}
if (pub.defaultHeaders) {
setTheHeaders(conn, pub.defaultHeaders);
}
if (pub.headers) {
setTheHeaders(conn, pub.headers);
delete pub.headers;
}
}
// private
function createExceptionObject(tId, callbackArg, isAbort, isTimeout) {
return {
tId : tId,
status : isAbort ? -1 : 0,
statusText : isAbort ? 'transaction aborted' : 'communication failure',
isAbort: isAbort,
isTimeout: isTimeout,
argument : callbackArg
};
}
// private
function initHeader(label, value) {
(pub.headers = pub.headers || {})[label] = value;
}
// private
function createResponseObject(o, callbackArg) {
var headerObj = {},
headerStr,
conn = o.conn,
t,
s,
// see: https://prototype.lighthouseapp.com/projects/8886/tickets/129-ie-mangles-http-response-status-code-204-to-1223
isBrokenStatus = conn.status == 1223;
try {
headerStr = o.conn.getAllResponseHeaders();
Ext.each(headerStr.replace(/\r\n/g, '\n').split('\n'), function(v){
t = v.indexOf(':');
if(t >= 0){
s = v.substr(0, t).toLowerCase();
if(v.charAt(t + 1) == ' '){
++t;
}
headerObj[s] = v.substr(t + 1);
}
});
} catch(e) {}
return {
tId : o.tId,
// Normalize the status and statusText when IE returns 1223, see the above link.
status : isBrokenStatus ? 204 : conn.status,
statusText : isBrokenStatus ? 'No Content' : conn.statusText,
getResponseHeader : function(header){return headerObj[header.toLowerCase()];},
getAllResponseHeaders : function(){return headerStr},
responseText : conn.responseText,
responseXML : conn.responseXML,
argument : callbackArg
};
}
// private
function releaseObject(o) {
if (o.tId) {
pub.conn[o.tId] = null;
}
o.conn = null;
o = null;
}
// private
function handleTransactionResponse(o, callback, isAbort, isTimeout) {
if (!callback) {
releaseObject(o);
return;
}
var httpStatus, responseObject;
try {
if (o.conn.status !== undefined && o.conn.status != 0) {
httpStatus = o.conn.status;
}
else {
httpStatus = 13030;
}
}
catch(e) {
httpStatus = 13030;
}
if ((httpStatus >= 200 && httpStatus < 300) || (Ext.isIE && httpStatus == 1223)) {
responseObject = createResponseObject(o, callback.argument);
if (callback.success) {
if (!callback.scope) {
callback.success(responseObject);
}
else {
callback.success.apply(callback.scope, [responseObject]);
}
}
}
else {
switch (httpStatus) {
case 12002:
case 12029:
case 12030:
case 12031:
case 12152:
case 13030:
responseObject = createExceptionObject(o.tId, callback.argument, (isAbort ? isAbort : false), isTimeout);
if (callback.failure) {
if (!callback.scope) {
callback.failure(responseObject);
}
else {
callback.failure.apply(callback.scope, [responseObject]);
}
}
break;
default:
responseObject = createResponseObject(o, callback.argument);
if (callback.failure) {
if (!callback.scope) {
callback.failure(responseObject);
}
else {
callback.failure.apply(callback.scope, [responseObject]);
}
}
}
}
releaseObject(o);
responseObject = null;
}
// private
function handleReadyState(o, callback){
callback = callback || {};
var conn = o.conn,
tId = o.tId,
poll = pub.poll,
cbTimeout = callback.timeout || null;
if (cbTimeout) {
pub.conn[tId] = conn;
pub.timeout[tId] = setTimeout(function() {
pub.abort(o, callback, true);
}, cbTimeout);
}
poll[tId] = setInterval(
function() {
if (conn && conn.readyState == 4) {
clearInterval(poll[tId]);
poll[tId] = null;
if (cbTimeout) {
clearTimeout(pub.timeout[tId]);
pub.timeout[tId] = null;
}
handleTransactionResponse(o, callback);
}
},
pub.pollInterval);
}
// private
function asyncRequest(method, uri, callback, postData) {
var o = getConnectionObject() || null;
if (o) {
o.conn.open(method, uri, true);
if (pub.useDefaultXhrHeader) {
initHeader('X-Requested-With', pub.defaultXhrHeader);
}
if(postData && pub.useDefaultHeader && (!pub.headers || !pub.headers[CONTENTTYPE])){
initHeader(CONTENTTYPE, pub.defaultPostHeader);
}
if (pub.defaultHeaders || pub.headers) {
setHeader(o);
}
handleReadyState(o, callback);
o.conn.send(postData || null);
}
return o;
}
// private
function getConnectionObject() {
var o;
try {
if (o = createXhrObject(pub.transactionId)) {
pub.transactionId++;
}
} catch(e) {
} finally {
return o;
}
}
// private
function createXhrObject(transactionId) {
var http;
try {
http = new XMLHttpRequest();
} catch(e) {
for (var i = 0; i < activeX.length; ++i) {
try {
http = new ActiveXObject(activeX[i]);
break;
} catch(e) {}
}
} finally {
return {conn : http, tId : transactionId};
}
}
var pub = {
request : function(method, uri, cb, data, options) {
if(options){
var me = this,
xmlData = options.xmlData,
jsonData = options.jsonData,
hs;
Ext.applyIf(me, options);
if(xmlData || jsonData){
hs = me.headers;
if(!hs || !hs[CONTENTTYPE]){
initHeader(CONTENTTYPE, xmlData ? 'text/xml' : 'application/json');
}
data = xmlData || (!Ext.isPrimitive(jsonData) ? Ext.encode(jsonData) : jsonData);
}
}
return asyncRequest(method || options.method || "POST", uri, cb, data);
},
serializeForm : function(form) {
var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements,
hasSubmit = false,
encoder = encodeURIComponent,
element,
options,
name,
val,
data = '',
type;
Ext.each(fElements, function(element) {
name = element.name;
type = element.type;
if (!element.disabled && name){
if(/select-(one|multiple)/i.test(type)) {
Ext.each(element.options, function(opt) {
if (opt.selected) {
data += String.format("{0}={1}&", encoder(name), encoder((opt.hasAttribute ? opt.hasAttribute('value') : opt.getAttribute('value') !== null) ? opt.value : opt.text));
}
});
} else if(!/file|undefined|reset|button/i.test(type)) {
if(!(/radio|checkbox/i.test(type) && !element.checked) && !(type == 'submit' && hasSubmit)){
data += encoder(name) + '=' + encoder(element.value) + '&';
hasSubmit = /submit/i.test(type);
}
}
}
});
return data.substr(0, data.length - 1);
},
useDefaultHeader : true,
defaultPostHeader : 'application/x-www-form-urlencoded; charset=UTF-8',
useDefaultXhrHeader : true,
defaultXhrHeader : 'XMLHttpRequest',
poll : {},
timeout : {},
conn: {},
pollInterval : 50,
transactionId : 0,
// This is never called - Is it worth exposing this?
// setProgId : function(id) {
// activeX.unshift(id);
// },
// This is never called - Is it worth exposing this?
// setDefaultPostHeader : function(b) {
// this.useDefaultHeader = b;
// },
// This is never called - Is it worth exposing this?
// setDefaultXhrHeader : function(b) {
// this.useDefaultXhrHeader = b;
// },
// This is never called - Is it worth exposing this?
// setPollingInterval : function(i) {
// if (typeof i == 'number' && isFinite(i)) {
// this.pollInterval = i;
// }
// },
// This is never called - Is it worth exposing this?
// resetDefaultHeaders : function() {
// this.defaultHeaders = null;
// },
abort : function(o, callback, isTimeout) {
var me = this,
tId = o.tId,
isAbort = false;
if (me.isCallInProgress(o)) {
o.conn.abort();
clearInterval(me.poll[tId]);
me.poll[tId] = null;
clearTimeout(pub.timeout[tId]);
me.timeout[tId] = null;
handleTransactionResponse(o, callback, (isAbort = true), isTimeout);
}
return isAbort;
},
isCallInProgress : function(o) {
// if there is a connection and readyState is not 0 or 4
return o.conn && !{0:true,4:true}[o.conn.readyState];
}
};
return pub;
}(); | {
"content_hash": "095b5a5d64ad80370c47bc6dbed9c281",
"timestamp": "",
"source": "github",
"line_count": 371,
"max_line_length": 198,
"avg_line_length": 31.590296495956874,
"alnum_prop": 0.4582764505119454,
"repo_name": "mguymon/mmd",
"id": "a584570e41835b2f2dd428f33217f32f342541f6",
"size": "11845",
"binary": false,
"copies": "13",
"ref": "refs/heads/master",
"path": "deployer/public/javascripts/extjs/ext-3.2.1/src/ext-core/src/adapter/ext-base-ajax.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "897031"
},
{
"name": "HTML",
"bytes": "14675"
},
{
"name": "Java",
"bytes": "28557"
},
{
"name": "JavaScript",
"bytes": "76369"
},
{
"name": "PHP",
"bytes": "53953"
},
{
"name": "Perl",
"bytes": "61631"
},
{
"name": "Ruby",
"bytes": "221223"
},
{
"name": "Shell",
"bytes": "62589"
}
],
"symlink_target": ""
} |
<?php
$app = 'frontend';
if (!include(__DIR__.'/../bootstrap/functional.php'))
{
return;
}
class sfAuthTestBrowser extends sfTestBrowser
{
public function checkNonAuth(): self
{
return $this->get('/auth/basic')
->with('request', function (sfTesterRequest $request) {
$request->isParameter('module', 'auth');
$request->isParameter('action', 'basic');
})
->with('response', function (sfTesterResponse $response) {
$response->isStatusCode(401);
$response->checkElement('#user', '');
$response->checkElement('#password', '');
$response->checkElement('#msg', 'KO');
});
}
public function checkAuth(): self
{
return $this->get('/auth/basic')
->with('request', function (sfTesterRequest $request) {
$request->isParameter('module', 'auth');
$request->isParameter('action', 'basic');
})
->with('response', function (sfTesterResponse $response) {
$response->isStatusCode(200);
$response->checkElement('#user', 'foo');
$response->checkElement('#password', 'bar');
$response->checkElement('#msg', 'OK');
});
}
}
$b = new sfAuthTestBrowser();
// default main page
$b->
checkNonAuth()->
setAuth('foo', 'bar')->
checkAuth()->
restart()->
checkNonAuth()
;
| {
"content_hash": "479d23b8a6299cd3c4bde76a35f1fec5",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 64,
"avg_line_length": 21.81967213114754,
"alnum_prop": 0.5837716003005259,
"repo_name": "rock-symphony/rock-symphony",
"id": "9f8aedade03be8fa5c366ae8e5bdb088c513152a",
"size": "1585",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/functional/authTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "AMPL",
"bytes": "1136"
},
{
"name": "Batchfile",
"bytes": "1151"
},
{
"name": "CSS",
"bytes": "9795"
},
{
"name": "Hack",
"bytes": "451"
},
{
"name": "JavaScript",
"bytes": "4717"
},
{
"name": "Makefile",
"bytes": "233"
},
{
"name": "PHP",
"bytes": "2588288"
},
{
"name": "Shell",
"bytes": "710"
}
],
"symlink_target": ""
} |
package org.apache.hadoop.hdfs.server.namenode;
import static org.apache.hadoop.hdfs.client.HdfsClientConfigKeys.DFS_WEBHDFS_REST_CSRF_ENABLED_DEFAULT;
import static org.apache.hadoop.hdfs.client.HdfsClientConfigKeys.DFS_WEBHDFS_REST_CSRF_ENABLED_KEY;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import javax.servlet.ServletContext;
import com.google.common.annotations.VisibleForTesting;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ha.HAServiceProtocol;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.DFSUtil;
import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys;
import org.apache.hadoop.hdfs.server.common.JspHelper;
import org.apache.hadoop.hdfs.server.namenode.startupprogress.StartupProgress;
import org.apache.hadoop.hdfs.server.namenode.web.resources.NamenodeWebHdfsMethods;
import org.apache.hadoop.hdfs.web.AuthFilter;
import org.apache.hadoop.hdfs.web.WebHdfsFileSystem;
import org.apache.hadoop.hdfs.web.resources.AclPermissionParam;
import org.apache.hadoop.hdfs.web.resources.Param;
import org.apache.hadoop.hdfs.web.resources.UserParam;
import org.apache.hadoop.http.HttpConfig;
import org.apache.hadoop.http.HttpServer2;
import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.security.SecurityUtil;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.http.RestCsrfPreventionFilter;
/**
* Encapsulates the HTTP server started by the NameNode.
*/
@InterfaceAudience.Private
public class NameNodeHttpServer {
private HttpServer2 httpServer;
private final Configuration conf;
private final NameNode nn;
private InetSocketAddress httpAddress;
private InetSocketAddress httpsAddress;
private final InetSocketAddress bindAddress;
public static final String NAMENODE_ADDRESS_ATTRIBUTE_KEY = "name.node.address";
public static final String FSIMAGE_ATTRIBUTE_KEY = "name.system.image";
protected static final String NAMENODE_ATTRIBUTE_KEY = "name.node";
public static final String STARTUP_PROGRESS_ATTRIBUTE_KEY = "startup.progress";
NameNodeHttpServer(Configuration conf, NameNode nn,
InetSocketAddress bindAddress) {
this.conf = conf;
this.nn = nn;
this.bindAddress = bindAddress;
}
private void initWebHdfs(Configuration conf) throws IOException {
// set user pattern based on configuration file
UserParam.setUserPattern(conf.get(
HdfsClientConfigKeys.DFS_WEBHDFS_USER_PATTERN_KEY,
HdfsClientConfigKeys.DFS_WEBHDFS_USER_PATTERN_DEFAULT));
AclPermissionParam.setAclPermissionPattern(conf.get(
HdfsClientConfigKeys.DFS_WEBHDFS_ACL_PERMISSION_PATTERN_KEY,
HdfsClientConfigKeys.DFS_WEBHDFS_ACL_PERMISSION_PATTERN_DEFAULT));
// add authentication filter for webhdfs
final String className = conf.get(
DFSConfigKeys.DFS_WEBHDFS_AUTHENTICATION_FILTER_KEY,
DFSConfigKeys.DFS_WEBHDFS_AUTHENTICATION_FILTER_DEFAULT);
final String name = className;
final String pathSpec = WebHdfsFileSystem.PATH_PREFIX + "/*";
Map<String, String> params = getAuthFilterParams(conf);
HttpServer2.defineFilter(httpServer.getWebAppContext(), name, className,
params, new String[] { pathSpec });
HttpServer2.LOG.info("Added filter '" + name + "' (class=" + className
+ ")");
// add REST CSRF prevention filter
if (conf.getBoolean(DFS_WEBHDFS_REST_CSRF_ENABLED_KEY,
DFS_WEBHDFS_REST_CSRF_ENABLED_DEFAULT)) {
Map<String, String> restCsrfParams = RestCsrfPreventionFilter
.getFilterParams(conf, "dfs.webhdfs.rest-csrf.");
String restCsrfClassName = RestCsrfPreventionFilter.class.getName();
HttpServer2.defineFilter(httpServer.getWebAppContext(), restCsrfClassName,
restCsrfClassName, restCsrfParams, new String[] {pathSpec});
}
// add webhdfs packages
httpServer.addJerseyResourcePackage(NamenodeWebHdfsMethods.class
.getPackage().getName() + ";" + Param.class.getPackage().getName(),
pathSpec);
}
/**
* @see DFSUtil#getHttpPolicy(org.apache.hadoop.conf.Configuration)
* for information related to the different configuration options and
* Http Policy is decided.
*/
void start() throws IOException {
HttpConfig.Policy policy = DFSUtil.getHttpPolicy(conf);
final String infoHost = bindAddress.getHostName();
final InetSocketAddress httpAddr = bindAddress;
final String httpsAddrString = conf.getTrimmed(
DFSConfigKeys.DFS_NAMENODE_HTTPS_ADDRESS_KEY,
DFSConfigKeys.DFS_NAMENODE_HTTPS_ADDRESS_DEFAULT);
InetSocketAddress httpsAddr = NetUtils.createSocketAddr(httpsAddrString);
if (httpsAddr != null) {
// If DFS_NAMENODE_HTTPS_BIND_HOST_KEY exists then it overrides the
// host name portion of DFS_NAMENODE_HTTPS_ADDRESS_KEY.
final String bindHost =
conf.getTrimmed(DFSConfigKeys.DFS_NAMENODE_HTTPS_BIND_HOST_KEY);
if (bindHost != null && !bindHost.isEmpty()) {
httpsAddr = new InetSocketAddress(bindHost, httpsAddr.getPort());
}
}
HttpServer2.Builder builder = DFSUtil.httpServerTemplateForNNAndJN(conf,
httpAddr, httpsAddr, "hdfs",
DFSConfigKeys.DFS_NAMENODE_KERBEROS_INTERNAL_SPNEGO_PRINCIPAL_KEY,
DFSConfigKeys.DFS_NAMENODE_KEYTAB_FILE_KEY);
final boolean xFrameEnabled = conf.getBoolean(
DFSConfigKeys.DFS_XFRAME_OPTION_ENABLED,
DFSConfigKeys.DFS_XFRAME_OPTION_ENABLED_DEFAULT);
final String xFrameOptionValue = conf.getTrimmed(
DFSConfigKeys.DFS_XFRAME_OPTION_VALUE,
DFSConfigKeys.DFS_XFRAME_OPTION_VALUE_DEFAULT);
builder.configureXFrame(xFrameEnabled).setXFrameOption(xFrameOptionValue);
httpServer = builder.build();
if (policy.isHttpsEnabled()) {
// assume same ssl port for all datanodes
InetSocketAddress datanodeSslPort = NetUtils.createSocketAddr(conf.getTrimmed(
DFSConfigKeys.DFS_DATANODE_HTTPS_ADDRESS_KEY, infoHost + ":"
+ DFSConfigKeys.DFS_DATANODE_HTTPS_DEFAULT_PORT));
httpServer.setAttribute(DFSConfigKeys.DFS_DATANODE_HTTPS_PORT_KEY,
datanodeSslPort.getPort());
}
initWebHdfs(conf);
httpServer.setAttribute(NAMENODE_ATTRIBUTE_KEY, nn);
httpServer.setAttribute(JspHelper.CURRENT_CONF, conf);
setupServlets(httpServer, conf);
httpServer.start();
int connIdx = 0;
if (policy.isHttpEnabled()) {
httpAddress = httpServer.getConnectorAddress(connIdx++);
conf.set(DFSConfigKeys.DFS_NAMENODE_HTTP_ADDRESS_KEY,
NetUtils.getHostPortString(httpAddress));
}
if (policy.isHttpsEnabled()) {
httpsAddress = httpServer.getConnectorAddress(connIdx);
conf.set(DFSConfigKeys.DFS_NAMENODE_HTTPS_ADDRESS_KEY,
NetUtils.getHostPortString(httpsAddress));
}
}
private Map<String, String> getAuthFilterParams(Configuration conf)
throws IOException {
Map<String, String> params = new HashMap<String, String>();
// Select configs beginning with 'dfs.web.authentication.'
Iterator<Map.Entry<String, String>> iterator = conf.iterator();
while (iterator.hasNext()) {
Entry<String, String> kvPair = iterator.next();
if (kvPair.getKey().startsWith(AuthFilter.CONF_PREFIX)) {
params.put(kvPair.getKey(), kvPair.getValue());
}
}
String principalInConf = conf
.get(DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_PRINCIPAL_KEY);
if (principalInConf != null && !principalInConf.isEmpty()) {
params
.put(
DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_PRINCIPAL_KEY,
SecurityUtil.getServerPrincipal(principalInConf,
bindAddress.getHostName()));
} else if (UserGroupInformation.isSecurityEnabled()) {
HttpServer2.LOG.error(
"WebHDFS and security are enabled, but configuration property '" +
DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_PRINCIPAL_KEY +
"' is not set.");
}
String httpKeytab = conf.get(DFSUtil.getSpnegoKeytabKey(conf,
DFSConfigKeys.DFS_NAMENODE_KEYTAB_FILE_KEY));
if (httpKeytab != null && !httpKeytab.isEmpty()) {
params.put(
DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_KEYTAB_KEY,
httpKeytab);
} else if (UserGroupInformation.isSecurityEnabled()) {
HttpServer2.LOG.error(
"WebHDFS and security are enabled, but configuration property '" +
DFSConfigKeys.DFS_WEB_AUTHENTICATION_KERBEROS_KEYTAB_KEY +
"' is not set.");
}
String anonymousAllowed = conf
.get(DFSConfigKeys.DFS_WEB_AUTHENTICATION_SIMPLE_ANONYMOUS_ALLOWED);
if (anonymousAllowed != null && !anonymousAllowed.isEmpty()) {
params.put(
DFSConfigKeys.DFS_WEB_AUTHENTICATION_SIMPLE_ANONYMOUS_ALLOWED,
anonymousAllowed);
}
return params;
}
/**
* Joins the httpserver.
*/
public void join() throws InterruptedException {
if (httpServer != null) {
httpServer.join();
}
}
void stop() throws Exception {
if (httpServer != null) {
httpServer.stop();
}
}
InetSocketAddress getHttpAddress() {
return httpAddress;
}
InetSocketAddress getHttpsAddress() {
return httpsAddress;
}
/**
* Sets fsimage for use by servlets.
*
* @param fsImage FSImage to set
*/
void setFSImage(FSImage fsImage) {
httpServer.setAttribute(FSIMAGE_ATTRIBUTE_KEY, fsImage);
}
/**
* Sets address of namenode for use by servlets.
*
* @param nameNodeAddress InetSocketAddress to set
*/
void setNameNodeAddress(InetSocketAddress nameNodeAddress) {
httpServer.setAttribute(NAMENODE_ADDRESS_ATTRIBUTE_KEY,
NetUtils.getConnectAddress(nameNodeAddress));
}
/**
* Sets startup progress of namenode for use by servlets.
*
* @param prog StartupProgress to set
*/
void setStartupProgress(StartupProgress prog) {
httpServer.setAttribute(STARTUP_PROGRESS_ATTRIBUTE_KEY, prog);
}
private static void setupServlets(HttpServer2 httpServer, Configuration conf) {
httpServer.addInternalServlet("startupProgress",
StartupProgressServlet.PATH_SPEC, StartupProgressServlet.class);
httpServer.addInternalServlet("fsck", "/fsck", FsckServlet.class,
true);
httpServer.addInternalServlet("imagetransfer", ImageServlet.PATH_SPEC,
ImageServlet.class, true);
}
static FSImage getFsImageFromContext(ServletContext context) {
return (FSImage)context.getAttribute(FSIMAGE_ATTRIBUTE_KEY);
}
public static NameNode getNameNodeFromContext(ServletContext context) {
return (NameNode)context.getAttribute(NAMENODE_ATTRIBUTE_KEY);
}
static Configuration getConfFromContext(ServletContext context) {
return (Configuration)context.getAttribute(JspHelper.CURRENT_CONF);
}
public static InetSocketAddress getNameNodeAddressFromContext(
ServletContext context) {
return (InetSocketAddress)context.getAttribute(
NAMENODE_ADDRESS_ATTRIBUTE_KEY);
}
/**
* Returns StartupProgress associated with ServletContext.
*
* @param context ServletContext to get
* @return StartupProgress associated with context
*/
static StartupProgress getStartupProgressFromContext(
ServletContext context) {
return (StartupProgress)context.getAttribute(STARTUP_PROGRESS_ATTRIBUTE_KEY);
}
public static HAServiceProtocol.HAServiceState getNameNodeStateFromContext(ServletContext context) {
return getNameNodeFromContext(context).getServiceState();
}
/**
* Returns the httpServer.
* @return HttpServer2
*/
@VisibleForTesting
public HttpServer2 getHttpServer() {
return httpServer;
}
}
| {
"content_hash": "dba1d3ae272f63859167ee2f8edbf09e",
"timestamp": "",
"source": "github",
"line_count": 321,
"max_line_length": 103,
"avg_line_length": 37.15264797507788,
"alnum_prop": 0.7264799597518028,
"repo_name": "wenxinhe/hadoop",
"id": "e7e5f512868f89b0c24c5ff7bcd1ccd29460d787",
"size": "12732",
"binary": false,
"copies": "10",
"ref": "refs/heads/trunk",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeHttpServer.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "74021"
},
{
"name": "C",
"bytes": "1523406"
},
{
"name": "C++",
"bytes": "1916529"
},
{
"name": "CMake",
"bytes": "57373"
},
{
"name": "CSS",
"bytes": "61697"
},
{
"name": "HTML",
"bytes": "259261"
},
{
"name": "Java",
"bytes": "74199755"
},
{
"name": "JavaScript",
"bytes": "805000"
},
{
"name": "Python",
"bytes": "23553"
},
{
"name": "Shell",
"bytes": "406480"
},
{
"name": "TLA",
"bytes": "14993"
},
{
"name": "TeX",
"bytes": "19322"
},
{
"name": "XSLT",
"bytes": "16894"
}
],
"symlink_target": ""
} |
The service field.
```csharp
public ServiceFieldInfo ServiceField { get; }
```
## See Also
* class [ServiceFieldInfo](../../Facility.Definition/ServiceFieldInfo.md)
* class [HttpFieldInfo](../HttpFieldInfo.md)
* namespace [Facility.Definition.Http](../../Facility.Definition.md)
<!-- DO NOT EDIT: generated by xmldocmd for Facility.Definition.dll -->
| {
"content_hash": "3ab7fc312e9673960acdfc7e71926cb7",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 73,
"avg_line_length": 27.307692307692307,
"alnum_prop": 0.7267605633802817,
"repo_name": "FacilityApi/Facility",
"id": "f622c37f2d5ffa1c92969c51585b32353d49b610",
"size": "397",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/Facility.Definition.Http/HttpFieldInfo/ServiceField.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "204369"
},
{
"name": "PowerShell",
"bytes": "672"
}
],
"symlink_target": ""
} |
export LD_LIBRARY_PATH=/opt/intel/mkl/lib/intel64:/usr/local/cuda-6.5/lib64
HOME_ROOT=/home/tzeng
PROJ_ROOT=ABA/autoGenelable_multi_lables_proj
CAFFE_TOOLS=$HOME_ROOT/$PROJ_ROOT/code/caffe/build/tools
#TRAIN_DATA_ROOT=$HOME_ROOT/$PROJ_ROOT/images/train/
#VAL_DATA_ROOT=$HOME_ROOT/$PROJ_ROOT/images/val/
MDB_DIR=$HOME_ROOT/$PROJ_ROOT/data
DATA_DIR=$HOME_ROOT/$PROJ_ROOT/data
Age=E11.5
# Set RESIZE=true to resize the images to 256x256. Leave as false if images have
# already been resized using another tool.
RESIZE=true
if $RESIZE; then
RESIZE_HEIGHT=224
RESIZE_WIDTH=224
else
RESIZE_HEIGHT=0
RESIZE_WIDTH=0
fi
# if [ ! -d "$TRAIN_DATA_ROOT" ]; then
# echo "Error: TRAIN_DATA_ROOT is not a path to a directory: $TRAIN_DATA_ROOT"
# echo "Set the TRAIN_DATA_ROOT variable in create_imagenet.sh to the path" \
# "where the ImageNet training data is stored."
# exit 1
# fi
# if [ ! -d "$VAL_DATA_ROOT" ]; then
# echo "Error: VAL_DATA_ROOT is not a path to a directory: $VAL_DATA_ROOT"
# echo "Set the VAL_DATA_ROOT variable in create_imagenet.sh to the path" \
# "where the ImageNet validation data is stored."
# exit 1
# fi
#echo "Creating train lmdb..."
#GLOG_logtostderr=1 $CAFFE_TOOLS/convert_imageset.bin \
# $TRAIN_DATA_ROOT \
# $DATA_DIR/train.txt \
# $MDB_DIR/train_lmdb 1 \
# "leveldb" \
# $RESIZE_HEIGHT $RESIZE_WIDTH
# GLOG_logtostderr=1 $CAFFE_TOOLS/convert_image_slice_set.bin \
# $DATA_DIR/train_slice_ish.txt \
# $MDB_DIR/train_slice_lvdb_ish 1 \
# "leveldb" \
# $RESIZE_HEIGHT $RESIZE_WIDTH
# echo "Creating val level DB..."
#GLOG_logtostderr=1 $CAFFE_TOOLS/convert_imageset.bin \
# $VAL_DATA_ROOT \
# $DATA_DIR/val.txt \
# $MDB_DIR/val_lmdb 1 \
# "leveldb" \
# $RESIZE_HEIGHT $RESIZE_WIDTH
GLOG_logtostderr=1 $CAFFE_TOOLS/convert_image_slice_set.bin \
$DATA_DIR/all_test_slice_ish_$Age.txt \
$MDB_DIR/all_test_slice_lvdb_ish_$Age 1 \
"leveldb" \
$RESIZE_HEIGHT $RESIZE_WIDTH
echo "Done." | {
"content_hash": "1ff42a42c9e9f9a1f6c36b2ad0317f67",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 80,
"avg_line_length": 26.394736842105264,
"alnum_prop": 0.6819541375872383,
"repo_name": "xiaomi646/caffe_2d_mlabel",
"id": "8f63c19a2fc431b90aee4077377b9fc458df410f",
"size": "2006",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tools/create_all_test_set_ABA_slice_imageset_ish.sh",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "207"
},
{
"name": "C++",
"bytes": "2030214"
},
{
"name": "Cuda",
"bytes": "88288"
},
{
"name": "Makefile",
"bytes": "21461"
},
{
"name": "Matlab",
"bytes": "41348"
},
{
"name": "Protocol Buffer",
"bytes": "25725"
},
{
"name": "Python",
"bytes": "227306"
},
{
"name": "Shell",
"bytes": "5958"
}
],
"symlink_target": ""
} |
title: How to Calculate the Margin of Error for a Sample Proportion
localeTitle: Como calcular a margem de erro para uma proporção de amostra
---
## Como calcular a margem de erro para uma proporção de amostra
Este é um esboço. [Ajude nossa comunidade a expandi-lo](https://github.com/freecodecamp/guides/tree/master/src/pages/mathematics/how-to-calculate-the-margin-of-error-for-a-sample-proportion/index.md) .
[Este guia de estilo rápido ajudará a garantir que sua solicitação de recebimento seja aceita](https://github.com/freecodecamp/guides/blob/master/README.md) .
#### Mais Informações: | {
"content_hash": "420b44c64e9688e92477af94907185b4",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 201,
"avg_line_length": 59.6,
"alnum_prop": 0.7885906040268457,
"repo_name": "HKuz/FreeCodeCamp",
"id": "3a2fbd9a3266c538b6b5c2f1e1e408e098aa7fe1",
"size": "612",
"binary": false,
"copies": "4",
"ref": "refs/heads/fix/JupyterNotebook",
"path": "guide/portuguese/mathematics/how-to-calculate-the-margin-of-error-for-a-sample-proportion/index.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "193850"
},
{
"name": "HTML",
"bytes": "100244"
},
{
"name": "JavaScript",
"bytes": "522369"
}
],
"symlink_target": ""
} |
using NUnit.Framework;
using RefactoringEssentials.CSharp.Diagnostics;
using System;
namespace RefactoringEssentials.Tests.CSharp.Diagnostics
{
[TestFixture]
public class RedundantDelegateCreationTests : CSharpDiagnosticTestBase
{
[Test]
public void TestAdd()
{
var input = @"
using System;
public class FooBase
{
public event EventHandler<EventArgs> Changed;
FooBase()
{
Changed += $new EventHandler<EventArgs>(HandleChanged)$;
}
void HandleChanged(object sender, EventArgs e)
{
}
}";
var output = @"
using System;
public class FooBase
{
public event EventHandler<EventArgs> Changed;
FooBase()
{
Changed += HandleChanged;
}
void HandleChanged(object sender, EventArgs e)
{
}
}";
Analyze<RedundantDelegateCreationAnalyzer>(input, output);
}
void olcol(object sender, EventArgs e)
{
throw new NotImplementedException();
}
[Test]
public void TestRemove()
{
Analyze<RedundantDelegateCreationAnalyzer>(@"
using System;
public class FooBase
{
public event EventHandler<EventArgs> Changed;
FooBase()
{
Changed -= $new EventHandler<EventArgs>(HandleChanged)$;
}
void HandleChanged(object sender, EventArgs e)
{
}
}", @"
using System;
public class FooBase
{
public event EventHandler<EventArgs> Changed;
FooBase()
{
Changed -= HandleChanged;
}
void HandleChanged(object sender, EventArgs e)
{
}
}");
}
[Test]
public void TestDisable()
{
Analyze<RedundantDelegateCreationAnalyzer>(@"
using System;
public class FooBase
{
public event EventHandler<EventArgs> Changed;
FooBase()
{
#pragma warning disable " + CSharpDiagnosticIDs.RedundantDelegateCreationAnalyzerID + @"
Changed += new EventHandler<EventArgs>(HandleChanged);
}
void HandleChanged(object sender, EventArgs e)
{
}
}");
}
[Test]
public void TestBug33763()
{
var input = @"
public class Foo
{
Foo foo;
public Foo FooBar {
get {
foo = new Foo(foo);
return foo;
}
}
public Foo(Foo f) { }
}
";
Analyze<RedundantDelegateCreationAnalyzer>(input);
}
}
} | {
"content_hash": "af1544162cf40ab1cfd8d2c36686fdcf",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 88,
"avg_line_length": 17.79850746268657,
"alnum_prop": 0.6071278825995807,
"repo_name": "ehasis/RefactoringEssentials",
"id": "86a8c2005d889b53cf58380e31386dbde3659ab6",
"size": "2385",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "Tests/CSharp/Diagnostics/RedundantDelegateCreationTests.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "754"
},
{
"name": "C#",
"bytes": "4110475"
},
{
"name": "HTML",
"bytes": "25895"
},
{
"name": "PowerShell",
"bytes": "995"
},
{
"name": "Visual Basic",
"bytes": "8195"
}
],
"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 System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
namespace Microsoft.CodeAnalysis.ReplaceDiscardDeclarationsWithAssignments
{
internal interface IReplaceDiscardDeclarationsWithAssignmentsService : ILanguageService
{
/// <summary>
/// Returns an updated <paramref name="memberDeclaration"/> with all the
/// local declarations named '_' replaced with simple assignments to discard.
/// For example,
/// 1. <code>int _ = M();</code> is replaced with <code>_ = M();</code>
/// 2. <code>int x = 1, _ = M(), y = 2;</code> is replaced with following statements:
/// <code>
/// int x = 1;
/// _ = M();
/// int y = 2;
/// </code>
/// This is normally done in context of a code transformation that generates new discard assignment(s),
/// such as <code>_ = M();</code>, and wants to prevent compiler errors where the containing method already
/// has a discard variable declaration, say <code>var _ = M2();</code> at some line after the one
/// where the code transformation wants to generate new discard assignment(s), which would be a compiler error.
/// This method replaces such discard variable declarations with discard assignments.
/// </summary>
Task<SyntaxNode> ReplaceAsync(SyntaxNode memberDeclaration, SemanticModel semanticModel, Workspace workspace, CancellationToken cancellationToken);
}
}
| {
"content_hash": "0db2cdbda05e2d60895137082f47f28f",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 155,
"avg_line_length": 54.0625,
"alnum_prop": 0.661271676300578,
"repo_name": "jmarolf/roslyn",
"id": "4276277796e0d5e2b16dbbebc4b0d7af40c8197b",
"size": "1732",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/ReplaceDiscardDeclarationsWithAssignments/IReplaceDiscardDeclarationsWithAssignmentsService.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "1C Enterprise",
"bytes": "257760"
},
{
"name": "Batchfile",
"bytes": "9059"
},
{
"name": "C#",
"bytes": "139027042"
},
{
"name": "C++",
"bytes": "5602"
},
{
"name": "CMake",
"bytes": "9153"
},
{
"name": "Dockerfile",
"bytes": "2450"
},
{
"name": "F#",
"bytes": "549"
},
{
"name": "PowerShell",
"bytes": "243026"
},
{
"name": "Shell",
"bytes": "92965"
},
{
"name": "Visual Basic .NET",
"bytes": "71729344"
}
],
"symlink_target": ""
} |
using System;
using CoreFoundation;
using Foundation;
using HomeKit;
using UIKit;
namespace HomeKitCatalog
{
/// <summary>
/// The `HMCatalogViewController` is a base class which mainly provides easy-access methods for shared HomeKit objects.
///
/// The base class for most table view controllers in this app. It manages home
/// delegate registration and facilitates 'popping back' when it's discovered that
/// a home has been deleted.
/// </summary>
[Register ("HMCatalogViewController")]
public class HMCatalogViewController : UITableViewController, IHMHomeDelegate
{
public HomeStore HomeStore {
get {
return HomeStore.SharedStore;
}
}
public HMHome Home {
get {
return HomeStore.Home;
}
}
[Export ("initWithCoder:")]
public HMCatalogViewController (NSCoder coder)
: base (coder)
{
}
public HMCatalogViewController (IntPtr handle)
: base (handle)
{
}
public HMCatalogViewController ()
{
}
// Pops the view controller, if required. Invokes the delegate registration method.
public override void ViewWillAppear (bool animated)
{
base.ViewWillAppear (animated);
if (ShouldPopViewController () && NavigationController != null) {
NavigationController.PopToRootViewController (true);
return;
}
RegisterAsDelegate ();
}
/// <summary>
/// Evaluates whether or not the view controller should pop to the list of homes.
/// </summary>
/// <returns><c>true</c>, if this instance is not the root view controller and the `Home` is null; <c>false</c> otherwise.</returns>
bool ShouldPopViewController ()
{
UIViewController rootViewController = null;
if (NavigationController != null)
rootViewController = NavigationController.ViewControllers [0];
return this != rootViewController && Home == null;
}
protected virtual void RegisterAsDelegate ()
{
var home = Home;
if (home != null)
home.Delegate = this;
}
protected void DisplayError (NSError error)
{
if (error != null) {
var errorCode = (HMError)(int)error.Code;
if (PresentedViewController != null || errorCode == HMError.OperationCancelled || errorCode == HMError.UserDeclinedAddingUser)
Console.WriteLine (error.LocalizedDescription);
else
DisplayErrorMessage (error.LocalizedDescription);
} else {
DisplayErrorMessage (error.Description);
}
}
void DisplayErrorMessage (string message)
{
DisplayMessage ("Error", message);
}
protected void DisplayMessage (string title, string message)
{
DispatchQueue.MainQueue.DispatchAsync (() => {
var alert = Alert.Create (title, message);
PresentViewController (alert, true, null);
});
}
}
} | {
"content_hash": "4a555f44f0f850d431a3ea707b62f22b",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 134,
"avg_line_length": 25.462264150943398,
"alnum_prop": 0.7006298629121896,
"repo_name": "xamarin/monotouch-samples",
"id": "fc1265e6966080b95d0eda4be7f83da5e945f0d6",
"size": "2701",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ios9/HomeKitCatalog/HomeKitCatalog/ViewControllers/HMCatalogViewController.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "5568672"
},
{
"name": "F#",
"bytes": "11402"
},
{
"name": "GLSL",
"bytes": "13657"
},
{
"name": "HTML",
"bytes": "9912"
},
{
"name": "Makefile",
"bytes": "16378"
},
{
"name": "Metal",
"bytes": "4299"
},
{
"name": "Objective-C",
"bytes": "106014"
},
{
"name": "Shell",
"bytes": "6235"
}
],
"symlink_target": ""
} |
var datePickerController;
(function() {
// Detect the browser language
datePicker.languageinfo = navigator.language ? navigator.language : navigator.userLanguage;
datePicker.languageinfo = datePicker.languageinfo ? datePicker.languageinfo.toLowerCase().replace(/-[a-z]+$/, "") : 'en';
// Load the appropriate language file
var scriptFiles = document.getElementsByTagName('head')[0].getElementsByTagName('script');
var loc = scriptFiles[scriptFiles.length - 1].src.substr(0, scriptFiles[scriptFiles.length - 1].src.lastIndexOf("/")) + "/lang/" + datePicker.languageinfo + ".js";
var script = document.createElement('script');
script.type = "text/javascript";
script.src = loc;
script.setAttribute("charset", "utf-8");
/*@cc_on
/*@if(@_win32)
var bases = document.getElementsByTagName('base');
if (bases.length && bases[0].childNodes.length) {
bases[0].appendChild(script);
} else {
document.getElementsByTagName('head')[0].appendChild(script);
};
@else @*/
document.getElementsByTagName('head')[0].appendChild(script);
/*@end
@*/
script = null;
// Defaults should the locale file not load
datePicker.months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
datePicker.fullDay = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
datePicker.titles = ["Previous month","Next month","Previous year","Next year", "Today", "Show Calendar"];
datePicker.getDaysPerMonth = function(nMonth, nYear) {
nMonth = (nMonth + 12) % 12;
return (((0 == (nYear%4)) && ((0 != (nYear%100)) || (0 == (nYear%400)))) && nMonth == 1) ? 29: [31,28,31,30,31,30,31,31,30,31,30,31][nMonth];
};
function datePicker(options) {
this.defaults = {};
for(opt in options) { this[opt] = this.defaults[opt] = options[opt]; };
this.date = new Date();
this.yearinc = 1;
this.timer = null;
this.pause = 1000;
this.timerSet = false;
this.fadeTimer = null;
this.interval = new Date();
this.firstDayOfWeek = this.defaults.firstDayOfWeek = this.dayInc = this.monthInc = this.yearInc = this.opacity = this.opacityTo = 0;
this.dateSet = null;
this.visible = false;
this.disabledDates = [];
this.enabledDates = [];
this.nbsp = String.fromCharCode( 160 );
var o = this;
o.events = {
onblur:function(e) {
o.removeKeyboardEvents();
},
onfocus:function(e) {
o.addKeyboardEvents();
},
onkeydown: function (e) {
o.stopTimer();
if(!o.visible) return false;
if(e == null) e = document.parentWindow.event;
var kc = e.keyCode ? e.keyCode : e.charCode;
if( kc == 13 ) {
// close (return)
var td = document.getElementById(o.id + "-date-picker-hover");
if(!td || td.className.search(/out-of-range|day-disabled/) != -1) return o.killEvent(e);
o.returnFormattedDate();
o.hide();
return o.killEvent(e);
} else if(kc == 27) {
// close (esc)
o.hide();
return o.killEvent(e);
} else if(kc == 32 || kc == 0) {
// today (space)
o.date = new Date();
o.updateTable();
return o.killEvent(e);
};
// Internet Explorer fires the keydown event faster than the JavaScript engine can
// update the interface. The following attempts to fix this.
/*@cc_on
@if(@_win32)
if(new Date().getTime() - o.interval.getTime() < 100) return o.killEvent(e);
o.interval = new Date();
@end
@*/
if ((kc > 49 && kc < 56) || (kc > 97 && kc < 104)) {
if (kc > 96) kc -= (96-48);
kc -= 49;
o.firstDayOfWeek = (o.firstDayOfWeek + kc) % 7;
o.updateTable();
return o.killEvent(e);
};
if ( kc < 37 || kc > 40 ) return true;
var d = new Date( o.date ).valueOf();
if ( kc == 37 ) {
// ctrl + left = previous month
if( e.ctrlKey ) {
d = new Date( o.date );
d.setDate( Math.min(d.getDate(), datePicker.getDaysPerMonth(d.getMonth() - 1,d.getFullYear())) );
d.setMonth( d.getMonth() - 1 );
} else {
d = new Date( o.date.getFullYear(), o.date.getMonth(), o.date.getDate() - 1 );
};
} else if ( kc == 39 ) {
// ctrl + right = next month
if( e.ctrlKey ) {
d = new Date( o.date );
d.setDate( Math.min(d.getDate(), datePicker.getDaysPerMonth(d.getMonth() + 1,d.getFullYear())) );
d.setMonth( d.getMonth() + 1 );
} else {
d = new Date( o.date.getFullYear(), o.date.getMonth(), o.date.getDate() + 1 );
};
} else if ( kc == 38 ) {
// ctrl + up = next year
if( e.ctrlKey ) {
d = new Date( o.date );
d.setDate( Math.min(d.getDate(), datePicker.getDaysPerMonth(d.getMonth(),d.getFullYear() + 1)) );
d.setFullYear( d.getFullYear() + 1 );
} else {
d = new Date( o.date.getFullYear(), o.date.getMonth(), o.date.getDate() - 7 );
};
} else if ( kc == 40 ) {
// ctrl + down = prev year
if( e.ctrlKey ) {
d = new Date( o.date );
d.setDate( Math.min(d.getDate(), datePicker.getDaysPerMonth(d.getMonth(),d.getFullYear() - 1)) );
d.setFullYear( d.getFullYear() - 1 );
} else {
d = new Date( o.date.getFullYear(), o.date.getMonth(), o.date.getDate() + 7 );
};
};
var tmpDate = new Date(d);
if(o.outOfRange(tmpDate)) return o.killEvent(e);
var cacheDate = new Date(o.date);
o.date = tmpDate;
if(cacheDate.getFullYear() != o.date.getFullYear() || cacheDate.getMonth() != o.date.getMonth()) o.updateTable();
else {
o.disableTodayButton();
var tds = o.table.getElementsByTagName('td');
var txt;
var start = o.date.getDate() - 6;
if(start < 0) start = 0;
for(var i = start, td; td = tds[i]; i++) {
txt = Number(td.firstChild.nodeValue);
if(isNaN(txt) || txt != o.date.getDate()) continue;
o.removeHighlight();
td.id = o.id + "-date-picker-hover";
td.className = td.className.replace(/date-picker-hover/g, "") + " date-picker-hover";
};
};
return o.killEvent(e);
},
gotoToday: function(e) {
o.date = new Date();
o.updateTable();
return o.killEvent(e);
},
onmousedown: function(e) {
if ( e == null ) e = document.parentWindow.event;
var el = e.target != null ? e.target : e.srcElement;
var found = false;
while(el.parentNode) {
if(el.id && (el.id == "fd-"+o.id || el.id == "fd-but-"+o.id)) {
found = true;
break;
};
try {
el = el.parentNode;
} catch(err) {
break;
};
};
if(found) return true;
o.stopTimer();
datePickerController.hideAll();
},
onmouseover: function(e) {
o.stopTimer();
var txt = this.firstChild.nodeValue;
if(this.className == "out-of-range" || txt.search(/^[\d]+$/) == -1) return;
o.removeHighlight();
this.id = o.id+"-date-picker-hover";
this.className = this.className.replace(/date-picker-hover/g, "") + " date-picker-hover";
o.date.setDate(this.firstChild.nodeValue);
o.disableTodayButton();
},
onclick: function(e) {
if(o.opacity != o.opacityTo || this.className.search(/out-of-range|day-disabled/) != -1) return false;
if ( e == null ) e = document.parentWindow.event;
var el = e.target != null ? e.target : e.srcElement;
while ( el.nodeType != 1 ) el = el.parentNode;
var d = new Date( o.date );
var txt = el.firstChild.data;
if(txt.search(/^[\d]+$/) == -1) return;
var n = Number( txt );
if(isNaN(n)) { return true; };
d.setDate( n );
o.date = d;
o.returnFormattedDate();
if(!o.staticPos) o.hide();
o.stopTimer();
return o.killEvent(e);
},
incDec: function(e) {
if ( e == null ) e = document.parentWindow.event;
var el = e.target != null ? e.target : e.srcElement;
if(el && el.className && el.className.search('fd-disabled') != -1) { return false; }
datePickerController.addEvent(document, "mouseup", o.events.clearTimer);
o.timerInc = 800;
o.dayInc = arguments[1];
o.yearInc = arguments[2];
o.monthInc = arguments[3];
o.timerSet = true;
o.updateTable();
return true;
},
clearTimer: function(e) {
o.stopTimer();
o.timerInc = 1000;
o.yearInc = 0;
o.monthInc = 0;
o.dayInc = 0;
datePickerController.removeEvent(document, "mouseup", o.events.clearTimer);
}
};
o.stopTimer = function() {
o.timerSet = false;
window.clearTimeout(o.timer);
};
o.removeHighlight = function() {
if(document.getElementById(o.id+"-date-picker-hover")) {
document.getElementById(o.id+"-date-picker-hover").className = document.getElementById(o.id+"-date-picker-hover").className.replace("date-picker-hover", "");
document.getElementById(o.id+"-date-picker-hover").id = "";
};
};
o.reset = function() {
for(def in o.defaults) { o[def] = o.defaults[def]; };
};
o.setOpacity = function(op) {
o.div.style.opacity = op/100;
o.div.style.filter = 'alpha(opacity=' + op + ')';
o.opacity = op;
};
o.fade = function() {
window.clearTimeout(o.fadeTimer);
o.fadeTimer = null;
delete(o.fadeTimer);
var diff = Math.round(o.opacity + ((o.opacityTo - o.opacity) / 4));
o.setOpacity(diff);
if(Math.abs(o.opacityTo - diff) > 3 && !o.noTransparency) {
o.fadeTimer = window.setTimeout(o.fade, 5);
} else {
o.setOpacity(o.opacityTo);
if(o.opacityTo == 0) {
o.div.style.display = "none";
o.visible = false;
} else {
o.visible = true;
};
};
};
o.killEvent = function(e) {
e = e || document.parentWindow.event;
if(e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
};
/*@cc_on
@if(@_win32)
e.cancelBubble = true;
e.returnValue = false;
@end
@*/
return false;
};
o.getElem = function() {
return document.getElementById(o.id.replace(/^fd-/, '')) || false;
};
o.setRangeLow = function(range) {
if(String(range).search(/^(\d\d?\d\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$/) == -1) range = '';
o.low = o.defaults.low = range;
if(o.staticPos) o.updateTable(true);
};
o.setRangeHigh = function(range) {
if(String(range).search(/^(\d\d?\d\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$/) == -1) range = '';
o.high = o.defaults.high = range;
if(o.staticPos) o.updateTable(true);
};
o.setDisabledDays = function(dayArray) {
o.disableDays = o.defaults.disableDays = dayArray;
if(o.staticPos) o.updateTable(true);
};
o.setDisabledDates = function(dateArray) {
var fin = [];
for(var i = dateArray.length; i-- ;) {
if(dateArray[i].match(/^(\d\d\d\d|\*\*\*\*)(0[1-9]|1[012]|\*\*)(0[1-9]|[12][0-9]|3[01])$/) != -1) fin[fin.length] = dateArray[i];
};
if(fin.length) {
o.disabledDates = fin;
o.enabledDates = [];
if(o.staticPos) o.updateTable(true);
};
};
o.setEnabledDates = function(dateArray) {
var fin = [];
for(var i = dateArray.length; i-- ;) {
if(dateArray[i].match(/^(\d\d\d\d|\*\*\*\*)(0[1-9]|1[012]|\*\*)(0[1-9]|[12][0-9]|3[01]|\*\*)$/) != -1 && dateArray[i] != "********") fin[fin.length] = dateArray[i];
};
if(fin.length) {
o.disabledDates = [];
o.enabledDates = fin;
if(o.staticPos) o.updateTable(true);
};
};
o.getDisabledDates = function(y, m) {
if(o.enabledDates.length) return o.getEnabledDates(y, m);
var obj = {};
var d = datePicker.getDaysPerMonth(m - 1, y);
m = m < 10 ? "0" + String(m) : m;
for(var i = o.disabledDates.length; i-- ;) {
var tmp = o.disabledDates[i].replace("****", y).replace("**", m);
if(tmp < Number(String(y)+m+"01") || tmp > Number(y+String(m)+d)) continue;
obj[tmp] = 1;
};
return obj;
};
o.getEnabledDates = function(y, m) {
var obj = {};
var d = datePicker.getDaysPerMonth(m - 1, y);
m = m < 10 ? "0" + String(m) : m;
var day,tmp,de,me,ye,disabled;
for(var dd = 1; dd <= d; dd++) {
day = dd < 10 ? "0" + String(dd) : dd;
disabled = true;
for(var i = o.enabledDates.length; i-- ;) {
tmp = o.enabledDates[i];
ye = String(o.enabledDates[i]).substr(0,4);
me = String(o.enabledDates[i]).substr(4,2);
de = String(o.enabledDates[i]).substr(6,2);
if(ye == y && me == m && de == day) {
disabled = false;
break;
}
if(ye == "****" || me == "**" || de == "**") {
if(ye == "****") tmp = tmp.replace(/^\*\*\*\*/, y);
if(me == "**") tmp = tmp = tmp.substr(0,4) + String(m) + tmp.substr(6,2);
if(de == "**") tmp = tmp.replace(/\*\*/, day);
if(tmp == String(y + String(m) + day)) {
disabled = false;
break;
};
};
};
if(disabled) obj[String(y + String(m) + day)] = 1;
};
return obj;
};
o.setFirstDayOfWeek = function(e) {
if ( e == null ) e = document.parentWindow.event;
var elem = e.target != null ? e.target : e.srcElement;
if(elem.tagName.toLowerCase() != "th") {
while(elem.tagName.toLowerCase() != "th") elem = elem.parentNode;
};
var cnt = 0;
while(elem.previousSibling) {
elem = elem.previousSibling;
if(elem.tagName.toLowerCase() == "th") cnt++;
};
o.firstDayOfWeek = (o.firstDayOfWeek + cnt) % 7;
o.updateTableHeaders();
return o.killEvent(e);
};
o.truePosition = function(element) {
var pos = o.cumulativeOffset(element);
if(window.opera) { return pos; }
var iebody = (document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body;
var dsocleft = document.all ? iebody.scrollLeft : window.pageXOffset;
var dsoctop = document.all ? iebody.scrollTop : window.pageYOffset;
var posReal = o.realOffset(element);
return [pos[0] - posReal[0] + dsocleft, pos[1] - posReal[1] + dsoctop];
};
o.realOffset = function(element) {
var t = 0, l = 0;
do {
t += element.scrollTop || 0;
l += element.scrollLeft || 0;
element = element.parentNode;
} while (element);
return [l, t];
};
o.cumulativeOffset = function(element) {
var t = 0, l = 0;
do {
t += element.offsetTop || 0;
l += element.offsetLeft || 0;
element = element.offsetParent;
} while (element);
return [l, t];
};
o.resize = function() {
if(!o.created || !o.getElem()) return;
o.div.style.visibility = "hidden";
if(!o.staticPos) { o.div.style.left = o.div.style.top = "0px"; }
o.div.style.display = "block";
var osh = o.div.offsetHeight;
var osw = o.div.offsetWidth;
o.div.style.visibility = "visible";
o.div.style.display = "none";
if(!o.staticPos) {
var elem = document.getElementById('fd-but-' + o.id);
var pos = o.truePosition(elem);
var trueBody = (document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body;
var scrollTop = window.devicePixelRatio || window.opera ? 0 : trueBody.scrollTop;
var scrollLeft = window.devicePixelRatio || window.opera ? 0 : trueBody.scrollLeft;
if(parseInt(trueBody.clientWidth+scrollLeft) < parseInt(osw+pos[0])) {
o.div.style.left = Math.abs(parseInt((trueBody.clientWidth+scrollLeft) - osw)) + "px";
} else {
o.div.style.left = pos[0] + "px";
};
if(parseInt(trueBody.clientHeight+scrollTop) < parseInt(osh+pos[1]+elem.offsetHeight+2)) {
o.div.style.top = Math.abs(parseInt(pos[1] - (osh + 2))) + "px";
} else {
o.div.style.top = Math.abs(parseInt(pos[1] + elem.offsetHeight + 2)) + "px";
};
};
/*@cc_on
@if(@_jscript_version <= 5.6)
if(o.staticPos) return;
o.iePopUp.style.top = o.div.style.top;
o.iePopUp.style.left = o.div.style.left;
o.iePopUp.style.width = osw + "px";
o.iePopUp.style.height = (osh - 2) + "px";
@end
@*/
};
o.equaliseDates = function() {
var clearDayFound = false;
var tmpDate;
for(var i = o.low; i <= o.high; i++) {
tmpDate = String(i);
if(!o.disableDays[new Date(tmpDate.substr(0,4), tmpDate.substr(6,2), tmpDate.substr(4,2)).getDay() - 1]) {
clearDayFound = true;
break;
};
};
if(!clearDayFound) o.disableDays = o.defaults.disableDays = [0,0,0,0,0,0,0];
};
o.outOfRange = function(tmpDate) {
if(!o.low && !o.high) return false;
var level = false;
if(!tmpDate) {
level = true;
tmpDate = o.date;
};
var d = (tmpDate.getDate() < 10) ? "0" + tmpDate.getDate() : tmpDate.getDate();
var m = ((tmpDate.getMonth() + 1) < 10) ? "0" + (tmpDate.getMonth() + 1) : tmpDate.getMonth() + 1;
var y = tmpDate.getFullYear();
var dt = String(y)+String(m)+String(d);
if(o.low && parseInt(dt) < parseInt(o.low)) {
if(!level) return true;
o.date = new Date(o.low.substr(0,4), o.low.substr(4,2)-1, o.low.substr(6,2), 5, 0, 0);
return false;
};
if(o.high && parseInt(dt) > parseInt(o.high)) {
if(!level) return true;
o.date = new Date( o.high.substr(0,4), o.high.substr(4,2)-1, o.high.substr(6,2), 5, 0, 0);
};
return false;
};
o.createButton = function() {
if(o.staticPos) { return; };
var but;
if(!document.getElementById("fd-but-" + o.id)) {
var inp = o.getElem();
but = document.createElement('a');
but.href = "#";
var span = document.createElement('span');
span.appendChild(document.createTextNode(String.fromCharCode( 160 )));
but.className = "date-picker-control";
but.title = (typeof(fdLocale) == "object" && options.locale && fdLocale.titles.length > 5) ? fdLocale.titles[5] : "";
but.id = "fd-but-" + o.id;
but.appendChild(span);
if(inp.nextSibling) {
inp.parentNode.insertBefore(but, inp.nextSibling);
} else {
inp.parentNode.appendChild(but);
};
} else {
but = document.getElementById("fd-but-" + o.id);
};
but.onclick = but.onpress = function(e) {
e = e || window.event;
var inpId = this.id.replace('fd-but-','');
try { var dp = datePickerController.getDatePicker(inpId); } catch(err) { return false; };
if(e.type == "press") {
var kc = e.keyCode != null ? e.keyCode : e.charCode;
if(kc != 13) { return true; };
if(dp.visible) {
hideAll();
return false;
};
};
if(!dp.visible) {
datePickerController.hideAll(inpId);
dp.show();
} else {
datePickerController.hideAll();
};
return false;
};
but = null;
},
o.create = function() {
function createTH(details) {
var th = document.createElement('th');
if(details.thClassName) th.className = details.thClassName;
if(details.colspan) {
/*@cc_on
/*@if (@_win32)
th.setAttribute('colSpan',details.colspan);
@else @*/
th.setAttribute('colspan',details.colspan);
/*@end
@*/
};
/*@cc_on
/*@if (@_win32)
th.unselectable = "on";
/*@end@*/
return th;
};
function createThAndButton(tr, obj) {
for(var i = 0, details; details = obj[i]; i++) {
var th = createTH(details);
tr.appendChild(th);
var but = document.createElement('span');
but.className = details.className;
but.id = o.id + details.id;
but.appendChild(document.createTextNode(details.text));
but.title = details.title || "";
if(details.onmousedown) but.onmousedown = details.onmousedown;
if(details.onclick) but.onclick = details.onclick;
if(details.onmouseout) but.onmouseout = details.onmouseout;
th.appendChild(but);
};
};
/*@cc_on
@if(@_jscript_version <= 5.6)
if(!document.getElementById("iePopUpHack")) {
o.iePopUp = document.createElement('iframe');
o.iePopUp.src = "javascript:'<html></html>';";
o.iePopUp.setAttribute('className','iehack');
o.iePopUp.scrolling="no";
o.iePopUp.frameBorder="0";
o.iePopUp.name = o.iePopUp.id = "iePopUpHack";
document.body.appendChild(o.iePopUp);
} else {
o.iePopUp = document.getElementById("iePopUpHack");
};
@end
@*/
if(typeof(fdLocale) == "object" && o.locale) {
datePicker.titles = fdLocale.titles;
datePicker.months = fdLocale.months;
datePicker.fullDay = fdLocale.fullDay;
// Optional parameters
if(fdLocale.dayAbbr) datePicker.dayAbbr = fdLocale.dayAbbr;
if(fdLocale.firstDayOfWeek) o.firstDayOfWeek = o.defaults.firstDayOfWeek = fdLocale.firstDayOfWeek;
};
o.div = document.createElement('div');
o.div.style.zIndex = 9999;
o.div.id = "fd-"+o.id;
o.div.className = "datePicker";
if(!o.staticPos) {
document.getElementsByTagName('body')[0].appendChild(o.div);
} else {
elem = o.getElem();
if(!elem) {
o.div = null;
return;
};
o.div.className += " staticDP";
o.div.setAttribute("tabIndex", "0");
o.div.onfocus = o.events.onfocus;
o.div.onblur = o.events.onblur;
elem.parentNode.insertBefore(o.div, elem.nextSibling);
if(o.hideInput && elem.type && elem.type == "text") elem.setAttribute("type", "hidden");
};
//var nbsp = String.fromCharCode( 160 );
var tr, row, col, tableHead, tableBody;
o.table = document.createElement('table');
o.div.appendChild( o.table );
tableHead = document.createElement('thead');
o.table.appendChild( tableHead );
tr = document.createElement('tr');
tableHead.appendChild(tr);
// Title Bar
o.titleBar = createTH({thClassName:"date-picker-title", colspan:7});
tr.appendChild( o.titleBar );
tr = null;
var span = document.createElement('span');
span.className = "month-display";
o.titleBar.appendChild(span);
span = document.createElement('span');
span.className = "year-display";
o.titleBar.appendChild(span);
span = null;
tr = document.createElement('tr');
tableHead.appendChild(tr);
createThAndButton(tr, [{className:"prev-but", id:"-prev-year-but", text:"\u00AB", title:datePicker.titles[2], onmousedown:function(e) { o.events.incDec(e,0,-1,0); }, onmouseout:o.events.clearTimer },{className:"prev-but", id:"-prev-month-but", text:"\u2039", title:datePicker.titles[0], onmousedown:function(e) { o.events.incDec(e,0,0,-1); }, onmouseout:o.events.clearTimer },{colspan:3, className:"today-but", id:"-today-but", text:datePicker.titles.length > 4 ? datePicker.titles[4] : "Today", onclick:o.events.gotoToday},{className:"next-but", id:"-next-month-but", text:"\u203A", title:datePicker.titles[1], onmousedown:function(e) { o.events.incDec(e,0,0,1); }, onmouseout:o.events.clearTimer },{className:"next-but", id:"-next-year-but", text:"\u00BB", title:datePicker.titles[3], onmousedown:function(e) { o.events.incDec(e,0,1,0); }, onmouseout:o.events.clearTimer }]);
tableBody = document.createElement('tbody');
o.table.appendChild( tableBody );
for(var rows = 0; rows < 7; rows++) {
row = document.createElement('tr');
if(rows != 0) tableBody.appendChild(row);
else tableHead.appendChild(row);
for(var cols = 0; cols < 7; cols++) {
col = (rows == 0) ? document.createElement('th') : document.createElement('td');
row.appendChild(col);
if(rows != 0) {
col.appendChild(document.createTextNode(o.nbsp));
col.onmouseover = o.events.onmouseover;
col.onclick = o.events.onclick;
} else {
col.className = "date-picker-day-header";
col.scope = "col";
};
col = null;
};
row = null;
};
// Table headers
var but;
var ths = o.table.getElementsByTagName('thead')[0].getElementsByTagName('tr')[2].getElementsByTagName('th');
for ( var y = 0; y < 7; y++ ) {
if(y > 0) {
but = document.createElement("span");
but.className = "fd-day-header";
but.onclick = ths[y].onclick = o.setFirstDayOfWeek;
but.appendChild(document.createTextNode(o.nbsp));
ths[y].appendChild(but);
but = null;
} else {
ths[y].appendChild(document.createTextNode(o.nbsp));
};
};
o.ths = o.table.getElementsByTagName('thead')[0].getElementsByTagName('tr')[2].getElementsByTagName('th');
o.trs = o.table.getElementsByTagName('tbody')[0].getElementsByTagName('tr');
o.updateTableHeaders();
tableBody = tableHead = tr = createThAndButton = createTH = null;
if(o.low && o.high && (o.high - o.low < 7)) { o.equaliseDates(); };
o.created = true;
if(o.staticPos) {
var yyN = document.getElementById(o.id);
datePickerController.addEvent(yyN, "change", o.changeHandler);
if(o.splitDate) {
var mmN = document.getElementById(o.id+'-mm');
var ddN = document.getElementById(o.id+'-dd');
datePickerController.addEvent(mmN, "change", o.changeHandler);
datePickerController.addEvent(ddN, "change", o.changeHandler);
};
o.show();
} else {
o.createButton();
o.resize();
o.fade();
};
};
o.changeHandler = function() {
o.setDateFromInput();
o.updateTable();
};
o.setDateFromInput = function() {
function m2c(val) {
return String(val).length < 2 ? "00".substring(0, 2 - String(val).length) + String(val) : val;
};
o.dateSet = null;
var elem = o.getElem();
if(!elem) return;
if(!o.splitDate) {
var date = datePickerController.dateFormat(elem.value, o.format.search(/m-d-y/i) != -1);
} else {
var mmN = document.getElementById(o.id+'-mm');
var ddN = document.getElementById(o.id+'-dd');
var tm = parseInt(mmN.tagName.toLowerCase() == "input" ? mmN.value : mmN.options[mmN.selectedIndex].value, 10);
var td = parseInt(ddN.tagName.toLowerCase() == "input" ? ddN.value : ddN.options[ddN.selectedIndex].value, 10);
var ty = parseInt(elem.tagName.toLowerCase() == "input" ? elem.value : elem.options[elem.selectedIndex || 0].value, 10);
var date = datePickerController.dateFormat(tm + "/" + td + "/" + ty, true);
};
var badDate = false;
if(!date) {
badDate = true;
date = String(new Date().getFullYear()) + m2c(new Date().getMonth()+1) + m2c(new Date().getDate());
};
var d,m,y;
y = Number(date.substr(0, 4));
m = Number(date.substr(4, 2)) - 1;
d = Number(date.substr(6, 2));
var dpm = datePicker.getDaysPerMonth(m, y);
if(d > dpm) d = dpm;
if(new Date(y, m, d) == 'Invalid Date' || new Date(y, m, d) == 'NaN') {
badDate = true;
o.date = new Date();
o.date.setHours(5);
return;
};
o.date = new Date(y, m, d);
o.date.setHours(5);
if(!badDate) o.dateSet = new Date(o.date);
m2c = null;
};
o.setSelectIndex = function(elem, indx) {
var len = elem.options.length;
indx = Number(indx);
for(var opt = 0; opt < len; opt++) {
if(elem.options[opt].value == indx) {
elem.selectedIndex = opt;
return;
};
};
},
o.returnFormattedDate = function() {
var elem = o.getElem();
if(!elem) return;
var d = (o.date.getDate() < 10) ? "0" + o.date.getDate() : o.date.getDate();
var m = ((o.date.getMonth() + 1) < 10) ? "0" + (o.date.getMonth() + 1) : o.date.getMonth() + 1;
var yyyy = o.date.getFullYear();
var disabledDates = o.getDisabledDates(yyyy, m);
var weekDay = ( o.date.getDay() + 6 ) % 7;
if(!(o.disableDays[weekDay] || String(yyyy)+m+d in disabledDates)) {
if(o.splitDate) {
var ddE = document.getElementById(o.id+"-dd");
var mmE = document.getElementById(o.id+"-mm");
if(ddE.tagName.toLowerCase() == "input") { ddE.value = d; }
else { o.setSelectIndex(ddE, d); /*ddE.selectedIndex = d - 1;*/ };
if(mmE.tagName.toLowerCase() == "input") { mmE.value = m; }
else { o.setSelectIndex(mmE, m); /*mmE.selectedIndex = m - 1;*/ };
if(elem.tagName.toLowerCase() == "input") elem.value = yyyy;
else {
o.setSelectIndex(elem, yyyy); /*
for(var opt = 0; opt < elem.options.length; opt++) {
if(elem.options[opt].value == yyyy) {
elem.selectedIndex = opt;
break;
};
};
*/
};
} else {
elem.value = o.format.replace('y',yyyy).replace('m',m).replace('d',d).replace(/-/g,o.divider);
};
if(!elem.type || elem.type && elem.type != "hidden"){ elem.focus(); }
if(o.staticPos) {
o.dateSet = new Date( o.date );
o.updateTable();
};
// Programmatically fire the onchange event
if(document.createEvent) {
var onchangeEvent = document.createEvent('HTMLEvents');
onchangeEvent.initEvent('change', true, false);
elem.dispatchEvent(onchangeEvent);
} else if(document.createEventObject) {
elem.fireEvent('onchange');
};
};
};
o.disableTodayButton = function() {
var today = new Date();
document.getElementById(o.id + "-today-but").className = document.getElementById(o.id + "-today-but").className.replace("fd-disabled", "");
if(o.outOfRange(today) || (o.date.getDate() == today.getDate() && o.date.getMonth() == today.getMonth() && o.date.getFullYear() == today.getFullYear())) {
document.getElementById(o.id + "-today-but").className += " fd-disabled";
document.getElementById(o.id + "-today-but").onclick = null;
} else {
document.getElementById(o.id + "-today-but").onclick = o.events.gotoToday;
};
};
o.updateTableHeaders = function() {
var d, but;
var ths = o.ths;
for ( var y = 0; y < 7; y++ ) {
d = (o.firstDayOfWeek + y) % 7;
ths[y].title = datePicker.fullDay[d];
if(y > 0) {
but = ths[y].getElementsByTagName("span")[0];
but.removeChild(but.firstChild);
but.appendChild(document.createTextNode(datePicker.dayAbbr ? datePicker.dayAbbr[d] : datePicker.fullDay[d].charAt(0)));
but.title = datePicker.fullDay[d];
but = null;
} else {
ths[y].removeChild(ths[y].firstChild);
ths[y].appendChild(document.createTextNode(datePicker.dayAbbr ? datePicker.dayAbbr[d] : datePicker.fullDay[d].charAt(0)));
};
};
o.updateTable();
};
o.updateTable = function(noCallback) {
if(o.timerSet) {
var d = new Date(o.date);
d.setDate( Math.min(d.getDate()+o.dayInc, datePicker.getDaysPerMonth(d.getMonth()+o.monthInc,d.getFullYear()+o.yearInc)) );
d.setMonth( d.getMonth() + o.monthInc );
d.setFullYear( d.getFullYear() + o.yearInc );
o.date = d;
};
if(!noCallback && "onupdate" in datePickerController && typeof(datePickerController.onupdate) == "function") datePickerController.onupdate(o);
o.outOfRange();
o.disableTodayButton();
// Set the tmpDate to the second day of this month (to avoid daylight savings time madness on Windows)
var tmpDate = new Date( o.date.getFullYear(), o.date.getMonth(), 2 );
tmpDate.setHours(5);
var tdm = tmpDate.getMonth();
var tdy = tmpDate.getFullYear();
// Do the disableDates for this year and month
var disabledDates = o.getDisabledDates(o.date.getFullYear(), o.date.getMonth() + 1);
var today = new Date();
// Previous buttons out of range
var b = document.getElementById(o.id + "-prev-year-but");
b.className = b.className.replace("fd-disabled", "");
if(o.outOfRange(new Date((tdy - 1), Number(tdm), datePicker.getDaysPerMonth(Number(tdm), tdy-1)))) {
b.className += " fd-disabled";
if(o.yearInc == -1) o.stopTimer();
};
b = document.getElementById(o.id + "-prev-month-but")
b.className = b.className.replace("fd-disabled", "");
if(o.outOfRange(new Date(tdy, (Number(tdm) - 1), datePicker.getDaysPerMonth(Number(tdm)-1, tdy)))) {
b.className += " fd-disabled";
if(o.monthInc == -1) o.stopTimer();
};
// Next buttons out of range
b= document.getElementById(o.id + "-next-year-but")
b.className = b.className.replace("fd-disabled", "");
if(o.outOfRange(new Date((tdy + 1), Number(tdm), 1))) {
b.className += " fd-disabled";
if(o.yearInc == 1) o.stopTimer();
};
b = document.getElementById(o.id + "-next-month-but")
b.className = b.className.replace("fd-disabled", "");
if(o.outOfRange(new Date(tdy, Number(tdm) + 1, 1))) {
b.className += " fd-disabled";
if(o.monthInc == 1) o.stopTimer();
};
b = null;
var cd = o.date.getDate();
var cm = o.date.getMonth();
var cy = o.date.getFullYear();
// Title Bar
var span = o.titleBar.getElementsByTagName("span");
while(span[0].firstChild) span[0].removeChild(span[0].firstChild);
while(span[1].firstChild) span[1].removeChild(span[1].firstChild);
span[0].appendChild(document.createTextNode(datePicker.months[cm] + o.nbsp));
span[1].appendChild(document.createTextNode(cy));
tmpDate.setDate( 1 );
var dt, cName, td, tds, i;
var weekDay = ( tmpDate.getDay() + 6 ) % 7;
var firstColIndex = (( (weekDay - o.firstDayOfWeek) + 7 ) % 7) - 1;
var dpm = datePicker.getDaysPerMonth(cm, cy);
var todayD = today.getDate();
var todayM = today.getMonth();
var todayY = today.getFullYear();
var c = "class";
/*@cc_on
@if(@_win32)
c = "className";
@end
@*/
var stub = String(tdy) + (String(tdm+1).length < 2 ? "0" + (tdm+1) : tdm+1);
for(var row = 0; row < 6; row++) {
tds = o.trs[row].getElementsByTagName('td');
for(var col = 0; col < 7; col++) {
td = tds[col];
td.removeChild(td.firstChild);
td.setAttribute("id", "");
td.setAttribute("title", "");
i = (row * 7) + col;
if(i > firstColIndex && i <= (firstColIndex + dpm)) {
dt = i - firstColIndex;
tmpDate.setDate(dt);
td.appendChild(document.createTextNode(dt));
if(o.outOfRange(tmpDate)) {
td.setAttribute(c, "out-of-range");
} else {
cName = [];
weekDay = ( tmpDate.getDay() + 6 ) % 7;
if(dt == todayD && tdm == todayM && tdy == todayY) {
cName.push("date-picker-today");
};
if(o.dateSet != null && o.dateSet.getDate() == dt && o.dateSet.getMonth() == tdm && o.dateSet.getFullYear() == tdy) {
cName.push("date-picker-selected-date");
};
if(o.disableDays[weekDay] || stub + String(dt < 10 ? "0" + dt : dt) in disabledDates) {
cName.push("day-disabled");
} else if(o.highlightDays[weekDay]) {
cName.push("date-picker-highlight");
};
if(cd == dt) {
td.setAttribute("id", o.id + "-date-picker-hover");
cName.push("date-picker-hover");
};
cName.push("dm-" + dt + '-' + (tdm + 1) + " " + " dmy-" + dt + '-' + (tdm + 1) + '-' + tdy);
td.setAttribute(c, cName.join(' '));
td.setAttribute("title", datePicker.months[cm] + o.nbsp + dt + "," + o.nbsp + cy);
};
} else {
td.appendChild(document.createTextNode(o.nbsp));
td.setAttribute(c, "date-picker-unused");
};
};
};
if(o.timerSet) {
o.timerInc = 50 + Math.round(((o.timerInc - 50) / 1.8));
o.timer = window.setTimeout(o.updateTable, o.timerInc);
};
};
o.addKeyboardEvents = function() {
datePickerController.addEvent(document, "keypress", o.events.onkeydown);
/*@cc_on
@if(@_win32)
datePickerController.removeEvent(document, "keypress", o.events.onkeydown);
datePickerController.addEvent(document, "keydown", o.events.onkeydown);
@end
@*/
if(window.devicePixelRatio) {
datePickerController.removeEvent(document, "keypress", o.events.onkeydown);
datePickerController.addEvent(document, "keydown", o.events.onkeydown);
};
};
o.removeKeyboardEvents =function() {
datePickerController.removeEvent(document, "keypress", o.events.onkeydown);
datePickerController.removeEvent(document, "keydown", o.events.onkeydown);
};
o.show = function() {
var elem = o.getElem();
if(!elem || o.visible || elem.disabled) return;
o.reset();
o.setDateFromInput();
o.updateTable();
if(!o.staticPos) o.resize();
datePickerController.addEvent(o.staticPos ? o.table : document, "mousedown", o.events.onmousedown);
if(!o.staticPos) { o.addKeyboardEvents(); };
o.opacityTo = o.noTransparency ? 99 : 95;
o.div.style.display = "block";
/*@cc_on
@if(@_jscript_version <= 5.6)
if(!o.staticPos) o.iePopUp.style.display = "block";
@end
@*/
o.fade();
o.visible = true;
};
o.hide = function() {
if(!o.visible) return;
o.stopTimer();
if(o.staticPos) return;
datePickerController.removeEvent(document, "mousedown", o.events.onmousedown);
datePickerController.removeEvent(document, "mouseup", o.events.clearTimer);
o.removeKeyboardEvents();
/*@cc_on
@if(@_jscript_version <= 5.6)
o.iePopUp.style.display = "none";
@end
@*/
o.opacityTo = 0;
o.fade();
o.visible = false;
var elem = o.getElem();
if(!elem.type || elem.type && elem.type != "hidden") { elem.focus(); };
};
o.destroy = function() {
// Cleanup for Internet Explorer
datePickerController.removeEvent(o.staticPos ? o.table : document, "mousedown", o.events.onmousedown);
datePickerController.removeEvent(document, "mouseup", o.events.clearTimer);
o.removeKeyboardEvents();
if(o.staticPos) {
var yyN = document.getElementById(o.id);
datePickerController.removeEvent(yyN, "change", o.changeHandler);
if(o.splitDate) {
var mmN = document.getElementById(o.id+'-mm');
var ddN = document.getElementById(o.id+'-dd');
datePickerController.removeEvent(mmN, "change", o.changeHandler);
datePickerController.removeEvent(ddN, "change", o.changeHandler);
};
o.div.onfocus = o.div.onblur = null;
};
var ths = o.table.getElementsByTagName("th");
for(var i = 0, th; th = ths[i]; i++) {
th.onmouseover = th.onmouseout = th.onmousedown = th.onclick = null;
};
var tds = o.table.getElementsByTagName("td");
for(var i = 0, td; td = tds[i]; i++) {
td.onmouseover = td.onclick = null;
};
var butts = o.table.getElementsByTagName("span");
for(var i = 0, butt; butt = butts[i]; i++) {
butt.onmousedown = butt.onclick = butt.onkeypress = null;
};
o.ths = o.trs = null;
clearTimeout(o.fadeTimer);
clearTimeout(o.timer);
o.fadeTimer = o.timer = null;
/*@cc_on
@if(@_jscript_version <= 5.6)
o.iePopUp = null;
@end
@*/
if(!o.staticPos && document.getElementById(o.id.replace(/^fd-/, 'fd-but-'))) {
var butt = document.getElementById(o.id.replace(/^fd-/, 'fd-but-'));
butt.onclick = butt.onpress = null;
};
if(o.div && o.div.parentNode) {
o.div.parentNode.removeChild(o.div);
};
o.titleBar = o.table = o.div = null;
o = null;
};
o.create();
};
datePickerController = function() {
var datePickers = {};
var uniqueId = 0;
var addEvent = function(obj, type, fn) {
if( obj.attachEvent ) {
obj["e"+type+fn] = fn;
obj[type+fn] = function(){obj["e"+type+fn]( window.event );};
obj.attachEvent( "on"+type, obj[type+fn] );
} else {
obj.addEventListener( type, fn, true );
};
};
var removeEvent = function(obj, type, fn) {
try {
if( obj.detachEvent ) {
obj.detachEvent( "on"+type, obj[type+fn] );
obj[type+fn] = null;
} else {
obj.removeEventListener( type, fn, true );
};
} catch(err) {};
};
var hideAll = function(exception) {
var dp;
for(dp in datePickers) {
if(!datePickers[dp].created || datePickers[dp].staticPos) continue;
if(exception && exception == datePickers[dp].id) { continue; };
if(document.getElementById(datePickers[dp].id)) { datePickers[dp].hide(); };
};
};
var cleanUp = function() {
var dp;
for(dp in datePickers) {
if(!document.getElementById(datePickers[dp].id)) {
if(!datePickers[dp].created) continue;
datePickers[dp].destroy();
datePickers[dp] = null;
delete datePickers[dp];
};
};
};
var destroy = function() {
for(dp in datePickers) {
if(!datePickers[dp].created) continue;
datePickers[dp].destroy();
datePickers[dp] = null;
delete datePickers[dp];
};
datePickers = null;
/*@cc_on
@if(@_jscript_version <= 5.6)
if(document.getElementById("iePopUpHack")) {
document.body.removeChild(document.getElementById("iePopUpHack"));
};
@end
@*/
datePicker.script = null;
removeEvent(window, 'load', datePickerController.create);
removeEvent(window, 'unload', datePickerController.destroy);
};
var dateFormat = function(dateIn, favourMDY) {
var dateTest = [
{ regExp:/^(0?[1-9]|[12][0-9]|3[01])([- \/.])(0?[1-9]|1[012])([- \/.])((\d\d)?\d\d)$/, d:1, m:3, y:5 }, // dmy
{ regExp:/^(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])([- \/.])((\d\d)?\d\d)$/, d:3, m:1, y:5 }, // mdy
{ regExp:/^(\d\d\d\d)([- \/.])(0?[1-9]|1[012])([- \/.])(0?[1-9]|[12][0-9]|3[01])$/, d:5, m:3, y:1 } // ymd
];
var start;
var cnt = 0;
while(cnt < 3) {
start = (cnt + (favourMDY ? 4 : 3)) % 3;
if(dateIn.match(dateTest[start].regExp)) {
res = dateIn.match(dateTest[start].regExp);
y = res[dateTest[start].y];
m = res[dateTest[start].m];
d = res[dateTest[start].d];
if(m.length == 1) m = "0" + m;
if(d.length == 1) d = "0" + d;
if(y.length != 4) y = (parseInt(y) < 50) ? '20' + y : '19' + y;
return String(y)+m+d;
};
cnt++;
};
return 0;
};
var joinNodeLists = function() {
if(!arguments.length) { return []; }
var nodeList = [];
for (var i = 0; i < arguments.length; i++) {
for (var j = 0, item; item = arguments[i][j]; j++) {
nodeList[nodeList.length] = item;
};
};
return nodeList;
};
var addDatePicker = function(inpId, options) {
if(!(inpId in datePickers)) {
datePickers[inpId] = new datePicker(options);
};
};
var getDatePicker = function(inpId) {
if(!(inpId in datePickers)) { throw "No datePicker has been created for the form element with an id of '" + inpId.toString() + "'"; };
return datePickers[inpId];
};
var grepRangeLimits = function(sel) {
var range = [];
for(var i = 0; i < sel.options.length; i++) {
if(sel.options[i].value.search(/^\d\d\d\d$/) == -1) { continue; };
if(!range[0] || Number(sel.options[i].value) < range[0]) { range[0] = Number(sel.options[i].value); };
if(!range[1] || Number(sel.options[i].value) > range[1]) { range[1] = Number(sel.options[i].value); };
};
return range;
};
var create = function(inp) {
if(!(typeof document.createElement != "undefined" && typeof document.documentElement != "undefined" && typeof document.documentElement.offsetWidth == "number")) return;
var inputs = (inp && inp.tagName) ? [inp] : joinNodeLists(document.getElementsByTagName('input'), document.getElementsByTagName('select'));
var regExp1 = /disable-days-([1-7]){1,6}/g; // the days to disable
var regExp2 = /no-transparency/g; // do not use transparency effects
var regExp3 = /highlight-days-([1-7]){1,7}/g; // the days to highlight in red
var regExp4 = /range-low-(\d\d\d\d-\d\d-\d\d)/g; // the lowest selectable date
var regExp5 = /range-high-(\d\d\d\d-\d\d-\d\d)/g; // the highest selectable date
var regExp6 = /format-(d-m-y|m-d-y|y-m-d)/g; // the input/output date format
var regExp7 = /divider-(dot|slash|space|dash)/g; // the character used to divide the date
var regExp8 = /no-locale/g; // do not attempt to detect the browser language
var regExp9 = /no-fade/g; // always show the datepicker
var regExp10 = /hide-input/g; // hide the input
for(var i=0, inp; inp = inputs[i]; i++) {
if(inp.className && (inp.className.search(regExp6) != -1 || inp.className.search(/split-date/) != -1) && ((inp.tagName.toLowerCase() == "input" && (inp.type == "text" || inp.type == "hidden")) || inp.tagName.toLowerCase() == "select")) {
if(inp.id && document.getElementById('fd-'+inp.id)) { continue; };
if(!inp.id) { inp.id = "fdDatePicker-" + uniqueId++; };
var options = {
id:inp.id,
low:"",
high:"",
divider:"/",
format:"d-m-y",
highlightDays:[0,0,0,0,0,1,1],
disableDays:[0,0,0,0,0,0,0],
locale:inp.className.search(regExp8) == -1,
splitDate:0,
noTransparency:inp.className.search(regExp2) != -1,
staticPos:inp.className.search(regExp9) != -1,
hideInput:inp.className.search(regExp10) != -1
};
if(!options.staticPos) {
options.hideInput = false;
} else {
options.noTransparency = true;
};
// Split the date into three parts ?
if(inp.className.search(/split-date/) != -1) {
if(document.getElementById(inp.id+'-dd') && document.getElementById(inp.id+'-mm') && document.getElementById(inp.id+'-dd').tagName.search(/input|select/i) != -1 && document.getElementById(inp.id+'-mm').tagName.search(/input|select/i) != -1) {
options.splitDate = 1;
};
};
// Date format(variations of d-m-y)
if(inp.className.search(regExp6) != -1) {
options.format = inp.className.match(regExp6)[0].replace('format-','');
};
// What divider to use, a "/", "-", "." or " "
if(inp.className.search(regExp7) != -1) {
var dividers = { dot:".", space:" ", dash:"-", slash:"/" };
options.divider = (inp.className.search(regExp7) != -1 && inp.className.match(regExp7)[0].replace('divider-','') in dividers) ? dividers[inp.className.match(regExp7)[0].replace('divider-','')] : "/";
};
// The days to highlight
if(inp.className.search(regExp3) != -1) {
var tmp = inp.className.match(regExp3)[0].replace(/highlight-days-/, '');
options.highlightDays = [0,0,0,0,0,0,0];
for(var j = 0; j < tmp.length; j++) {
options.highlightDays[tmp.charAt(j) - 1] = 1;
};
};
// The days to disable
if(inp.className.search(regExp1) != -1) {
var tmp = inp.className.match(regExp1)[0].replace(/disable-days-/, '');
options.disableDays = [0,0,0,0,0,0,0];
for(var j = 0; j < tmp.length; j++) {
options.disableDays[tmp.charAt(j) - 1] = 1;
};
};
// The lower limit
if(inp.className.search(/range-low-today/i) != -1) {
options.low = datePickerController.dateFormat((new Date().getMonth() + 1) + "/" + new Date().getDate() + "/" + new Date().getFullYear(), true);
} else if(inp.className.search(regExp4) != -1) {
options.low = datePickerController.dateFormat(inp.className.match(regExp4)[0].replace(/range-low-/, ''), false);
if(!options.low) {
options.low = '';
};
};
// The higher limit
if(inp.className.search(/range-high-today/i) != -1 && inp.className.search(/range-low-today/i) == -1) {
options.high = datePickerController.dateFormat((new Date().getMonth() + 1) + "/" + new Date().getDate() + "/" + new Date().getFullYear(), true);
} else if(inp.className.search(regExp5) != -1) {
options.high = datePickerController.dateFormat(inp.className.match(regExp5)[0].replace(/range-high-/, ''), false);
if(!options.high) {
options.high = '';
};
};
// Always round lower & higher limits if a selectList involved
if(inp.tagName.search(/select/i) != -1) {
var range = grepRangeLimits(inp);
options.low = options.low ? range[0] + String(options.low).substr(4,4) : datePickerController.dateFormat(range[0] + "/01/01");
options.high = options.high ? range[1] + String(options.low).substr(4,4) : datePickerController.dateFormat(range[1] + "/12/31");
};
addDatePicker(inp.id, options);
};
};
}
return {
addEvent:addEvent,
removeEvent:removeEvent,
create:create,
destroy:destroy,
cleanUp:cleanUp,
addDatePicker:addDatePicker,
getDatePicker:getDatePicker,
dateFormat:dateFormat,
datePickers:datePickers,
hideAll:hideAll
};
}();
})();
datePickerController.addEvent(window, 'load', datePickerController.create);
datePickerController.addEvent(window, 'unload', datePickerController.destroy);
| {
"content_hash": "9cd38ce613c61d49a8cca51568b39c61",
"timestamp": "",
"source": "github",
"line_count": 1420,
"max_line_length": 893,
"avg_line_length": 51.78661971830986,
"alnum_prop": 0.3871384473122374,
"repo_name": "bigprof-software/online-invoicing-system",
"id": "748a90474ce846d3d5b4a0f04b702b90c8baf7c5",
"size": "74591",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/resources/datepicker/js/datepicker.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "200405"
},
{
"name": "HTML",
"bytes": "94887"
},
{
"name": "JavaScript",
"bytes": "238762"
},
{
"name": "PHP",
"bytes": "1750853"
}
],
"symlink_target": ""
} |
package com.android.mms.ui;
import android.content.Context;
import com.android.mms.model.AudioModel;
import com.android.mms.model.ImageModel;
import com.android.mms.model.Model;
import com.android.mms.model.SlideModel;
import com.android.mms.model.SlideshowModel;
import com.android.mms.model.VideoModel;
import com.android.mms.util.ItemLoadedCallback;
import com.android.mms.util.ItemLoadedFuture;
import com.android.mms.util.ThumbnailManager.ImageLoaded;
public class MmsThumbnailPresenter extends Presenter {
private static final String TAG = "MmsThumbnailPresenter";
private ItemLoadedCallback mOnLoadedCallback;
private ItemLoadedFuture mItemLoadedFuture;
public MmsThumbnailPresenter(Context context, ViewInterface view, Model model) {
super(context, view, model);
}
@Override
public void present(ItemLoadedCallback callback) {
mOnLoadedCallback = callback;
SlideModel slide = ((SlideshowModel) mModel).get(0);
if (slide != null) {
presentFirstSlide((SlideViewInterface) mView, slide);
}
}
private void presentFirstSlide(SlideViewInterface view, SlideModel slide) {
view.reset();
if (slide.hasImage()) {
presentImageThumbnail(view, slide.getImage());
} else if (slide.hasVideo()) {
presentVideoThumbnail(view, slide.getVideo());
} else if (slide.hasAudio()) {
presentAudioThumbnail(view, slide.getAudio());
}
}
private ItemLoadedCallback<ImageLoaded> mImageLoadedCallback =
new ItemLoadedCallback<ImageLoaded>() {
public void onItemLoaded(ImageLoaded imageLoaded, Throwable exception) {
if (exception == null) {
if (mItemLoadedFuture != null) {
synchronized(mItemLoadedFuture) {
mItemLoadedFuture.setIsDone(true);
}
}
if (mOnLoadedCallback != null) {
mOnLoadedCallback.onItemLoaded(imageLoaded, exception);
} else {
// Right now we're only handling image and video loaded callbacks.
SlideModel slide = ((SlideshowModel) mModel).get(0);
if (slide != null) {
if (slide.hasVideo() && imageLoaded.mIsVideo) {
((SlideViewInterface)mView).setVideoThumbnail(null,
imageLoaded.mBitmap);
} else if (slide.hasImage() && !imageLoaded.mIsVideo) {
((SlideViewInterface)mView).setImage(null, imageLoaded.mBitmap);
}
}
}
}
}
};
private void presentVideoThumbnail(SlideViewInterface view, VideoModel video) {
mItemLoadedFuture = video.loadThumbnailBitmap(mImageLoadedCallback);
}
private void presentImageThumbnail(SlideViewInterface view, ImageModel image) {
mItemLoadedFuture = image.loadThumbnailBitmap(mImageLoadedCallback);
}
protected void presentAudioThumbnail(SlideViewInterface view, AudioModel audio) {
view.setAudio(audio.getUri(), audio.getSrc(), audio.getExtras());
}
public void onModelChanged(Model model, boolean dataChanged) {
// TODO Auto-generated method stub
}
public void cancelBackgroundLoading() {
// Currently we only support background loading of thumbnails. If we extend background
// loading to other media types, we should add a cancelLoading API to Model.
SlideModel slide = ((SlideshowModel) mModel).get(0);
if (slide != null && slide.hasImage()) {
slide.getImage().cancelThumbnailLoading();
}
}
}
| {
"content_hash": "a9774234aa0fa912087ef691cb9c5398",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 94,
"avg_line_length": 38.323232323232325,
"alnum_prop": 0.6304691618344754,
"repo_name": "bmaupin/android-sms-plus",
"id": "45b10c666aca72b0cdbc4fc334b563ef46a30243",
"size": "4448",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/com/android/mms/ui/MmsThumbnailPresenter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2034778"
},
{
"name": "Makefile",
"bytes": "5812"
},
{
"name": "XML",
"bytes": "109591"
}
],
"symlink_target": ""
} |
package org.apache.flink.table.runtime.operators.deduplicate;
import org.apache.flink.api.common.typeinfo.Types;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.table.data.RowData;
import org.apache.flink.util.Collector;
import javax.annotation.Nullable;
import java.util.Map;
import static org.apache.flink.table.runtime.operators.deduplicate.DeduplicateFunctionHelper.processFirstRowOnProcTime;
/**
* This function is used to get the first row for every key partition in miniBatch mode.
*
* <p>The state stores a boolean flag to indicate whether key appears before as an optimization.
*/
public class ProcTimeMiniBatchDeduplicateKeepFirstRowFunction
extends MiniBatchDeduplicateFunctionBase<Boolean, RowData, RowData, RowData, RowData> {
private static final long serialVersionUID = -7994602893547654994L;
private final TypeSerializer<RowData> serializer;
public ProcTimeMiniBatchDeduplicateKeepFirstRowFunction(
TypeSerializer<RowData> serializer,
long stateRetentionTime) {
super(Types.BOOLEAN, stateRetentionTime);
this.serializer = serializer;
}
@Override
public RowData addInput(@Nullable RowData value, RowData input) {
if (value == null) {
// put the input into buffer
return serializer.copy(input);
} else {
// the input is not first row, ignore it
return value;
}
}
@Override
public void finishBundle(
Map<RowData, RowData> buffer, Collector<RowData> out) throws Exception {
for (Map.Entry<RowData, RowData> entry : buffer.entrySet()) {
RowData currentKey = entry.getKey();
RowData currentRow = entry.getValue();
ctx.setCurrentKey(currentKey);
processFirstRowOnProcTime(currentRow, state, out);
}
}
}
| {
"content_hash": "62be9a96c4a497a74fadf8e52b6e6579",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 119,
"avg_line_length": 31.327272727272728,
"alnum_prop": 0.7748113755078352,
"repo_name": "greghogan/flink",
"id": "eb2d73dd3600206dbc35bc423feafc3e5bb8b1a9",
"size": "2528",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/operators/deduplicate/ProcTimeMiniBatchDeduplicateKeepFirstRowFunction.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4588"
},
{
"name": "CSS",
"bytes": "58146"
},
{
"name": "Clojure",
"bytes": "93329"
},
{
"name": "Dockerfile",
"bytes": "12142"
},
{
"name": "FreeMarker",
"bytes": "25294"
},
{
"name": "HTML",
"bytes": "108358"
},
{
"name": "Java",
"bytes": "52179549"
},
{
"name": "JavaScript",
"bytes": "1829"
},
{
"name": "Makefile",
"bytes": "5134"
},
{
"name": "Python",
"bytes": "1015013"
},
{
"name": "Scala",
"bytes": "13763923"
},
{
"name": "Shell",
"bytes": "513745"
},
{
"name": "TSQL",
"bytes": "123113"
},
{
"name": "TypeScript",
"bytes": "246974"
}
],
"symlink_target": ""
} |
import java.util.Random;
public class ScoreBoardSLL {
public static void main (String[] args) {
Random random = new Random();
// Create 20 scores and store them in an array
System.out.println("Here is a list of 20 scores:");
SingleLinkedList scores = new SingleLinkedList();
for (int count = 0; count < 20; count++) {
int score = random.nextInt(100) + 1;
System.out.println("Score " + (count + 1) + ": " + score);
scores.addNode(new Score(score));
}
System.out.println("\nThe top 10 scores are:");
scores.printLinkedList();
}
}
| {
"content_hash": "449085742fe06d6723bd53b9839dd7fe",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 70,
"avg_line_length": 30.523809523809526,
"alnum_prop": 0.5772230889235569,
"repo_name": "mattboy9921/ScoreBoardSLL",
"id": "23fd99b770881245100b309b65054c8dd7751648",
"size": "641",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/ScoreBoardSLL.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "3021"
}
],
"symlink_target": ""
} |
#region MIT license
//
// MIT license
//
// Copyright (c) 2007-2008 Jiri Moudry, Pascal Craponne
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#endregion
using System.Collections.Generic;
using System.Data;
namespace DbLinq.Vendor.Implementation
{
partial class SchemaLoader
{
protected abstract IList<IDataTableColumn> ReadColumns(IDbConnection connectionString, string databaseName);
}
}
| {
"content_hash": "f4efa6cb905a8b1a1e9317df5f22dd72",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 116,
"avg_line_length": 41.4,
"alnum_prop": 0.7605244996549344,
"repo_name": "lytico/dblinq2007",
"id": "27c8e567f00aa4854d9ae475aeeadc1c1f058b59",
"size": "1451",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/DbLinq/Vendor/Implementation/SchemaLoader.Columns.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "3937552"
},
{
"name": "Shell",
"bytes": "568"
},
{
"name": "Visual Basic",
"bytes": "7313"
}
],
"symlink_target": ""
} |
package org.axonframework.serializer;
/**
* Abstract implementation of the ContentTypeConverter for convenience purposes. It implements the {@link
* #convert(org.axonframework.serializer.SerializedObject)} method, based on information available through the other
* methods.
*
* @param <S> The source data type representing the serialized object
* @param <T> The target data type representing the serialized object
* @author Allard Buijze
* @since 2.0
*/
public abstract class AbstractContentTypeConverter<S, T> implements ContentTypeConverter<S, T> {
@Override
public SerializedObject<T> convert(SerializedObject<S> original) {
return new SimpleSerializedObject<T>(convert(original.getData()), targetType(), original.getType());
}
}
| {
"content_hash": "37edb913d3514e2719d38669379cd4b7",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 116,
"avg_line_length": 36.476190476190474,
"alnum_prop": 0.758485639686684,
"repo_name": "fpape/AxonFramework",
"id": "ba2b8652ee257623cde113a74f9fe0d9e31ee072",
"size": "1373",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "core/src/main/java/org/axonframework/serializer/AbstractContentTypeConverter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "4598074"
}
],
"symlink_target": ""
} |
.pace {
-webkit-pointer-events: none;
pointer-events: none;
z-index: 2000;
position: fixed;
height: 90px;
width: 90px;
margin: auto;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.pace.pace-inactive .pace-activity {
display: none;
}
.pace .pace-activity {
position: fixed;
z-index: 2000;
display: block;
position: absolute;
left: -30px;
top: -30px;
height: 90px;
width: 90px;
display: block;
border-width: 30px;
border-style: double;
border-color: #A90329 transparent transparent;
border-radius: 50%;
-webkit-animation: spin 1s linear infinite;
-moz-animation: spin 1s linear infinite;
-o-animation: spin 1s linear infinite;
animation: spin 1s linear infinite;
}
.pace .pace-activity:before {
content: ' ';
position: absolute;
top: 10px;
left: 10px;
height: 50px;
width: 50px;
display: block;
border-width: 10px;
border-style: solid;
border-color: #A90329 transparent transparent;
border-radius: 50%;
}
@-webkit-keyframes spin {
100% { -webkit-transform: rotate(359deg); }
}
@-moz-keyframes spin {
100% { -moz-transform: rotate(359deg); }
}
@-o-keyframes spin {
100% { -moz-transform: rotate(359deg); }
}
@keyframes spin {
100% { transform: rotate(359deg); }
} | {
"content_hash": "dded08980b93467e7c35777a6de589d0",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 48,
"avg_line_length": 18.12857142857143,
"alnum_prop": 0.6509062253743105,
"repo_name": "Sotera/graphene",
"id": "0148b2c29039dba2d7b506f12f00a5e68d4b2200",
"size": "1269",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "graphene-parent/graphene-web/src/main/webapp/core/css/pace-radar.css",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ActionScript",
"bytes": "15982"
},
{
"name": "Batchfile",
"bytes": "2998"
},
{
"name": "CSS",
"bytes": "1638268"
},
{
"name": "HTML",
"bytes": "31729"
},
{
"name": "Java",
"bytes": "3415980"
},
{
"name": "JavaScript",
"bytes": "5029687"
},
{
"name": "Shell",
"bytes": "96"
}
],
"symlink_target": ""
} |
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package org.andengine.extension.physics.box2d;
public final class R {
}
| {
"content_hash": "cd811cf6b42fbb0d40727c0701a10c37",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 52,
"avg_line_length": 25.7,
"alnum_prop": 0.7354085603112841,
"repo_name": "pedroroberto/PhysicsLab",
"id": "741e3f8ff48a5d667496fabdf5d27ed5939097a2",
"size": "257",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "andEnginePhysicsBox2DExtension/build/generated/source/r/androidTest/debug/org/andengine/extension/physics/box2d/R.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "108"
},
{
"name": "C",
"bytes": "45009"
},
{
"name": "C++",
"bytes": "535290"
},
{
"name": "Java",
"bytes": "2933058"
},
{
"name": "Makefile",
"bytes": "6067"
},
{
"name": "Shell",
"bytes": "838"
}
],
"symlink_target": ""
} |
<?php
namespace com\indigloo\sc\html {
use \com\indigloo\Template as Template;
use \com\indigloo\Util as Util ;
use \com\indigloo\Url as Url ;
use \com\indigloo\sc\util\PseudoId ;
use \com\indigloo\sc\ui\Constants as UIConstants;
use \com\indigloo\sc\auth\Login as Login ;
class SocialGraph {
private static function getTemplate($source,$typeOfUI,$hasImage) {
$prefix = "/fragments/graph" ;
settype($source, "integer");
switch($source) {
case 1 :
$prefix = $prefix."/follower/" ;
break ;
case 2 :
$prefix = $prefix."/following/" ;
break ;
default :
trigger_error("unknown social graph source", E_USER_ERROR);
}
$tmpl = ($hasImage) ? "image.tmpl" : "noimage.tmpl";
$path = $prefix.$typeOfUI."/".$tmpl ;
return $path ;
}
static function getPubWidget($row) {
$view = new \stdClass;
$template = NULL ;
$userId = $row["login_id"];
$pubUserId = PseudoId::encode($userId);
$pubUserUrl = Url::base()."/pub/user/".$pubUserId ;
$view->pubUserUrl = $pubUserUrl ;
$view->name = $row["name"];
$view->srcImage = $row["photo_url"];
$view->hasImage = !Util::tryEmpty($view->srcImage);
// whoever is browsing this widget will become the follower
// and follow the user of this widget
$loginIdInSession = Login::tryLoginIdInSession();
$view->followerId = (empty($loginIdInSession)) ? "{loginId}" : $loginIdInSession ;
$view->followingId = $userId ;
//template depends on image availabality
$template = ($view->hasImage) ? "/fragments/graph/pub/widget/image.tmpl" :
"/fragments/graph/pub/widget/noimage.tmpl" ;
$html = Template::render($template,$view);
return $html ;
}
/*
* @param $source kind of row - follower/following
* 1 - means follower , 2 - means following
*
*/
static function getWidget($loginId,$row,$source) {
$view = self::createView($loginId,$row);
$template = NULL;
$hasImage = !Util::tryEmpty($view->srcImage);
$template = self::getTemplate($source, "widget", $hasImage) ;
$html = Template::render($template,$view);
return $html ;
}
static function createView($loginId, $row) {
$view = new \stdClass;
$userId = $row["login_id"];
$pubUserId = PseudoId::encode($userId);
$pubUserUrl = Url::base()."/pub/user/".$pubUserId ;
$view->pubUserUrl = $pubUserUrl ;
$view->name = $row["name"];
$view->srcImage = $row["photo_url"];
// This is for follow action on my follower's page.
// for follow action :- I will start following
// so followerId - is me
// for unfollow action :- I was following the user
// so again, followerId is - me
$view->followingId = $userId ;
$view->followerId = $loginId ;
return $view ;
}
static function getTile($loginId,$row,$source) {
$view = self::createView($loginId,$row);
$template = NULL;
$hasImage = Util::tryEmpty($view->srcImage);
$template = self::getTemplate($source, "tile", $hasImage) ;
$html = Template::render($template,$view);
return $html ;
}
static function getDashWrapper($content,$options=NULL) {
$defaults = array(
"size" => 1,
"title" => "default",
"link" => "default");
$settings = Util::getSettings($options,$defaults);
$size = $settings["size"];
settype($size,"integer");
if($size == 0 ) {
return "" ;
}
$html = NULL ;
$view = new \stdClass;
$view->content = $content ;
$view->title = $settings["title"];
$view->link = $settings["link"];
$template = "/fragments/graph/dash/wrapper.tmpl" ;
$html = Template::render($template,$view);
return $html ;
}
static function getTable($loginId,$rows,$source,$options) {
$html = NULL ;
$view = new \stdClass;
$defaults = array(
"ui" => "table",
"image" => false);
$settings = Util::getSettings($options,$defaults);
$records = array();
foreach($rows as $row){
$record = array();
$userId = $row['login_id'];
$pubUserId = PseudoId::encode($userId);
$pubUserUrl = "/pub/user/".$pubUserId ;
$record['pubUserUrl'] = $pubUserUrl ;
$record['name'] = $row['name'];
$record['followingId'] = $userId ;
$record['followerId']= $loginId ;
$record['hasImage'] = false ;
/*
if(!Util::tryEmpty($row["photo_url"])) {
$record['srcImage'] = $row["photo_url"];
$record['hasImage'] = true ;
}else {
$record['srcImage'] = UIConstants::PH2_PIC;
} */
$record['srcImage'] = UIConstants::PH3_PIC;
$records[] = $record;
}
$view->records = $records ;
settype($source,"integer");
$template = self::getTemplate($source,$settings["ui"],$settings["image"]);
$html = Template::render($template,$view);
return $html ;
}
}
}
?>
| {
"content_hash": "41f8ff3e6869ff16c1136cff436818f2",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 94,
"avg_line_length": 33.22043010752688,
"alnum_prop": 0.46852241463019906,
"repo_name": "rjha/sc",
"id": "6696846c5089a42dac7d8d945a1f5b537598177e",
"size": "6179",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/com/indigloo/sc/html/SocialGraph.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "232362"
},
{
"name": "JavaScript",
"bytes": "625295"
},
{
"name": "PHP",
"bytes": "1061901"
},
{
"name": "Perl",
"bytes": "362179"
},
{
"name": "Shell",
"bytes": "69656"
},
{
"name": "VimL",
"bytes": "67409"
}
],
"symlink_target": ""
} |
'use strict';
// MODULES //
var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
var smskmin = require( './smskmin.native.js' );
var ndarray = require( './ndarray.native.js' );
// MAIN //
setReadOnly( smskmin, 'ndarray', ndarray );
// EXPORTS //
module.exports = smskmin;
| {
"content_hash": "2968815042b7e2d53a11c6244dccfbb4",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 85,
"avg_line_length": 16.57894736842105,
"alnum_prop": 0.6666666666666666,
"repo_name": "stdlib-js/stdlib",
"id": "0b844317c214e356828b6120e92f06b4d755b57e",
"size": "931",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "lib/node_modules/@stdlib/stats/base/smskmin/lib/native.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "21739"
},
{
"name": "C",
"bytes": "15336495"
},
{
"name": "C++",
"bytes": "1349482"
},
{
"name": "CSS",
"bytes": "58039"
},
{
"name": "Fortran",
"bytes": "198059"
},
{
"name": "HTML",
"bytes": "56181"
},
{
"name": "Handlebars",
"bytes": "16114"
},
{
"name": "JavaScript",
"bytes": "85975525"
},
{
"name": "Julia",
"bytes": "1508654"
},
{
"name": "Makefile",
"bytes": "4806816"
},
{
"name": "Python",
"bytes": "3343697"
},
{
"name": "R",
"bytes": "576612"
},
{
"name": "Shell",
"bytes": "559315"
},
{
"name": "TypeScript",
"bytes": "19309407"
},
{
"name": "WebAssembly",
"bytes": "5980"
}
],
"symlink_target": ""
} |
FROM gradle:5.4.1-jdk11
USER root
WORKDIR /http4k
COPY build.gradle build.gradle
COPY settings.gradle settings.gradle
COPY apache apache
COPY core core
COPY jetty jetty
COPY ktorcio ktorcio
COPY netty netty
COPY undertow undertow
RUN gradle --quiet build jetty:shadowJar
CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-XX:+AlwaysPreTouch", "-jar", "jetty/build/libs/http4k-jetty-benchmark.jar"]
| {
"content_hash": "2c852c46491a9a808d718db24b9455f8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 162,
"avg_line_length": 33.38461538461539,
"alnum_prop": 0.7672811059907834,
"repo_name": "zloster/FrameworkBenchmarks",
"id": "25292e9e3227f4f37290fb05c65e09d02057be1a",
"size": "434",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "frameworks/Kotlin/http4k/http4k.dockerfile",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "104"
},
{
"name": "Batchfile",
"bytes": "1125"
},
{
"name": "C",
"bytes": "243674"
},
{
"name": "C#",
"bytes": "484837"
},
{
"name": "C++",
"bytes": "197934"
},
{
"name": "CMake",
"bytes": "6315"
},
{
"name": "CSS",
"bytes": "2035"
},
{
"name": "Clojure",
"bytes": "80972"
},
{
"name": "Common Lisp",
"bytes": "22120"
},
{
"name": "Crystal",
"bytes": "27193"
},
{
"name": "D",
"bytes": "203825"
},
{
"name": "Dart",
"bytes": "52130"
},
{
"name": "Dockerfile",
"bytes": "339472"
},
{
"name": "Dylan",
"bytes": "868"
},
{
"name": "Elixir",
"bytes": "14485"
},
{
"name": "Erlang",
"bytes": "41222"
},
{
"name": "F#",
"bytes": "91061"
},
{
"name": "Go",
"bytes": "161938"
},
{
"name": "Groovy",
"bytes": "21834"
},
{
"name": "HTML",
"bytes": "142024"
},
{
"name": "Hack",
"bytes": "2261"
},
{
"name": "Haskell",
"bytes": "55691"
},
{
"name": "Java",
"bytes": "682207"
},
{
"name": "JavaScript",
"bytes": "175373"
},
{
"name": "Kotlin",
"bytes": "57654"
},
{
"name": "Lua",
"bytes": "14508"
},
{
"name": "Makefile",
"bytes": "4991"
},
{
"name": "Meson",
"bytes": "846"
},
{
"name": "MoonScript",
"bytes": "2396"
},
{
"name": "Nim",
"bytes": "1288"
},
{
"name": "PHP",
"bytes": "533948"
},
{
"name": "PLpgSQL",
"bytes": "3446"
},
{
"name": "Perl",
"bytes": "15376"
},
{
"name": "Python",
"bytes": "359517"
},
{
"name": "QMake",
"bytes": "2301"
},
{
"name": "Racket",
"bytes": "5069"
},
{
"name": "Ruby",
"bytes": "89692"
},
{
"name": "Rust",
"bytes": "89001"
},
{
"name": "Scala",
"bytes": "101770"
},
{
"name": "Shell",
"bytes": "96116"
},
{
"name": "Smarty",
"bytes": "744"
},
{
"name": "Swift",
"bytes": "101361"
},
{
"name": "TypeScript",
"bytes": "15109"
},
{
"name": "UrWeb",
"bytes": "4453"
},
{
"name": "Vala",
"bytes": "1579"
},
{
"name": "Visual Basic",
"bytes": "27087"
},
{
"name": "Volt",
"bytes": "511"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
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.
-->
<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" PolicyId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIC005:policy" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-overrides" Version="1.0" xsi:schemaLocation="urn:oasis:names:tc:xacml:3.0:policy:schema:os access_control-xacml-2.0-policy-schema-os.xsd">
<Description>
Policy for Conformance Test IIC005.
</Description>
<Target/>
<Rule Effect="Permit" RuleId="urn:oasis:names:tc:xacml:2.0:conformance-test:IIC005:rule">
<Description>
A subject who is the author of Bart Simpson's medical
record may read Bart Simpson's medical record.
</Description>
<Condition>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
<AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id" Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
</Apply>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
<AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:2.0:conformance-test:author" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
</Apply>
</Apply>
</Condition>
</Rule>
</Policy>
| {
"content_hash": "460d21439e3b97237a0b3260a8426c26",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 413,
"avg_line_length": 60.5609756097561,
"alnum_prop": 0.7172774869109948,
"repo_name": "apache/incubator-openaz",
"id": "4321c8dc4dd761106c1d8286a6635f10adc1c014",
"size": "2483",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "openaz-xacml-test/src/test/resources/testsets/conformance/xacml3.0-ct-v.0.4/IIC005Policy.xml",
"mode": "33261",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
/**
* Autogenerated by Thrift Compiler (0.14.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package org.apache.hadoop.hive.metastore.api;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.14.1)")
@org.apache.hadoop.classification.InterfaceAudience.Public @org.apache.hadoop.classification.InterfaceStability.Stable public class ShowCompactResponseElement implements org.apache.thrift.TBase<ShowCompactResponseElement, ShowCompactResponseElement._Fields>, java.io.Serializable, Cloneable, Comparable<ShowCompactResponseElement> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ShowCompactResponseElement");
private static final org.apache.thrift.protocol.TField DBNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("dbname", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField TABLENAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tablename", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField PARTITIONNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("partitionname", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)4);
private static final org.apache.thrift.protocol.TField STATE_FIELD_DESC = new org.apache.thrift.protocol.TField("state", org.apache.thrift.protocol.TType.STRING, (short)5);
private static final org.apache.thrift.protocol.TField WORKERID_FIELD_DESC = new org.apache.thrift.protocol.TField("workerid", org.apache.thrift.protocol.TType.STRING, (short)6);
private static final org.apache.thrift.protocol.TField START_FIELD_DESC = new org.apache.thrift.protocol.TField("start", org.apache.thrift.protocol.TType.I64, (short)7);
private static final org.apache.thrift.protocol.TField RUN_AS_FIELD_DESC = new org.apache.thrift.protocol.TField("runAs", org.apache.thrift.protocol.TType.STRING, (short)8);
private static final org.apache.thrift.protocol.TField HIGHTEST_TXN_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("hightestTxnId", org.apache.thrift.protocol.TType.I64, (short)9);
private static final org.apache.thrift.protocol.TField META_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("metaInfo", org.apache.thrift.protocol.TType.STRING, (short)10);
private static final org.apache.thrift.protocol.TField END_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("endTime", org.apache.thrift.protocol.TType.I64, (short)11);
private static final org.apache.thrift.protocol.TField HADOOP_JOB_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("hadoopJobId", org.apache.thrift.protocol.TType.STRING, (short)12);
private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.I64, (short)13);
private static final org.apache.thrift.protocol.TField ERROR_MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("errorMessage", org.apache.thrift.protocol.TType.STRING, (short)14);
private static final org.apache.thrift.protocol.TField ENQUEUE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("enqueueTime", org.apache.thrift.protocol.TType.I64, (short)15);
private static final org.apache.thrift.protocol.TField WORKER_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("workerVersion", org.apache.thrift.protocol.TType.STRING, (short)16);
private static final org.apache.thrift.protocol.TField INITIATOR_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("initiatorId", org.apache.thrift.protocol.TType.STRING, (short)17);
private static final org.apache.thrift.protocol.TField INITIATOR_VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("initiatorVersion", org.apache.thrift.protocol.TType.STRING, (short)18);
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new ShowCompactResponseElementStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new ShowCompactResponseElementTupleSchemeFactory();
private @org.apache.thrift.annotation.Nullable java.lang.String dbname; // required
private @org.apache.thrift.annotation.Nullable java.lang.String tablename; // required
private @org.apache.thrift.annotation.Nullable java.lang.String partitionname; // optional
private @org.apache.thrift.annotation.Nullable CompactionType type; // required
private @org.apache.thrift.annotation.Nullable java.lang.String state; // required
private @org.apache.thrift.annotation.Nullable java.lang.String workerid; // optional
private long start; // optional
private @org.apache.thrift.annotation.Nullable java.lang.String runAs; // optional
private long hightestTxnId; // optional
private @org.apache.thrift.annotation.Nullable java.lang.String metaInfo; // optional
private long endTime; // optional
private @org.apache.thrift.annotation.Nullable java.lang.String hadoopJobId; // optional
private long id; // optional
private @org.apache.thrift.annotation.Nullable java.lang.String errorMessage; // optional
private long enqueueTime; // optional
private @org.apache.thrift.annotation.Nullable java.lang.String workerVersion; // optional
private @org.apache.thrift.annotation.Nullable java.lang.String initiatorId; // optional
private @org.apache.thrift.annotation.Nullable java.lang.String initiatorVersion; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
DBNAME((short)1, "dbname"),
TABLENAME((short)2, "tablename"),
PARTITIONNAME((short)3, "partitionname"),
/**
*
* @see CompactionType
*/
TYPE((short)4, "type"),
STATE((short)5, "state"),
WORKERID((short)6, "workerid"),
START((short)7, "start"),
RUN_AS((short)8, "runAs"),
HIGHTEST_TXN_ID((short)9, "hightestTxnId"),
META_INFO((short)10, "metaInfo"),
END_TIME((short)11, "endTime"),
HADOOP_JOB_ID((short)12, "hadoopJobId"),
ID((short)13, "id"),
ERROR_MESSAGE((short)14, "errorMessage"),
ENQUEUE_TIME((short)15, "enqueueTime"),
WORKER_VERSION((short)16, "workerVersion"),
INITIATOR_ID((short)17, "initiatorId"),
INITIATOR_VERSION((short)18, "initiatorVersion");
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
static {
for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
@org.apache.thrift.annotation.Nullable
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // DBNAME
return DBNAME;
case 2: // TABLENAME
return TABLENAME;
case 3: // PARTITIONNAME
return PARTITIONNAME;
case 4: // TYPE
return TYPE;
case 5: // STATE
return STATE;
case 6: // WORKERID
return WORKERID;
case 7: // START
return START;
case 8: // RUN_AS
return RUN_AS;
case 9: // HIGHTEST_TXN_ID
return HIGHTEST_TXN_ID;
case 10: // META_INFO
return META_INFO;
case 11: // END_TIME
return END_TIME;
case 12: // HADOOP_JOB_ID
return HADOOP_JOB_ID;
case 13: // ID
return ID;
case 14: // ERROR_MESSAGE
return ERROR_MESSAGE;
case 15: // ENQUEUE_TIME
return ENQUEUE_TIME;
case 16: // WORKER_VERSION
return WORKER_VERSION;
case 17: // INITIATOR_ID
return INITIATOR_ID;
case 18: // INITIATOR_VERSION
return INITIATOR_VERSION;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
@org.apache.thrift.annotation.Nullable
public static _Fields findByName(java.lang.String name) {
return byName.get(name);
}
private final short _thriftId;
private final java.lang.String _fieldName;
_Fields(short thriftId, java.lang.String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public java.lang.String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __START_ISSET_ID = 0;
private static final int __HIGHTESTTXNID_ISSET_ID = 1;
private static final int __ENDTIME_ISSET_ID = 2;
private static final int __ID_ISSET_ID = 3;
private static final int __ENQUEUETIME_ISSET_ID = 4;
private byte __isset_bitfield = 0;
private static final _Fields optionals[] = {_Fields.PARTITIONNAME,_Fields.WORKERID,_Fields.START,_Fields.RUN_AS,_Fields.HIGHTEST_TXN_ID,_Fields.META_INFO,_Fields.END_TIME,_Fields.HADOOP_JOB_ID,_Fields.ID,_Fields.ERROR_MESSAGE,_Fields.ENQUEUE_TIME,_Fields.WORKER_VERSION,_Fields.INITIATOR_ID,_Fields.INITIATOR_VERSION};
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.DBNAME, new org.apache.thrift.meta_data.FieldMetaData("dbname", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.TABLENAME, new org.apache.thrift.meta_data.FieldMetaData("tablename", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.PARTITIONNAME, new org.apache.thrift.meta_data.FieldMetaData("partitionname", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, CompactionType.class)));
tmpMap.put(_Fields.STATE, new org.apache.thrift.meta_data.FieldMetaData("state", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.WORKERID, new org.apache.thrift.meta_data.FieldMetaData("workerid", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.START, new org.apache.thrift.meta_data.FieldMetaData("start", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.RUN_AS, new org.apache.thrift.meta_data.FieldMetaData("runAs", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.HIGHTEST_TXN_ID, new org.apache.thrift.meta_data.FieldMetaData("hightestTxnId", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.META_INFO, new org.apache.thrift.meta_data.FieldMetaData("metaInfo", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.END_TIME, new org.apache.thrift.meta_data.FieldMetaData("endTime", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.HADOOP_JOB_ID, new org.apache.thrift.meta_data.FieldMetaData("hadoopJobId", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.ERROR_MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("errorMessage", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.ENQUEUE_TIME, new org.apache.thrift.meta_data.FieldMetaData("enqueueTime", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.WORKER_VERSION, new org.apache.thrift.meta_data.FieldMetaData("workerVersion", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.INITIATOR_ID, new org.apache.thrift.meta_data.FieldMetaData("initiatorId", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.INITIATOR_VERSION, new org.apache.thrift.meta_data.FieldMetaData("initiatorVersion", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ShowCompactResponseElement.class, metaDataMap);
}
public ShowCompactResponseElement() {
this.hadoopJobId = "None";
}
public ShowCompactResponseElement(
java.lang.String dbname,
java.lang.String tablename,
CompactionType type,
java.lang.String state)
{
this();
this.dbname = dbname;
this.tablename = tablename;
this.type = type;
this.state = state;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public ShowCompactResponseElement(ShowCompactResponseElement other) {
__isset_bitfield = other.__isset_bitfield;
if (other.isSetDbname()) {
this.dbname = other.dbname;
}
if (other.isSetTablename()) {
this.tablename = other.tablename;
}
if (other.isSetPartitionname()) {
this.partitionname = other.partitionname;
}
if (other.isSetType()) {
this.type = other.type;
}
if (other.isSetState()) {
this.state = other.state;
}
if (other.isSetWorkerid()) {
this.workerid = other.workerid;
}
this.start = other.start;
if (other.isSetRunAs()) {
this.runAs = other.runAs;
}
this.hightestTxnId = other.hightestTxnId;
if (other.isSetMetaInfo()) {
this.metaInfo = other.metaInfo;
}
this.endTime = other.endTime;
if (other.isSetHadoopJobId()) {
this.hadoopJobId = other.hadoopJobId;
}
this.id = other.id;
if (other.isSetErrorMessage()) {
this.errorMessage = other.errorMessage;
}
this.enqueueTime = other.enqueueTime;
if (other.isSetWorkerVersion()) {
this.workerVersion = other.workerVersion;
}
if (other.isSetInitiatorId()) {
this.initiatorId = other.initiatorId;
}
if (other.isSetInitiatorVersion()) {
this.initiatorVersion = other.initiatorVersion;
}
}
public ShowCompactResponseElement deepCopy() {
return new ShowCompactResponseElement(this);
}
@Override
public void clear() {
this.dbname = null;
this.tablename = null;
this.partitionname = null;
this.type = null;
this.state = null;
this.workerid = null;
setStartIsSet(false);
this.start = 0;
this.runAs = null;
setHightestTxnIdIsSet(false);
this.hightestTxnId = 0;
this.metaInfo = null;
setEndTimeIsSet(false);
this.endTime = 0;
this.hadoopJobId = "None";
setIdIsSet(false);
this.id = 0;
this.errorMessage = null;
setEnqueueTimeIsSet(false);
this.enqueueTime = 0;
this.workerVersion = null;
this.initiatorId = null;
this.initiatorVersion = null;
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getDbname() {
return this.dbname;
}
public void setDbname(@org.apache.thrift.annotation.Nullable java.lang.String dbname) {
this.dbname = dbname;
}
public void unsetDbname() {
this.dbname = null;
}
/** Returns true if field dbname is set (has been assigned a value) and false otherwise */
public boolean isSetDbname() {
return this.dbname != null;
}
public void setDbnameIsSet(boolean value) {
if (!value) {
this.dbname = null;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getTablename() {
return this.tablename;
}
public void setTablename(@org.apache.thrift.annotation.Nullable java.lang.String tablename) {
this.tablename = tablename;
}
public void unsetTablename() {
this.tablename = null;
}
/** Returns true if field tablename is set (has been assigned a value) and false otherwise */
public boolean isSetTablename() {
return this.tablename != null;
}
public void setTablenameIsSet(boolean value) {
if (!value) {
this.tablename = null;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getPartitionname() {
return this.partitionname;
}
public void setPartitionname(@org.apache.thrift.annotation.Nullable java.lang.String partitionname) {
this.partitionname = partitionname;
}
public void unsetPartitionname() {
this.partitionname = null;
}
/** Returns true if field partitionname is set (has been assigned a value) and false otherwise */
public boolean isSetPartitionname() {
return this.partitionname != null;
}
public void setPartitionnameIsSet(boolean value) {
if (!value) {
this.partitionname = null;
}
}
/**
*
* @see CompactionType
*/
@org.apache.thrift.annotation.Nullable
public CompactionType getType() {
return this.type;
}
/**
*
* @see CompactionType
*/
public void setType(@org.apache.thrift.annotation.Nullable CompactionType type) {
this.type = type;
}
public void unsetType() {
this.type = null;
}
/** Returns true if field type is set (has been assigned a value) and false otherwise */
public boolean isSetType() {
return this.type != null;
}
public void setTypeIsSet(boolean value) {
if (!value) {
this.type = null;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getState() {
return this.state;
}
public void setState(@org.apache.thrift.annotation.Nullable java.lang.String state) {
this.state = state;
}
public void unsetState() {
this.state = null;
}
/** Returns true if field state is set (has been assigned a value) and false otherwise */
public boolean isSetState() {
return this.state != null;
}
public void setStateIsSet(boolean value) {
if (!value) {
this.state = null;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getWorkerid() {
return this.workerid;
}
public void setWorkerid(@org.apache.thrift.annotation.Nullable java.lang.String workerid) {
this.workerid = workerid;
}
public void unsetWorkerid() {
this.workerid = null;
}
/** Returns true if field workerid is set (has been assigned a value) and false otherwise */
public boolean isSetWorkerid() {
return this.workerid != null;
}
public void setWorkeridIsSet(boolean value) {
if (!value) {
this.workerid = null;
}
}
public long getStart() {
return this.start;
}
public void setStart(long start) {
this.start = start;
setStartIsSet(true);
}
public void unsetStart() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __START_ISSET_ID);
}
/** Returns true if field start is set (has been assigned a value) and false otherwise */
public boolean isSetStart() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __START_ISSET_ID);
}
public void setStartIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __START_ISSET_ID, value);
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getRunAs() {
return this.runAs;
}
public void setRunAs(@org.apache.thrift.annotation.Nullable java.lang.String runAs) {
this.runAs = runAs;
}
public void unsetRunAs() {
this.runAs = null;
}
/** Returns true if field runAs is set (has been assigned a value) and false otherwise */
public boolean isSetRunAs() {
return this.runAs != null;
}
public void setRunAsIsSet(boolean value) {
if (!value) {
this.runAs = null;
}
}
public long getHightestTxnId() {
return this.hightestTxnId;
}
public void setHightestTxnId(long hightestTxnId) {
this.hightestTxnId = hightestTxnId;
setHightestTxnIdIsSet(true);
}
public void unsetHightestTxnId() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __HIGHTESTTXNID_ISSET_ID);
}
/** Returns true if field hightestTxnId is set (has been assigned a value) and false otherwise */
public boolean isSetHightestTxnId() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __HIGHTESTTXNID_ISSET_ID);
}
public void setHightestTxnIdIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __HIGHTESTTXNID_ISSET_ID, value);
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getMetaInfo() {
return this.metaInfo;
}
public void setMetaInfo(@org.apache.thrift.annotation.Nullable java.lang.String metaInfo) {
this.metaInfo = metaInfo;
}
public void unsetMetaInfo() {
this.metaInfo = null;
}
/** Returns true if field metaInfo is set (has been assigned a value) and false otherwise */
public boolean isSetMetaInfo() {
return this.metaInfo != null;
}
public void setMetaInfoIsSet(boolean value) {
if (!value) {
this.metaInfo = null;
}
}
public long getEndTime() {
return this.endTime;
}
public void setEndTime(long endTime) {
this.endTime = endTime;
setEndTimeIsSet(true);
}
public void unsetEndTime() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __ENDTIME_ISSET_ID);
}
/** Returns true if field endTime is set (has been assigned a value) and false otherwise */
public boolean isSetEndTime() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __ENDTIME_ISSET_ID);
}
public void setEndTimeIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __ENDTIME_ISSET_ID, value);
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getHadoopJobId() {
return this.hadoopJobId;
}
public void setHadoopJobId(@org.apache.thrift.annotation.Nullable java.lang.String hadoopJobId) {
this.hadoopJobId = hadoopJobId;
}
public void unsetHadoopJobId() {
this.hadoopJobId = null;
}
/** Returns true if field hadoopJobId is set (has been assigned a value) and false otherwise */
public boolean isSetHadoopJobId() {
return this.hadoopJobId != null;
}
public void setHadoopJobIdIsSet(boolean value) {
if (!value) {
this.hadoopJobId = null;
}
}
public long getId() {
return this.id;
}
public void setId(long id) {
this.id = id;
setIdIsSet(true);
}
public void unsetId() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID);
}
/** Returns true if field id is set (has been assigned a value) and false otherwise */
public boolean isSetId() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID);
}
public void setIdIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value);
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getErrorMessage() {
return this.errorMessage;
}
public void setErrorMessage(@org.apache.thrift.annotation.Nullable java.lang.String errorMessage) {
this.errorMessage = errorMessage;
}
public void unsetErrorMessage() {
this.errorMessage = null;
}
/** Returns true if field errorMessage is set (has been assigned a value) and false otherwise */
public boolean isSetErrorMessage() {
return this.errorMessage != null;
}
public void setErrorMessageIsSet(boolean value) {
if (!value) {
this.errorMessage = null;
}
}
public long getEnqueueTime() {
return this.enqueueTime;
}
public void setEnqueueTime(long enqueueTime) {
this.enqueueTime = enqueueTime;
setEnqueueTimeIsSet(true);
}
public void unsetEnqueueTime() {
__isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __ENQUEUETIME_ISSET_ID);
}
/** Returns true if field enqueueTime is set (has been assigned a value) and false otherwise */
public boolean isSetEnqueueTime() {
return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __ENQUEUETIME_ISSET_ID);
}
public void setEnqueueTimeIsSet(boolean value) {
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __ENQUEUETIME_ISSET_ID, value);
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getWorkerVersion() {
return this.workerVersion;
}
public void setWorkerVersion(@org.apache.thrift.annotation.Nullable java.lang.String workerVersion) {
this.workerVersion = workerVersion;
}
public void unsetWorkerVersion() {
this.workerVersion = null;
}
/** Returns true if field workerVersion is set (has been assigned a value) and false otherwise */
public boolean isSetWorkerVersion() {
return this.workerVersion != null;
}
public void setWorkerVersionIsSet(boolean value) {
if (!value) {
this.workerVersion = null;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getInitiatorId() {
return this.initiatorId;
}
public void setInitiatorId(@org.apache.thrift.annotation.Nullable java.lang.String initiatorId) {
this.initiatorId = initiatorId;
}
public void unsetInitiatorId() {
this.initiatorId = null;
}
/** Returns true if field initiatorId is set (has been assigned a value) and false otherwise */
public boolean isSetInitiatorId() {
return this.initiatorId != null;
}
public void setInitiatorIdIsSet(boolean value) {
if (!value) {
this.initiatorId = null;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.String getInitiatorVersion() {
return this.initiatorVersion;
}
public void setInitiatorVersion(@org.apache.thrift.annotation.Nullable java.lang.String initiatorVersion) {
this.initiatorVersion = initiatorVersion;
}
public void unsetInitiatorVersion() {
this.initiatorVersion = null;
}
/** Returns true if field initiatorVersion is set (has been assigned a value) and false otherwise */
public boolean isSetInitiatorVersion() {
return this.initiatorVersion != null;
}
public void setInitiatorVersionIsSet(boolean value) {
if (!value) {
this.initiatorVersion = null;
}
}
public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
switch (field) {
case DBNAME:
if (value == null) {
unsetDbname();
} else {
setDbname((java.lang.String)value);
}
break;
case TABLENAME:
if (value == null) {
unsetTablename();
} else {
setTablename((java.lang.String)value);
}
break;
case PARTITIONNAME:
if (value == null) {
unsetPartitionname();
} else {
setPartitionname((java.lang.String)value);
}
break;
case TYPE:
if (value == null) {
unsetType();
} else {
setType((CompactionType)value);
}
break;
case STATE:
if (value == null) {
unsetState();
} else {
setState((java.lang.String)value);
}
break;
case WORKERID:
if (value == null) {
unsetWorkerid();
} else {
setWorkerid((java.lang.String)value);
}
break;
case START:
if (value == null) {
unsetStart();
} else {
setStart((java.lang.Long)value);
}
break;
case RUN_AS:
if (value == null) {
unsetRunAs();
} else {
setRunAs((java.lang.String)value);
}
break;
case HIGHTEST_TXN_ID:
if (value == null) {
unsetHightestTxnId();
} else {
setHightestTxnId((java.lang.Long)value);
}
break;
case META_INFO:
if (value == null) {
unsetMetaInfo();
} else {
setMetaInfo((java.lang.String)value);
}
break;
case END_TIME:
if (value == null) {
unsetEndTime();
} else {
setEndTime((java.lang.Long)value);
}
break;
case HADOOP_JOB_ID:
if (value == null) {
unsetHadoopJobId();
} else {
setHadoopJobId((java.lang.String)value);
}
break;
case ID:
if (value == null) {
unsetId();
} else {
setId((java.lang.Long)value);
}
break;
case ERROR_MESSAGE:
if (value == null) {
unsetErrorMessage();
} else {
setErrorMessage((java.lang.String)value);
}
break;
case ENQUEUE_TIME:
if (value == null) {
unsetEnqueueTime();
} else {
setEnqueueTime((java.lang.Long)value);
}
break;
case WORKER_VERSION:
if (value == null) {
unsetWorkerVersion();
} else {
setWorkerVersion((java.lang.String)value);
}
break;
case INITIATOR_ID:
if (value == null) {
unsetInitiatorId();
} else {
setInitiatorId((java.lang.String)value);
}
break;
case INITIATOR_VERSION:
if (value == null) {
unsetInitiatorVersion();
} else {
setInitiatorVersion((java.lang.String)value);
}
break;
}
}
@org.apache.thrift.annotation.Nullable
public java.lang.Object getFieldValue(_Fields field) {
switch (field) {
case DBNAME:
return getDbname();
case TABLENAME:
return getTablename();
case PARTITIONNAME:
return getPartitionname();
case TYPE:
return getType();
case STATE:
return getState();
case WORKERID:
return getWorkerid();
case START:
return getStart();
case RUN_AS:
return getRunAs();
case HIGHTEST_TXN_ID:
return getHightestTxnId();
case META_INFO:
return getMetaInfo();
case END_TIME:
return getEndTime();
case HADOOP_JOB_ID:
return getHadoopJobId();
case ID:
return getId();
case ERROR_MESSAGE:
return getErrorMessage();
case ENQUEUE_TIME:
return getEnqueueTime();
case WORKER_VERSION:
return getWorkerVersion();
case INITIATOR_ID:
return getInitiatorId();
case INITIATOR_VERSION:
return getInitiatorVersion();
}
throw new java.lang.IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new java.lang.IllegalArgumentException();
}
switch (field) {
case DBNAME:
return isSetDbname();
case TABLENAME:
return isSetTablename();
case PARTITIONNAME:
return isSetPartitionname();
case TYPE:
return isSetType();
case STATE:
return isSetState();
case WORKERID:
return isSetWorkerid();
case START:
return isSetStart();
case RUN_AS:
return isSetRunAs();
case HIGHTEST_TXN_ID:
return isSetHightestTxnId();
case META_INFO:
return isSetMetaInfo();
case END_TIME:
return isSetEndTime();
case HADOOP_JOB_ID:
return isSetHadoopJobId();
case ID:
return isSetId();
case ERROR_MESSAGE:
return isSetErrorMessage();
case ENQUEUE_TIME:
return isSetEnqueueTime();
case WORKER_VERSION:
return isSetWorkerVersion();
case INITIATOR_ID:
return isSetInitiatorId();
case INITIATOR_VERSION:
return isSetInitiatorVersion();
}
throw new java.lang.IllegalStateException();
}
@Override
public boolean equals(java.lang.Object that) {
if (that instanceof ShowCompactResponseElement)
return this.equals((ShowCompactResponseElement)that);
return false;
}
public boolean equals(ShowCompactResponseElement that) {
if (that == null)
return false;
if (this == that)
return true;
boolean this_present_dbname = true && this.isSetDbname();
boolean that_present_dbname = true && that.isSetDbname();
if (this_present_dbname || that_present_dbname) {
if (!(this_present_dbname && that_present_dbname))
return false;
if (!this.dbname.equals(that.dbname))
return false;
}
boolean this_present_tablename = true && this.isSetTablename();
boolean that_present_tablename = true && that.isSetTablename();
if (this_present_tablename || that_present_tablename) {
if (!(this_present_tablename && that_present_tablename))
return false;
if (!this.tablename.equals(that.tablename))
return false;
}
boolean this_present_partitionname = true && this.isSetPartitionname();
boolean that_present_partitionname = true && that.isSetPartitionname();
if (this_present_partitionname || that_present_partitionname) {
if (!(this_present_partitionname && that_present_partitionname))
return false;
if (!this.partitionname.equals(that.partitionname))
return false;
}
boolean this_present_type = true && this.isSetType();
boolean that_present_type = true && that.isSetType();
if (this_present_type || that_present_type) {
if (!(this_present_type && that_present_type))
return false;
if (!this.type.equals(that.type))
return false;
}
boolean this_present_state = true && this.isSetState();
boolean that_present_state = true && that.isSetState();
if (this_present_state || that_present_state) {
if (!(this_present_state && that_present_state))
return false;
if (!this.state.equals(that.state))
return false;
}
boolean this_present_workerid = true && this.isSetWorkerid();
boolean that_present_workerid = true && that.isSetWorkerid();
if (this_present_workerid || that_present_workerid) {
if (!(this_present_workerid && that_present_workerid))
return false;
if (!this.workerid.equals(that.workerid))
return false;
}
boolean this_present_start = true && this.isSetStart();
boolean that_present_start = true && that.isSetStart();
if (this_present_start || that_present_start) {
if (!(this_present_start && that_present_start))
return false;
if (this.start != that.start)
return false;
}
boolean this_present_runAs = true && this.isSetRunAs();
boolean that_present_runAs = true && that.isSetRunAs();
if (this_present_runAs || that_present_runAs) {
if (!(this_present_runAs && that_present_runAs))
return false;
if (!this.runAs.equals(that.runAs))
return false;
}
boolean this_present_hightestTxnId = true && this.isSetHightestTxnId();
boolean that_present_hightestTxnId = true && that.isSetHightestTxnId();
if (this_present_hightestTxnId || that_present_hightestTxnId) {
if (!(this_present_hightestTxnId && that_present_hightestTxnId))
return false;
if (this.hightestTxnId != that.hightestTxnId)
return false;
}
boolean this_present_metaInfo = true && this.isSetMetaInfo();
boolean that_present_metaInfo = true && that.isSetMetaInfo();
if (this_present_metaInfo || that_present_metaInfo) {
if (!(this_present_metaInfo && that_present_metaInfo))
return false;
if (!this.metaInfo.equals(that.metaInfo))
return false;
}
boolean this_present_endTime = true && this.isSetEndTime();
boolean that_present_endTime = true && that.isSetEndTime();
if (this_present_endTime || that_present_endTime) {
if (!(this_present_endTime && that_present_endTime))
return false;
if (this.endTime != that.endTime)
return false;
}
boolean this_present_hadoopJobId = true && this.isSetHadoopJobId();
boolean that_present_hadoopJobId = true && that.isSetHadoopJobId();
if (this_present_hadoopJobId || that_present_hadoopJobId) {
if (!(this_present_hadoopJobId && that_present_hadoopJobId))
return false;
if (!this.hadoopJobId.equals(that.hadoopJobId))
return false;
}
boolean this_present_id = true && this.isSetId();
boolean that_present_id = true && that.isSetId();
if (this_present_id || that_present_id) {
if (!(this_present_id && that_present_id))
return false;
if (this.id != that.id)
return false;
}
boolean this_present_errorMessage = true && this.isSetErrorMessage();
boolean that_present_errorMessage = true && that.isSetErrorMessage();
if (this_present_errorMessage || that_present_errorMessage) {
if (!(this_present_errorMessage && that_present_errorMessage))
return false;
if (!this.errorMessage.equals(that.errorMessage))
return false;
}
boolean this_present_enqueueTime = true && this.isSetEnqueueTime();
boolean that_present_enqueueTime = true && that.isSetEnqueueTime();
if (this_present_enqueueTime || that_present_enqueueTime) {
if (!(this_present_enqueueTime && that_present_enqueueTime))
return false;
if (this.enqueueTime != that.enqueueTime)
return false;
}
boolean this_present_workerVersion = true && this.isSetWorkerVersion();
boolean that_present_workerVersion = true && that.isSetWorkerVersion();
if (this_present_workerVersion || that_present_workerVersion) {
if (!(this_present_workerVersion && that_present_workerVersion))
return false;
if (!this.workerVersion.equals(that.workerVersion))
return false;
}
boolean this_present_initiatorId = true && this.isSetInitiatorId();
boolean that_present_initiatorId = true && that.isSetInitiatorId();
if (this_present_initiatorId || that_present_initiatorId) {
if (!(this_present_initiatorId && that_present_initiatorId))
return false;
if (!this.initiatorId.equals(that.initiatorId))
return false;
}
boolean this_present_initiatorVersion = true && this.isSetInitiatorVersion();
boolean that_present_initiatorVersion = true && that.isSetInitiatorVersion();
if (this_present_initiatorVersion || that_present_initiatorVersion) {
if (!(this_present_initiatorVersion && that_present_initiatorVersion))
return false;
if (!this.initiatorVersion.equals(that.initiatorVersion))
return false;
}
return true;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = hashCode * 8191 + ((isSetDbname()) ? 131071 : 524287);
if (isSetDbname())
hashCode = hashCode * 8191 + dbname.hashCode();
hashCode = hashCode * 8191 + ((isSetTablename()) ? 131071 : 524287);
if (isSetTablename())
hashCode = hashCode * 8191 + tablename.hashCode();
hashCode = hashCode * 8191 + ((isSetPartitionname()) ? 131071 : 524287);
if (isSetPartitionname())
hashCode = hashCode * 8191 + partitionname.hashCode();
hashCode = hashCode * 8191 + ((isSetType()) ? 131071 : 524287);
if (isSetType())
hashCode = hashCode * 8191 + type.getValue();
hashCode = hashCode * 8191 + ((isSetState()) ? 131071 : 524287);
if (isSetState())
hashCode = hashCode * 8191 + state.hashCode();
hashCode = hashCode * 8191 + ((isSetWorkerid()) ? 131071 : 524287);
if (isSetWorkerid())
hashCode = hashCode * 8191 + workerid.hashCode();
hashCode = hashCode * 8191 + ((isSetStart()) ? 131071 : 524287);
if (isSetStart())
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(start);
hashCode = hashCode * 8191 + ((isSetRunAs()) ? 131071 : 524287);
if (isSetRunAs())
hashCode = hashCode * 8191 + runAs.hashCode();
hashCode = hashCode * 8191 + ((isSetHightestTxnId()) ? 131071 : 524287);
if (isSetHightestTxnId())
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(hightestTxnId);
hashCode = hashCode * 8191 + ((isSetMetaInfo()) ? 131071 : 524287);
if (isSetMetaInfo())
hashCode = hashCode * 8191 + metaInfo.hashCode();
hashCode = hashCode * 8191 + ((isSetEndTime()) ? 131071 : 524287);
if (isSetEndTime())
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(endTime);
hashCode = hashCode * 8191 + ((isSetHadoopJobId()) ? 131071 : 524287);
if (isSetHadoopJobId())
hashCode = hashCode * 8191 + hadoopJobId.hashCode();
hashCode = hashCode * 8191 + ((isSetId()) ? 131071 : 524287);
if (isSetId())
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(id);
hashCode = hashCode * 8191 + ((isSetErrorMessage()) ? 131071 : 524287);
if (isSetErrorMessage())
hashCode = hashCode * 8191 + errorMessage.hashCode();
hashCode = hashCode * 8191 + ((isSetEnqueueTime()) ? 131071 : 524287);
if (isSetEnqueueTime())
hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(enqueueTime);
hashCode = hashCode * 8191 + ((isSetWorkerVersion()) ? 131071 : 524287);
if (isSetWorkerVersion())
hashCode = hashCode * 8191 + workerVersion.hashCode();
hashCode = hashCode * 8191 + ((isSetInitiatorId()) ? 131071 : 524287);
if (isSetInitiatorId())
hashCode = hashCode * 8191 + initiatorId.hashCode();
hashCode = hashCode * 8191 + ((isSetInitiatorVersion()) ? 131071 : 524287);
if (isSetInitiatorVersion())
hashCode = hashCode * 8191 + initiatorVersion.hashCode();
return hashCode;
}
@Override
public int compareTo(ShowCompactResponseElement other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = java.lang.Boolean.compare(isSetDbname(), other.isSetDbname());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDbname()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.dbname, other.dbname);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetTablename(), other.isSetTablename());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTablename()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tablename, other.tablename);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetPartitionname(), other.isSetPartitionname());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPartitionname()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.partitionname, other.partitionname);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetType(), other.isSetType());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetType()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetState(), other.isSetState());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetState()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.state, other.state);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetWorkerid(), other.isSetWorkerid());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetWorkerid()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.workerid, other.workerid);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetStart(), other.isSetStart());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetStart()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.start, other.start);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetRunAs(), other.isSetRunAs());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRunAs()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.runAs, other.runAs);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetHightestTxnId(), other.isSetHightestTxnId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetHightestTxnId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hightestTxnId, other.hightestTxnId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetMetaInfo(), other.isSetMetaInfo());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMetaInfo()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.metaInfo, other.metaInfo);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetEndTime(), other.isSetEndTime());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetEndTime()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.endTime, other.endTime);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetHadoopJobId(), other.isSetHadoopJobId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetHadoopJobId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.hadoopJobId, other.hadoopJobId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetId(), other.isSetId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetErrorMessage(), other.isSetErrorMessage());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetErrorMessage()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.errorMessage, other.errorMessage);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetEnqueueTime(), other.isSetEnqueueTime());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetEnqueueTime()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.enqueueTime, other.enqueueTime);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetWorkerVersion(), other.isSetWorkerVersion());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetWorkerVersion()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.workerVersion, other.workerVersion);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetInitiatorId(), other.isSetInitiatorId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetInitiatorId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.initiatorId, other.initiatorId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = java.lang.Boolean.compare(isSetInitiatorVersion(), other.isSetInitiatorVersion());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetInitiatorVersion()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.initiatorVersion, other.initiatorVersion);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
@org.apache.thrift.annotation.Nullable
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
scheme(iprot).read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
scheme(oprot).write(oprot, this);
}
@Override
public java.lang.String toString() {
java.lang.StringBuilder sb = new java.lang.StringBuilder("ShowCompactResponseElement(");
boolean first = true;
sb.append("dbname:");
if (this.dbname == null) {
sb.append("null");
} else {
sb.append(this.dbname);
}
first = false;
if (!first) sb.append(", ");
sb.append("tablename:");
if (this.tablename == null) {
sb.append("null");
} else {
sb.append(this.tablename);
}
first = false;
if (isSetPartitionname()) {
if (!first) sb.append(", ");
sb.append("partitionname:");
if (this.partitionname == null) {
sb.append("null");
} else {
sb.append(this.partitionname);
}
first = false;
}
if (!first) sb.append(", ");
sb.append("type:");
if (this.type == null) {
sb.append("null");
} else {
sb.append(this.type);
}
first = false;
if (!first) sb.append(", ");
sb.append("state:");
if (this.state == null) {
sb.append("null");
} else {
sb.append(this.state);
}
first = false;
if (isSetWorkerid()) {
if (!first) sb.append(", ");
sb.append("workerid:");
if (this.workerid == null) {
sb.append("null");
} else {
sb.append(this.workerid);
}
first = false;
}
if (isSetStart()) {
if (!first) sb.append(", ");
sb.append("start:");
sb.append(this.start);
first = false;
}
if (isSetRunAs()) {
if (!first) sb.append(", ");
sb.append("runAs:");
if (this.runAs == null) {
sb.append("null");
} else {
sb.append(this.runAs);
}
first = false;
}
if (isSetHightestTxnId()) {
if (!first) sb.append(", ");
sb.append("hightestTxnId:");
sb.append(this.hightestTxnId);
first = false;
}
if (isSetMetaInfo()) {
if (!first) sb.append(", ");
sb.append("metaInfo:");
if (this.metaInfo == null) {
sb.append("null");
} else {
sb.append(this.metaInfo);
}
first = false;
}
if (isSetEndTime()) {
if (!first) sb.append(", ");
sb.append("endTime:");
sb.append(this.endTime);
first = false;
}
if (isSetHadoopJobId()) {
if (!first) sb.append(", ");
sb.append("hadoopJobId:");
if (this.hadoopJobId == null) {
sb.append("null");
} else {
sb.append(this.hadoopJobId);
}
first = false;
}
if (isSetId()) {
if (!first) sb.append(", ");
sb.append("id:");
sb.append(this.id);
first = false;
}
if (isSetErrorMessage()) {
if (!first) sb.append(", ");
sb.append("errorMessage:");
if (this.errorMessage == null) {
sb.append("null");
} else {
sb.append(this.errorMessage);
}
first = false;
}
if (isSetEnqueueTime()) {
if (!first) sb.append(", ");
sb.append("enqueueTime:");
sb.append(this.enqueueTime);
first = false;
}
if (isSetWorkerVersion()) {
if (!first) sb.append(", ");
sb.append("workerVersion:");
if (this.workerVersion == null) {
sb.append("null");
} else {
sb.append(this.workerVersion);
}
first = false;
}
if (isSetInitiatorId()) {
if (!first) sb.append(", ");
sb.append("initiatorId:");
if (this.initiatorId == null) {
sb.append("null");
} else {
sb.append(this.initiatorId);
}
first = false;
}
if (isSetInitiatorVersion()) {
if (!first) sb.append(", ");
sb.append("initiatorVersion:");
if (this.initiatorVersion == null) {
sb.append("null");
} else {
sb.append(this.initiatorVersion);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (!isSetDbname()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'dbname' is unset! Struct:" + toString());
}
if (!isSetTablename()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'tablename' is unset! Struct:" + toString());
}
if (!isSetType()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' is unset! Struct:" + toString());
}
if (!isSetState()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'state' is unset! Struct:" + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class ShowCompactResponseElementStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
public ShowCompactResponseElementStandardScheme getScheme() {
return new ShowCompactResponseElementStandardScheme();
}
}
private static class ShowCompactResponseElementStandardScheme extends org.apache.thrift.scheme.StandardScheme<ShowCompactResponseElement> {
public void read(org.apache.thrift.protocol.TProtocol iprot, ShowCompactResponseElement struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // DBNAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.dbname = iprot.readString();
struct.setDbnameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // TABLENAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.tablename = iprot.readString();
struct.setTablenameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // PARTITIONNAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.partitionname = iprot.readString();
struct.setPartitionnameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // TYPE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.type = org.apache.hadoop.hive.metastore.api.CompactionType.findByValue(iprot.readI32());
struct.setTypeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // STATE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.state = iprot.readString();
struct.setStateIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 6: // WORKERID
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.workerid = iprot.readString();
struct.setWorkeridIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 7: // START
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.start = iprot.readI64();
struct.setStartIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 8: // RUN_AS
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.runAs = iprot.readString();
struct.setRunAsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 9: // HIGHTEST_TXN_ID
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.hightestTxnId = iprot.readI64();
struct.setHightestTxnIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 10: // META_INFO
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.metaInfo = iprot.readString();
struct.setMetaInfoIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 11: // END_TIME
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.endTime = iprot.readI64();
struct.setEndTimeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 12: // HADOOP_JOB_ID
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.hadoopJobId = iprot.readString();
struct.setHadoopJobIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 13: // ID
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.id = iprot.readI64();
struct.setIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 14: // ERROR_MESSAGE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.errorMessage = iprot.readString();
struct.setErrorMessageIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 15: // ENQUEUE_TIME
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.enqueueTime = iprot.readI64();
struct.setEnqueueTimeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 16: // WORKER_VERSION
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.workerVersion = iprot.readString();
struct.setWorkerVersionIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 17: // INITIATOR_ID
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.initiatorId = iprot.readString();
struct.setInitiatorIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 18: // INITIATOR_VERSION
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.initiatorVersion = iprot.readString();
struct.setInitiatorVersionIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, ShowCompactResponseElement struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.dbname != null) {
oprot.writeFieldBegin(DBNAME_FIELD_DESC);
oprot.writeString(struct.dbname);
oprot.writeFieldEnd();
}
if (struct.tablename != null) {
oprot.writeFieldBegin(TABLENAME_FIELD_DESC);
oprot.writeString(struct.tablename);
oprot.writeFieldEnd();
}
if (struct.partitionname != null) {
if (struct.isSetPartitionname()) {
oprot.writeFieldBegin(PARTITIONNAME_FIELD_DESC);
oprot.writeString(struct.partitionname);
oprot.writeFieldEnd();
}
}
if (struct.type != null) {
oprot.writeFieldBegin(TYPE_FIELD_DESC);
oprot.writeI32(struct.type.getValue());
oprot.writeFieldEnd();
}
if (struct.state != null) {
oprot.writeFieldBegin(STATE_FIELD_DESC);
oprot.writeString(struct.state);
oprot.writeFieldEnd();
}
if (struct.workerid != null) {
if (struct.isSetWorkerid()) {
oprot.writeFieldBegin(WORKERID_FIELD_DESC);
oprot.writeString(struct.workerid);
oprot.writeFieldEnd();
}
}
if (struct.isSetStart()) {
oprot.writeFieldBegin(START_FIELD_DESC);
oprot.writeI64(struct.start);
oprot.writeFieldEnd();
}
if (struct.runAs != null) {
if (struct.isSetRunAs()) {
oprot.writeFieldBegin(RUN_AS_FIELD_DESC);
oprot.writeString(struct.runAs);
oprot.writeFieldEnd();
}
}
if (struct.isSetHightestTxnId()) {
oprot.writeFieldBegin(HIGHTEST_TXN_ID_FIELD_DESC);
oprot.writeI64(struct.hightestTxnId);
oprot.writeFieldEnd();
}
if (struct.metaInfo != null) {
if (struct.isSetMetaInfo()) {
oprot.writeFieldBegin(META_INFO_FIELD_DESC);
oprot.writeString(struct.metaInfo);
oprot.writeFieldEnd();
}
}
if (struct.isSetEndTime()) {
oprot.writeFieldBegin(END_TIME_FIELD_DESC);
oprot.writeI64(struct.endTime);
oprot.writeFieldEnd();
}
if (struct.hadoopJobId != null) {
if (struct.isSetHadoopJobId()) {
oprot.writeFieldBegin(HADOOP_JOB_ID_FIELD_DESC);
oprot.writeString(struct.hadoopJobId);
oprot.writeFieldEnd();
}
}
if (struct.isSetId()) {
oprot.writeFieldBegin(ID_FIELD_DESC);
oprot.writeI64(struct.id);
oprot.writeFieldEnd();
}
if (struct.errorMessage != null) {
if (struct.isSetErrorMessage()) {
oprot.writeFieldBegin(ERROR_MESSAGE_FIELD_DESC);
oprot.writeString(struct.errorMessage);
oprot.writeFieldEnd();
}
}
if (struct.isSetEnqueueTime()) {
oprot.writeFieldBegin(ENQUEUE_TIME_FIELD_DESC);
oprot.writeI64(struct.enqueueTime);
oprot.writeFieldEnd();
}
if (struct.workerVersion != null) {
if (struct.isSetWorkerVersion()) {
oprot.writeFieldBegin(WORKER_VERSION_FIELD_DESC);
oprot.writeString(struct.workerVersion);
oprot.writeFieldEnd();
}
}
if (struct.initiatorId != null) {
if (struct.isSetInitiatorId()) {
oprot.writeFieldBegin(INITIATOR_ID_FIELD_DESC);
oprot.writeString(struct.initiatorId);
oprot.writeFieldEnd();
}
}
if (struct.initiatorVersion != null) {
if (struct.isSetInitiatorVersion()) {
oprot.writeFieldBegin(INITIATOR_VERSION_FIELD_DESC);
oprot.writeString(struct.initiatorVersion);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class ShowCompactResponseElementTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
public ShowCompactResponseElementTupleScheme getScheme() {
return new ShowCompactResponseElementTupleScheme();
}
}
private static class ShowCompactResponseElementTupleScheme extends org.apache.thrift.scheme.TupleScheme<ShowCompactResponseElement> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, ShowCompactResponseElement struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
oprot.writeString(struct.dbname);
oprot.writeString(struct.tablename);
oprot.writeI32(struct.type.getValue());
oprot.writeString(struct.state);
java.util.BitSet optionals = new java.util.BitSet();
if (struct.isSetPartitionname()) {
optionals.set(0);
}
if (struct.isSetWorkerid()) {
optionals.set(1);
}
if (struct.isSetStart()) {
optionals.set(2);
}
if (struct.isSetRunAs()) {
optionals.set(3);
}
if (struct.isSetHightestTxnId()) {
optionals.set(4);
}
if (struct.isSetMetaInfo()) {
optionals.set(5);
}
if (struct.isSetEndTime()) {
optionals.set(6);
}
if (struct.isSetHadoopJobId()) {
optionals.set(7);
}
if (struct.isSetId()) {
optionals.set(8);
}
if (struct.isSetErrorMessage()) {
optionals.set(9);
}
if (struct.isSetEnqueueTime()) {
optionals.set(10);
}
if (struct.isSetWorkerVersion()) {
optionals.set(11);
}
if (struct.isSetInitiatorId()) {
optionals.set(12);
}
if (struct.isSetInitiatorVersion()) {
optionals.set(13);
}
oprot.writeBitSet(optionals, 14);
if (struct.isSetPartitionname()) {
oprot.writeString(struct.partitionname);
}
if (struct.isSetWorkerid()) {
oprot.writeString(struct.workerid);
}
if (struct.isSetStart()) {
oprot.writeI64(struct.start);
}
if (struct.isSetRunAs()) {
oprot.writeString(struct.runAs);
}
if (struct.isSetHightestTxnId()) {
oprot.writeI64(struct.hightestTxnId);
}
if (struct.isSetMetaInfo()) {
oprot.writeString(struct.metaInfo);
}
if (struct.isSetEndTime()) {
oprot.writeI64(struct.endTime);
}
if (struct.isSetHadoopJobId()) {
oprot.writeString(struct.hadoopJobId);
}
if (struct.isSetId()) {
oprot.writeI64(struct.id);
}
if (struct.isSetErrorMessage()) {
oprot.writeString(struct.errorMessage);
}
if (struct.isSetEnqueueTime()) {
oprot.writeI64(struct.enqueueTime);
}
if (struct.isSetWorkerVersion()) {
oprot.writeString(struct.workerVersion);
}
if (struct.isSetInitiatorId()) {
oprot.writeString(struct.initiatorId);
}
if (struct.isSetInitiatorVersion()) {
oprot.writeString(struct.initiatorVersion);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, ShowCompactResponseElement struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
struct.dbname = iprot.readString();
struct.setDbnameIsSet(true);
struct.tablename = iprot.readString();
struct.setTablenameIsSet(true);
struct.type = org.apache.hadoop.hive.metastore.api.CompactionType.findByValue(iprot.readI32());
struct.setTypeIsSet(true);
struct.state = iprot.readString();
struct.setStateIsSet(true);
java.util.BitSet incoming = iprot.readBitSet(14);
if (incoming.get(0)) {
struct.partitionname = iprot.readString();
struct.setPartitionnameIsSet(true);
}
if (incoming.get(1)) {
struct.workerid = iprot.readString();
struct.setWorkeridIsSet(true);
}
if (incoming.get(2)) {
struct.start = iprot.readI64();
struct.setStartIsSet(true);
}
if (incoming.get(3)) {
struct.runAs = iprot.readString();
struct.setRunAsIsSet(true);
}
if (incoming.get(4)) {
struct.hightestTxnId = iprot.readI64();
struct.setHightestTxnIdIsSet(true);
}
if (incoming.get(5)) {
struct.metaInfo = iprot.readString();
struct.setMetaInfoIsSet(true);
}
if (incoming.get(6)) {
struct.endTime = iprot.readI64();
struct.setEndTimeIsSet(true);
}
if (incoming.get(7)) {
struct.hadoopJobId = iprot.readString();
struct.setHadoopJobIdIsSet(true);
}
if (incoming.get(8)) {
struct.id = iprot.readI64();
struct.setIdIsSet(true);
}
if (incoming.get(9)) {
struct.errorMessage = iprot.readString();
struct.setErrorMessageIsSet(true);
}
if (incoming.get(10)) {
struct.enqueueTime = iprot.readI64();
struct.setEnqueueTimeIsSet(true);
}
if (incoming.get(11)) {
struct.workerVersion = iprot.readString();
struct.setWorkerVersionIsSet(true);
}
if (incoming.get(12)) {
struct.initiatorId = iprot.readString();
struct.setInitiatorIdIsSet(true);
}
if (incoming.get(13)) {
struct.initiatorVersion = iprot.readString();
struct.setInitiatorVersionIsSet(true);
}
}
}
private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
}
}
| {
"content_hash": "b5174c03dc93e15d16dbbe319eeab527",
"timestamp": "",
"source": "github",
"line_count": 2136,
"max_line_length": 332,
"avg_line_length": 34.42837078651685,
"alnum_prop": 0.649029766518446,
"repo_name": "lirui-apache/hive",
"id": "dff37fe2e68b9eea7af56058e3af8085659ae5b8",
"size": "73539",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ShowCompactResponseElement.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "54376"
},
{
"name": "Batchfile",
"bytes": "845"
},
{
"name": "C",
"bytes": "28218"
},
{
"name": "C++",
"bytes": "45308"
},
{
"name": "CSS",
"bytes": "5157"
},
{
"name": "GAP",
"bytes": "179818"
},
{
"name": "HTML",
"bytes": "58711"
},
{
"name": "HiveQL",
"bytes": "7568849"
},
{
"name": "Java",
"bytes": "52828789"
},
{
"name": "JavaScript",
"bytes": "43855"
},
{
"name": "M4",
"bytes": "2276"
},
{
"name": "PHP",
"bytes": "148097"
},
{
"name": "PLSQL",
"bytes": "5261"
},
{
"name": "PLpgSQL",
"bytes": "302587"
},
{
"name": "Perl",
"bytes": "319842"
},
{
"name": "PigLatin",
"bytes": "12333"
},
{
"name": "Python",
"bytes": "408633"
},
{
"name": "Roff",
"bytes": "5379"
},
{
"name": "SQLPL",
"bytes": "409"
},
{
"name": "Shell",
"bytes": "299497"
},
{
"name": "TSQL",
"bytes": "2556735"
},
{
"name": "Thrift",
"bytes": "144783"
},
{
"name": "XSLT",
"bytes": "20199"
},
{
"name": "q",
"bytes": "320552"
}
],
"symlink_target": ""
} |
| [docs](..) / [using](.) / squirrel-command-line.md
|:---|
# Squirrel Command Line
Here is a simplified help output specifically around creating releases:
```
Usage: Squirrel.exe command [OPTS]
Creates Squirrel packages
Commands
--releasify=VALUE Update or generate a releases directory with a
given NuGet package
Options:
-h, -?, --help Display Help and exit
-r, --releaseDir=VALUE Path to a release directory to use with Releasify
-p, --packagesDir=VALUE Path to the NuGet Packages directory for C# apps
--bootstrapperExe=VALUE
Path to the Setup.exe to use as a template
-g, --loadingGif=VALUE Path to an animated GIF to be displayed during
installation
-n, --signWithParams=VALUE Sign the installer via SignTool.exe with the
parameters given
--setupIcon=VALUE Path to an ICO file that will be used for the
Setup executable's icon
-b --baseUrl=VALUE Provides a base URL to prefix the RELEASES file
packages with
--no-msi Don't generate an MSI package
--msi-win64 Mark the MSI as 64-bit, which is useful in
Enterprise deployment scenarios
--no-delta Don't generate delta packages to save time
--framework-version=VALUE
Set the required .NET framework version, e.g. net461
```
## See Also
* [Loading GIF](loading-gif.md) - specify a "loading" image during initial install of large applications.
* [Application Signing](application-signing.md) - adding code signing to `Setup.exe` and your application.
---
| Return: [Table of Contents](../readme.md) |
|----|
| {
"content_hash": "e8968da3b96b9e9ac19a49de0b55ebed",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 106,
"avg_line_length": 39.51063829787234,
"alnum_prop": 0.5961227786752827,
"repo_name": "Squirrel/Squirrel.Windows",
"id": "8b28ac5899c8f14c883a301219db032b1e4bc835",
"size": "1857",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "docs/using/squirrel-command-line.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "4770"
},
{
"name": "C",
"bytes": "89108"
},
{
"name": "C#",
"bytes": "799245"
},
{
"name": "C++",
"bytes": "1673329"
}
],
"symlink_target": ""
} |
<!--
~ Waltz - Enterprise Architecture
~ Copyright (C) 2016, 2017, 2018, 2019 Waltz open source project
~ See README.md for more information
~
~ 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
~
-->
<div>
<waltz-page-header name="{{ ctrl.definition.name }}"
icon="puzzle-piece">
<breadcrumbs>
<ol class="waltz-breadcrumbs">
<li><a ui-sref="main">Home</a></li>
<li><a ui-sref="main.assessment-definition.list">Assessment Definitions</a></li>
<li>
<span ng-bind="ctrl.definition.name">
</span>
</li>
</ol>
</breadcrumbs>
</waltz-page-header>
<waltz-assessment-definition-overview definition="ctrl.definition"
rating-scheme-items="ctrl.ratingSchemeItems">
</waltz-assessment-definition-overview>
<br>
<waltz-section icon="desktop"
name="Assessment Ratings">
<div class="row">
<div class="col-md-12">
<waltz-section-actions>
<button waltz-has-role="{{ctrl.definition.permittedRole}}"
class="btn btn-xs btn-primary"
ui-sref="main.assessment-definition.edit ({id: ctrl.definition.id})">
Bulk Edit
</button>
<waltz-data-extract-link name="Export"
styling="button"
extract="assessment-rating/by-definition/{{ctrl.definition.id}}"
method="POST">
</waltz-data-extract-link>
</waltz-section-actions>
<waltz-grid-with-search scope-provider="ctrl"
ng-if="ctrl.appRatings.length > 0"
entries="ctrl.appRatings"
column-defs="ctrl.columnDefs">
</waltz-grid-with-search>
<waltz-no-data ng-if="ctrl.appRatings.length == 0">
<message>
<strong>
No assessment ratings
</strong>
have been associated.
</message>
</waltz-no-data>
</div>
</div>
</waltz-section>
</div> | {
"content_hash": "d15406ed25756625eaaa4c6fa23b55a4",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 109,
"avg_line_length": 41.563380281690144,
"alnum_prop": 0.4910199932226364,
"repo_name": "kamransaleem/waltz",
"id": "0d88a8bb7f69e59bda2c94ad13329fdf8e68df42",
"size": "2951",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "waltz-ng/client/assessments/pages/view/assessment-definition-view.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "154572"
},
{
"name": "HTML",
"bytes": "1360149"
},
{
"name": "Java",
"bytes": "3346006"
},
{
"name": "JavaScript",
"bytes": "2246024"
},
{
"name": "Shell",
"bytes": "305"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.8"/>
<title>Assimp: vector2.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Assimp
 <span id="projectnumber">v3.1.1 (June 2014)</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.8 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_f20ea33e5bdbec818687709fdec687d3.html">include</a></li><li class="navelem"><a class="el" href="dir_de6ea5b4f632de0a6335898895c1a899.html">assimp</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> |
<a href="#typedef-members">Typedefs</a> |
<a href="#var-members">Variables</a> </div>
<div class="headertitle">
<div class="title">vector2.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="singletonai_vector2t.html">aiVector2t< TReal ></a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Represents a two-dimensional vector. <a href="singletonai_vector2t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a88c679abbf11a38de8cd26b41bea780e"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="singletonai_vector2t.html">aiVector2t</a>< float > </td><td class="memItemRight" valign="bottom"><a class="el" href="vector2_8h.html#a88c679abbf11a38de8cd26b41bea780e">aiVector2D</a></td></tr>
<tr class="separator:a88c679abbf11a38de8cd26b41bea780e"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a92e0974916d8630c226981922672cbf9"><td class="memItemLeft" align="right" valign="top">class <a class="el" href="singletonai_vector2t.html">aiVector2t</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="vector2_8h.html#a92e0974916d8630c226981922672cbf9">PACK_STRUCT</a></td></tr>
<tr class="separator:a92e0974916d8630c226981922672cbf9"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Typedef Documentation</h2>
<a class="anchor" id="a88c679abbf11a38de8cd26b41bea780e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">typedef <a class="el" href="singletonai_vector2t.html">aiVector2t</a><float> <a class="el" href="vector2_8h.html#a88c679abbf11a38de8cd26b41bea780e">aiVector2D</a></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a class="anchor" id="a92e0974916d8630c226981922672cbf9"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">class <a class="el" href="singletonai_vector2t.html">aiVector2t</a> PACK_STRUCT</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Feb 18 2015 13:46:03 for Assimp by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.8
</small></address>
</body>
</html>
| {
"content_hash": "a622b2253e3120d9164fe7cc9481e491",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 336,
"avg_line_length": 47.85454545454545,
"alnum_prop": 0.6666033434650456,
"repo_name": "cgloger/inviwo",
"id": "42b8508015ba3e376686ba443091b8c84d2ac3da",
"size": "5264",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "modules/assimp/ext/assimp/doc/AssimpDoc_Html/vector2_8h.html",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Assembly",
"bytes": "87832"
},
{
"name": "Batchfile",
"bytes": "11554"
},
{
"name": "C",
"bytes": "15805810"
},
{
"name": "C#",
"bytes": "713601"
},
{
"name": "C++",
"bytes": "25473057"
},
{
"name": "CMake",
"bytes": "1277310"
},
{
"name": "COBOL",
"bytes": "2921725"
},
{
"name": "CSS",
"bytes": "26526"
},
{
"name": "D",
"bytes": "175403"
},
{
"name": "GLSL",
"bytes": "261754"
},
{
"name": "Groff",
"bytes": "6855"
},
{
"name": "HTML",
"bytes": "2691735"
},
{
"name": "Inno Setup",
"bytes": "8416"
},
{
"name": "Java",
"bytes": "287161"
},
{
"name": "JavaScript",
"bytes": "3140"
},
{
"name": "Logos",
"bytes": "2952312"
},
{
"name": "M",
"bytes": "10146"
},
{
"name": "M4",
"bytes": "16806"
},
{
"name": "Makefile",
"bytes": "5057156"
},
{
"name": "Matlab",
"bytes": "1691"
},
{
"name": "Objective-C",
"bytes": "129135"
},
{
"name": "Objective-C++",
"bytes": "29141"
},
{
"name": "Pascal",
"bytes": "13054"
},
{
"name": "Python",
"bytes": "184506"
},
{
"name": "QMake",
"bytes": "1381"
},
{
"name": "Shell",
"bytes": "258309"
},
{
"name": "Smalltalk",
"bytes": "1501"
},
{
"name": "Smarty",
"bytes": "169"
},
{
"name": "Tcl",
"bytes": "1811"
},
{
"name": "UnrealScript",
"bytes": "1273"
},
{
"name": "XSLT",
"bytes": "3925"
}
],
"symlink_target": ""
} |
package org.apache.phoenix.end2end;
import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;
import org.junit.Test;
public class ServerExceptionIT extends BaseHBaseManagedTimeIT {
@Test
public void testServerExceptionBackToClient() throws Exception {
Properties props = new Properties(TEST_PROPERTIES);
Connection conn = DriverManager.getConnection(getUrl(), props);
conn.setAutoCommit(false);
try {
String ddl = "CREATE TABLE IF NOT EXISTS t1(pk VARCHAR NOT NULL PRIMARY KEY, " +
"col1 INTEGER, col2 INTEGER)";
createTestTable(getUrl(), ddl);
String query = "UPSERT INTO t1 VALUES(?,?,?)";
PreparedStatement stmt = conn.prepareStatement(query);
stmt.setString(1, "1");
stmt.setInt(2, 1);
stmt.setInt(3, 0);
stmt.execute();
conn.commit();
query = "SELECT * FROM t1 where col1/col2 > 0";
stmt = conn.prepareStatement(query);
ResultSet rs = stmt.executeQuery();
rs.next();
rs.getInt(1);
fail("Should have caught exception.");
} catch (SQLException e) {
assertTrue(e.getMessage().contains("ERROR 212 (22012): Arithmetic error on server. / by zero"));
} finally {
conn.close();
}
}
}
| {
"content_hash": "6661d71e64ff8640d23ae9736c751b80",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 108,
"avg_line_length": 32.80392156862745,
"alnum_prop": 0.6150627615062761,
"repo_name": "jffnothing/phoenix-4.0.0-incubating",
"id": "ab9bb2893742a7e93edc54969b53beb7b3053340",
"size": "2474",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "phoenix-core/src/it/java/org/apache/phoenix/end2end/ServerExceptionIT.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "GAP",
"bytes": "38837"
},
{
"name": "Java",
"bytes": "6237503"
},
{
"name": "Python",
"bytes": "11444"
},
{
"name": "Shell",
"bytes": "1250"
}
],
"symlink_target": ""
} |
package org.apache.zookeeper.server.quorum;
import static org.apache.zookeeper.test.ClientBase.CONNECTION_TIMEOUT;
import java.util.ArrayList;
import java.util.HashSet;
import org.apache.zookeeper.PortAssignment;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.test.ClientBase;
import org.apache.zookeeper.test.ReconfigTest;
import org.junit.Assert;
import org.junit.Test;
public class ReconfigRecoveryTest extends QuorumPeerTestBase {
/**
* Reconfiguration recovery - test that a reconfiguration is completed if
* leader has .next file during startup and new config is not running yet
*/
@Test
public void testNextConfigCompletion() throws Exception {
ClientBase.setupTestEnv();
// 2 servers in current config, 3 in next config
final int SERVER_COUNT = 3;
final int clientPorts[] = new int[SERVER_COUNT];
StringBuilder sb = new StringBuilder();
String server;
ArrayList<String> allServers = new ArrayList<String>();
String currentQuorumCfgSection = null, nextQuorumCfgSection;
for (int i = 0; i < SERVER_COUNT; i++) {
clientPorts[i] = PortAssignment.unique();
server = "server." + i + "=localhost:" + PortAssignment.unique()
+ ":" + PortAssignment.unique() + ":participant;localhost:"
+ clientPorts[i];
allServers.add(server);
sb.append(server + "\n");
if (i == 1)
currentQuorumCfgSection = sb.toString() + "version=100000000\n";
}
sb.append("version=200000000\n"); // version of current config is 100000000
nextQuorumCfgSection = sb.toString();
// Both servers 0 and 1 will have the .next config file, which means
// for them that a reconfiguration was in progress when they failed
// and the leader will complete it
MainThread mt[] = new MainThread[SERVER_COUNT];
ZooKeeper zk[] = new ZooKeeper[SERVER_COUNT];
for (int i = 0; i < SERVER_COUNT - 1; i++) {
mt[i] = new MainThread(i, clientPorts[i], currentQuorumCfgSection);
// note that we should run the server, shut it down and only then
// simulate a reconfig in progress by writing the temp file, but here no
// other server is competing with them in FLE, so we can skip this step
// (server 2 is booted after FLE ends)
mt[i].writeTempDynamicConfigFile(nextQuorumCfgSection);
mt[i].start();
zk[i] = new ZooKeeper("127.0.0.1:" + clientPorts[i],
ClientBase.CONNECTION_TIMEOUT, this);
}
Assert.assertTrue("waiting for server 0 being up", ClientBase
.waitForServerUp("127.0.0.1:" + clientPorts[0],
CONNECTION_TIMEOUT));
Assert.assertTrue("waiting for server 1 being up", ClientBase
.waitForServerUp("127.0.0.1:" + clientPorts[1],
CONNECTION_TIMEOUT));
int leader = mt[0].main.quorumPeer.leader == null ? 1 : 0;
// the new server's config is going to include itself and the current leader
sb = new StringBuilder();
sb.append(allServers.get(leader) + "\n");
sb.append(allServers.get(2) + "\n");
// suppose that this new server never heard about the reconfig proposal
String newServerInitialConfig = sb.toString();
mt[2] = new MainThread(2, clientPorts[2], newServerInitialConfig);
mt[2].start();
zk[2] = new ZooKeeper("127.0.0.1:" + clientPorts[2],
ClientBase.CONNECTION_TIMEOUT, this);
Assert.assertTrue("waiting for server 2 being up", ClientBase
.waitForServerUp("127.0.0.1:" + clientPorts[2],
CONNECTION_TIMEOUT));
ReconfigTest.testServerHasConfig(zk[0], allServers, null);
ReconfigTest.testServerHasConfig(zk[1], allServers, null);
ReconfigTest.testServerHasConfig(zk[2], allServers, null);
ReconfigTest.testNormalOperation(zk[0], zk[2]);
ReconfigTest.testNormalOperation(zk[2], zk[1]);
for (int i = 0; i < SERVER_COUNT; i++) {
mt[i].shutdown();
zk[i].close();
}
}
/**
* Reconfiguration recovery - current config servers discover .next file,
* but they're both observers and their ports change in next config. Suppose
* that next config wasn't activated yet. Should complete reconfiguration.
*/
@Test
public void testCurrentServersAreObserversInNextConfig() throws Exception {
ClientBase.setupTestEnv();
// 2 servers in current config, 5 in next config
final int SERVER_COUNT = 5;
final int clientPorts[] = new int[SERVER_COUNT];
final int oldClientPorts[] = new int[2];
StringBuilder sb = new StringBuilder();
String server;
String currentQuorumCfg = null, currentQuorumCfgSection = null, nextQuorumCfgSection = null;
ArrayList<String> allServersCurrent = new ArrayList<String>();
ArrayList<String> allServersNext = new ArrayList<String>();
for (int i = 0; i < 2; i++) {
oldClientPorts[i] = PortAssignment.unique();
server = "server." + i + "=localhost:" + PortAssignment.unique()
+ ":" + PortAssignment.unique() + ":participant;localhost:"
+ oldClientPorts[i];
allServersCurrent.add(server);
sb.append(server + "\n");
}
currentQuorumCfg = sb.toString();
sb.append("version=100000000\n");
currentQuorumCfgSection = sb.toString();
sb = new StringBuilder();
String role;
for (int i = 0; i < SERVER_COUNT; i++) {
clientPorts[i] = PortAssignment.unique();
if (i < 2) {
role = "observer";
} else {
role = "participant";
}
server = "server." + i + "=localhost:" + PortAssignment.unique()
+ ":" + PortAssignment.unique() + ":" + role
+ ";localhost:" + clientPorts[i];
allServersNext.add(server);
sb.append(server + "\n");
}
sb.append("version=200000000\n"); // version of current config is 100000000
nextQuorumCfgSection = sb.toString();
MainThread mt[] = new MainThread[SERVER_COUNT];
ZooKeeper zk[] = new ZooKeeper[SERVER_COUNT];
// run servers 0 and 1 normally
for (int i = 0; i < 2; i++) {
mt[i] = new MainThread(i, oldClientPorts[i],
currentQuorumCfgSection);
mt[i].start();
zk[i] = new ZooKeeper("127.0.0.1:" + oldClientPorts[i],
ClientBase.CONNECTION_TIMEOUT, this);
}
for (int i = 0; i < 2; i++) {
Assert.assertTrue("waiting for server " + i + " being up",
ClientBase.waitForServerUp(
"127.0.0.1:" + oldClientPorts[i],
CONNECTION_TIMEOUT * 2));
}
ReconfigTest.testNormalOperation(zk[0], zk[1]);
// shut them down and then simulate a reboot with a reconfig in progress
for (int i = 0; i < 2; i++) {
mt[i].shutdown();
zk[i].close();
}
for (int i = 0; i < 2; i++) {
Assert.assertTrue(
"waiting for server " + i + " being up",
ClientBase.waitForServerDown("127.0.0.1:"
+ oldClientPorts[i], CONNECTION_TIMEOUT * 2));
}
for (int i = 0; i < 2; i++) {
mt[i].writeTempDynamicConfigFile(nextQuorumCfgSection);
mt[i].start();
zk[i] = new ZooKeeper("127.0.0.1:" + clientPorts[i],
ClientBase.CONNECTION_TIMEOUT, this);
}
// new members are initialized with current config + the new server
for (int i = 2; i < SERVER_COUNT; i++) {
mt[i] = new MainThread(i, clientPorts[i], currentQuorumCfg
+ allServersNext.get(i));
mt[i].start();
zk[i] = new ZooKeeper("127.0.0.1:" + clientPorts[i],
ClientBase.CONNECTION_TIMEOUT, this);
}
for (int i = 0; i < SERVER_COUNT; i++) {
Assert.assertTrue("waiting for server " + i + " being up",
ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[i],
CONNECTION_TIMEOUT * 2));
ReconfigTest.testServerHasConfig(zk[i], allServersNext, null);
}
ReconfigTest.testNormalOperation(zk[0], zk[2]);
ReconfigTest.testNormalOperation(zk[4], zk[1]);
for (int i = 0; i < SERVER_COUNT; i++) {
zk[i].close();
mt[i].shutdown();
}
}
/**
* Reconfiguration recovery - test that if servers in old config have a
* .next file but no quorum of new config is up then no progress should be
* possible (no progress will happen to ensure safety as the new config
* might be actually up but partitioned from old config)
*/
@Test
public void testNextConfigUnreachable() throws Exception {
ClientBase.setupTestEnv();
// 2 servers in current config, 5 in next config
final int SERVER_COUNT = 5;
final int clientPorts[] = new int[SERVER_COUNT];
StringBuilder sb = new StringBuilder();
String server;
String currentQuorumCfgSection = null, nextQuorumCfgSection;
ArrayList<String> allServers = new ArrayList<String>();
for (int i = 0; i < SERVER_COUNT; i++) {
clientPorts[i] = PortAssignment.unique();
server = "server." + i + "=localhost:" + PortAssignment.unique()
+ ":" + PortAssignment.unique() + ":participant;localhost:"
+ clientPorts[i];
allServers.add(server);
sb.append(server + "\n");
if (i == 1)
currentQuorumCfgSection = sb.toString() + "version=100000000\n";
}
sb.append("version=200000000\n"); // version of current config is 100000000
nextQuorumCfgSection = sb.toString();
MainThread mt[] = new MainThread[SERVER_COUNT];
ZooKeeper zk[] = new ZooKeeper[SERVER_COUNT];
// Both servers 0 and 1 will have the .next config file, which means
// for them that a reconfiguration was in progress when they failed
for (int i = 0; i < 2; i++) {
mt[i] = new MainThread(i, clientPorts[i], currentQuorumCfgSection);
// note that we should run the server, shut it down and only then
// simulate a reconfig in progress by writing the temp file, but here no
// other server is competing with them in FLE, so we can skip this step
mt[i].writeTempDynamicConfigFile(nextQuorumCfgSection);
mt[i].start();
zk[i] = new ZooKeeper("127.0.0.1:" + clientPorts[i],
ClientBase.CONNECTION_TIMEOUT, this);
}
Thread.sleep(CONNECTION_TIMEOUT * 2);
// make sure servers 0, 1 don't come online - this should be the case
// since they can't complete the reconfig
for (int i = 0; i < 2; i++) {
Assert.assertFalse("server " + i + " is up but shouldn't be",
ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[i],
CONNECTION_TIMEOUT / 10));
}
for (int i = 0; i < 2; i++) {
zk[i].close();
mt[i].shutdown();
}
}
/**
* Reconfiguration recovery - test that old config members will join the new
* config if its already active, and not try to complete the reconfiguration
*/
@Test
public void testNextConfigAlreadyActive() throws Exception {
ClientBase.setupTestEnv();
// 2 servers in current config, 5 in next config
final int SERVER_COUNT = 5;
final int clientPorts[] = new int[SERVER_COUNT];
StringBuilder sb = new StringBuilder();
String server;
String currentQuorumCfgSection = null, nextQuorumCfgSection;
ArrayList<String> allServers = new ArrayList<String>();
for (int i = 0; i < SERVER_COUNT; i++) {
clientPorts[i] = PortAssignment.unique();
server = "server." + i + "=localhost:" + PortAssignment.unique()
+ ":" + PortAssignment.unique() + ":participant;localhost:"
+ clientPorts[i];
allServers.add(server);
sb.append(server + "\n");
if (i == 1) currentQuorumCfgSection = sb.toString() + "version=100000000\n";
}
sb.append("version=200000000\n"); // version of current config is 100000000
nextQuorumCfgSection = sb.toString();
// lets start servers 2, 3, 4 with the new config
MainThread mt[] = new MainThread[SERVER_COUNT];
ZooKeeper zk[] = new ZooKeeper[SERVER_COUNT];
for (int i = 2; i < SERVER_COUNT; i++) {
mt[i] = new MainThread(i, clientPorts[i], nextQuorumCfgSection);
mt[i].start();
zk[i] = new ZooKeeper("127.0.0.1:" + clientPorts[i],
ClientBase.CONNECTION_TIMEOUT, this);
}
for (int i = 2; i < SERVER_COUNT; i++) {
Assert.assertTrue("waiting for server " + i + " being up",
ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[i],
CONNECTION_TIMEOUT));
}
ReconfigTest.testNormalOperation(zk[2], zk[3]);
long epoch = mt[2].main.quorumPeer.getAcceptedEpoch();
// Both servers 0 and 1 will have the .next config file, which means
// for them that a reconfiguration was in progress when they failed
// and the leader will complete it.
for (int i = 0; i < 2; i++) {
mt[i] = new MainThread(i, clientPorts[i], currentQuorumCfgSection);
mt[i].writeTempDynamicConfigFile(nextQuorumCfgSection);
mt[i].start();
zk[i] = new ZooKeeper("127.0.0.1:" + clientPorts[i],
ClientBase.CONNECTION_TIMEOUT, this);
}
// servers 0 and 1 should connect to all servers, including the one in
// their .next file during startup, and will find the next config and join it
for (int i = 0; i < 2; i++) {
Assert.assertTrue("waiting for server " + i + " being up",
ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[i],
CONNECTION_TIMEOUT * 2));
}
// make sure they joined the new config without any change to it
Assert.assertEquals(epoch, mt[0].main.quorumPeer.getAcceptedEpoch());
Assert.assertEquals(epoch, mt[1].main.quorumPeer.getAcceptedEpoch());
Assert.assertEquals(epoch, mt[2].main.quorumPeer.getAcceptedEpoch());
ReconfigTest.testServerHasConfig(zk[0], allServers, null);
ReconfigTest.testServerHasConfig(zk[1], allServers, null);
ReconfigTest.testNormalOperation(zk[0], zk[2]);
ReconfigTest.testNormalOperation(zk[4], zk[1]);
for (int i = 0; i < SERVER_COUNT; i++) {
zk[i].close();
mt[i].shutdown();
}
}
/**
* Tests conversion of observer to participant AFTER new config was already
* committed. Old config: servers 0 (participant), 1 (participant), 2
* (observer) New config: servers 2 (participant), 3 (participant) We start
* server 2 with old config and start server 3 with new config. All other
* servers are down. In order to terminate FLE, server 3 must 'convince'
* server 2 to adopt the new config and turn into a participant.
*/
@Test
public void testObserverConvertedToParticipantDuringFLE() throws Exception {
ClientBase.setupTestEnv();
final int SERVER_COUNT = 4;
int[][] ports = generatePorts(SERVER_COUNT);
String currentQuorumCfgSection, nextQuorumCfgSection;
// generate old config string
HashSet<Integer> observers = new HashSet<Integer>();
observers.add(2);
StringBuilder sb = generateConfig(3, ports, observers);
sb.append("version=100000000");
currentQuorumCfgSection = sb.toString();
// generate new config string
ArrayList<String> allServersNext = new ArrayList<String>();
sb = new StringBuilder();
for (int i = 2; i < SERVER_COUNT; i++) {
String server = "server." + i + "=localhost:" + ports[i][0] + ":"
+ ports[i][1] + ":participant;localhost:" + ports[i][2];
allServersNext.add(server);
sb.append(server + "\n");
}
sb.append("version=200000000"); // version of current config is 100000000
nextQuorumCfgSection = sb.toString();
MainThread mt[] = new MainThread[SERVER_COUNT];
ZooKeeper zk[] = new ZooKeeper[SERVER_COUNT];
// start server 2 with old config, where it is an observer
mt[2] = new MainThread(2, ports[2][2], currentQuorumCfgSection);
mt[2].start();
zk[2] = new ZooKeeper("127.0.0.1:" + ports[2][2],
ClientBase.CONNECTION_TIMEOUT, this);
// start server 3 with new config
mt[3] = new MainThread(3, ports[3][2], nextQuorumCfgSection);
mt[3].start();
zk[3] = new ZooKeeper("127.0.0.1:" + ports[3][2],
ClientBase.CONNECTION_TIMEOUT, this);
for (int i = 2; i < SERVER_COUNT; i++) {
Assert.assertTrue("waiting for server " + i + " being up",
ClientBase.waitForServerUp("127.0.0.1:" + ports[i][2],
CONNECTION_TIMEOUT * 2));
ReconfigTest.testServerHasConfig(zk[i], allServersNext, null);
}
Assert.assertEquals(nextQuorumCfgSection,
ReconfigTest.testServerHasConfig(zk[2], null, null));
Assert.assertEquals(nextQuorumCfgSection,
ReconfigTest.testServerHasConfig(zk[3], null, null));
ReconfigTest.testNormalOperation(zk[2], zk[2]);
ReconfigTest.testNormalOperation(zk[3], zk[2]);
for (int i = 2; i < SERVER_COUNT; i++) {
zk[i].close();
mt[i].shutdown();
}
}
/**
* Tests conversion of observer to participant during reconfig recovery, new
* config was not committed yet. Old config: servers 0 (participant), 1
* (participant), 2 (observer) New config: servers 2 (participant), 3
* (participant) We start server servers 0, 1, 2 with old config and a .next
* file indicating a reconfig in progress. We start server 3 with old config
* + itself in config file. In this scenario server 2 can't be converted to
* participant during reconfig since we don't gossip about proposed
* configurations, only about committed ones. This tests that new config can
* be completed, which requires server 2's ack for the newleader message,
* even though its an observer.
*/
@Test
public void testCurrentObserverIsParticipantInNewConfig() throws Exception {
ClientBase.setupTestEnv();
final int SERVER_COUNT = 4;
int[][] ports = generatePorts(SERVER_COUNT);
String currentQuorumCfg, currentQuorumCfgSection, nextQuorumCfgSection;
// generate old config string
HashSet<Integer> observers = new HashSet<Integer>();
observers.add(2);
StringBuilder sb = generateConfig(3, ports, observers);
currentQuorumCfg = sb.toString();
sb.append("version=100000000");
currentQuorumCfgSection = sb.toString();
// Run servers 0..2 for a while
MainThread mt[] = new MainThread[SERVER_COUNT];
ZooKeeper zk[] = new ZooKeeper[SERVER_COUNT];
for (int i = 0; i <= 2; i++) {
mt[i] = new MainThread(i, ports[i][2], currentQuorumCfgSection);
mt[i].start();
zk[i] = new ZooKeeper("127.0.0.1:" + ports[i][2],
ClientBase.CONNECTION_TIMEOUT, this);
}
ReconfigTest.testNormalOperation(zk[0], zk[2]);
for (int i = 0; i <= 2; i++) {
Assert.assertTrue("waiting for server " + i + " being up",
ClientBase.waitForServerUp("127.0.0.1:" + ports[i][2],
CONNECTION_TIMEOUT * 2));
}
// shut servers 0..2 down
for (int i = 0; i <= 2; i++) {
mt[i].shutdown();
zk[i].close();
}
// generate new config string
ArrayList<String> allServersNext = new ArrayList<String>();
sb = new StringBuilder();
for (int i = 2; i < SERVER_COUNT; i++) {
String server = "server." + i + "=localhost:" + ports[i][0] + ":"
+ ports[i][1] + ":participant;localhost:" + ports[i][2];
allServersNext.add(server);
sb.append(server + "\n");
}
sb.append("version=200000000"); // version of current config is 100000000
nextQuorumCfgSection = sb.toString();
// simulate reconfig in progress - servers 0..2 have a temp reconfig
// file when they boot
for (int i = 0; i <= 2; i++) {
mt[i].writeTempDynamicConfigFile(nextQuorumCfgSection);
mt[i].start();
zk[i] = new ZooKeeper("127.0.0.1:" + ports[i][2],
ClientBase.CONNECTION_TIMEOUT, this);
}
// new server 3 has still its invalid joiner config - everyone in old
// config + itself
mt[3] = new MainThread(3, ports[3][2], currentQuorumCfg
+ allServersNext.get(1));
mt[3].start();
zk[3] = new ZooKeeper("127.0.0.1:" + ports[3][2],
ClientBase.CONNECTION_TIMEOUT, this);
for (int i = 2; i < SERVER_COUNT; i++) {
Assert.assertTrue("waiting for server " + i + " being up",
ClientBase.waitForServerUp("127.0.0.1:" + ports[i][2],
CONNECTION_TIMEOUT * 2));
ReconfigTest.testServerHasConfig(zk[i], allServersNext, null);
}
ReconfigTest.testNormalOperation(zk[0], zk[2]);
ReconfigTest.testNormalOperation(zk[3], zk[1]);
Assert.assertEquals(nextQuorumCfgSection,
ReconfigTest.testServerHasConfig(zk[2], null, null));
Assert.assertEquals(nextQuorumCfgSection,
ReconfigTest.testServerHasConfig(zk[3], null, null));
for (int i = 0; i < SERVER_COUNT; i++) {
zk[i].close();
mt[i].shutdown();
}
}
/*
* Generates 3 ports per server
*/
private int[][] generatePorts(int numServers) {
int[][] ports = new int[numServers][];
for (int i = 0; i < numServers; i++) {
ports[i] = new int[3];
for (int j = 0; j < 3; j++) {
ports[i][j] = PortAssignment.unique();
}
}
return ports;
}
/*
* Creates a configuration string for servers 0..numServers-1 Ids in
* observerIds correspond to observers, other ids are for participants.
*/
private StringBuilder generateConfig(int numServers, int[][] ports,
HashSet<Integer> observerIds) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < numServers; i++) {
String server = "server." + i + "=localhost:" + ports[i][0] + ":"
+ ports[i][1] + ":"
+ (observerIds.contains(i) ? "observer" : "participant")
+ ";localhost:" + ports[i][2];
sb.append(server + "\n");
}
return sb;
}
} | {
"content_hash": "b56eb9db35ebb3c5af26b9b1e5d9b4dd",
"timestamp": "",
"source": "github",
"line_count": 570,
"max_line_length": 100,
"avg_line_length": 41.90350877192982,
"alnum_prop": 0.5730793384969646,
"repo_name": "JulyKe/ZooKeeper350",
"id": "1a090dc95038587ba484a0628feb509e628239fa",
"size": "24691",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/java/test/org/apache/zookeeper/server/quorum/ReconfigRecoveryTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4635"
},
{
"name": "C",
"bytes": "717978"
},
{
"name": "C++",
"bytes": "1008032"
},
{
"name": "CSS",
"bytes": "4016"
},
{
"name": "HTML",
"bytes": "41619"
},
{
"name": "Java",
"bytes": "4415204"
},
{
"name": "JavaScript",
"bytes": "239387"
},
{
"name": "M4",
"bytes": "77455"
},
{
"name": "Makefile",
"bytes": "183403"
},
{
"name": "Mako",
"bytes": "13678"
},
{
"name": "Perl",
"bytes": "226860"
},
{
"name": "Perl6",
"bytes": "72008"
},
{
"name": "Python",
"bytes": "181842"
},
{
"name": "Roff",
"bytes": "698106"
},
{
"name": "Shell",
"bytes": "432022"
},
{
"name": "XS",
"bytes": "132670"
},
{
"name": "XSLT",
"bytes": "6024"
}
],
"symlink_target": ""
} |
using Bridge.Contract;
using Bridge.Contract.Constants;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.CSharp.Resolver;
using ICSharpCode.NRefactory.Semantics;
using ICSharpCode.NRefactory.TypeSystem;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Bridge.Translator
{
public class GeneratorBlock : AbstractEmitterBlock, IAsyncBlock
{
public GeneratorBlock(IEmitter emitter, MethodDeclaration methodDeclaration)
: base(emitter, methodDeclaration)
{
this.Emitter = emitter;
this.MethodDeclaration = methodDeclaration;
}
public GeneratorBlock(IEmitter emitter, LambdaExpression lambdaExpression)
: base(emitter, lambdaExpression)
{
this.Emitter = emitter;
this.LambdaExpression = lambdaExpression;
}
public GeneratorBlock(IEmitter emitter, AnonymousMethodExpression anonymousMethodExpression)
: base(emitter, anonymousMethodExpression)
{
this.Emitter = emitter;
this.AnonymousMethodExpression = anonymousMethodExpression;
}
public GeneratorBlock(IEmitter emitter, Accessor accessor)
: base(emitter, accessor)
{
this.Emitter = emitter;
this.Accessor = accessor;
}
public AstNode Node
{
get
{
if (this.MethodDeclaration != null)
{
return this.MethodDeclaration;
}
if (this.AnonymousMethodExpression != null)
{
return this.AnonymousMethodExpression;
}
if (this.LambdaExpression != null)
{
return this.LambdaExpression;
}
if (this.Accessor != null)
{
return this.Accessor;
}
return null;
}
}
public MethodDeclaration MethodDeclaration
{
get;
set;
}
public LambdaExpression LambdaExpression
{
get;
set;
}
public AnonymousMethodExpression AnonymousMethodExpression
{
get;
set;
}
public Accessor Accessor
{
get;
set;
}
public List<IAsyncJumpLabel> JumpLabels
{
get;
set;
}
public AstNode Body
{
get
{
if (this.MethodDeclaration != null)
{
return this.MethodDeclaration.Body;
}
if (this.LambdaExpression != null)
{
return this.LambdaExpression.Body;
}
if (this.AnonymousMethodExpression != null)
{
return this.AnonymousMethodExpression.Body;
}
if (this.Accessor != null)
{
return this.Accessor.Body;
}
return null;
}
}
public List<string> Parameters
{
get
{
AstNodeCollection<ParameterDeclaration> prms = null;
AstNodeCollection<TypeParameterDeclaration> tprms = null;
if (this.MethodDeclaration != null)
{
prms = this.MethodDeclaration.Parameters;
if (this.MethodDeclaration.TypeParameters.Count > 0 &&
!Helpers.IsIgnoreGeneric(this.MethodDeclaration, this.Emitter))
{
tprms = this.MethodDeclaration.TypeParameters;
}
}
else if (this.LambdaExpression != null)
{
prms = this.LambdaExpression.Parameters;
}
else if (this.AnonymousMethodExpression != null)
{
prms = this.AnonymousMethodExpression.Parameters;
}
var result = new List<string>();
if (tprms != null)
{
foreach (var typeParameterDeclaration in tprms)
{
result.Add(typeParameterDeclaration.Name);
}
}
if (prms != null)
{
foreach (var parameterDeclaration in prms)
{
var name = this.Emitter.GetParameterName(parameterDeclaration);
if (this.Emitter.LocalsNamesMap != null && this.Emitter.LocalsNamesMap.ContainsKey(name))
{
name = this.Emitter.LocalsNamesMap[name];
}
result.Add(name);
}
}
return result;
}
}
protected bool PreviousIsAync
{
get;
set;
}
protected bool PreviousIsYield
{
get;
set;
}
protected List<string> PreviousAsyncVariables
{
get;
set;
}
protected IAsyncBlock PreviousAsyncBlock
{
get;
set;
}
public AstNode[] AwaitExpressions
{
get;
set;
}
public List<AstNode> WrittenAwaitExpressions
{
get;
set;
}
public IType ReturnType
{
get;
set;
}
public bool IsTaskReturn
{
get;
set;
}
public bool IsEnumeratorReturn
{
get;
set;
}
public int Step
{
get;
set;
}
public List<IAsyncStep> Steps
{
get;
set;
}
public List<IAsyncStep> EmittedAsyncSteps
{
get;
set;
}
public bool ReplaceAwaiterByVar
{
get;
set;
}
public List<IAsyncTryInfo> TryInfos
{
get;
set;
}
public void InitAsyncBlock()
{
this.PreviousIsAync = this.Emitter.IsAsync;
this.PreviousIsYield = this.Emitter.IsYield;
this.Emitter.IsAsync = true;
this.Emitter.IsYield = true;
this.PreviousAsyncVariables = this.Emitter.AsyncVariables;
this.Emitter.AsyncVariables = new List<string>();
this.PreviousAsyncBlock = this.Emitter.AsyncBlock;
this.Emitter.AsyncBlock = this;
this.ReplaceAwaiterByVar = this.Emitter.ReplaceAwaiterByVar;
this.Emitter.ReplaceAwaiterByVar = false;
this.DetectReturnType();
this.FindAwaitNodes();
this.Steps = new List<IAsyncStep>();
this.TryInfos = new List<IAsyncTryInfo>();
this.JumpLabels = new List<IAsyncJumpLabel>();
this.WrittenAwaitExpressions = new List<AstNode>();
}
protected void FindAwaitNodes()
{
this.AwaitExpressions = this.GetAwaiters(this.Body);
}
protected void DetectReturnType()
{
if (this.MethodDeclaration != null)
{
this.ReturnType = this.Emitter.Resolver.ResolveNode(this.MethodDeclaration.ReturnType, this.Emitter).Type;
}
else if (this.LambdaExpression != null)
{
this.ReturnType = ((LambdaResolveResult)this.Emitter.Resolver.ResolveNode(this.LambdaExpression, this.Emitter)).ReturnType;
}
else if (this.AnonymousMethodExpression != null)
{
this.ReturnType = ((LambdaResolveResult)this.Emitter.Resolver.ResolveNode(this.AnonymousMethodExpression, this.Emitter)).ReturnType;
}
else if (this.Accessor != null)
{
this.ReturnType = this.Emitter.Resolver.ResolveNode(((EntityDeclaration)this.Accessor.Parent).ReturnType, this.Emitter).Type;
}
IsEnumeratorReturn = this.ReturnType.Name == "IEnumerator";
}
protected void FinishGeneratorBlock()
{
this.Emitter.IsAsync = this.PreviousIsAync;
this.Emitter.IsYield = this.PreviousIsYield;
this.Emitter.AsyncVariables = this.PreviousAsyncVariables;
this.Emitter.AsyncBlock = this.PreviousAsyncBlock;
this.Emitter.ReplaceAwaiterByVar = this.ReplaceAwaiterByVar;
}
protected override void DoEmit()
{
this.Emit(false);
}
public void Emit(bool skipInit)
{
if (!skipInit)
{
this.InitAsyncBlock();
}
this.EmitGeneratorBlock();
this.FinishGeneratorBlock();
}
protected void EmitGeneratorBlock()
{
this.BeginBlock();
var args = this.Parameters;
if (!IsEnumeratorReturn)
{
this.WriteReturn(true);
this.Write("new ");
if (this.ReturnType.IsParameterized)
{
this.Write("(Bridge.GeneratorEnumerable$1(" + BridgeTypes.ToJsName(this.ReturnType.TypeArguments[0], this.Emitter) + "))");
}
else
{
this.Write("Bridge.GeneratorEnumerable");
}
this.WriteOpenParentheses();
this.Write(JS.Funcs.BRIDGE_BIND + "(this, ");
this.WriteFunction();
if (args.Count > 0)
{
this.WriteOpenParentheses();
for (int i = 0; i < args.Count; i++)
{
this.Write(args[i]);
if (i < args.Count - 1)
{
this.Write(", ");
}
}
this.WriteCloseParentheses();
}
else
{
this.WriteOpenCloseParentheses(true);
}
this.WriteSpace();
this.BeginBlock();
}
this.WriteVar(true);
this.Write(JS.Vars.ASYNC_STEP + " = 0");
this.Emitter.Comma = true;
this.Indent();
// This is required to add async variables into Emitter.AsyncVariables and emit them prior to body
IWriterInfo writerInfo = this.SaveWriter();
StringBuilder body = this.NewWriter();
Emitter.ResetLevel(writerInfo.Level - 1);
this.EmitGeneratorBody();
this.RestoreWriter(writerInfo);
foreach (var localVar in this.Emitter.AsyncVariables)
{
this.EnsureComma(true);
this.Write(localVar);
this.Emitter.Comma = true;
}
this.Emitter.Comma = false;
this.WriteSemiColon();
this.Outdent();
this.WriteNewLine();
this.WriteNewLine();
this.WriteVar(true);
this.Write(JS.Vars.ENUMERATOR + " = new ");
if (this.ReturnType.IsParameterized)
{
this.Write("(" + JS.Types.Bridge.Generator.NAME_GENERIC +"(" + BridgeTypes.ToJsName(this.ReturnType.TypeArguments[0], this.Emitter) + "))");
}
else
{
this.Write(JS.Types.Bridge.Generator.NAME);
}
this.WriteOpenParentheses();
this.Write(JS.Funcs.BRIDGE_BIND + "(this, ");
this.WriteFunction();
this.WriteOpenCloseParentheses(true);
this.Write(body);
this.WriteCloseParentheses();
this.EmitFinallyHandler();
this.WriteCloseParentheses();
this.WriteSemiColon();
this.WriteNewLine();
this.WriteReturn(true);
this.Write(JS.Vars.ENUMERATOR);
this.WriteSemiColon();
this.WriteNewLine();
if (!IsEnumeratorReturn)
{
this.EndBlock();
if (args.Count > 0)
{
this.Write(", arguments");
}
this.WriteCloseParentheses();
this.WriteCloseParentheses();
this.WriteSemiColon();
this.WriteNewLine();
}
this.EndBlock();
}
protected void EmitGeneratorBody()
{
this.BeginBlock();
var asyncTryVisitor = new AsyncTryVisitor();
this.Node.AcceptChildren(asyncTryVisitor);
var needTry = true;
this.Emitter.AsyncVariables.Add(JS.Vars.ASYNC_JUMP);
if (needTry)
{
this.Emitter.AsyncVariables.Add(JS.Vars.ASYNC_RETURN_VALUE);
this.WriteTry();
this.BeginBlock();
}
this.WriteFor();
this.Write("(;;) ");
this.BeginBlock();
this.WriteSwitch();
this.Write("(" + JS.Vars.ASYNC_STEP + ") ");
this.BeginBlock();
this.Step = 0;
var writer = this.SaveWriter();
this.AddAsyncStep();
this.Body.AcceptVisitor(this.Emitter);
this.RestoreWriter(writer);
this.InjectSteps();
this.WriteNewLine();
this.EndBlock();
this.WriteNewLine();
this.EndBlock();
if (needTry)
{
if (!this.Emitter.Locals.ContainsKey(JS.Vars.ASYNC_E))
{
this.AddLocal(JS.Vars.ASYNC_E, null, AstType.Null);
}
this.WriteNewLine();
this.EndBlock();
this.Write(" catch(" + JS.Vars.ASYNC_E1 + ") ");
this.BeginBlock();
this.Write(JS.Vars.ASYNC_E + " = " + JS.Types.System.Exception.CREATE + "(" + JS.Vars.ASYNC_E1 + ");");
this.WriteNewLine();
this.InjectCatchHandlers();
this.WriteNewLine();
this.EndBlock();
}
this.WriteNewLine();
this.EndBlock();
}
protected void InjectCatchHandlers()
{
var infos = this.TryInfos;
foreach(var info in infos)
{
if (info.CatchBlocks.Count > 0)
{
this.WriteIf();
this.WriteOpenParentheses(true);
this.Write(string.Format(JS.Vars.ASYNC_STEP + " >= {0} && " + JS.Vars.ASYNC_STEP + " <= {1}", info.StartStep, info.EndStep));
this.WriteCloseParentheses(true);
this.BeginBlock();
var firstClause = true;
for(int i = 0; i < info.CatchBlocks.Count; i++)
{
var clause = info.CatchBlocks[i];
var varName = clause.Item1;
var exceptionType = clause.Item2;
var step = clause.Item3;
var isBaseException = exceptionType == JS.Types.System.Exception.NAME;
if (info.CatchBlocks.Count == 1 && isBaseException)
{
if (!string.IsNullOrEmpty(varName))
{
this.Write(varName + " = " + JS.Vars.ASYNC_E + ";");
this.WriteNewLine();
}
this.Write(JS.Vars.ASYNC_STEP + " = " + step + ";");
this.WriteNewLine();
this.Write(JS.Vars.ENUMERATOR + "." + JS.Funcs.ASYNC_YIELD_BODY + "();");
this.WriteNewLine();
this.Write("return;");
}
else
{
if (!firstClause)
{
this.WriteSpace();
this.WriteElse();
}
if (!isBaseException)
{
this.WriteIf();
this.WriteOpenParentheses();
this.Write(JS.Types.Bridge.IS + "(" + JS.Vars.ASYNC_E + ", " + exceptionType + ")");
this.WriteCloseParentheses();
this.WriteSpace();
}
firstClause = false;
this.BeginBlock();
if (!string.IsNullOrEmpty(varName))
{
this.Write(varName + " = " + JS.Vars.ASYNC_E + ";");
this.WriteNewLine();
}
this.Write(JS.Vars.ASYNC_STEP + " = " + step + ";");
this.WriteNewLine();
this.Write(JS.Vars.ENUMERATOR + "." + JS.Funcs.ASYNC_YIELD_BODY + "();");
this.WriteNewLine();
this.Write("return;");
this.WriteNewLine();
this.EndBlock();
}
}
this.WriteNewLine();
this.EndBlock();
this.WriteNewLine();
}
if (info.FinallyStep > 0)
{
if (!this.Emitter.Locals.ContainsKey(JS.Vars.ASYNC_E))
{
this.AddLocal(JS.Vars.ASYNC_E, null, AstType.Null);
}
this.WriteIf();
this.WriteOpenParentheses();
this.Write(string.Format(JS.Vars.ASYNC_STEP + " >= {0} && " + JS.Vars.ASYNC_STEP + " <= {1}", info.StartStep, info.CatchBlocks.Count > 0 ? info.CatchBlocks.Last().Item4 : info.EndStep));
this.WriteCloseParentheses();
this.BeginBlock();
//this.Write(Variables.E + " = " + Variables.ASYNC_E + ";");
this.WriteNewLine();
this.Write(JS.Vars.ASYNC_STEP + " = " + info.FinallyStep + ";");
this.WriteNewLine();
this.Write(JS.Vars.ENUMERATOR + "." + JS.Funcs.ASYNC_YIELD_BODY + "();");
this.WriteNewLine();
this.Write("return;");
this.WriteNewLine();
this.EndBlock();
this.WriteNewLine();
}
}
this.Write("throw " + JS.Vars.ASYNC_E + ";");
}
protected bool EmitFinallyHandler()
{
var infos = this.TryInfos;
bool needHeader = true;
foreach (var info in infos)
{
if (info.FinallyStep > 0)
{
if (!this.Emitter.Locals.ContainsKey(JS.Vars.ASYNC_E))
{
this.AddLocal(JS.Vars.ASYNC_E, null, AstType.Null);
}
if (needHeader)
{
this.Write(", function () ");
this.BeginBlock();
needHeader = false;
}
this.WriteIf();
this.WriteOpenParentheses();
this.Write(string.Format(JS.Vars.ASYNC_STEP + " >= {0} && " + JS.Vars.ASYNC_STEP + " <= {1}", info.StartStep, info.CatchBlocks.Count > 0 ? info.CatchBlocks.Last().Item4 : info.EndStep));
this.WriteCloseParentheses();
this.BeginBlock();
this.WriteNewLine();
this.Write(JS.Vars.ASYNC_STEP + " = " + info.FinallyStep + ";");
this.WriteNewLine();
this.Write(JS.Vars.ENUMERATOR + "." + JS.Funcs.ASYNC_YIELD_BODY + "();");
this.WriteNewLine();
this.Write("return;");
this.WriteNewLine();
this.EndBlock();
this.WriteNewLine();
}
}
if (!needHeader)
{
this.WriteNewLine();
this.EndBlock();
}
return !needHeader;
}
protected void InjectSteps()
{
foreach(var label in this.JumpLabels)
{
var tostep = this.Steps.First(s => s.Node == label.Node);
label.Output.Replace(Helpers.PrefixDollar("{", label.Node.GetHashCode(), "}"), tostep.Step.ToString());
}
for(int i = 0; i < this.Steps.Count; i++)
{
var step = this.Steps[i];
if (i != 0)
{
this.WriteNewLine();
}
var output = step.Output.ToString();
var cleanOutput = this.RemoveTokens(output);
this.Write("case " + i + ": ");
this.BeginBlock();
bool addNewLine = false;
if (!string.IsNullOrWhiteSpace(cleanOutput))
{
if (addNewLine)
{
this.WriteNewLine();
}
this.Write(this.WriteIndentToString(output.TrimEnd()));
}
if (!this.IsOnlyWhitespaceOnPenultimateLine(false))
{
addNewLine = true;
}
if (step.JumpToStep > -1 && !AbstractEmitterBlock.IsJumpStatementLast(cleanOutput))
{
if (addNewLine)
{
this.WriteNewLine();
}
this.Write(JS.Vars.ASYNC_STEP + " = " + step.JumpToStep + ";");
this.WriteNewLine();
this.Write("continue;");
}
else if (step.JumpToNode != null && !AbstractEmitterBlock.IsJumpStatementLast(cleanOutput))
{
var tostep = this.Steps.First(s => s.Node == step.JumpToNode);
if (addNewLine)
{
this.WriteNewLine();
}
this.Write(JS.Vars.ASYNC_STEP + " = " + tostep.Step + ";");
this.WriteNewLine();
this.Write("continue;");
}
else if (i == (this.Steps.Count - 1) && !AbstractEmitterBlock.IsReturnLast(cleanOutput))
{
if (addNewLine)
{
this.WriteNewLine();
}
}
this.WriteNewLine();
this.EndBlock();
}
this.WriteNewLine();
this.Write("default: ");
this.BeginBlock();
this.Write("return false;");
this.WriteNewLine();
this.EndBlock();
}
public IAsyncStep AddAsyncStep(int fromTaskNumber = -1)
{
var step = this.Step++;
var asyncStep = new AsyncStep(this.Emitter, step, fromTaskNumber);
this.Steps.Add(asyncStep);
return asyncStep;
}
public IAsyncStep AddAsyncStep(AstNode node)
{
var asyncStep = this.AddAsyncStep();
asyncStep.Node = node;
return asyncStep;
}
public bool IsParentForAsync(AstNode child)
{
if (child is IfElseStatement)
{
return false;
}
else
{
foreach(var awaiter in this.AwaitExpressions)
{
if (child.IsInside(awaiter.StartLocation))
{
return true;
}
}
}
return false;
}
}
public class GeneratorStep : IAsyncStep
{
public GeneratorStep(IEmitter emitter, int step)
{
this.Step = step;
this.Emitter = emitter;
this.JumpToStep = -1;
if (this.Emitter.LastSavedWriter != null)
{
this.Emitter.LastSavedWriter.Comma = this.Emitter.Comma;
this.Emitter.LastSavedWriter.IsNewLine = this.Emitter.IsNewLine;
this.Emitter.LastSavedWriter.Level = this.Emitter.Level;
this.Emitter.LastSavedWriter = null;
}
this.Output = new StringBuilder();
this.Emitter.Output = this.Output;
this.Emitter.IsNewLine = false;
this.Emitter.ResetLevel();
this.Emitter.Comma = false;
}
public int FromTaskNumber
{
get;
set;
}
public int JumpToStep
{
get;
set;
}
public AstNode JumpToNode
{
get;
set;
}
public AstNode Node
{
get;
set;
}
public int Step
{
get;
set;
}
protected IEmitter Emitter
{
get;
set;
}
public StringBuilder Output
{
get;
set;
}
public object Label
{
get; set;
}
}
public class GeneratorJumpLabel : IAsyncJumpLabel
{
public StringBuilder Output
{
get;
set;
}
public AstNode Node
{
get;
set;
}
}
} | {
"content_hash": "53a94ba552cc201f20778695a39e3cbd",
"timestamp": "",
"source": "github",
"line_count": 901,
"max_line_length": 206,
"avg_line_length": 29.58490566037736,
"alnum_prop": 0.44237695078031214,
"repo_name": "bridgedotnet/Bridge",
"id": "a75ff828958494007aa136db1f86f732769affc2",
"size": "26658",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Compiler/Translator/Emitter/Blocks/GeneratorBlock.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4769"
},
{
"name": "C#",
"bytes": "23533024"
},
{
"name": "CSS",
"bytes": "507"
},
{
"name": "HTML",
"bytes": "190"
},
{
"name": "JavaScript",
"bytes": "3937"
},
{
"name": "PowerShell",
"bytes": "5284"
},
{
"name": "Shell",
"bytes": "7698"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CafeinaXml.XReflection.DataStructures.Reflection
{
internal class ListReflection
{
private static Dictionary<Type, ListReflected> Precached = new Dictionary<Type,ListReflected>();
public static ListReflected Reflect(Type type)
{
if (Precached.ContainsKey(type))
{
return Precached[type];
}
ListReflected listReflected = new ListReflected(
type.GetProperty("Count").GetGetMethod(),
type.GetProperty("Item").GetGetMethod(),
type.GetMethod("Add")
);
listReflected.Structure = StructureClassifier.GetStructure(type);
listReflected.GenericType = listReflected.Structure.GenericType[0];
listReflected.GenericTypeStructure = StructureClassifier.GetStructure(listReflected.GenericType);
Precached.Add(type, listReflected);
return listReflected;
}
private ListReflection()
{ }
}
}
| {
"content_hash": "dbb5f10adc9d19c661f0794eb6731c31",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 109,
"avg_line_length": 30.62162162162162,
"alnum_prop": 0.6248896734333628,
"repo_name": "dacanizares/CafeinaXml",
"id": "f0830131ed9cbc203b7b5bec9b7daa6d3680733b",
"size": "1135",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CafeinaXml/XReflection/DataStructures/Reflection/ListReflection.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "46398"
},
{
"name": "HTML",
"bytes": "8780"
}
],
"symlink_target": ""
} |
require("./proof")(4, function (step, compiler, schema, placeholder, equal, deepEqual) {
var structure, expected, actual, length;
var compilation =
compiler.compile(" \
SELECT *,\
(SELECT * \
FROM Product AS products ON products.manufacturerId = manufacturer.id) \
FROM Manufacturer AS manufacturer \
", schema, placeholder);
equal(compilation.structure.sql.trim().replace(/\s+/g, ' '),
'SELECT manufacturer.id AS manufacturer__id, manufacturer.name AS manufacturer__name \
FROM Manufacturer AS manufacturer'.replace(/\s+/g, ' '), 'query');
equal(compilation.structure.temporary, 'relatable_temporary_1', 'query temporary');
var join = compilation.structure.joins[0];
equal(join.sql.trim().replace(/\s+/g, ' '),
'SELECT products.id AS products__id, \
products.manufacturerId AS products__manufacturerId, \
products.manufacturerCode AS products__manufacturerCode, \
products.name AS products__name \
FROM relatable_temporary_1 AS manufacturer \
JOIN Product AS products ON products.manufacturerId = manufacturer.manufacturer__id \
'.trim().replace(/\s+/g, ' '), 'sub query');
equal(join.pivot, 'products', 'pivot');
});
| {
"content_hash": "7edca1cf74ee90eed4b4c4251ae8ce76",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 97,
"avg_line_length": 50.38461538461539,
"alnum_prop": 0.632824427480916,
"repo_name": "bigeasy/relatable",
"id": "223af176c37450f87ff2687ea088e96881ad36bb",
"size": "1331",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "t/compiler/sub-select.t.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "117270"
},
{
"name": "Shell",
"bytes": "701"
}
],
"symlink_target": ""
} |
<?php
/**
* This file has been @generated by a phing task by {@link BuildMetadataPHPFromXml}.
* See [README.md](README.md#generating-data) for more information.
*
* Pull requests changing data in these files will not be accepted. See the
* [FAQ in the README](README.md#problems-with-invalid-numbers] on how to make
* metadata changes.
*
* Do not modify this file directly!
*/
return array (
'generalDesc' =>
array (
'NationalNumberPattern' => '[14]\\d{2,3}',
'PossibleLength' =>
array (
0 => 3,
1 => 4,
),
'PossibleLengthLocalOnly' =>
array (
),
),
'tollFree' =>
array (
'NationalNumberPattern' => 'NA',
'PossibleLength' =>
array (
0 => -1,
),
'PossibleLengthLocalOnly' =>
array (
),
),
'premiumRate' =>
array (
'NationalNumberPattern' => 'NA',
'PossibleLength' =>
array (
0 => -1,
),
'PossibleLengthLocalOnly' =>
array (
),
),
'emergency' =>
array (
'NationalNumberPattern' => '10[123]',
'ExampleNumber' => '101',
'PossibleLength' =>
array (
0 => 3,
),
'PossibleLengthLocalOnly' =>
array (
),
),
'shortCode' =>
array (
'NationalNumberPattern' => '10[123]|4040',
'ExampleNumber' => '101',
'PossibleLength' =>
array (
),
'PossibleLengthLocalOnly' =>
array (
),
),
'standardRate' =>
array (
'NationalNumberPattern' => 'NA',
'PossibleLength' =>
array (
0 => -1,
),
'PossibleLengthLocalOnly' =>
array (
),
),
'carrierSpecific' =>
array (
'NationalNumberPattern' => '4040',
'ExampleNumber' => '4040',
'PossibleLength' =>
array (
0 => 4,
),
'PossibleLengthLocalOnly' =>
array (
),
),
'id' => 'KG',
'countryCode' => 0,
'internationalPrefix' => '',
'sameMobileAndFixedLinePattern' => false,
'numberFormat' =>
array (
),
'intlNumberFormat' =>
array (
),
'mainCountryForCode' => false,
'leadingZeroPossible' => false,
'mobileNumberPortableRegion' => false,
);
| {
"content_hash": "f5ab611ba4015faa4cfddd6cf3a5e694",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 84,
"avg_line_length": 19.47222222222222,
"alnum_prop": 0.548264384213029,
"repo_name": "42php/42php",
"id": "84f2928a8ee7e3c2935ac94ea11026bf6e12cb2b",
"size": "2103",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "vendor/libphonenumber/data/ShortNumberMetadata_KG.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "71"
},
{
"name": "CSS",
"bytes": "185"
},
{
"name": "JavaScript",
"bytes": "5488"
},
{
"name": "PHP",
"bytes": "132301"
},
{
"name": "Shell",
"bytes": "95"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Hymenomyc. eur. (Upsaliae) 550 (1874)
#### Original name
Boletus carpineus Sowerby, 1799
### Remarks
null | {
"content_hash": "bff641df6fddf789fe6ae4f508d94d78",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 14.846153846153847,
"alnum_prop": 0.7150259067357513,
"repo_name": "mdoering/backbone",
"id": "d6b2fd2a46edbdf3c24728aa25be02d973c584a2",
"size": "269",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Basidiomycota/Agaricomycetes/Polyporales/Meruliaceae/Bjerkandera/Bjerkandera adusta/ Syn. Polyporus adustus carpineus/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package com.jayway.jsonpath.internal;
import com.jayway.jsonpath.JsonPathException;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamClass;
import java.io.OutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public final class Utils {
public static final String CR = System.getProperty("line.separator");
/**
* Creates a range of integers from start (inclusive) to end (exclusive)
*
* @param start
* @param end
* @return
*/
public static List<Integer> createRange(int start, int end) {
if (end <= start) {
throw new IllegalArgumentException("Cannot create range from " + start + " to " + end + ", end must be greater than start.");
}
if (start == end-1) {
return Collections.emptyList();
}
List<Integer> range = new ArrayList<Integer>(end-start-1);
for (int i = start; i < end; i++) {
range.add(i);
}
return range;
}
// accept a collection of objects, since all objects have toString()
public static String join(String delimiter, String wrap, Iterable<? extends Object> objs) {
Iterator<? extends Object> iter = objs.iterator();
if (!iter.hasNext()) {
return "";
}
StringBuilder buffer = new StringBuilder();
buffer.append(wrap).append(iter.next()).append(wrap);
while (iter.hasNext()) {
buffer.append(delimiter).append(wrap).append(iter.next()).append(wrap);
}
return buffer.toString();
}
// accept a collection of objects, since all objects have toString()
public static String join(String delimiter, Iterable<? extends Object> objs) {
return join(delimiter, "", objs);
}
//---------------------------------------------------------
//
// IO
//
//---------------------------------------------------------
public static void closeQuietly(Closeable closeable) {
try {
if (closeable != null) {
closeable.close();
}
} catch (IOException ignore) {
}
}
//---------------------------------------------------------
//
// Strings
//
//---------------------------------------------------------
public static boolean isInt(String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0; i < sz; i++) {
if (Character.isDigit(str.charAt(i)) == false) {
return false;
}
}
return true;
}
public static boolean isNumeric(String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0; i < sz; i++) {
if (Character.isDigit(str.charAt(i)) == false && !(str.charAt(i) == '.')) {
return false;
}
}
return true;
}
/**
* <p>Checks if a CharSequence is empty ("") or null.</p>
* <p/>
* <pre>
* StringUtils.isEmpty(null) = true
* StringUtils.isEmpty("") = true
* StringUtils.isEmpty(" ") = false
* StringUtils.isEmpty("bob") = false
* StringUtils.isEmpty(" bob ") = false
* </pre>
* <p/>
* <p>NOTE: This method changed in Lang version 2.0.
* It no longer trims the CharSequence.
* That functionality is available in isBlank().</p>
*
* @param cs the CharSequence to check, may be null
* @return {@code true} if the CharSequence is empty or null
* @since 3.0 Changed signature from isEmpty(String) to isEmpty(CharSequence)
*/
public static boolean isEmpty(CharSequence cs) {
return cs == null || cs.length() == 0;
}
/**
* Used by the indexOf(CharSequence methods) as a green implementation of indexOf.
*
* @param cs the {@code CharSequence} to be processed
* @param searchChar the {@code CharSequence} to be searched for
* @param start the start index
* @return the index where the search sequence was found
*/
static int indexOf(CharSequence cs, CharSequence searchChar, int start) {
return cs.toString().indexOf(searchChar.toString(), start);
}
/**
* <p>Counts how many times the substring appears in the larger string.</p>
* <p/>
* <p>A {@code null} or empty ("") String input returns {@code 0}.</p>
* <p/>
* <pre>
* StringUtils.countMatches(null, *) = 0
* StringUtils.countMatches("", *) = 0
* StringUtils.countMatches("abba", null) = 0
* StringUtils.countMatches("abba", "") = 0
* StringUtils.countMatches("abba", "a") = 2
* StringUtils.countMatches("abba", "ab") = 1
* StringUtils.countMatches("abba", "xxx") = 0
* </pre>
*
* @param str the CharSequence to check, may be null
* @param sub the substring to count, may be null
* @return the number of occurrences, 0 if either CharSequence is {@code null}
* @since 3.0 Changed signature from countMatches(String, String) to countMatches(CharSequence, CharSequence)
*/
public static int countMatches(CharSequence str, CharSequence sub) {
if (isEmpty(str) || isEmpty(sub)) {
return 0;
}
int count = 0;
int idx = 0;
while ((idx = indexOf(str, sub, idx)) != -1) {
count++;
idx += sub.length();
}
return count;
}
//---------------------------------------------------------
//
// Validators
//
//---------------------------------------------------------
/**
* <p>Validate that the specified argument is not {@code null};
* otherwise throwing an exception with the specified message.
* <p/>
* <pre>Validate.notNull(myObject, "The object must not be null");</pre>
*
* @param <T> the object type
* @param object the object to check
* @param message the {@link String#format(String, Object...)} exception message if invalid, not null
* @param values the optional values for the formatted exception message
* @return the validated object (never {@code null} for method chaining)
* @throws NullPointerException if the object is {@code null}
*/
public static <T> T notNull(T object, String message, Object... values) {
if (object == null) {
throw new IllegalArgumentException(String.format(message, values));
}
return object;
}
/**
* <p>Validate that the argument condition is {@code true}; otherwise
* throwing an exception with the specified message. This method is useful when
* validating according to an arbitrary boolean expression, such as validating a
* primitive number or using your own custom validation expression.</p>
* <p/>
* <pre>Validate.isTrue(i > 0.0, "The value must be greater than zero: %d", i);</pre>
* <p/>
* <p>For performance reasons, the long value is passed as a separate parameter and
* appended to the exception message only in the case of an error.</p>
*
* @param expression the boolean expression to check
* @param message
* @throws IllegalArgumentException if expression is {@code false}
*/
public static void isTrue(boolean expression, String message) {
if (expression == false) {
throw new IllegalArgumentException(message);
}
}
/**
* <p>Validate that the specified argument character sequence is
* neither {@code null} nor a length of zero (no characters);
* otherwise throwing an exception with the specified message.
* <p/>
* <pre>Validate.notEmpty(myString, "The string must not be empty");</pre>
*
* @param <T> the character sequence type
* @param chars the character sequence to check, validated not null by this method
* @param message the {@link String#format(String, Object...)} exception message if invalid, not null
* @param values the optional values for the formatted exception message, null array not recommended
* @return the validated character sequence (never {@code null} method for chaining)
* @throws NullPointerException if the character sequence is {@code null}
* @throws IllegalArgumentException if the character sequence is empty
*/
public static <T extends CharSequence> T notEmpty(T chars, String message, Object... values) {
if (chars == null) {
throw new IllegalArgumentException(String.format(message, values));
}
if (chars.length() == 0) {
throw new IllegalArgumentException(String.format(message, values));
}
return chars;
}
//---------------------------------------------------------
//
// Converters
//
//---------------------------------------------------------
public static String toString(Object o) {
if (null == o) {
return null;
}
return o.toString();
}
//---------------------------------------------------------
//
// Serialization
//
//---------------------------------------------------------
/**
* <p>Serializes an {@code Object} to the specified stream.</p>
* <p/>
* <p>The stream will be closed once the object is written.
* This avoids the need for a finally clause, and maybe also exception
* handling, in the application code.</p>
* <p/>
* <p>The stream passed in is not buffered internally within this method.
* This is the responsibility of your application if desired.</p>
*
* @param obj the object to serialize to bytes, may be null
* @param outputStream the stream to write to, must not be null
* @throws IllegalArgumentException if {@code outputStream} is {@code null}
* @throws RuntimeException (runtime) if the serialization fails
*/
public static void serialize(Serializable obj, OutputStream outputStream) {
if (outputStream == null) {
throw new IllegalArgumentException("The OutputStream must not be null");
}
ObjectOutputStream out = null;
try {
// stream closed in the finally
out = new ObjectOutputStream(outputStream);
out.writeObject(obj);
} catch (IOException ex) {
throw new JsonPathException(ex);
} finally {
try {
if (out != null) {
out.close();
}
} catch (IOException ex) { // NOPMD
// ignore close exception
}
}
}
/**
* <p>Serializes an {@code Object} to a byte array for
* storage/serialization.</p>
*
* @param obj the object to serialize to bytes
* @return a byte[] with the converted Serializable
* @throws RuntimeException (runtime) if the serialization fails
*/
public static byte[] serialize(Serializable obj) {
ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
serialize(obj, baos);
return baos.toByteArray();
}
// Deserialize
//-----------------------------------------------------------------------
/**
* <p>Deserializes an {@code Object} from the specified stream.</p>
* <p/>
* <p>The stream will be closed once the object is written. This
* avoids the need for a finally clause, and maybe also exception
* handling, in the application code.</p>
* <p/>
* <p>The stream passed in is not buffered internally within this method.
* This is the responsibility of your application if desired.</p>
*
* @param inputStream the serialized object input stream, must not be null
* @return the deserialized object
* @throws IllegalArgumentException if {@code inputStream} is {@code null}
* @throws RuntimeException (runtime) if the serialization fails
*/
public static Object deserialize(InputStream inputStream) {
if (inputStream == null) {
throw new IllegalArgumentException("The InputStream must not be null");
}
ObjectInputStream in = null;
try {
// stream closed in the finally
in = new ObjectInputStream(inputStream);
return in.readObject();
} catch (ClassNotFoundException ex) {
throw new JsonPathException(ex);
} catch (IOException ex) {
throw new JsonPathException(ex);
} finally {
try {
if (in != null) {
in.close();
}
} catch (IOException ex) { // NOPMD
// ignore close exception
}
}
}
/**
* <p>Deserializes a single {@code Object} from an array of bytes.</p>
*
* @param objectData the serialized object, must not be null
* @return the deserialized object
* @throws IllegalArgumentException if {@code objectData} is {@code null}
* @throws RuntimeException (runtime) if the serialization fails
*/
public static Object deserialize(byte[] objectData) {
if (objectData == null) {
throw new IllegalArgumentException("The byte[] must not be null");
}
ByteArrayInputStream bais = new ByteArrayInputStream(objectData);
return deserialize(bais);
}
/**
* <p>Custom specialization of the standard JDK {@link java.io.ObjectInputStream}
* that uses a custom <code>ClassLoader</code> to resolve a class.
* If the specified <code>ClassLoader</code> is not able to resolve the class,
* the context classloader of the current thread will be used.
* This way, the standard deserialization work also in web-application
* containers and application servers, no matter in which of the
* <code>ClassLoader</code> the particular class that encapsulates
* serialization/deserialization lives. </p>
* <p/>
* <p>For more in-depth information about the problem for which this
* class here is a workaround, see the JIRA issue LANG-626. </p>
*/
static class ClassLoaderAwareObjectInputStream extends ObjectInputStream {
private ClassLoader classLoader;
/**
* Constructor.
*
* @param in The <code>InputStream</code>.
* @param classLoader classloader to use
* @throws IOException if an I/O error occurs while reading stream header.
* @see java.io.ObjectInputStream
*/
public ClassLoaderAwareObjectInputStream(InputStream in, ClassLoader classLoader) throws IOException {
super(in);
this.classLoader = classLoader;
}
/**
* Overriden version that uses the parametrized <code>ClassLoader</code> or the <code>ClassLoader</code>
* of the current <code>Thread</code> to resolve the class.
*
* @param desc An instance of class <code>ObjectStreamClass</code>.
* @return A <code>Class</code> object corresponding to <code>desc</code>.
* @throws IOException Any of the usual Input/Output exceptions.
* @throws ClassNotFoundException If class of a serialized object cannot be found.
*/
@Override
protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
String name = desc.getName();
try {
return Class.forName(name, false, classLoader);
} catch (ClassNotFoundException ex) {
return Class.forName(name, false, Thread.currentThread().getContextClassLoader());
}
}
}
private Utils () {}
}
| {
"content_hash": "ba6c4d2bed5052577509c1509b3a20b2",
"timestamp": "",
"source": "github",
"line_count": 434,
"max_line_length": 137,
"avg_line_length": 37.19124423963134,
"alnum_prop": 0.5775974227123475,
"repo_name": "NetNow/JsonPath",
"id": "ce6e24ef212a4554432097dc26e53101d918f4cb",
"size": "16754",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "json-path/src/main/java/com/jayway/jsonpath/internal/Utils.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "6380"
},
{
"name": "HTML",
"bytes": "15940"
},
{
"name": "Java",
"bytes": "547006"
},
{
"name": "JavaScript",
"bytes": "3809"
}
],
"symlink_target": ""
} |
<?php
$here = dirname(__FILE__);
$yii = $here . '/../yii/framework/yii.php';
$config = $here . '/protected/config/main.php';
// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
require_once($yii);
Yii::createWebApplication($config)->run();
| {
"content_hash": "73b03a51a0654a200664589ba9ec99f4",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 76,
"avg_line_length": 33.15384615384615,
"alnum_prop": 0.6983758700696056,
"repo_name": "jessesiu/gigadb",
"id": "bb051f949b70346d1ee6b181c8cffa515a8930dc",
"size": "431",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "index.php",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "30"
},
{
"name": "Batchfile",
"bytes": "397"
},
{
"name": "CSS",
"bytes": "168250"
},
{
"name": "HTML",
"bytes": "36198"
},
{
"name": "JavaScript",
"bytes": "388543"
},
{
"name": "Makefile",
"bytes": "3874"
},
{
"name": "PHP",
"bytes": "967610"
},
{
"name": "Python",
"bytes": "830"
},
{
"name": "Shell",
"bytes": "4403"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Alternate PHP Syntax for View Files : CodeIgniter User Guide</title>
<style type='text/css' media='all'>@import url('../userguide.css');</style>
<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
<script type="text/javascript" src="../nav/nav.js"></script>
<script type="text/javascript" src="../nav/prototype.lite.js"></script>
<script type="text/javascript" src="../nav/moo.fx.js"></script>
<script type="text/javascript" src="../nav/user_guide_menu.js"></script>
<meta http-equiv='expires' content='-1' />
<meta http-equiv= 'pragma' content='no-cache' />
<meta name='robots' content='all' />
<meta name='author' content='ExpressionEngine Dev Team' />
<meta name='description' content='CodeIgniter User Guide' />
</head>
<body>
<!-- START NAVIGATION -->
<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td><h1>CodeIgniter User Guide Version 2.1.0</h1></td>
<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
</tr>
</table>
</div>
<!-- END NAVIGATION -->
<!-- START BREADCRUMB -->
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td id="breadcrumb">
<a href="http://codeigniter.com/">CodeIgniter Home</a> ›
<a href="../index.html">User Guide Home</a> ›
Alternate PHP Syntax
</td>
<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" /> <input type="submit" class="submit" name="sa" value="Go" /></form></td>
</tr>
</table>
<!-- END BREADCRUMB -->
<br clear="all" />
<!-- START CONTENT -->
<div id="content">
<h1>Alternate PHP Syntax for View Files</h1>
<p>If you do not utilize CodeIgniter's <a href="../libraries/parser.html">template engine</a>, you'll be using pure PHP
in your View files. To minimize the PHP code in these files, and to make it easier to identify the code blocks it is recommended that you use
PHPs alternative syntax for control structures and short tag echo statements. If you are not familiar with this syntax, it allows you to eliminate the braces from your code,
and eliminate "echo" statements.</p>
<h2>Automatic Short Tag Support</h2>
<p><strong>Note:</strong> If you find that the syntax described in this page does not work on your server it might
be that "short tags" are disabled in your PHP ini file. CodeIgniter will optionally rewrite short tags on-the-fly,
allowing you to use that syntax even if your server doesn't support it. This feature can be enabled in your
<dfn>config/config.php</dfn> file.</p>
<p class="important">Please note that if you do use this feature, if PHP errors are encountered
in your <strong>view files</strong>, the error message and line number will not be accurately shown. Instead, all errors
will be shown as <kbd>eval()</kbd> errors.</p>
<h2>Alternative Echos</h2>
<p>Normally to echo, or print out a variable you would do this:</p>
<code><?php echo $variable; ?></code>
<p>With the alternative syntax you can instead do it this way:</p>
<code><?=$variable?></code>
<h2>Alternative Control Structures</h2>
<p>Controls structures, like <var>if</var>, <var>for</var>, <var>foreach</var>, and <var>while</var> can be
written in a simplified format as well. Here is an example using foreach:</p>
<code>
<ul><br />
<br />
<var><?php foreach ($todo as $item): ?></var><br />
<br />
<li><var><?=$item?></var></li><br />
<br />
<var><?php endforeach; ?></var><br />
<br />
</ul></code>
<p>Notice that there are no braces. Instead, the end brace is replaced with <var>endforeach</var>.
Each of the control structures listed above has a similar closing syntax:
<var>endif</var>, <var>endfor</var>, <var>endforeach</var>, and <var>endwhile</var></p>
<p>Also notice that instead of using a semicolon after each structure (except the last one), there is a colon. This is
important!</p>
<p>Here is another example, using if/elseif/else. Notice the colons:</p>
<code><var><?php if ($username == 'sally'): ?></var><br />
<br />
<h3>Hi Sally</h3><br />
<br />
<var><?php elseif ($username == 'joe'): ?></var><br />
<br />
<h3>Hi Joe</h3><br />
<br />
<var><?php else: ?></var><br />
<br />
<h3>Hi unknown user</h3><br />
<br />
<var><?php endif; ?></var></code>
</div>
<!-- END CONTENT -->
<div id="footer">
<p>
Previous Topic: <a href="managing_apps.html">Managing Applications</a>
·
<a href="#top">Top of Page</a> ·
<a href="../index.html">User Guide Home</a> ·
Next Topic: <a href="security.html">Security</a>
</p>
<p><a href="http://codeigniter.com">CodeIgniter</a> · Copyright © 2006 - 2011 · <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
</div>
</body>
</html> | {
"content_hash": "704cc8bfdea402bb1282353d58db333e",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 383,
"avg_line_length": 39.48299319727891,
"alnum_prop": 0.6783252929014473,
"repo_name": "FANMixco/gravitynow",
"id": "6e601af44283e51b3585f851452b1a0f862a6d80",
"size": "5804",
"binary": false,
"copies": "15",
"ref": "refs/heads/master",
"path": "Web/user_guide/general/alternative_php.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "26"
},
{
"name": "C#",
"bytes": "308469"
},
{
"name": "CSS",
"bytes": "44752"
},
{
"name": "HTML",
"bytes": "1315551"
},
{
"name": "JavaScript",
"bytes": "76101"
},
{
"name": "PHP",
"bytes": "1264171"
},
{
"name": "PowerShell",
"bytes": "6274"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<title>Download - Thymeleaf</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="icon" href="images/favicon.ico"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu:400,400italic,700,700italic"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic,700italic"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/2.1.3/normalize.min.css" media="screen"/>
<link rel="stylesheet" href="styles/thymeleaf.css" media="screen"/>
<script src="https://unpkg.com/[email protected]/dumb-query-selector.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/prism.min.js" data-manual
defer integrity="sha256-HWJnMZHGx7U1jmNfxe4yaQedmpo/mtxWSIXvcJkLIf4=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/plugins/unescaped-markup/prism-unescaped-markup.js"
defer integrity="sha256-THYQfN3ZkC8QQ5I4JxslpEaXIT7tUakaV9/e69MYEuU=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/plugins/normalize-whitespace/prism-normalize-whitespace.min.js"
defer integrity="sha256-abVQckxqXkWO8NiZk8TBPHzv3/LObzIqzzQWz0kV0F0=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/plugins/line-numbers/prism-line-numbers.js"
defer integrity="sha256-ISWqAwOAxClmLCu22st3+xU4+kVYHrE8jdn6ONzjg5Q=" crossorigin="anonymous"></script>
<script src="scripts/thymeleaf.js" defer></script>
</head>
<body id="thymeleaf-downloads">
<div class="fluid-container toolbar-container">
<nav class="fluid-block toolbar">
<div class="toolbar-menu">
<div class="toolbar-menu-location">Download</div>
<button id="site-menu-button" type="button" class="toolbar-menu-button">Site Menu</button>
</div>
<div id="site-menu" class="toolbar-menu-items">
<ul class="toolbar-links">
<li><a href="index.html" class="toolbar-link">Home</a></li>
<li class="selected"><a href="download.html" class="toolbar-link">Download</a></li>
<li><a href="documentation.html" class="toolbar-link">Docs</a></li>
<li><a href="ecosystem.html" class="toolbar-link">Ecosystem</a></li>
<li><a href="faq.html" class="toolbar-link">FAQ</a></li>
</ul>
<ul id="site-nav-links" class="toolbar-links">
<li><a href="https://twitter.com/thymeleaf" class="toolbar-link">Twitter</a></li>
<li><a href="https://github.com/thymeleaf" class="toolbar-link">GitHub</a></li>
</ul>
</div>
</nav>
</div>
<div class="hero-container fluid-container">
<header class="hero-header fluid-block">
<div class="hero-header-text">
<h1 class="hero-header-title">Thymeleaf</h1>
</div>
<div class="hero-header-image">
<img src="images/thymeleaf.png" alt="Thymeleaf logo" class="hero-header-logo"/>
</div>
</header>
</div>
<div class="fluid-container">
<main class="fluid-block">
<section class="description">
<p>
<strong>Thymeleaf 3.0.15.RELEASE</strong> is the current stable version. It requires <strong>Java SE 6</strong> or newer.
</p>
<ul>
<li>Release date: 31 January 2022</li>
<li>Release notes: <a href="releasenotes.html#thymeleaf-3.0.15">Thymeleaf 3.0.15 release notes</a></li>
</ul>
</section>
<section>
<header>
<h2>
<a id="maven-gradle" href="#maven-gradle" class="anchor"></a>
Maven/Gradle
</h2>
</header>
<p>The easiest way to include Thymeleaf in your project is to use a
build system like Maven or Gradle and make use of the Thymeleaf artifacts
living in the Central Repository. All you need to do is add the Thymeleaf
dependencies you need to your project:</p>
<div class="table-scroller">
<table>
<thead>
<tr>
<th>Module</th>
<th>Group ID</th>
<th>Artifact ID</th>
</tr>
</thead>
<tbody>
<tr>
<td>Core library</td>
<td><code>org.thymeleaf</code></td>
<td><code>thymeleaf</code></td>
</tr>
<tr>
<td>Spring 3 integration</td>
<td><code>org.thymeleaf</code></td>
<td><code>thymeleaf-spring3</code></td>
</tr>
<tr>
<td>Spring 4 integration</td>
<td><code>org.thymeleaf</code></td>
<td><code>thymeleaf-spring4</code></td>
</tr>
<tr>
<td>Spring 5 integration</td>
<td><code>org.thymeleaf</code></td>
<td><code>thymeleaf-spring5</code></td>
</tr>
<tr>
<td>Testing library</td>
<td><code>org.thymeleaf</code></td>
<td><code>thymeleaf-testing</code></td>
</tr>
<tr>
<td>Spring Security 3 integration</td>
<td><code>org.thymeleaf.extras</code></td>
<td><code>thymeleaf-extras-springsecurity3</code></td>
</tr>
<tr>
<td>Spring Security 4 integration</td>
<td><code>org.thymeleaf.extras</code></td>
<td><code>thymeleaf-extras-springsecurity4</code></td>
</tr>
<tr>
<td>Java 8 Time API compatibility</td>
<td><code>org.thymeleaf.extras</code></td>
<td><code>thymeleaf-extras-java8time</code></td>
</tr>
<tr>
<td>Tiles 2 integration</td>
<td><code>org.thymeleaf.extras</code></td>
<td><code>thymeleaf-extras-tiles2</code></td>
</tr>
<tr>
<td>IE Conditional Comments support</td>
<td><code>org.thymeleaf.extras</code></td>
<td><code>thymeleaf-extras-conditionalcomments</code></td>
</tr>
</tbody>
</table>
</div>
<p>
An example:
</p>
<pre class="line-numbers"><code class="language-xml"><!--
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>3.0.15.RELEASE</version>
</dependency>
--></code></pre>
</section>
<section>
<header>
<h2>
<a id="distribution-packages" href="#distribution-packages" class="anchor"></a>
Distribution packages
</h2>
</header>
<p>
In case you don't use a build tool such as Maven or Gradle, we also offer a
complete distribution package containing binaries, source, javadoc and dependencies
in the form of a convenient <tt>.zip</tt> file, which you can download from
our <a href="https://github.com/thymeleaf/thymeleaf-dist/releases/" target="_blank"><strong>GitHub's</strong>
releases distribution</a>.
</p>
</section>
<section>
<header>
<h2>
<a id="sources" href="#sources" class="anchor"></a>
Sources
</h2>
</header>
<p>Thymeleaf's source code is available on <a href="https://github.com/thymeleaf">GitHub</a>. Here are the main repositories:</p>
<div class="table-scroller">
<table>
<thead>
<tr>
<th>Module</th>
<th>Repository</th>
</tr>
</thead>
<tbody>
<tr>
<td>Core library</td>
<td><a href="https://github.com/thymeleaf/thymeleaf">https://github.com/thymeleaf/thymeleaf</a></td>
</tr>
<tr>
<td>Spring integration</td>
<td><a href="https://github.com/thymeleaf/thymeleaf-spring">https://github.com/thymeleaf/thymeleaf-spring</a></td>
</tr>
<tr>
<td>Documentation</td>
<td><a href="https://github.com/thymeleaf/thymeleaf-docs">https://github.com/thymeleaf/thymeleaf-docs</a></td>
</tr>
<tr>
<td>Testing library</td>
<td><a href="https://github.com/thymeleaf/thymeleaf-testing">https://github.com/thymeleaf/thymeleaf-testing</a></td>
</tr>
<tr>
<td>Test suites</td>
<td><a href="https://github.com/thymeleaf/thymeleaf-tests">https://github.com/thymeleaf/thymeleaf-tests</a></td>
</tr>
<tr>
<td>Benchmarks</td>
<td><a href="https://github.com/thymeleaf/thymeleaf-benchmarks">https://github.com/thymeleaf/thymeleaf-benchmarks</a></td>
</tr>
<tr>
<td>Spring Security integration</td>
<td><a href="https://github.com/thymeleaf/thymeleaf-extras-springsecurity">https://github.com/thymeleaf/thymeleaf-extras-springsecurity</a></td>
</tr>
<tr>
<td>Java 8 Time API compatibility</td>
<td><a href="https://github.com/thymeleaf/thymeleaf-extras-java8time">https://github.com/thymeleaf/thymeleaf-extras-java8time</a></td>
</tr>
<tr>
<td>Tiles 2 integration</td>
<td><a href="https://github.com/thymeleaf/thymeleaf-extras-tiles2">https://github.com/thymeleaf/thymeleaf-extras-tiles2</a></td>
</tr>
<tr>
<td>IE Conditional Comments support</td>
<td><a href="https://github.com/thymeleaf/thymeleaf-extras-conditionalcomments">https://github.com/thymeleaf/thymeleaf-extras-conditionalcomments</a></td>
</tr>
</tbody>
</table>
</div>
</section>
<section>
<header>
<h2>
<a id="artwork" href="#artwork" class="anchor"></a>
Artwork
</h2>
</header>
<p>
If you need to use the Thymeleaf logo, you can just copy the one below, or have a look
<a href="https://github.com/thymeleaf/thymeleaf-dist/tree/master/src/artwork/thymeleaf%202016">here</a> and
find several versions of it along with instructions on how to use it.
</p>
<img src="https://raw.githubusercontent.com/thymeleaf/thymeleaf-org/main/artwork/thymeleaf%202016/thymeleaf_logo_white.png"/>
<p>
The Thymeleaf Artwork by The Thymeleaf Project is licensed under the Creative Commons
<a href="http://creativecommons.org/licenses/by-sa/3.0/">CC BY-SA 3.0 License</a>. Note that
this license only applies to the Thymeleaf artwork, and specifically does not apply to software
published by the Thymeleaf project nor to the names, logos or other artwork of companies
or projects using Thymeleaf, even if displayed on this website.
</p>
</section>
</main>
</div>
<div class="fluid-container footer-container">
<footer class="footer fluid-block">
<div class="footer-sections">
<h5>On this site</h5>
<ul class="footer-sections-links">
<li><a href="index.html">Home</a></li>
<li><a href="download.html">Download</a></li>
<li><a href="documentation.html">Docs</a></li>
<li><a href="ecosystem.html">Ecosystem</a></li>
<li><a href="faq.html">FAQ</a></li>
<li id="footer-issue-tracking"><a href="issuetracking.html">Issue Tracking</a></li>
<li><a href="team.html">The Thymeleaf Team</a></li>
<li><a href="whoisusingthymeleaf.html">Who's using Thymeleaf?</a></li>
</ul>
</div>
<div>
<h5>External links</h5>
<ul class="footer-sections-links">
<li><a href="https://twitter.com/thymeleaf">Follow us on Twitter</a></li>
<li><a href="https://github.com/thymeleaf">Fork us on GitHub</a></li>
</ul>
</div>
</footer>
<div class="copyright fluid-block">Copyright © The Thymeleaf Team</div>
<div class="license fluid-block">
Thymeleaf is <strong>open source</strong> software distributed under the
<a href="https://www.apache.org/licenses/LICENSE-2.0.html">Apache License 2.0</a><br/>
This website (excluding the names and logos of Thymeleaf users) is licensed under the <a href="http://creativecommons.org/licenses/by-sa/3.0/">CC BY-SA 3.0 License</a>
</div>
</div>
</body>
</html>
| {
"content_hash": "6420cda5072a0df519161a394acca41b",
"timestamp": "",
"source": "github",
"line_count": 305,
"max_line_length": 170,
"avg_line_length": 37.99672131147541,
"alnum_prop": 0.6331003537837605,
"repo_name": "thymeleaf/thymeleaf-dist",
"id": "71c3a196d894eddb20c4f957daf752b355c78a2c",
"size": "11589",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "src/site/download.html",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "11425"
},
{
"name": "HTML",
"bytes": "231847"
},
{
"name": "JavaScript",
"bytes": "995"
}
],
"symlink_target": ""
} |
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* 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.
*/
/*
* $Id: CharInfo.java,v 1.2.4.1 2005/09/15 08:15:14 suresh_emailid Exp $
*/
package com.sun.org.apache.xml.internal.serializer;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
import com.sun.org.apache.xml.internal.serializer.utils.SystemIDResolver;
import com.sun.org.apache.xml.internal.serializer.utils.Utils;
import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Locale;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
import javax.xml.transform.TransformerException;
/**
* This class provides services that tell if a character should have
* special treatement, such as entity reference substitution or normalization
* of a newline character. It also provides character to entity reference
* lookup.
*
* DEVELOPERS: See Known Issue in the constructor.
*
* @xsl.usage internal
*/
final class CharInfo
{
/** Given a character, lookup a String to output (e.g. a decorated entity reference). */
private HashMap m_charToString = new HashMap();
/**
* The name of the HTML entities file.
* If specified, the file will be resource loaded with the default class loader.
*/
public static final String HTML_ENTITIES_RESOURCE =
"com.sun.org.apache.xml.internal.serializer.HTMLEntities";
/**
* The name of the XML entities file.
* If specified, the file will be resource loaded with the default class loader.
*/
public static final String XML_ENTITIES_RESOURCE =
"com.sun.org.apache.xml.internal.serializer.XMLEntities";
/** The horizontal tab character, which the parser should always normalize. */
public static final char S_HORIZONAL_TAB = 0x09;
/** The linefeed character, which the parser should always normalize. */
public static final char S_LINEFEED = 0x0A;
/** The carriage return character, which the parser should always normalize. */
public static final char S_CARRIAGERETURN = 0x0D;
/** This flag is an optimization for HTML entities. It false if entities
* other than quot (34), amp (38), lt (60) and gt (62) are defined
* in the range 0 to 127.
* @xsl.usage internal
*/
final boolean onlyQuotAmpLtGt;
/** Copy the first 0,1 ... ASCII_MAX values into an array */
private static final int ASCII_MAX = 128;
/** Array of values is faster access than a set of bits
* to quickly check ASCII characters in attribute values.
*/
private boolean[] isSpecialAttrASCII = new boolean[ASCII_MAX];
/** Array of values is faster access than a set of bits
* to quickly check ASCII characters in text nodes.
*/
private boolean[] isSpecialTextASCII = new boolean[ASCII_MAX];
private boolean[] isCleanTextASCII = new boolean[ASCII_MAX];
/** An array of bits to record if the character is in the set.
* Although information in this array is complete, the
* isSpecialAttrASCII array is used first because access to its values
* is common and faster.
*/
private int array_of_bits[] = createEmptySetOfIntegers(65535);
// 5 for 32 bit words, 6 for 64 bit words ...
/*
* This constant is used to shift an integer to quickly
* calculate which element its bit is stored in.
* 5 for 32 bit words (int) , 6 for 64 bit words (long)
*/
private static final int SHIFT_PER_WORD = 5;
/*
* A mask to get the low order bits which are used to
* calculate the value of the bit within a given word,
* that will represent the presence of the integer in the
* set.
*
* 0x1F for 32 bit words (int),
* or 0x3F for 64 bit words (long)
*/
private static final int LOW_ORDER_BITMASK = 0x1f;
/*
* This is used for optimizing the lookup of bits representing
* the integers in the set. It is the index of the first element
* in the array array_of_bits[] that is not used.
*/
private int firstWordNotUsed;
/**
* Constructor that reads in a resource file that describes the mapping of
* characters to entity references.
* This constructor is private, just to force the use
* of the getCharInfo(entitiesResource) factory
*
* Resource files must be encoded in UTF-8 and can either be properties
* files with a .properties extension assumed. Alternatively, they can
* have the following form, with no particular extension assumed:
*
* <pre>
* # First char # is a comment
* Entity numericValue
* quot 34
* amp 38
* </pre>
*
* @param entitiesResource Name of properties or resource file that should
* be loaded, which describes that mapping of characters to entity
* references.
*/
private CharInfo(String entitiesResource, String method)
{
this(entitiesResource, method, false);
}
private CharInfo(String entitiesResource, String method, boolean internal)
{
ResourceBundle entities = null;
boolean noExtraEntities = true;
// Make various attempts to interpret the parameter as a properties
// file or resource file, as follows:
//
// 1) attempt to load .properties file using ResourceBundle
// 2) try using the class loader to find the specified file a resource
// file
// 3) try treating the resource a URI
try {
if (internal) {
// Load entity property files by using PropertyResourceBundle,
// cause of security issure for applets
entities = PropertyResourceBundle.getBundle(entitiesResource);
} else {
ClassLoader cl = SecuritySupport.getContextClassLoader();
if (cl != null) {
entities = PropertyResourceBundle.getBundle(entitiesResource,
Locale.getDefault(), cl);
}
}
} catch (Exception e) {}
if (entities != null) {
Enumeration keys = entities.getKeys();
while (keys.hasMoreElements()){
String name = (String) keys.nextElement();
String value = entities.getString(name);
int code = Integer.parseInt(value);
defineEntity(name, (char) code);
if (extraEntity(code))
noExtraEntities = false;
}
set(S_LINEFEED);
set(S_CARRIAGERETURN);
} else {
InputStream is = null;
String err = null;
// Load user specified resource file by using URL loading, it
// requires a valid URI as parameter
try {
if (internal) {
is = CharInfo.class.getResourceAsStream(entitiesResource);
} else {
ClassLoader cl = SecuritySupport.getContextClassLoader();
if (cl != null) {
try {
is = cl.getResourceAsStream(entitiesResource);
} catch (Exception e) {
err = e.getMessage();
}
}
if (is == null) {
try {
URL url = new URL(entitiesResource);
is = url.openStream();
} catch (Exception e) {
err = e.getMessage();
}
}
}
if (is == null) {
throw new RuntimeException(
Utils.messages.createMessage(
MsgKey.ER_RESOURCE_COULD_NOT_FIND,
new Object[] {entitiesResource, err}));
}
// Fix Bugzilla#4000: force reading in UTF-8
// This creates the de facto standard that Xalan's resource
// files must be encoded in UTF-8. This should work in all
// JVMs.
//
// %REVIEW% KNOWN ISSUE: IT FAILS IN MICROSOFT VJ++, which
// didn't implement the UTF-8 encoding. Theoretically, we should
// simply let it fail in that case, since the JVM is obviously
// broken if it doesn't support such a basic standard. But
// since there are still some users attempting to use VJ++ for
// development, we have dropped in a fallback which makes a
// second attempt using the platform's default encoding. In VJ++
// this is apparently ASCII, which is subset of UTF-8... and
// since the strings we'll be reading here are also primarily
// limited to the 7-bit ASCII range (at least, in English
// versions of Xalan), this should work well enough to keep us
// on the air until we're ready to officially decommit from
// VJ++.
BufferedReader reader;
try {
reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
} catch (UnsupportedEncodingException e) {
reader = new BufferedReader(new InputStreamReader(is));
}
String line = reader.readLine();
while (line != null) {
if (line.length() == 0 || line.charAt(0) == '#') {
line = reader.readLine();
continue;
}
int index = line.indexOf(' ');
if (index > 1) {
String name = line.substring(0, index);
++index;
if (index < line.length()) {
String value = line.substring(index);
index = value.indexOf(' ');
if (index > 0) {
value = value.substring(0, index);
}
int code = Integer.parseInt(value);
defineEntity(name, (char) code);
if (extraEntity(code))
noExtraEntities = false;
}
}
line = reader.readLine();
}
is.close();
set(S_LINEFEED);
set(S_CARRIAGERETURN);
} catch (Exception e) {
throw new RuntimeException(
Utils.messages.createMessage(
MsgKey.ER_RESOURCE_COULD_NOT_LOAD,
new Object[] { entitiesResource,
e.toString(),
entitiesResource,
e.toString()}));
} finally {
if (is != null) {
try {
is.close();
} catch (Exception except) {}
}
}
}
/* initialize the array isCleanTextASCII[] with a cache of values
* for use by ToStream.character(char[], int , int)
* and the array isSpecialTextASCII[] with the opposite values
* (all in the name of performance!)
*/
for (int ch = 0; ch <ASCII_MAX; ch++)
if((((0x20 <= ch || (0x0A == ch || 0x0D == ch || 0x09 == ch)))
&& (!get(ch))) || ('"' == ch))
{
isCleanTextASCII[ch] = true;
isSpecialTextASCII[ch] = false;
}
else {
isCleanTextASCII[ch] = false;
isSpecialTextASCII[ch] = true;
}
onlyQuotAmpLtGt = noExtraEntities;
// initialize the array with a cache of the BitSet values
for (int i=0; i<ASCII_MAX; i++)
isSpecialAttrASCII[i] = get(i);
/* Now that we've used get(ch) just above to initialize the
* two arrays we will change by adding a tab to the set of
* special chars for XML (but not HTML!).
* We do this because a tab is always a
* special character in an XML attribute,
* but only a special character in XML text
* if it has an entity defined for it.
* This is the reason for this delay.
*/
if (Method.XML.equals(method))
{
isSpecialAttrASCII[S_HORIZONAL_TAB] = true;
}
}
/**
* Defines a new character reference. The reference's name and value are
* supplied. Nothing happens if the character reference is already defined.
* <p>Unlike internal entities, character references are a string to single
* character mapping. They are used to map non-ASCII characters both on
* parsing and printing, primarily for HTML documents. '<amp;' is an
* example of a character reference.</p>
*
* @param name The entity's name
* @param value The entity's value
*/
private void defineEntity(String name, char value)
{
StringBuilder sb = new StringBuilder("&");
sb.append(name);
sb.append(';');
String entityString = sb.toString();
defineChar2StringMapping(entityString, value);
}
/**
* Map a character to a String. For example given
* the character '>' this method would return the fully decorated
* entity name "<".
* Strings for entity references are loaded from a properties file,
* but additional mappings defined through calls to defineChar2String()
* are possible. Such entity reference mappings could be over-ridden.
*
* This is reusing a stored key object, in an effort to avoid
* heap activity. Unfortunately, that introduces a threading risk.
* Simplest fix for now is to make it a synchronized method, or to give
* up the reuse; I see very little performance difference between them.
* Long-term solution would be to replace the hashtable with a sparse array
* keyed directly from the character's integer value; see DTM's
* string pool for a related solution.
*
* @param value The character that should be resolved to
* a String, e.g. resolve '>' to "<".
*
* @return The String that the character is mapped to, or null if not found.
* @xsl.usage internal
*/
String getOutputStringForChar(char value)
{
CharKey charKey = new CharKey();
charKey.setChar(value);
return (String) m_charToString.get(charKey);
}
/**
* Tell if the character argument that is from
* an attribute value should have special treatment.
*
* @param value the value of a character that is in an attribute value
* @return true if the character should have any special treatment,
* such as when writing out attribute values,
* or entity references.
* @xsl.usage internal
*/
final boolean isSpecialAttrChar(int value)
{
// for performance try the values in the boolean array first,
// this is faster access than the BitSet for common ASCII values
if (value < ASCII_MAX)
return isSpecialAttrASCII[value];
// rather than java.util.BitSet, our private
// implementation is faster (and less general).
return get(value);
}
/**
* Tell if the character argument that is from a
* text node should have special treatment.
*
* @param value the value of a character that is in a text node
* @return true if the character should have any special treatment,
* such as when writing out attribute values,
* or entity references.
* @xsl.usage internal
*/
final boolean isSpecialTextChar(int value)
{
// for performance try the values in the boolean array first,
// this is faster access than the BitSet for common ASCII values
if (value < ASCII_MAX)
return isSpecialTextASCII[value];
// rather than java.util.BitSet, our private
// implementation is faster (and less general).
return get(value);
}
/**
* This method is used to determine if an ASCII character in
* a text node (not an attribute value) is "clean".
* @param value the character to check (0 to 127).
* @return true if the character can go to the writer as-is
* @xsl.usage internal
*/
final boolean isTextASCIIClean(int value)
{
return isCleanTextASCII[value];
}
/**
* Read an internal resource file that describes the mapping of
* characters to entity references; Construct a CharInfo object.
*
* @param entitiesFileName Name of entities resource file that should
* be loaded, which describes the mapping of characters to entity references.
* @param method the output method type, which should be one of "xml", "html", and "text".
* @return an instance of CharInfo
*
* @xsl.usage internal
*/
static CharInfo getCharInfoInternal(String entitiesFileName, String method)
{
CharInfo charInfo = (CharInfo) m_getCharInfoCache.get(entitiesFileName);
if (charInfo != null) {
return charInfo;
}
charInfo = new CharInfo(entitiesFileName, method, true);
m_getCharInfoCache.put(entitiesFileName, charInfo);
return charInfo;
}
/**
* Constructs a CharInfo object using the following process to try reading
* the entitiesFileName parameter:
*
* 1) attempt to load it as a ResourceBundle
* 2) try using the class loader to find the specified file
* 3) try opening it as an URI
*
* In case of 2 and 3, the resource file must be encoded in UTF-8 and have the
* following format:
* <pre>
* # First char # is a comment
* Entity numericValue
* quot 34
* amp 38
* </pre>
*
* @param entitiesFileName Name of entities resource file that should
* be loaded, which describes the mapping of characters to entity references.
* @param method the output method type, which should be one of "xml", "html", and "text".
* @return an instance of CharInfo
*/
static CharInfo getCharInfo(String entitiesFileName, String method)
{
try {
return new CharInfo(entitiesFileName, method, false);
} catch (Exception e) {}
String absoluteEntitiesFileName;
if (entitiesFileName.indexOf(':') < 0) {
absoluteEntitiesFileName =
SystemIDResolver.getAbsoluteURIFromRelative(entitiesFileName);
} else {
try {
absoluteEntitiesFileName =
SystemIDResolver.getAbsoluteURI(entitiesFileName, null);
} catch (TransformerException te) {
throw new WrappedRuntimeException(te);
}
}
return new CharInfo(absoluteEntitiesFileName, method, false);
}
/** Table of user-specified char infos. */
private static HashMap m_getCharInfoCache = new HashMap();
/**
* Returns the array element holding the bit value for the
* given integer
* @param i the integer that might be in the set of integers
*
*/
private static int arrayIndex(int i) {
return (i >> SHIFT_PER_WORD);
}
/**
* For a given integer in the set it returns the single bit
* value used within a given word that represents whether
* the integer is in the set or not.
*/
private static int bit(int i) {
int ret = (1 << (i & LOW_ORDER_BITMASK));
return ret;
}
/**
* Creates a new empty set of integers (characters)
* @param max the maximum integer to be in the set.
*/
private int[] createEmptySetOfIntegers(int max) {
firstWordNotUsed = 0; // an optimization
int[] arr = new int[arrayIndex(max - 1) + 1];
return arr;
}
/**
* Adds the integer (character) to the set of integers.
* @param i the integer to add to the set, valid values are
* 0, 1, 2 ... up to the maximum that was specified at
* the creation of the set.
*/
private final void set(int i) {
setASCIIdirty(i);
int j = (i >> SHIFT_PER_WORD); // this word is used
int k = j + 1;
if(firstWordNotUsed < k) // for optimization purposes.
firstWordNotUsed = k;
array_of_bits[j] |= (1 << (i & LOW_ORDER_BITMASK));
}
/**
* Return true if the integer (character)is in the set of integers.
*
* This implementation uses an array of integers with 32 bits per
* integer. If a bit is set to 1 the corresponding integer is
* in the set of integers.
*
* @param i an integer that is tested to see if it is the
* set of integers, or not.
*/
private final boolean get(int i) {
boolean in_the_set = false;
int j = (i >> SHIFT_PER_WORD); // wordIndex(i)
// an optimization here, ... a quick test to see
// if this integer is beyond any of the words in use
if(j < firstWordNotUsed)
in_the_set = (array_of_bits[j] &
(1 << (i & LOW_ORDER_BITMASK))
) != 0; // 0L for 64 bit words
return in_the_set;
}
// record if there are any entities other than
// quot, amp, lt, gt (probably user defined)
/**
* @return true if the entity
* @param code The value of the character that has an entity defined
* for it.
*/
private boolean extraEntity(int entityValue)
{
boolean extra = false;
if (entityValue < 128)
{
switch (entityValue)
{
case 34 : // quot
case 38 : // amp
case 60 : // lt
case 62 : // gt
break;
default : // other entity in range 0 to 127
extra = true;
}
}
return extra;
}
/**
* If the character is a printable ASCII character then
* mark it as not clean and needing replacement with
* a String on output.
* @param ch
*/
private void setASCIIdirty(int j)
{
if (0 <= j && j < ASCII_MAX)
{
isCleanTextASCII[j] = false;
isSpecialTextASCII[j] = true;
}
}
/**
* If the character is a printable ASCII character then
* mark it as and not needing replacement with
* a String on output.
* @param ch
*/
private void setASCIIclean(int j)
{
if (0 <= j && j < ASCII_MAX)
{
isCleanTextASCII[j] = true;
isSpecialTextASCII[j] = false;
}
}
private void defineChar2StringMapping(String outputString, char inputChar)
{
CharKey character = new CharKey(inputChar);
m_charToString.put(character, outputString);
set(inputChar);
}
/**
* Simple class for fast lookup of char values, when used with
* hashtables. You can set the char, then use it as a key.
*
* This class is a copy of the one in com.sun.org.apache.xml.internal.utils.
* It exists to cut the serializers dependancy on that package.
*
* @xsl.usage internal
*/
private static class CharKey extends Object
{
/** String value */
private char m_char;
/**
* Constructor CharKey
*
* @param key char value of this object.
*/
public CharKey(char key)
{
m_char = key;
}
/**
* Default constructor for a CharKey.
*
* @param key char value of this object.
*/
public CharKey()
{
}
/**
* Get the hash value of the character.
*
* @return hash value of the character.
*/
public final void setChar(char c)
{
m_char = c;
}
/**
* Get the hash value of the character.
*
* @return hash value of the character.
*/
public final int hashCode()
{
return (int)m_char;
}
/**
* Override of equals() for this object
*
* @param obj to compare to
*
* @return True if this object equals this string value
*/
public final boolean equals(Object obj)
{
return ((CharKey)obj).m_char == m_char;
}
}
}
| {
"content_hash": "e40e222309343c04e8a82bc4fec4a541",
"timestamp": "",
"source": "github",
"line_count": 743,
"max_line_length": 94,
"avg_line_length": 34.43203230148048,
"alnum_prop": 0.5768283625845287,
"repo_name": "shun634501730/java_source_cn",
"id": "c63468d3d7fc3b137ecc741115a72da195911e6f",
"size": "25738",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src_en/com/sun/org/apache/xml/internal/serializer/CharInfo.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "189890"
},
{
"name": "C++",
"bytes": "6565"
},
{
"name": "Java",
"bytes": "85628126"
}
],
"symlink_target": ""
} |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>ip::tcp::protocol</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../../index.html" title="Asio">
<link rel="up" href="../ip__tcp.html" title="ip::tcp">
<link rel="prev" href="operator_eq__eq_.html" title="ip::tcp::operator==">
<link rel="next" href="resolver.html" title="ip::tcp::resolver">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="operator_eq__eq_.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../ip__tcp.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="resolver.html"><img src="../../../next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="asio.reference.ip__tcp.protocol"></a><a class="link" href="protocol.html" title="ip::tcp::protocol">ip::tcp::protocol</a>
</h4></div></div></div>
<p>
<a class="indexterm" name="idm130514"></a>
Obtain an identifier for the protocol.
</p>
<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">protocol</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
</pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003-2016 Christopher
M. Kohlhoff<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="operator_eq__eq_.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../ip__tcp.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="resolver.html"><img src="../../../next.png" alt="Next"></a>
</div>
</body>
</html>
| {
"content_hash": "a2e6a1d00c26780aa52121dae27073eb",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 340,
"avg_line_length": 59.55813953488372,
"alnum_prop": 0.6235845372901211,
"repo_name": "tcye/heptapod",
"id": "b6afa62948770cd7973f15163d3d9c19cbf5977f",
"size": "2561",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "doc/asio/asio/reference/ip__tcp/protocol.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "20405"
},
{
"name": "CMake",
"bytes": "847"
}
],
"symlink_target": ""
} |
package okhttp3.slack;
import com.squareup.moshi.FromJson;
import com.squareup.moshi.JsonAdapter;
import com.squareup.moshi.Moshi;
import com.squareup.moshi.ToJson;
import java.io.IOException;
import okhttp3.Call;
import okhttp3.HttpUrl;
import okhttp3.WebSocket;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.WebSocketListener;
import okio.ByteString;
/**
* API access to the <a href="https://api.slack.com/apps">Slack API</a> as an application. One
* instance of this class may operate without a user, or on behalf of many users. Use the Slack API
* dashboard to create a client ID and secret for this application.
*
* <p>You must configure your Slack API OAuth and Permissions page with a localhost URL like {@code
* http://localhost:53203/oauth/}, passing the same port to this class’ constructor.
*/
public final class SlackApi {
private final HttpUrl baseUrl = HttpUrl.parse("https://slack.com/api/");
private final OkHttpClient httpClient;
private final Moshi moshi;
public final String clientId;
public final String clientSecret;
public final int port;
public SlackApi(String clientId, String clientSecret, int port) {
this.httpClient = new OkHttpClient.Builder()
.build();
this.moshi = new Moshi.Builder()
.add(new SlackJsonAdapters())
.build();
this.clientId = clientId;
this.clientSecret = clientSecret;
this.port = port;
}
/** See https://api.slack.com/docs/oauth. */
public HttpUrl authorizeUrl(String scopes, HttpUrl redirectUrl, ByteString state, String team) {
HttpUrl.Builder builder = baseUrl.newBuilder("/oauth/authorize")
.addQueryParameter("client_id", clientId)
.addQueryParameter("scope", scopes)
.addQueryParameter("redirect_uri", redirectUrl.toString())
.addQueryParameter("state", state.base64());
if (team != null) {
builder.addQueryParameter("team", team);
}
return builder.build();
}
/** See https://api.slack.com/methods/oauth.access. */
public OAuthSession exchangeCode(String code, HttpUrl redirectUrl) throws IOException {
HttpUrl url = baseUrl.newBuilder("oauth.access")
.addQueryParameter("client_id", clientId)
.addQueryParameter("client_secret", clientSecret)
.addQueryParameter("code", code)
.addQueryParameter("redirect_uri", redirectUrl.toString())
.build();
Request request = new Request.Builder()
.url(url)
.build();
Call call = httpClient.newCall(request);
try (Response response = call.execute()) {
JsonAdapter<OAuthSession> jsonAdapter = moshi.adapter(OAuthSession.class);
return jsonAdapter.fromJson(response.body().source());
}
}
/** See https://api.slack.com/methods/rtm.start. */
public RtmStartResponse rtmStart(String accessToken) throws IOException {
HttpUrl url = baseUrl.newBuilder("rtm.start")
.addQueryParameter("token", accessToken)
.build();
Request request = new Request.Builder()
.url(url)
.build();
Call call = httpClient.newCall(request);
try (Response response = call.execute()) {
JsonAdapter<RtmStartResponse> jsonAdapter = moshi.adapter(RtmStartResponse.class);
return jsonAdapter.fromJson(response.body().source());
}
}
/** See https://api.slack.com/rtm. */
public WebSocket rtm(HttpUrl url, WebSocketListener listener) {
return httpClient.newWebSocket(new Request.Builder()
.url(url)
.build(), listener);
}
static final class SlackJsonAdapters {
@ToJson String urlToJson(HttpUrl httpUrl) {
return httpUrl.toString();
}
@FromJson HttpUrl urlFromJson(String urlString) {
if (urlString.startsWith("wss:")) urlString = "https:" + urlString.substring(4);
if (urlString.startsWith("ws:")) urlString = "http:" + urlString.substring(3);
return HttpUrl.parse(urlString);
}
}
}
| {
"content_hash": "ba51c88ed4473931a38eb03ec1a1f909",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 99,
"avg_line_length": 35.32142857142857,
"alnum_prop": 0.6953993933265925,
"repo_name": "qingsong-xu/okhttp",
"id": "0ec0ef7a458938c36e78b8368733133df3d82fc7",
"size": "4558",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "samples/slack/src/main/java/okhttp3/slack/SlackApi.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "3695"
},
{
"name": "HTML",
"bytes": "10259"
},
{
"name": "Java",
"bytes": "1413404"
},
{
"name": "Shell",
"bytes": "916"
}
],
"symlink_target": ""
} |
package org.jboss.resteasy.test.core.interceptors.resource;
import javax.annotation.Priority;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.Provider;
import javax.ws.rs.ext.WriterInterceptor;
import javax.ws.rs.ext.WriterInterceptorContext;
import java.io.IOException;
import java.util.LinkedList;
@Provider
@Priority(100)
public class ReaderContextFirstWriterInterceptor implements WriterInterceptor {
@Override
public void aroundWriteTo(WriterInterceptorContext context)
throws IOException, WebApplicationException {
MultivaluedMap<String, Object> headers = context.getHeaders();
String header = (String) headers.getFirst(ReaderContextResource.HEADERNAME);
if (header != null && header.equals(getClass().getName())) {
context.setAnnotations(ReaderContextResource.class.getAnnotations());
context.setEntity(toList(getClass().getName()));
context.setMediaType(MediaType.TEXT_HTML_TYPE);
context.setType(LinkedList.class);
}
context.proceed();
}
private static <T> LinkedList<T> toList(T o) {
LinkedList<T> list = new LinkedList<T>();
list.add(o);
return list;
}
}
| {
"content_hash": "0ca05cfe4fae56f8ce70677c05bd014d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 36.333333333333336,
"alnum_prop": 0.7163608562691132,
"repo_name": "awhitford/Resteasy",
"id": "c89eed49d2b7790be780b0cfeee86bb792ad57fc",
"size": "1308",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/core/interceptors/resource/ReaderContextFirstWriterInterceptor.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "226"
},
{
"name": "Java",
"bytes": "8760338"
},
{
"name": "JavaScript",
"bytes": "17786"
},
{
"name": "Python",
"bytes": "4868"
},
{
"name": "Shell",
"bytes": "1606"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "d6c83bfa5917efb57fd09a748b57cde8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "510d2f85205d79202848d31b4a548521af31740a",
"size": "192",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Agrostis/Agrostis stolonifera/ Syn. Agrostis palustris stolonifera/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php
class Zip_spark extends Spark_type {
function __construct($data)
{
parent::__construct($data);
$this->temp_file = $this->temp_path . '.zip';
$this->archive_url = property_exists($this->data, 'archive_url') ? $this->data->archive_url : null;
}
function location_detail()
{
return "ZIP archive at $this->archive_url";
}
private static function unzip_installed()
{
return !!`unzip`;
}
function retrieve()
{
file_put_contents($this->temp_file, file_get_contents($this->archive_url));
// Try a few ways to unzip
if (class_exists('ZipArchive'))
{
$zip = new ZipArchive;
$zip->open($this->temp_file);
$zip->extractTo($this->temp_path);
$zip->close();
}
else
{
if (!self::unzip_installed())
{
throw new Spark_exception('You have to install PECL ZipArchive or `unzip` to install this spark.');
}
`unzip $this->temp_file -d $this->temp_path`;
}
if (!file_exists($this->temp_path))
{
throw new Spark_exception('Failed to retrieve the spark ;(');
}
return true;
}
}
| {
"content_hash": "28ce022993ca197ebc004a22e7d426d0",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 115,
"avg_line_length": 26.06122448979592,
"alnum_prop": 0.5152701644479248,
"repo_name": "katzgrau/getsparks.org",
"id": "8ab9bb55038ebcf160589bc039bd57fe654dccf5",
"size": "1277",
"binary": false,
"copies": "5",
"ref": "refs/heads/develop",
"path": "tools/lib/spark/spark_types/zip_spark.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "11466"
},
{
"name": "PHP",
"bytes": "1451567"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
Docums Mycol. 8(no. 32): 19 (1978)
#### Original name
Cortinarius psalliotoides Chevassut & Rob. Henry
### Remarks
null | {
"content_hash": "49c4b96998f381aa675812e6562f16a5",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 48,
"avg_line_length": 14.076923076923077,
"alnum_prop": 0.7049180327868853,
"repo_name": "mdoering/backbone",
"id": "8a687313e98b074de84962ef502ccbbdabc0d752",
"size": "255",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Basidiomycota/Agaricomycetes/Agaricales/Cortinariaceae/Cortinarius/Cortinarius psalliotoides/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"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_21) on Mon Apr 16 12:29:31 EDT 2012 -->
<TITLE>
UserGroup
</TITLE>
<META NAME="date" CONTENT="2012-04-16">
<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="UserGroup";
}
}
</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> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserEmail.html" title="class in gov.nih.nci.caadapter.security.domain"><B>PREV CLASS</B></A>
<A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserSecurityObjectMapping.html" title="class in gov.nih.nci.caadapter.security.domain"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?gov/nih/nci/caadapter/security/domain/UserGroup.html" target="_top"><B>FRAMES</B></A>
<A HREF="UserGroup.html" target="_top"><B>NO FRAMES</B></A>
<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: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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">
gov.nih.nci.caadapter.security.domain</FONT>
<BR>
Class UserGroup</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><B>gov.nih.nci.caadapter.security.domain.UserGroup</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>UserGroup</B><DT>extends java.lang.Object</DL>
</PRE>
<P>
The UserGroup object define the UserGroups for security.
<P>
<P>
<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="../../../../../../gov/nih/nci/caadapter/security/domain/UserGroup.html#UserGroup()">UserGroup</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== 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> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserGroup.html#getDescription()">getDescription</A></B>()</CODE>
<BR>
gets the value for variable description.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserGroup.html#getGroupId()">getGroupId</A></B>()</CODE>
<BR>
Returns the int for the variable groupId.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserGroup.html#getGroupName()">getGroupName</A></B>()</CODE>
<BR>
Gets the value for variable groupName.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserDateStamp.html" title="class in gov.nih.nci.caadapter.security.domain">UserDateStamp</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserGroup.html#getUserDateStamp()">getUserDateStamp</A></B>()</CODE>
<BR>
Returns the int for the variable userDateStamp.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserGroup.html#setDescription(java.lang.String)">setDescription</A></B>(java.lang.String setValue)</CODE>
<BR>
Sets the value for variable description.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserGroup.html#setGroupId(int)">setGroupId</A></B>(int setValue)</CODE>
<BR>
Sets the value for variable groupId.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserGroup.html#setGroupName(java.lang.String)">setGroupName</A></B>(java.lang.String setValue)</CODE>
<BR>
Sets the value for variable groupName.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserGroup.html#setUserDateStamp(gov.nih.nci.caadapter.security.domain.UserDateStamp)">setUserDateStamp</A></B>(<A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserDateStamp.html" title="class in gov.nih.nci.caadapter.security.domain">UserDateStamp</A> setValue)</CODE>
<BR>
Sets the value for variable groupId.</TD>
</TR>
</TABLE>
<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>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<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="UserGroup()"><!-- --></A><H3>
UserGroup</H3>
<PRE>
public <B>UserGroup</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="setDescription(java.lang.String)"><!-- --></A><H3>
setDescription</H3>
<PRE>
public void <B>setDescription</B>(java.lang.String setValue)</PRE>
<DL>
<DD>Sets the value for variable description.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>String</CODE> - setValue</DL>
</DD>
</DL>
<HR>
<A NAME="getDescription()"><!-- --></A><H3>
getDescription</H3>
<PRE>
public java.lang.String <B>getDescription</B>()</PRE>
<DL>
<DD>gets the value for variable description.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>String description</DL>
</DD>
</DL>
<HR>
<A NAME="setGroupName(java.lang.String)"><!-- --></A><H3>
setGroupName</H3>
<PRE>
public void <B>setGroupName</B>(java.lang.String setValue)</PRE>
<DL>
<DD>Sets the value for variable groupName.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>String</CODE> - setValue</DL>
</DD>
</DL>
<HR>
<A NAME="getGroupName()"><!-- --></A><H3>
getGroupName</H3>
<PRE>
public java.lang.String <B>getGroupName</B>()</PRE>
<DL>
<DD>Gets the value for variable groupName.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>String groupName</DL>
</DD>
</DL>
<HR>
<A NAME="setGroupId(int)"><!-- --></A><H3>
setGroupId</H3>
<PRE>
public void <B>setGroupId</B>(int setValue)</PRE>
<DL>
<DD>Sets the value for variable groupId.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>int</CODE> - setValue</DL>
</DD>
</DL>
<HR>
<A NAME="getGroupId()"><!-- --></A><H3>
getGroupId</H3>
<PRE>
public int <B>getGroupId</B>()</PRE>
<DL>
<DD>Returns the int for the variable groupId.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>String</DL>
</DD>
</DL>
<HR>
<A NAME="setUserDateStamp(gov.nih.nci.caadapter.security.domain.UserDateStamp)"><!-- --></A><H3>
setUserDateStamp</H3>
<PRE>
public void <B>setUserDateStamp</B>(<A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserDateStamp.html" title="class in gov.nih.nci.caadapter.security.domain">UserDateStamp</A> setValue)</PRE>
<DL>
<DD>Sets the value for variable groupId.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>int</CODE> - setValue</DL>
</DD>
</DL>
<HR>
<A NAME="getUserDateStamp()"><!-- --></A><H3>
getUserDateStamp</H3>
<PRE>
public <A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserDateStamp.html" title="class in gov.nih.nci.caadapter.security.domain">UserDateStamp</A> <B>getUserDateStamp</B>()</PRE>
<DL>
<DD>Returns the int for the variable userDateStamp.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>UserDateStamp</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> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserEmail.html" title="class in gov.nih.nci.caadapter.security.domain"><B>PREV CLASS</B></A>
<A HREF="../../../../../../gov/nih/nci/caadapter/security/domain/UserSecurityObjectMapping.html" title="class in gov.nih.nci.caadapter.security.domain"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?gov/nih/nci/caadapter/security/domain/UserGroup.html" target="_top"><B>FRAMES</B></A>
<A HREF="UserGroup.html" target="_top"><B>NO FRAMES</B></A>
<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: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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": "a20215a769d5f1e541154bc6bd9fbe21",
"timestamp": "",
"source": "github",
"line_count": 407,
"max_line_length": 368,
"avg_line_length": 38.945945945945944,
"alnum_prop": 0.6164910731184152,
"repo_name": "NCIP/caadapter",
"id": "7b853f6c76ca9a69072c4c7d39090d92b187358a",
"size": "15851",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "software/cmts/doc/javadoc/gov/nih/nci/caadapter/security/domain/UserGroup.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ActionScript",
"bytes": "5177"
},
{
"name": "CSS",
"bytes": "140722"
},
{
"name": "Java",
"bytes": "8275293"
},
{
"name": "JavaScript",
"bytes": "224288"
},
{
"name": "Shell",
"bytes": "8013"
},
{
"name": "XQuery",
"bytes": "41953"
},
{
"name": "XSLT",
"bytes": "269567"
}
],
"symlink_target": ""
} |
#include <stdlib.h>
#include <stdio.h>
#include "xdebug_mm.h"
#include "xdebug_str.h"
#include "xdebug_var.h"
#include "xdebug_xml.h"
#include "xdebug_compat.h"
static void xdebug_xml_return_attribute(xdebug_xml_attribute* attr, xdebug_str* output)
{
char *tmp;
size_t newlen;
xdebug_str_addl(output, " ", 1, 0);
/* attribute name */
tmp = xdebug_xmlize(attr->name, attr->name_len, &newlen);
xdebug_str_addl(output, tmp, newlen, 0);
efree(tmp);
/* attribute value */
xdebug_str_addl(output, "=\"", 2, 0);
if (attr->value) {
tmp = xdebug_xmlize(attr->value, attr->value_len, &newlen);
xdebug_str_add(output, tmp, 0);
efree(tmp);
}
xdebug_str_addl(output, "\"", 1, 0);
if (attr->next) {
xdebug_xml_return_attribute(attr->next, output);
}
}
static void xdebug_xml_return_text_node(xdebug_xml_text_node* node, xdebug_str* output)
{
xdebug_str_addl(output, "<![CDATA[", 9, 0);
if (node->encode) {
/* if cdata tags are in the text, then we must base64 encode */
size_t new_len = 0;
unsigned char *encoded_text;
encoded_text = xdebug_base64_encode((unsigned char*) node->text, node->text_len, &new_len);
xdebug_str_add(output, (char*) encoded_text, 0);
xdfree(encoded_text);
} else {
xdebug_str_add(output, node->text, 0);
}
xdebug_str_addl(output, "]]>", 3, 0);
}
void xdebug_xml_return_node(xdebug_xml_node* node, struct xdebug_str *output)
{
xdebug_str_addl(output, "<", 1, 0);
xdebug_str_add(output, node->tag, 0);
if (node->text && node->text->encode) {
xdebug_xml_add_attribute_ex(node, "encoding", "base64", 0, 0);
}
if (node->attribute) {
xdebug_xml_return_attribute(node->attribute, output);
}
xdebug_str_addl(output, ">", 1, 0);
if (node->child) {
xdebug_xml_return_node(node->child, output);
}
if (node->text) {
xdebug_xml_return_text_node(node->text, output);
}
xdebug_str_addl(output, "</", 2, 0);
xdebug_str_add(output, node->tag, 0);
xdebug_str_addl(output, ">", 1, 0);
if (node->next) {
xdebug_xml_return_node(node->next, output);
}
}
xdebug_xml_node *xdebug_xml_node_init_ex(const char *tag, int free_tag)
{
xdebug_xml_node *xml = xdmalloc(sizeof (xdebug_xml_node));
xml->tag = (char*) tag;
xml->text = NULL;
xml->child = NULL;
xml->attribute = NULL;
xml->next = NULL;
xml->free_tag = free_tag;
return xml;
}
void xdebug_xml_add_attribute_exl(xdebug_xml_node* xml, const char *attribute, size_t attribute_len, const char *value, size_t value_len, int free_name, int free_value)
{
xdebug_xml_attribute *attr = xdmalloc(sizeof (xdebug_xml_attribute));
xdebug_xml_attribute **ptr;
/* Init structure */
attr->name = (char*) attribute;
attr->value = (char*) value;
attr->name_len = attribute_len;
attr->value_len = value_len;
attr->next = NULL;
attr->free_name = free_name;
attr->free_value = free_value;
/* Find last attribute in node */
ptr = &xml->attribute;
while (*ptr != NULL) {
ptr = &(*ptr)->next;
}
*ptr = attr;
}
void xdebug_xml_add_child(xdebug_xml_node *xml, xdebug_xml_node *child)
{
xdebug_xml_node **ptr;
ptr = &xml->child;
while (*ptr != NULL) {
ptr = &((*ptr)->next);
}
*ptr = child;
}
static void xdebug_xml_text_node_dtor(xdebug_xml_text_node* node)
{
if (node->free_value && node->text) {
xdfree(node->text);
}
xdfree(node);
}
void xdebug_xml_add_text(xdebug_xml_node *xml, char *text)
{
xdebug_xml_add_text_ex(xml, text, strlen(text), 1, 0);
}
void xdebug_xml_add_text_encode(xdebug_xml_node *xml, char *text)
{
xdebug_xml_add_text_ex(xml, text, strlen(text), 1, 1);
}
void xdebug_xml_add_text_ex(xdebug_xml_node *xml, char *text, int length, int free_text, int encode)
{
xdebug_xml_text_node *node = xdmalloc(sizeof (xdebug_xml_text_node));
node->free_value = free_text;
node->encode = encode;
if (xml->text) {
xdebug_xml_text_node_dtor(xml->text);
}
node->text = text;
node->text_len = length;
xml->text = node;
if (!encode && strstr(node->text, "]]>")) {
node->encode = 1;
}
}
static void xdebug_xml_attribute_dtor(xdebug_xml_attribute *attr)
{
if (attr->next) {
xdebug_xml_attribute_dtor(attr->next);
}
if (attr->free_name) {
xdfree(attr->name);
}
if (attr->free_value) {
xdfree(attr->value);
}
xdfree(attr);
}
void xdebug_xml_node_dtor(xdebug_xml_node* xml)
{
if (xml->next) {
xdebug_xml_node_dtor(xml->next);
}
if (xml->child) {
xdebug_xml_node_dtor(xml->child);
}
if (xml->attribute) {
xdebug_xml_attribute_dtor(xml->attribute);
}
if (xml->free_tag) {
xdfree(xml->tag);
}
if (xml->text) {
xdebug_xml_text_node_dtor(xml->text);
}
xdfree(xml);
}
| {
"content_hash": "10b4065565632af83d4756e808017384",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 168,
"avg_line_length": 23.075757575757574,
"alnum_prop": 0.6474064346684176,
"repo_name": "mbutkereit/docker-php",
"id": "b503556630974644bdc1dd9d21b623a4d381c3f5",
"size": "5715",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "php-fpm/php/7.3.x/config/xdebug/xdebug_xml.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "307"
},
{
"name": "C",
"bytes": "6857127"
},
{
"name": "C++",
"bytes": "42249"
},
{
"name": "Dockerfile",
"bytes": "24931"
},
{
"name": "HTML",
"bytes": "12378"
},
{
"name": "JavaScript",
"bytes": "9908"
},
{
"name": "M4",
"bytes": "55018"
},
{
"name": "Makefile",
"bytes": "208758"
},
{
"name": "PHP",
"bytes": "7854687"
},
{
"name": "Shell",
"bytes": "1369195"
},
{
"name": "Vim script",
"bytes": "24261"
}
],
"symlink_target": ""
} |
package com.google.security.zynamics.binnavi.debug.models.targetinformation;
/**
* Represents the settings which can be set in the debugger events panel in the CDebuggerOptions
* dialog.
*/
public class DebuggerEventSettings {
private final boolean breakOnDllLoad;
private final boolean breakOnDllUnload;
/**
* Creates a new instance of the debugger event settings class.
*
* @param breakOnDllLoad Specifies whether the debugger should break whenever a dll is loaded into
* the debuggee.
* @param breakOnDllUnload Specifies whether the debugger should break whenever a dll is unloaded
* from the debuggee.
*/
public DebuggerEventSettings(final boolean breakOnDllLoad, final boolean breakOnDllUnload) {
this.breakOnDllLoad = breakOnDllLoad;
this.breakOnDllUnload = breakOnDllUnload;
}
public boolean getBreakOnDllLoad() {
return breakOnDllLoad;
}
public boolean getBreakOnDllUnload() {
return breakOnDllUnload;
}
}
| {
"content_hash": "cdefef59389a6222551adff75bd7dcc0",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 100,
"avg_line_length": 30.96875,
"alnum_prop": 0.7497477295660948,
"repo_name": "chubbymaggie/binnavi",
"id": "1e4aefa9198957b05255dbbd7bfcab04c535486a",
"size": "1574",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/main/java/com/google/security/zynamics/binnavi/debug/models/targetinformation/DebuggerEventSettings.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1489"
},
{
"name": "C",
"bytes": "8997"
},
{
"name": "C++",
"bytes": "982064"
},
{
"name": "CMake",
"bytes": "1953"
},
{
"name": "CSS",
"bytes": "12843"
},
{
"name": "GAP",
"bytes": "3637"
},
{
"name": "HTML",
"bytes": "437459"
},
{
"name": "Java",
"bytes": "21693692"
},
{
"name": "Makefile",
"bytes": "3498"
},
{
"name": "PLSQL",
"bytes": "1866504"
},
{
"name": "PLpgSQL",
"bytes": "638893"
},
{
"name": "Protocol Buffer",
"bytes": "10300"
},
{
"name": "Python",
"bytes": "23981"
},
{
"name": "SQLPL",
"bytes": "330046"
},
{
"name": "Shell",
"bytes": "713"
}
],
"symlink_target": ""
} |
<?php
/* SensioDistributionBundle:Configurator:form.html.twig */
class __TwigTemplate_90a3e892fce8ae2e55b5471a54fbd9b3ca7e3802b309b3729c9e4015e11d5692 extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
// line 1
try {
$this->parent = $this->env->loadTemplate("form_div_layout.html.twig");
} catch (Twig_Error_Loader $e) {
$e->setTemplateFile($this->getTemplateName());
$e->setTemplateLine(1);
throw $e;
}
$this->blocks = array(
'form_rows' => array($this, 'block_form_rows'),
'form_row' => array($this, 'block_form_row'),
'form_label' => array($this, 'block_form_label'),
);
}
protected function doGetParent(array $context)
{
return "form_div_layout.html.twig";
}
protected function doDisplay(array $context, array $blocks = array())
{
$this->parent->display($context, array_merge($this->blocks, $blocks));
}
// line 3
public function block_form_rows($context, array $blocks = array())
{
// line 4
echo " <div class=\"symfony-form-errors\">
";
// line 5
echo $this->env->getExtension('form')->renderer->searchAndRenderBlock((isset($context["form"]) ? $context["form"] : $this->getContext($context, "form")), 'errors');
echo "
</div>
";
// line 7
$context['_parent'] = (array) $context;
$context['_seq'] = twig_ensure_traversable((isset($context["form"]) ? $context["form"] : $this->getContext($context, "form")));
foreach ($context['_seq'] as $context["_key"] => $context["child"]) {
// line 8
echo " ";
echo $this->env->getExtension('form')->renderer->searchAndRenderBlock($context["child"], 'row');
echo "
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['child'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
}
// line 12
public function block_form_row($context, array $blocks = array())
{
// line 13
echo " <div class=\"symfony-form-row\">
";
// line 14
echo $this->env->getExtension('form')->renderer->searchAndRenderBlock((isset($context["form"]) ? $context["form"] : $this->getContext($context, "form")), 'label');
echo "
<div class=\"symfony-form-field\">
";
// line 16
echo $this->env->getExtension('form')->renderer->searchAndRenderBlock((isset($context["form"]) ? $context["form"] : $this->getContext($context, "form")), 'widget');
echo "
<div class=\"symfony-form-errors\">
";
// line 18
echo $this->env->getExtension('form')->renderer->searchAndRenderBlock((isset($context["form"]) ? $context["form"] : $this->getContext($context, "form")), 'errors');
echo "
</div>
</div>
</div>
";
}
// line 24
public function block_form_label($context, array $blocks = array())
{
// line 25
echo " ";
if (twig_test_empty((isset($context["label"]) ? $context["label"] : $this->getContext($context, "label")))) {
// line 26
echo " ";
$context["label"] = $this->env->getExtension('form')->humanize((isset($context["name"]) ? $context["name"] : $this->getContext($context, "name")));
// line 27
echo " ";
}
// line 28
echo " <label for=\"";
echo twig_escape_filter($this->env, (isset($context["id"]) ? $context["id"] : $this->getContext($context, "id")), "html", null, true);
echo "\">
";
// line 29
echo twig_escape_filter($this->env, $this->env->getExtension('translator')->trans((isset($context["label"]) ? $context["label"] : $this->getContext($context, "label"))), "html", null, true);
echo "
";
// line 30
if ((isset($context["required"]) ? $context["required"] : $this->getContext($context, "required"))) {
// line 31
echo " <span class=\"symfony-form-required\" title=\"This field is required\">*</span>
";
}
// line 33
echo " </label>
";
}
public function getTemplateName()
{
return "SensioDistributionBundle:Configurator:form.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 116 => 33, 112 => 31, 110 => 30, 106 => 29, 101 => 28, 98 => 27, 95 => 26, 92 => 25, 89 => 24, 80 => 18, 75 => 16, 70 => 14, 67 => 13, 64 => 12, 53 => 8, 49 => 7, 44 => 5, 41 => 4, 38 => 3, 11 => 1,);
}
}
| {
"content_hash": "d3c9b7b7f03b0c811e270a1b5a0d86d5",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 243,
"avg_line_length": 37.08955223880597,
"alnum_prop": 0.5251509054325956,
"repo_name": "Vulcania/GSB_Symfony",
"id": "2b3fd5f73bac250509251c507f1eec4b3a5cc09e",
"size": "4970",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/cache/dev_old/twig/90/a3/e892fce8ae2e55b5471a54fbd9b3ca7e3802b309b3729c9e4015e11d5692.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3073"
},
{
"name": "CSS",
"bytes": "31261"
},
{
"name": "HTML",
"bytes": "21750"
},
{
"name": "JavaScript",
"bytes": "974207"
},
{
"name": "PHP",
"bytes": "192287"
},
{
"name": "Shell",
"bytes": "464"
}
],
"symlink_target": ""
} |
<html>
<body>
<font face="verdana" size="-1">This inspection reports parameters that are not used by their methods and all method
implementations/overriders.</font>
</body>
</html>
| {
"content_hash": "5009afb0f50c40aa932074ce4bdf85cc",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 115,
"avg_line_length": 30.166666666666668,
"alnum_prop": 0.7513812154696132,
"repo_name": "android-ia/platform_tools_idea",
"id": "fc8a81cbbb6be520cd3b005169d702802b71c2db",
"size": "181",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "resources-en/src/inspectionDescriptions/UnusedParameters.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "174889"
},
{
"name": "C#",
"bytes": "390"
},
{
"name": "C++",
"bytes": "75164"
},
{
"name": "CSS",
"bytes": "11575"
},
{
"name": "Erlang",
"bytes": "10"
},
{
"name": "Groovy",
"bytes": "1838147"
},
{
"name": "J",
"bytes": "5050"
},
{
"name": "Java",
"bytes": "117376638"
},
{
"name": "JavaScript",
"bytes": "112"
},
{
"name": "Objective-C",
"bytes": "19631"
},
{
"name": "Perl",
"bytes": "6549"
},
{
"name": "Python",
"bytes": "2787996"
},
{
"name": "Shell",
"bytes": "68540"
},
{
"name": "XSLT",
"bytes": "113531"
}
],
"symlink_target": ""
} |
"""Integration with the Rachio Iro sprinkler system controller."""
from abc import abstractmethod
from contextlib import suppress
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.switch import SwitchEntity
from homeassistant.const import ATTR_ENTITY_ID, ATTR_ID
from homeassistant.core import callback
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.event import async_track_point_in_utc_time
from homeassistant.util.dt import as_timestamp, now, parse_datetime, utc_from_timestamp
from .const import (
CONF_MANUAL_RUN_MINS,
DEFAULT_MANUAL_RUN_MINS,
DOMAIN as DOMAIN_RACHIO,
KEY_CUSTOM_CROP,
KEY_CUSTOM_SHADE,
KEY_CUSTOM_SLOPE,
KEY_DEVICE_ID,
KEY_DURATION,
KEY_ENABLED,
KEY_ID,
KEY_IMAGE_URL,
KEY_NAME,
KEY_ON,
KEY_RAIN_DELAY,
KEY_RAIN_DELAY_END,
KEY_SCHEDULE_ID,
KEY_SUBTYPE,
KEY_SUMMARY,
KEY_TYPE,
KEY_ZONE_ID,
KEY_ZONE_NUMBER,
SCHEDULE_TYPE_FIXED,
SCHEDULE_TYPE_FLEX,
SERVICE_SET_ZONE_MOISTURE,
SERVICE_START_MULTIPLE_ZONES,
SIGNAL_RACHIO_CONTROLLER_UPDATE,
SIGNAL_RACHIO_RAIN_DELAY_UPDATE,
SIGNAL_RACHIO_SCHEDULE_UPDATE,
SIGNAL_RACHIO_ZONE_UPDATE,
SLOPE_FLAT,
SLOPE_MODERATE,
SLOPE_SLIGHT,
SLOPE_STEEP,
)
from .entity import RachioDevice
from .webhooks import (
SUBTYPE_RAIN_DELAY_OFF,
SUBTYPE_RAIN_DELAY_ON,
SUBTYPE_SCHEDULE_COMPLETED,
SUBTYPE_SCHEDULE_STARTED,
SUBTYPE_SCHEDULE_STOPPED,
SUBTYPE_SLEEP_MODE_OFF,
SUBTYPE_SLEEP_MODE_ON,
SUBTYPE_ZONE_COMPLETED,
SUBTYPE_ZONE_PAUSED,
SUBTYPE_ZONE_STARTED,
SUBTYPE_ZONE_STOPPED,
)
_LOGGER = logging.getLogger(__name__)
ATTR_DURATION = "duration"
ATTR_PERCENT = "percent"
ATTR_SCHEDULE_SUMMARY = "Summary"
ATTR_SCHEDULE_ENABLED = "Enabled"
ATTR_SCHEDULE_DURATION = "Duration"
ATTR_SCHEDULE_TYPE = "Type"
ATTR_SORT_ORDER = "sortOrder"
ATTR_ZONE_NUMBER = "Zone number"
ATTR_ZONE_SHADE = "Shade"
ATTR_ZONE_SLOPE = "Slope"
ATTR_ZONE_SUMMARY = "Summary"
ATTR_ZONE_TYPE = "Type"
START_MULTIPLE_ZONES_SCHEMA = vol.Schema(
{
vol.Required(ATTR_ENTITY_ID): cv.entity_ids,
vol.Required(ATTR_DURATION): cv.ensure_list_csv,
}
)
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Rachio switches."""
zone_entities = []
has_flex_sched = False
entities = await hass.async_add_executor_job(_create_entities, hass, config_entry)
for entity in entities:
if isinstance(entity, RachioZone):
zone_entities.append(entity)
if isinstance(entity, RachioSchedule) and entity.type == SCHEDULE_TYPE_FLEX:
has_flex_sched = True
async_add_entities(entities)
_LOGGER.info("%d Rachio switch(es) added", len(entities))
def start_multiple(service):
"""Service to start multiple zones in sequence."""
zones_list = []
person = hass.data[DOMAIN_RACHIO][config_entry.entry_id]
entity_id = service.data[ATTR_ENTITY_ID]
duration = iter(service.data[ATTR_DURATION])
default_time = service.data[ATTR_DURATION][0]
entity_to_zone_id = {
entity.entity_id: entity.zone_id for entity in zone_entities
}
for (count, data) in enumerate(entity_id):
if data in entity_to_zone_id:
# Time can be passed as a list per zone,
# or one time for all zones
time = int(next(duration, default_time)) * 60
zones_list.append(
{
ATTR_ID: entity_to_zone_id.get(data),
ATTR_DURATION: time,
ATTR_SORT_ORDER: count,
}
)
if len(zones_list) != 0:
person.start_multiple_zones(zones_list)
_LOGGER.debug("Starting zone(s) %s", entity_id)
else:
raise HomeAssistantError("No matching zones found in given entity_ids")
hass.services.async_register(
DOMAIN_RACHIO,
SERVICE_START_MULTIPLE_ZONES,
start_multiple,
schema=START_MULTIPLE_ZONES_SCHEMA,
)
if has_flex_sched:
platform = entity_platform.current_platform.get()
platform.async_register_entity_service(
SERVICE_SET_ZONE_MOISTURE,
{vol.Required(ATTR_PERCENT): cv.positive_int},
"set_moisture_percent",
)
def _create_entities(hass, config_entry):
entities = []
person = hass.data[DOMAIN_RACHIO][config_entry.entry_id]
# Fetch the schedule once at startup
# in order to avoid every zone doing it
for controller in person.controllers:
entities.append(RachioStandbySwitch(controller))
entities.append(RachioRainDelay(controller))
zones = controller.list_zones()
schedules = controller.list_schedules()
flex_schedules = controller.list_flex_schedules()
current_schedule = controller.current_schedule
for zone in zones:
entities.append(RachioZone(person, controller, zone, current_schedule))
for sched in schedules + flex_schedules:
entities.append(RachioSchedule(person, controller, sched, current_schedule))
_LOGGER.debug("Added %s", entities)
return entities
class RachioSwitch(RachioDevice, SwitchEntity):
"""Represent a Rachio state that can be toggled."""
def __init__(self, controller):
"""Initialize a new Rachio switch."""
super().__init__(controller)
self._state = None
@property
def name(self) -> str:
"""Get a name for this switch."""
return f"Switch on {self._controller.name}"
@property
def is_on(self) -> bool:
"""Return whether the switch is currently on."""
return self._state
@callback
def _async_handle_any_update(self, *args, **kwargs) -> None:
"""Determine whether an update event applies to this device."""
if args[0][KEY_DEVICE_ID] != self._controller.controller_id:
# For another device
return
# For this device
self._async_handle_update(args, kwargs)
@abstractmethod
def _async_handle_update(self, *args, **kwargs) -> None:
"""Handle incoming webhook data."""
class RachioStandbySwitch(RachioSwitch):
"""Representation of a standby status/button."""
@property
def name(self) -> str:
"""Return the name of the standby switch."""
return f"{self._controller.name} in standby mode"
@property
def unique_id(self) -> str:
"""Return a unique id by combining controller id and purpose."""
return f"{self._controller.controller_id}-standby"
@property
def icon(self) -> str:
"""Return an icon for the standby switch."""
return "mdi:power"
@callback
def _async_handle_update(self, *args, **kwargs) -> None:
"""Update the state using webhook data."""
if args[0][0][KEY_SUBTYPE] == SUBTYPE_SLEEP_MODE_ON:
self._state = True
elif args[0][0][KEY_SUBTYPE] == SUBTYPE_SLEEP_MODE_OFF:
self._state = False
self.async_write_ha_state()
def turn_on(self, **kwargs) -> None:
"""Put the controller in standby mode."""
self._controller.rachio.device.turn_off(self._controller.controller_id)
def turn_off(self, **kwargs) -> None:
"""Resume controller functionality."""
self._controller.rachio.device.turn_on(self._controller.controller_id)
async def async_added_to_hass(self):
"""Subscribe to updates."""
if KEY_ON in self._controller.init_data:
self._state = not self._controller.init_data[KEY_ON]
self.async_on_remove(
async_dispatcher_connect(
self.hass,
SIGNAL_RACHIO_CONTROLLER_UPDATE,
self._async_handle_any_update,
)
)
class RachioRainDelay(RachioSwitch):
"""Representation of a rain delay status/switch."""
def __init__(self, controller):
"""Set up a Rachio rain delay switch."""
self._cancel_update = None
super().__init__(controller)
@property
def name(self) -> str:
"""Return the name of the switch."""
return f"{self._controller.name} rain delay"
@property
def unique_id(self) -> str:
"""Return a unique id by combining controller id and purpose."""
return f"{self._controller.controller_id}-delay"
@property
def icon(self) -> str:
"""Return an icon for rain delay."""
return "mdi:camera-timer"
@callback
def _async_handle_update(self, *args, **kwargs) -> None:
"""Update the state using webhook data."""
if self._cancel_update:
self._cancel_update()
self._cancel_update = None
if args[0][0][KEY_SUBTYPE] == SUBTYPE_RAIN_DELAY_ON:
endtime = parse_datetime(args[0][0][KEY_RAIN_DELAY_END])
_LOGGER.debug("Rain delay expires at %s", endtime)
self._state = True
self._cancel_update = async_track_point_in_utc_time(
self.hass, self._delay_expiration, endtime
)
elif args[0][0][KEY_SUBTYPE] == SUBTYPE_RAIN_DELAY_OFF:
self._state = False
self.async_write_ha_state()
@callback
def _delay_expiration(self, *args) -> None:
"""Trigger when a rain delay expires."""
self._state = False
self._cancel_update = None
self.async_write_ha_state()
def turn_on(self, **kwargs) -> None:
"""Activate a 24 hour rain delay on the controller."""
self._controller.rachio.device.rain_delay(self._controller.controller_id, 86400)
_LOGGER.debug("Starting rain delay for 24 hours")
def turn_off(self, **kwargs) -> None:
"""Resume controller functionality."""
self._controller.rachio.device.rain_delay(self._controller.controller_id, 0)
_LOGGER.debug("Canceling rain delay")
async def async_added_to_hass(self):
"""Subscribe to updates."""
if KEY_RAIN_DELAY in self._controller.init_data:
self._state = self._controller.init_data[
KEY_RAIN_DELAY
] / 1000 > as_timestamp(now())
# If the controller was in a rain delay state during a reboot, this re-sets the timer
if self._state is True:
delay_end = utc_from_timestamp(
self._controller.init_data[KEY_RAIN_DELAY] / 1000
)
_LOGGER.debug("Re-setting rain delay timer for %s", delay_end)
self._cancel_update = async_track_point_in_utc_time(
self.hass, self._delay_expiration, delay_end
)
self.async_on_remove(
async_dispatcher_connect(
self.hass,
SIGNAL_RACHIO_RAIN_DELAY_UPDATE,
self._async_handle_any_update,
)
)
class RachioZone(RachioSwitch):
"""Representation of one zone of sprinklers connected to the Rachio Iro."""
def __init__(self, person, controller, data, current_schedule):
"""Initialize a new Rachio Zone."""
self.id = data[KEY_ID]
self._zone_name = data[KEY_NAME]
self._zone_number = data[KEY_ZONE_NUMBER]
self._zone_enabled = data[KEY_ENABLED]
self._entity_picture = data.get(KEY_IMAGE_URL)
self._person = person
self._shade_type = data.get(KEY_CUSTOM_SHADE, {}).get(KEY_NAME)
self._zone_type = data.get(KEY_CUSTOM_CROP, {}).get(KEY_NAME)
self._slope_type = data.get(KEY_CUSTOM_SLOPE, {}).get(KEY_NAME)
self._summary = ""
self._current_schedule = current_schedule
super().__init__(controller)
def __str__(self):
"""Display the zone as a string."""
return 'Rachio Zone "{}" on {}'.format(self.name, str(self._controller))
@property
def zone_id(self) -> str:
"""How the Rachio API refers to the zone."""
return self.id
@property
def name(self) -> str:
"""Return the friendly name of the zone."""
return self._zone_name
@property
def unique_id(self) -> str:
"""Return a unique id by combining controller id and zone number."""
return f"{self._controller.controller_id}-zone-{self.zone_id}"
@property
def icon(self) -> str:
"""Return the icon to display."""
return "mdi:water"
@property
def zone_is_enabled(self) -> bool:
"""Return whether the zone is allowed to run."""
return self._zone_enabled
@property
def entity_picture(self):
"""Return the entity picture to use in the frontend, if any."""
return self._entity_picture
@property
def extra_state_attributes(self) -> dict:
"""Return the optional state attributes."""
props = {ATTR_ZONE_NUMBER: self._zone_number, ATTR_ZONE_SUMMARY: self._summary}
if self._shade_type:
props[ATTR_ZONE_SHADE] = self._shade_type
if self._zone_type:
props[ATTR_ZONE_TYPE] = self._zone_type
if self._slope_type:
if self._slope_type == SLOPE_FLAT:
props[ATTR_ZONE_SLOPE] = "Flat"
elif self._slope_type == SLOPE_SLIGHT:
props[ATTR_ZONE_SLOPE] = "Slight"
elif self._slope_type == SLOPE_MODERATE:
props[ATTR_ZONE_SLOPE] = "Moderate"
elif self._slope_type == SLOPE_STEEP:
props[ATTR_ZONE_SLOPE] = "Steep"
return props
def turn_on(self, **kwargs) -> None:
"""Start watering this zone."""
# Stop other zones first
self.turn_off()
# Start this zone
manual_run_time = timedelta(
minutes=self._person.config_entry.options.get(
CONF_MANUAL_RUN_MINS, DEFAULT_MANUAL_RUN_MINS
)
)
self._controller.rachio.zone.start(self.zone_id, manual_run_time.seconds)
_LOGGER.debug(
"Watering %s on %s for %s",
self.name,
self._controller.name,
str(manual_run_time),
)
def turn_off(self, **kwargs) -> None:
"""Stop watering all zones."""
self._controller.stop_watering()
def set_moisture_percent(self, percent) -> None:
"""Set the zone moisture percent."""
_LOGGER.debug("Setting %s moisture to %s percent", self._zone_name, percent)
self._controller.rachio.zone.set_moisture_percent(self.id, percent / 100)
@callback
def _async_handle_update(self, *args, **kwargs) -> None:
"""Handle incoming webhook zone data."""
if args[0][KEY_ZONE_ID] != self.zone_id:
return
self._summary = args[0][KEY_SUMMARY]
if args[0][KEY_SUBTYPE] == SUBTYPE_ZONE_STARTED:
self._state = True
elif args[0][KEY_SUBTYPE] in [
SUBTYPE_ZONE_STOPPED,
SUBTYPE_ZONE_COMPLETED,
SUBTYPE_ZONE_PAUSED,
]:
self._state = False
self.async_write_ha_state()
async def async_added_to_hass(self):
"""Subscribe to updates."""
self._state = self.zone_id == self._current_schedule.get(KEY_ZONE_ID)
self.async_on_remove(
async_dispatcher_connect(
self.hass, SIGNAL_RACHIO_ZONE_UPDATE, self._async_handle_update
)
)
class RachioSchedule(RachioSwitch):
"""Representation of one fixed schedule on the Rachio Iro."""
def __init__(self, person, controller, data, current_schedule):
"""Initialize a new Rachio Schedule."""
self._schedule_id = data[KEY_ID]
self._schedule_name = data[KEY_NAME]
self._duration = data[KEY_DURATION]
self._schedule_enabled = data[KEY_ENABLED]
self._summary = data[KEY_SUMMARY]
self.type = data.get(KEY_TYPE, SCHEDULE_TYPE_FIXED)
self._current_schedule = current_schedule
super().__init__(controller)
@property
def name(self) -> str:
"""Return the friendly name of the schedule."""
return f"{self._schedule_name} Schedule"
@property
def unique_id(self) -> str:
"""Return a unique id by combining controller id and schedule."""
return f"{self._controller.controller_id}-schedule-{self._schedule_id}"
@property
def icon(self) -> str:
"""Return the icon to display."""
return "mdi:water" if self.schedule_is_enabled else "mdi:water-off"
@property
def extra_state_attributes(self) -> dict:
"""Return the optional state attributes."""
return {
ATTR_SCHEDULE_SUMMARY: self._summary,
ATTR_SCHEDULE_ENABLED: self.schedule_is_enabled,
ATTR_SCHEDULE_DURATION: f"{round(self._duration / 60)} minutes",
ATTR_SCHEDULE_TYPE: self.type,
}
@property
def schedule_is_enabled(self) -> bool:
"""Return whether the schedule is allowed to run."""
return self._schedule_enabled
def turn_on(self, **kwargs) -> None:
"""Start this schedule."""
self._controller.rachio.schedulerule.start(self._schedule_id)
_LOGGER.debug(
"Schedule %s started on %s",
self.name,
self._controller.name,
)
def turn_off(self, **kwargs) -> None:
"""Stop watering all zones."""
self._controller.stop_watering()
@callback
def _async_handle_update(self, *args, **kwargs) -> None:
"""Handle incoming webhook schedule data."""
# Schedule ID not passed when running individual zones, so we catch that error
with suppress(KeyError):
if args[0][KEY_SCHEDULE_ID] == self._schedule_id:
if args[0][KEY_SUBTYPE] in [SUBTYPE_SCHEDULE_STARTED]:
self._state = True
elif args[0][KEY_SUBTYPE] in [
SUBTYPE_SCHEDULE_STOPPED,
SUBTYPE_SCHEDULE_COMPLETED,
]:
self._state = False
self.async_write_ha_state()
async def async_added_to_hass(self):
"""Subscribe to updates."""
self._state = self._schedule_id == self._current_schedule.get(KEY_SCHEDULE_ID)
self.async_on_remove(
async_dispatcher_connect(
self.hass, SIGNAL_RACHIO_SCHEDULE_UPDATE, self._async_handle_update
)
)
| {
"content_hash": "155cdeb952408d66c151ce294d0b1879",
"timestamp": "",
"source": "github",
"line_count": 549,
"max_line_length": 93,
"avg_line_length": 34.05464480874317,
"alnum_prop": 0.6043538724860933,
"repo_name": "adrienbrault/home-assistant",
"id": "8d87b688aa47e701fc40d90b639d91ed42628d4e",
"size": "18696",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "homeassistant/components/rachio/switch.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "1795"
},
{
"name": "Python",
"bytes": "32021043"
},
{
"name": "Shell",
"bytes": "4900"
}
],
"symlink_target": ""
} |
using System;
namespace UnityEngine.Rendering.PostProcessing
{
[Serializable]
[PostProcess(typeof(GrainRenderer), "Unity/Grain")]
public sealed class Grain : PostProcessEffectSettings
{
[Tooltip("Enable the use of colored grain.")]
public BoolParameter colored = new BoolParameter { value = true };
[Range(0f, 1f), Tooltip("Grain strength. Higher means more visible grain.")]
public FloatParameter intensity = new FloatParameter { value = 0f };
[Range(0.3f, 3f), Tooltip("Grain particle size.")]
public FloatParameter size = new FloatParameter { value = 1f };
[Range(0f, 1f), DisplayName("Luminance Contribution"), Tooltip("Controls the noisiness response curve based on scene luminance. Lower values mean less noise in dark areas.")]
public FloatParameter lumContrib = new FloatParameter { value = 0.8f };
public override bool IsEnabledAndSupported(PostProcessRenderContext context)
{
return enabled.value
&& intensity.value > 0f;
}
}
public sealed class GrainRenderer : PostProcessEffectRenderer<Grain>
{
RenderTexture m_GrainLookupRT;
const int k_SampleCount = 1024;
int m_SampleIndex;
public override void Render(PostProcessRenderContext context)
{
#if POSTFX_DEBUG_STATIC_GRAIN
// Chosen by a fair dice roll
float time = 4f;
float rndOffsetX = 0f;
float rndOffsetY = 0f;
#else
float time = Time.realtimeSinceStartup;
float rndOffsetX = HaltonSeq.Get(m_SampleIndex & 1023, 2);
float rndOffsetY = HaltonSeq.Get(m_SampleIndex & 1023, 3);
if (++m_SampleIndex >= k_SampleCount)
m_SampleIndex = 0;
#endif
// Generate the grain lut for the current frame first
if (m_GrainLookupRT == null || !m_GrainLookupRT.IsCreated())
{
RuntimeUtilities.Destroy(m_GrainLookupRT);
m_GrainLookupRT = new RenderTexture(128, 128, 0, GetLookupFormat())
{
filterMode = FilterMode.Bilinear,
wrapMode = TextureWrapMode.Repeat,
anisoLevel = 0,
name = "Grain Lookup Texture"
};
m_GrainLookupRT.Create();
}
var sheet = context.propertySheets.Get(context.resources.shaders.grainBaker);
sheet.properties.Clear();
sheet.properties.SetFloat(ShaderIDs.Phase, time % 10f);
context.command.BeginSample("GrainLookup");
context.command.BlitFullscreenTriangle(BuiltinRenderTextureType.None, m_GrainLookupRT, sheet, settings.colored.value ? 1 : 0);
context.command.EndSample("GrainLookup");
// Send everything to the uber shader
var uberSheet = context.uberSheet;
uberSheet.EnableKeyword("GRAIN");
uberSheet.properties.SetTexture(ShaderIDs.GrainTex, m_GrainLookupRT);
uberSheet.properties.SetVector(ShaderIDs.Grain_Params1, new Vector2(settings.lumContrib.value, settings.intensity.value * 20f));
uberSheet.properties.SetVector(ShaderIDs.Grain_Params2, new Vector4((float)context.width / (float)m_GrainLookupRT.width / settings.size.value, (float)context.height / (float)m_GrainLookupRT.height / settings.size.value, rndOffsetX, rndOffsetY));
}
RenderTextureFormat GetLookupFormat()
{
if (RenderTextureFormat.ARGBHalf.IsSupported())
return RenderTextureFormat.ARGBHalf;
return RenderTextureFormat.ARGB32;
}
public override void Release()
{
RuntimeUtilities.Destroy(m_GrainLookupRT);
m_GrainLookupRT = null;
m_SampleIndex = 0;
}
}
}
| {
"content_hash": "1f3658c355f462dfc7e0756a4eafa18c",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 257,
"avg_line_length": 39.755102040816325,
"alnum_prop": 0.6239733059548255,
"repo_name": "RobertFont/AlphaProject",
"id": "ce48d2c18e9efda06d640cf4d2dd8b00217d15f6",
"size": "3896",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Assets/PostProcessing/Runtime/Effects/Grain.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "738682"
},
{
"name": "HLSL",
"bytes": "292619"
},
{
"name": "Mathematica",
"bytes": "8499910"
},
{
"name": "ShaderLab",
"bytes": "99893"
}
],
"symlink_target": ""
} |
//-----------------------------------------------------------------------
// <copyright file="HasChildren.cs" company="Marimer LLC">
// Copyright (c) Marimer LLC. All rights reserved.
// Website: http://www.lhotka.net/cslanet/
// </copyright>
// <summary>no summary</summary>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Csla.Serialization;
using Csla.Serialization.Mobile;
using Csla.Core;
using System.Runtime.Serialization;
namespace Csla.Test.ValidationRules
{
[Serializable]
public class HasChildren : BusinessBase<HasChildren>
{
private static PropertyInfo<int> IdProperty = RegisterProperty(new PropertyInfo<int>("Id", "Id"));
public int Id
{
get { return GetProperty(IdProperty); }
set { SetProperty(IdProperty, value); }
}
private static PropertyInfo<ChildList> ChildListProperty = RegisterProperty(new PropertyInfo<ChildList>("ChildList", "Child list"));
public ChildList ChildList
{
get
{
if (!FieldManager.FieldExists(ChildListProperty))
LoadProperty(ChildListProperty, ChildList.NewList());
return GetProperty(ChildListProperty);
}
}
protected override void AddBusinessRules()
{
BusinessRules.AddRule(new OneItem<HasChildren> { PrimaryProperty = ChildListProperty });
}
public class OneItem<T> : Rules.BusinessRule
where T : HasChildren
{
protected override void Execute(Rules.RuleContext context)
{
var target = (T)context.Target;
if (target.ChildList.Count < 1)
context.AddErrorResult("At least one item required");
}
}
protected override void Initialize()
{
base.Initialize();
#if (!SILVERLIGHT)
ChildList.ListChanged += new System.ComponentModel.ListChangedEventHandler(ChildList_ListChanged);
#endif
this.ChildChanged += new EventHandler<ChildChangedEventArgs>(HasChildren_ChildChanged);
}
protected override void OnDeserialized(StreamingContext context)
{
base.OnDeserialized(context);
#if !SILVERLIGHT
ChildList.ListChanged += new System.ComponentModel.ListChangedEventHandler(ChildList_ListChanged);
#endif
this.ChildChanged += new EventHandler<ChildChangedEventArgs>(HasChildren_ChildChanged);
}
#if (!SILVERLIGHT)
void ChildList_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
{
//ValidationRules.CheckRules(ChildListProperty);
}
#endif
void HasChildren_ChildChanged(object sender, ChildChangedEventArgs e)
{
BusinessRules.CheckRules(ChildListProperty);
}
public static void NewObject(EventHandler<DataPortalResult<HasChildren>> completed)
{
Csla.DataPortal.BeginCreate<HasChildren>(completed);
}
}
} | {
"content_hash": "92def184f932b86f6745fc03cfaed3c4",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 136,
"avg_line_length": 31.63736263736264,
"alnum_prop": 0.6748871135811045,
"repo_name": "BrettJaner/csla",
"id": "431098b537708b766849b225c43357a53b99aab1",
"size": "2881",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/Csla.test/ValidationRules/HasChildren.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "13295"
},
{
"name": "Batchfile",
"bytes": "1434"
},
{
"name": "C#",
"bytes": "4395424"
},
{
"name": "HTML",
"bytes": "52832"
},
{
"name": "PowerShell",
"bytes": "25361"
},
{
"name": "Shell",
"bytes": "533"
},
{
"name": "Visual Basic",
"bytes": "42440"
}
],
"symlink_target": ""
} |
struct CallbackMsg_t
{
HSteamUser m_hSteamUser;
int m_iCallback;
uint8 *m_pubParam;
int m_cubParam;
};
#pragma pack( pop )
//-----------------------------------------------------------------------------
// Purpose: Functions for accessing and manipulating a steam account
// associated with one client instance
//-----------------------------------------------------------------------------
class ISteamUser
{
public:
// returns the HSteamUser this interface represents
// this is only used internally by the API, and by a few select interfaces that support multi-user
virtual HSteamUser GetHSteamUser() = 0;
// returns true if the Steam client current has a live connection to the Steam servers.
// If false, it means there is no active connection due to either a networking issue on the local machine, or the Steam server is down/busy.
// The Steam client will automatically be trying to recreate the connection as often as possible.
virtual bool BLoggedOn() = 0;
// returns the CSteamID of the account currently logged into the Steam client
// a CSteamID is a unique identifier for an account, and used to differentiate users in all parts of the Steamworks API
virtual CSteamID GetSteamID() = 0;
// Multiplayer Authentication functions
// InitiateGameConnection() starts the state machine for authenticating the game client with the game server
// It is the client portion of a three-way handshake between the client, the game server, and the steam servers
//
// Parameters:
// void *pAuthBlob - a pointer to empty memory that will be filled in with the authentication token.
// int cbMaxAuthBlob - the number of bytes of allocated memory in pBlob. Should be at least 2048 bytes.
// CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client
// CGameID gameID - the ID of the current game. For games without mods, this is just CGameID( <appID> )
// uint32 unIPServer, uint16 usPortServer - the IP address of the game server
// bool bSecure - whether or not the client thinks that the game server is reporting itself as secure (i.e. VAC is running)
//
// return value - returns the number of bytes written to pBlob. If the return is 0, then the buffer passed in was too small, and the call has failed
// The contents of pBlob should then be sent to the game server, for it to use to complete the authentication process.
virtual int InitiateGameConnection( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure ) = 0;
// notify of disconnect
// needs to occur when the game client leaves the specified game server, needs to match with the InitiateGameConnection() call
virtual void TerminateGameConnection( uint32 unIPServer, uint16 usPortServer ) = 0;
// Legacy functions
// used by only a few games to track usage events
virtual void TrackAppUsageEvent( CGameID gameID, int eAppUsageEvent, const char *pchExtraInfo = "" ) = 0;
// get the local storage folder for current Steam account to write application data, e.g. save games, configs etc.
// this will usually be something like "C:\Progam Files\Steam\userdata\<SteamID>\<AppID>\local"
virtual bool GetUserDataFolder( char *pchBuffer, int cubBuffer ) = 0;
// Starts voice recording. Once started, use GetVoice() to get the data
virtual void StartVoiceRecording( ) = 0;
// Stops voice recording. Because people often release push-to-talk keys early, the system will keep recording for
// a little bit after this function is called. GetVoice() should continue to be called until it returns
// k_eVoiceResultNotRecording
virtual void StopVoiceRecording( ) = 0;
// Determine the amount of captured audio data that is available in bytes.
// This provides both the compressed and uncompressed data. Please note that the uncompressed
// data is not the raw feed from the microphone: data may only be available if audible
// levels of speech are detected.
// nUncompressedVoiceDesiredSampleRate is necessary to know the number of bytes to return in pcbUncompressed - can be set to 0 if you don't need uncompressed (the usual case)
// If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate
virtual EVoiceResult GetAvailableVoice( uint32 *pcbCompressed, uint32 *pcbUncompressed, uint32 nUncompressedVoiceDesiredSampleRate ) = 0;
// Gets the latest voice data from the microphone. Compressed data is an arbitrary format, and is meant to be handed back to
// DecompressVoice() for playback later as a binary blob. Uncompressed data is 16-bit, signed integer, 11025Hz PCM format.
// Please note that the uncompressed data is not the raw feed from the microphone: data may only be available if audible
// levels of speech are detected, and may have passed through denoising filters, etc.
// This function should be called as often as possible once recording has started; once per frame at least.
// nBytesWritten is set to the number of bytes written to pDestBuffer.
// nUncompressedBytesWritten is set to the number of bytes written to pUncompressedDestBuffer.
// You must grab both compressed and uncompressed here at the same time, if you want both.
// Matching data that is not read during this call will be thrown away.
// GetAvailableVoice() can be used to determine how much data is actually available.
// If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nUncompressedVoiceDesiredSampleRate
virtual EVoiceResult GetVoice( bool bWantCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, bool bWantUncompressed, void *pUncompressedDestBuffer, uint32 cbUncompressedDestBufferSize, uint32 *nUncompressBytesWritten, uint32 nUncompressedVoiceDesiredSampleRate ) = 0;
// Decompresses a chunk of compressed data produced by GetVoice().
// nBytesWritten is set to the number of bytes written to pDestBuffer unless the return value is k_EVoiceResultBufferTooSmall.
// In that case, nBytesWritten is set to the size of the buffer required to decompress the given
// data. The suggested buffer size for the destination buffer is 22 kilobytes.
// The output format of the data is 16-bit signed at the requested samples per second.
// If you're upgrading from an older Steamworks API, you'll want to pass in 11025 to nDesiredSampleRate
virtual EVoiceResult DecompressVoice( const void *pCompressed, uint32 cbCompressed, void *pDestBuffer, uint32 cbDestBufferSize, uint32 *nBytesWritten, uint32 nDesiredSampleRate ) = 0;
// This returns the frequency of the voice data as it's stored internally; calling DecompressVoice() with this size will yield the best results
virtual uint32 GetVoiceOptimalSampleRate() = 0;
// Retrieve ticket to be sent to the entity who wishes to authenticate you.
// pcbTicket retrieves the length of the actual ticket.
virtual HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0;
// Authenticate ticket from entity steamID to be sure it is valid and isnt reused
// Registers for callbacks if the entity goes offline or cancels the ticket ( see ValidateAuthTicketResponse_t callback and EAuthSessionResponse )
virtual EBeginAuthSessionResult BeginAuthSession( const void *pAuthTicket, int cbAuthTicket, CSteamID steamID ) = 0;
// Stop tracking started by BeginAuthSession - called when no longer playing game with this entity
virtual void EndAuthSession( CSteamID steamID ) = 0;
// Cancel auth ticket from GetAuthSessionTicket, called when no longer playing game with the entity you gave the ticket to
virtual void CancelAuthTicket( HAuthTicket hAuthTicket ) = 0;
// After receiving a user's authentication data, and passing it to BeginAuthSession, use this function
// to determine if the user owns downloadable content specified by the provided AppID.
virtual EUserHasLicenseForAppResult UserHasLicenseForApp( CSteamID steamID, AppId_t appID ) = 0;
// returns true if this users looks like they are behind a NAT device. Only valid once the user has connected to steam
// (i.e a SteamServersConnected_t has been issued) and may not catch all forms of NAT.
virtual bool BIsBehindNAT() = 0;
// set data to be replicated to friends so that they can join your game
// CSteamID steamIDGameServer - the steamID of the game server, received from the game server by the client
// uint32 unIPServer, uint16 usPortServer - the IP address of the game server
virtual void AdvertiseGame( CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer ) = 0;
// Requests a ticket encrypted with an app specific shared key
// pDataToInclude, cbDataToInclude will be encrypted into the ticket
// ( This is asynchronous, you must wait for the ticket to be completed by the server )
CALL_RESULT( EncryptedAppTicketResponse_t )
virtual SteamAPICall_t RequestEncryptedAppTicket( void *pDataToInclude, int cbDataToInclude ) = 0;
// retrieve a finished ticket
virtual bool GetEncryptedAppTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket ) = 0;
// Trading Card badges data access
// if you only have one set of cards, the series will be 1
// the user has can have two different badges for a series; the regular (max level 5) and the foil (max level 1)
virtual int GetGameBadgeLevel( int nSeries, bool bFoil ) = 0;
// gets the Steam Level of the user, as shown on their profile
virtual int GetPlayerSteamLevel() = 0;
// Requests a URL which authenticates an in-game browser for store check-out,
// and then redirects to the specified URL. As long as the in-game browser
// accepts and handles session cookies, Steam microtransaction checkout pages
// will automatically recognize the user instead of presenting a login page.
// The result of this API call will be a StoreAuthURLResponse_t callback.
// NOTE: The URL has a very short lifetime to prevent history-snooping attacks,
// so you should only call this API when you are about to launch the browser,
// or else immediately navigate to the result URL using a hidden browser window.
// NOTE 2: The resulting authorization cookie has an expiration time of one day,
// so it would be a good idea to request and visit a new auth URL every 12 hours.
CALL_RESULT( StoreAuthURLResponse_t )
virtual SteamAPICall_t RequestStoreAuthURL( const char *pchRedirectURL ) = 0;
// gets whether the users phone number is verified
virtual bool BIsPhoneVerified() = 0;
// gets whether the user has two factor enabled on their account
virtual bool BIsTwoFactorEnabled() = 0;
// gets whether the users phone number is identifying
virtual bool BIsPhoneIdentifying() = 0;
// gets whether the users phone number is awaiting (re)verification
virtual bool BIsPhoneRequiringVerification() = 0;
};
#define STEAMUSER_INTERFACE_VERSION "SteamUser019"
// callbacks
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error isteamclient.h must be included
#endif
//-----------------------------------------------------------------------------
// Purpose: called when a connections to the Steam back-end has been established
// this means the Steam client now has a working connection to the Steam servers
// usually this will have occurred before the game has launched, and should
// only be seen if the user has dropped connection due to a networking issue
// or a Steam server update
//-----------------------------------------------------------------------------
struct SteamServersConnected_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 1 };
};
//-----------------------------------------------------------------------------
// Purpose: called when a connection attempt has failed
// this will occur periodically if the Steam client is not connected,
// and has failed in it's retry to establish a connection
//-----------------------------------------------------------------------------
struct SteamServerConnectFailure_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 2 };
EResult m_eResult;
bool m_bStillRetrying;
};
//-----------------------------------------------------------------------------
// Purpose: called if the client has lost connection to the Steam servers
// real-time services will be disabled until a matching SteamServersConnected_t has been posted
//-----------------------------------------------------------------------------
struct SteamServersDisconnected_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 3 };
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: Sent by the Steam server to the client telling it to disconnect from the specified game server,
// which it may be in the process of or already connected to.
// The game client should immediately disconnect upon receiving this message.
// This can usually occur if the user doesn't have rights to play on the game server.
//-----------------------------------------------------------------------------
struct ClientGameServerDeny_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 13 };
uint32 m_uAppID;
uint32 m_unGameServerIP;
uint16 m_usGameServerPort;
uint16 m_bSecure;
uint32 m_uReason;
};
//-----------------------------------------------------------------------------
// Purpose: called when the callback system for this client is in an error state (and has flushed pending callbacks)
// When getting this message the client should disconnect from Steam, reset any stored Steam state and reconnect.
// This usually occurs in the rare event the Steam client has some kind of fatal error.
//-----------------------------------------------------------------------------
struct IPCFailure_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 17 };
enum EFailureType
{
k_EFailureFlushedCallbackQueue,
k_EFailurePipeFail,
};
uint8 m_eFailureType;
};
//-----------------------------------------------------------------------------
// Purpose: Signaled whenever licenses change
//-----------------------------------------------------------------------------
struct LicensesUpdated_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 25 };
};
//-----------------------------------------------------------------------------
// callback for BeginAuthSession
//-----------------------------------------------------------------------------
struct ValidateAuthTicketResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 43 };
CSteamID m_SteamID;
EAuthSessionResponse m_eAuthSessionResponse;
CSteamID m_OwnerSteamID; // different from m_SteamID if borrowed
};
//-----------------------------------------------------------------------------
// Purpose: called when a user has responded to a microtransaction authorization request
//-----------------------------------------------------------------------------
struct MicroTxnAuthorizationResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 52 };
uint32 m_unAppID; // AppID for this microtransaction
uint64 m_ulOrderID; // OrderID provided for the microtransaction
uint8 m_bAuthorized; // if user authorized transaction
};
//-----------------------------------------------------------------------------
// Purpose: Result from RequestEncryptedAppTicket
//-----------------------------------------------------------------------------
struct EncryptedAppTicketResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 54 };
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// callback for GetAuthSessionTicket
//-----------------------------------------------------------------------------
struct GetAuthSessionTicketResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 63 };
HAuthTicket m_hAuthTicket;
EResult m_eResult;
};
//-----------------------------------------------------------------------------
// Purpose: sent to your game in response to a steam://gamewebcallback/ command
//-----------------------------------------------------------------------------
struct GameWebCallback_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 64 };
char m_szURL[256];
};
//-----------------------------------------------------------------------------
// Purpose: sent to your game in response to ISteamUser::RequestStoreAuthURL
//-----------------------------------------------------------------------------
struct StoreAuthURLResponse_t
{
enum { k_iCallback = k_iSteamUserCallbacks + 65 };
char m_szURL[512];
};
#pragma pack( pop )
#endif // ISTEAMUSER_H
| {
"content_hash": "268bf3f996c54492b2b6ffcecd9754c2",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 295,
"avg_line_length": 50.01807228915663,
"alnum_prop": 0.6746958930507045,
"repo_name": "s-m-k/SteamworksWrapper",
"id": "f97a057188068119345e8a0f8f572b1d00603222",
"size": "17219",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "NativeSource/inc/steam/isteamuser.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "100739"
},
{
"name": "C#",
"bytes": "580262"
},
{
"name": "C++",
"bytes": "473039"
},
{
"name": "Objective-C",
"bytes": "3590"
},
{
"name": "Python",
"bytes": "1469"
},
{
"name": "Shell",
"bytes": "126"
}
],
"symlink_target": ""
} |
/**
*
*/
package fp4g.generator;
import fp4g.core.Expresion;
import fp4g.data.Container;
import fp4g.data.expresion.FunctionCall;
import fp4g.exceptions.CannotEvalException;
/**
* @author Edgardo
*
*/
public abstract class FunctionGenerator <M extends MetaSourceModel, T extends Generator<M>>
{
//el generador para que esté disponible para las demás instancias...
protected final T generator;
public FunctionGenerator(T generator)
{
this.generator = generator;
}
/**
* A partir de los parametros puestos en el generador, devolverá una expresión.
* Tal expresión, será luego convertida en codigo según el generador.
*
* @param current define actual donde se invoca esta clase
* @param parent padre quien contiene a la función actual.
* @param model modelo del codigo fuente que se genera
* @param list
* @return una expresion, la cual puede ser codigo directo o algo...
* @throws CannotEvalException
*/
public abstract Expresion generate(M model,FunctionCall function, Container container) throws CannotEvalException;
}
| {
"content_hash": "6d4be342165891717cc9bb8d25c1fb45",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 115,
"avg_line_length": 27.333333333333332,
"alnum_prop": 0.7485928705440901,
"repo_name": "egyware/fp4g",
"id": "f8be80deef42ce9635adaa30a9b97c3abfaa1bdd",
"size": "1066",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "fp4g/src/fp4g/generator/FunctionGenerator.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ANTLR",
"bytes": "8160"
},
{
"name": "HTML",
"bytes": "1156"
},
{
"name": "Java",
"bytes": "660826"
},
{
"name": "JavaScript",
"bytes": "9831"
}
],
"symlink_target": ""
} |
<?php
/**
* DO NOT EDIT THIS FILE!
*
* This file was automatically generated from external sources.
*
* Any manual change here will be lost the next time the SDK
* is updated. You've been warned!
*/
namespace DTS\eBaySDK\Trading\Types;
/**
*
* @property string $unit
*/
class QuantityType extends \DTS\eBaySDK\Types\DecimalType
{
/**
* @var array Properties belonging to objects of this class.
*/
private static $propertyTypes = [
'unit' => [
'type' => 'string',
'repeatable' => false,
'attribute' => true,
'attributeName' => 'unit'
]
];
/**
* @param array $values Optional properties and values to assign to the object.
*/
public function __construct(array $values = [])
{
list($parentValues, $childValues) = self::getParentValues(self::$propertyTypes, $values);
parent::__construct($parentValues);
if (!array_key_exists(__CLASS__, self::$properties)) {
self::$properties[__CLASS__] = array_merge(self::$properties[get_parent_class()], self::$propertyTypes);
}
if (!array_key_exists(__CLASS__, self::$xmlNamespaces)) {
self::$xmlNamespaces[__CLASS__] = 'xmlns="urn:ebay:apis:eBLBaseComponents"';
}
$this->setValues(__CLASS__, $childValues);
}
}
| {
"content_hash": "5affd144e70e2e077c5974521dfc0892",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 116,
"avg_line_length": 27.1,
"alnum_prop": 0.5874538745387454,
"repo_name": "davidtsadler/ebay-sdk-php",
"id": "1a0405aefce79f8049803fc3a5aed136cb432bfd",
"size": "1355",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Trading/Types/QuantityType.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Makefile",
"bytes": "10944"
},
{
"name": "PHP",
"bytes": "9958599"
}
],
"symlink_target": ""
} |
package com.streamsets.datacollector.execution;
import com.streamsets.datacollector.runner.Pipeline;
public interface PipelineInfo {
Pipeline getPipeline();
}
| {
"content_hash": "78ccce956d8c1e6fbf83f804a79a7398",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 52,
"avg_line_length": 16.6,
"alnum_prop": 0.8072289156626506,
"repo_name": "SandishKumarHN/datacollector",
"id": "57493d9134c5ddf58bc6abf30ae0ca4b2149897e",
"size": "764",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "container/src/main/java/com/streamsets/datacollector/execution/PipelineInfo.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "101291"
},
{
"name": "CSS",
"bytes": "120603"
},
{
"name": "Groovy",
"bytes": "11876"
},
{
"name": "HTML",
"bytes": "529889"
},
{
"name": "Java",
"bytes": "20591845"
},
{
"name": "JavaScript",
"bytes": "1073298"
},
{
"name": "Python",
"bytes": "7413"
},
{
"name": "Scala",
"bytes": "6347"
},
{
"name": "Shell",
"bytes": "30090"
}
],
"symlink_target": ""
} |
Resume Template
A two column asymetric resume template made using HTML,CSS and Bootstrap perfect for an undergraduate Engineering/CS student.
Usage
Fork or clone the git repository. Edit index.html
Command for cloning git clone https://github.com/Spurrya/resume2.git
See sample resume in resume.pdf
The row on the right column include: Skills, Leadership, Competition and Education The row on the left column include: Work Experience and Projects.
Credits
Abhijith Ramalingam and Spurrya Jaggi
| {
"content_hash": "71ee088365fe401307ac0164b5a0e130",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 148,
"avg_line_length": 35.642857142857146,
"alnum_prop": 0.8176352705410822,
"repo_name": "Spurrya/resume2",
"id": "f2139f60e2f909db2e88d6241077e6bc37a92172",
"size": "499",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2014"
},
{
"name": "HTML",
"bytes": "14039"
}
],
"symlink_target": ""
} |
require_relative '../../../spec_helper'
require_relative 'fixtures/classes'
describe "Enumerator::Lazy#take_while" do
before :each do
@yieldsmixed = EnumeratorLazySpecs::YieldsMixed.new.to_enum.lazy
@eventsmixed = EnumeratorLazySpecs::EventsMixed.new.to_enum.lazy
ScratchPad.record []
end
after :each do
ScratchPad.clear
end
it "returns a new instance of Enumerator::Lazy" do
ret = @yieldsmixed.take_while {}
ret.should be_an_instance_of(Enumerator::Lazy)
ret.should_not equal(@yieldsmixed)
end
it "sets #size to nil" do
Enumerator::Lazy.new(Object.new, 100) {}.take_while { true }.size.should == nil
end
describe "when the returned lazy enumerator is evaluated by .force" do
it "stops after specified times" do
(0..Float::INFINITY).lazy.take_while { |n| n < 3 }.force.should == [0, 1, 2]
@eventsmixed.take_while { false }.force
ScratchPad.recorded.should == [:before_yield]
end
end
it "calls the block with initial values when yield with multiple arguments" do
yields = []
@yieldsmixed.take_while { |v| yields << v; true }.force
yields.should == EnumeratorLazySpecs::YieldsMixed.initial_yields
end
it "raises an ArgumentError when not given a block" do
-> { @yieldsmixed.take_while }.should raise_error(ArgumentError)
end
describe "on a nested Lazy" do
it "sets #size to nil" do
Enumerator::Lazy.new(Object.new, 100) {}.take(20).take_while { true }.size.should == nil
end
describe "when the returned lazy enumerator is evaluated by .force" do
it "stops after specified times" do
(0..Float::INFINITY).lazy.take_while { |n| n < 3 }.take_while(&:even?).force.should == [0]
@eventsmixed.take_while { true }.take_while { false }.force
ScratchPad.recorded.should == [:before_yield]
end
end
end
end
| {
"content_hash": "d31bad48db54e24db2c4fb5d01f861eb",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 98,
"avg_line_length": 32.206896551724135,
"alnum_prop": 0.6718415417558886,
"repo_name": "ruby/spec",
"id": "bcea0b1419f4faf383f0f7b2aefea1f71a72582f",
"size": "1898",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "core/enumerator/lazy/take_while_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "189924"
},
{
"name": "Ruby",
"bytes": "6763362"
},
{
"name": "Shell",
"bytes": "65"
}
],
"symlink_target": ""
} |
========
arcpyext
========
arcpyext provides a collection of helper functions that make common tasks performed with the Esri ArcPy site-package
easier to accomplish. It was chiefly developed to service a command-line toolset (agstools) for managing ArcGIS
environments, but can readily be used within other scripts.
Features
===============
Currently, arcpyext has functionality for preparing map documents for publishing, and performing CRUD operations within
an edit session on a geo-database.
arcpyext.mapping
----------------
The *mapping* module provides features for changing the data sources of a layer, create an SDDraft, modifying most of
the basic service settings on an SDDraft, and stage an SDDraft to a Service Definition (SD).
See the associated tests for code examples.
arcpyext.data
-------------
The *data* module wraps the basic create, update and delete operations in an edit session, automatically starting/
stoping/aborting an edit operation as appropriate. The functions simply wrap the appropriate *arcpy.da* cursors, so
functionally they work identically. Also provided is a handy fucntion for reading rows into a list.
Example::
import arcpy
import arcpyext.data
#WORKSPACE = "path/to/sde_database.sde"
WORKSPACE = "path/to/geodatabase.gdb"
TABLE = "Countries"
edit_session = arcpy.da.Editor(WORKSPACE)
edit_session.startEditing()
try:
arcpyext.data.delete_rows(edit_session, TABLE, "Name LIKE 'A%'", ('Name'))
except RuntimeError, re:
edit_session.stopEditing(False)
edit_session.stopEditing(True)
del edit_session
See the associated tests for more code examples. | {
"content_hash": "3b17369aa9d8a0d3f4e797694a57d80a",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 120,
"avg_line_length": 33.48,
"alnum_prop": 0.7359617682198327,
"repo_name": "adamkerz/arcpyext",
"id": "96e818fb717dc0133b6c96cc5eaec9a5f8e8a779",
"size": "1674",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Source/README.rst",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PowerShell",
"bytes": "90"
},
{
"name": "Python",
"bytes": "59745"
}
],
"symlink_target": ""
} |
var _ = require('underscore');
var Router = require('director').Router;
function Moxi() {
this.options = {};
this.layouts = {};
this.components = {};
this.routes = {};
this.datasources = {};
this.mode = "dev";
this.router = Router().configure({ html5history: true, run_handler_in_init: false, notfound: this.unknownRoute });
}
_.extend(Moxi.prototype,
require("./lib/browser/configure"),
require("./lib/register"),
require("./lib/layout"),
require("./lib/browser/resolver"),
require("./lib/reducer"),
require("./lib/browser/route"),
require("./lib/browser/start")
);
var moxiSingleton = new Moxi();
window.Moxi = moxiSingleton;
module.exports = moxiSingleton; | {
"content_hash": "0780f42859076504aa96febcfaa59787",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 118,
"avg_line_length": 25.714285714285715,
"alnum_prop": 0.6347222222222222,
"repo_name": "ozymandias547/Vivid",
"id": "77566ca2c91e4fdea614960e7ffd2d330ba41d77",
"size": "720",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "moxi/browser.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "24247"
},
{
"name": "JavaScript",
"bytes": "64026"
}
],
"symlink_target": ""
} |
title: Episode 80
subtitle: Getting Started Is Never Easy
datum: March 21 2016
layout: post
author: Arne and Stefan
explicit: 'no'
duration: "0:03:13"
audio:
mp3: 80.mp3
ogg: 80.ogg
m4a: 80.m4a
chapters:
- '00:00:00.000 Intro.'
- '00:00:00.500 ... Shoubidoubidoo ...'
- '00:00:01.000 Outro.'
---
## {{ page.subtitle }}
{{ page | web_player_moderator:site }}
## Show Notes and Links
* Well this is the place for the Show Notes.
* Send Feedback either in the [Github Repo](https://github.com/haslinger/jekyll-octopod) or at the Twitter account [@AuaUffCode](http://twitter.com/@AuaUffCode).
| {
"content_hash": "dfed133292560f6495d7c016aa10cb51",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 163,
"avg_line_length": 24.36,
"alnum_prop": 0.6814449917898193,
"repo_name": "jekyll-octopod/staging",
"id": "e6771b1a6e4339e1580fd1054258a5eb1f511aeb",
"size": "613",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2016-03-21-episode80.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2813844"
},
{
"name": "HTML",
"bytes": "15416"
},
{
"name": "JavaScript",
"bytes": "469280"
},
{
"name": "Ruby",
"bytes": "23755"
}
],
"symlink_target": ""
} |
from siuba.siu import CallTreeLocal, FunctionLookupError, ExecutionValidatorVisitor
from .groupby import SeriesGroupBy
from .translate import (
forward_method,
not_implemented,
method_agg_op,
method_win_op_agg_result
)
from siuba.experimental.pd_groups.groupby import SeriesGroupBy, GroupByAgg, broadcast_agg, is_compatible
# THE REAL DIALECT FILE LET'S DO THIS
# ====================================
from siuba.ops import ALL_OPS
from siuba import ops
# register concrete implementations for all ops -------------------------------
# note that this may include versions that would error (e.g. tries to look
# up a Series method that doesn't exist). Custom implementations to fix
# are registered over these further down
for dispatcher in ALL_OPS.values():#vars(ops).values():
#try:
forward_method(dispatcher)
#except KeyError:
# pass
# custom implementations ------------------------------------------------------
def register_method(ns, op_name, f, is_property = False, accessor = None):
generic = ns[op_name]
return generic.register(SeriesGroupBy, f(op_name, is_property, accessor))
# add to new op spec
# create new call tree
# aggregate ----
NOT_IMPLEMENTED_AGG = [
"bool", "dot", "empty", "equals", "hasnans", "is_unique", "kurt",
"kurtosis", "memory_usage", "nbytes", "product"
]
for f_name in NOT_IMPLEMENTED_AGG:
ALL_OPS[f_name].register(SeriesGroupBy, not_implemented(f_name))
# size is a property on ungrouped, but not grouped pandas data.
# since siuba follows the ungrouped API, it's used as _.x.size, and
# just needs its implementation registered as a *non*-property.
ops.size.register(SeriesGroupBy, method_agg_op("size", is_property = False, accessor = None))
# window ----
NOT_IMPLEMENTED_WIN = [
"asof", "at", "autocorr", "cat.remove_unused_categories",
"convert_dtypes", "drop_duplicates", "duplicated", "get",
"iat", "iloc", "infer_objects", "is_monotonic",
]
for f_name in NOT_IMPLEMENTED_WIN:
ALL_OPS[f_name].register(SeriesGroupBy, not_implemented(f_name))
# a few functions apply window operations, but return an agg-like result
forward_method(ops.is_monotonic_decreasing, method_win_op_agg_result)
forward_method(ops.is_monotonic_increasing, method_win_op_agg_result)
# NOTE TODO: these methods could be implemented, but depend on the type of
# time index they're operating on
NOT_IMPLEMENTED_DT = [
"dt.qyear", "dt.to_pytimedelta", "dt.to_timestamp", "dt.total_seconds", "dt.tz_convert",
"to_period","dt.to_pydatetime"
]
for f_name in NOT_IMPLEMENTED_DT:
ALL_OPS[f_name].register(SeriesGroupBy, not_implemented(f_name))
# ====================================
from .translate import GroupByAgg, SeriesGroupBy
# TODO: use pandas call tree creator
from siuba.ops.generics import ALL_PROPERTIES, ALL_ACCESSORS
call_listener = CallTreeLocal(
ALL_OPS,
call_sub_attr = ALL_ACCESSORS,
chain_sub_attr = True,
dispatch_cls = GroupByAgg,
result_cls = SeriesGroupBy,
call_props = ALL_PROPERTIES
)
call_validator = ExecutionValidatorVisitor(GroupByAgg, SeriesGroupBy)
# Fast group by verbs =========================================================
from siuba.siu import Call, singledispatch2
from siuba.dply.verbs import mutate, filter, summarize, DataFrameGroupBy
from pandas.core.dtypes.inference import is_scalar
import warnings
def fallback_warning(expr, reason):
warnings.warn(
"The expression below cannot be executed quickly. "
"Using the slow (but general) pandas apply method."
"\n\nExpression: {}\nReason: {}"
.format(expr, reason)
)
def grouped_eval(__data, expr, require_agg = False):
if is_scalar(expr):
return expr
if isinstance(expr, Call):
try:
call = call_listener.enter(expr)
call_validator.visit(call)
except FunctionLookupError as e:
fallback_warning(expr, str(e))
call = expr
#
grouped_res = call(__data)
if isinstance(grouped_res, SeriesGroupBy):
if not is_compatible(grouped_res, __data):
raise ValueError("Incompatible groupers")
# TODO: may want to validate result is correct length / index?
# e.g. a SeriesGroupBy could be compatible and not an agg
if require_agg:
return grouped_res.obj
else:
# broadcast from aggregate to original length (like transform)
return broadcast_agg(grouped_res)
else:
# can happen right now if user selects, e.g., a property of the
# groupby object, like .dtype, which returns a single value
# in the future, could restrict set of operations user could perform
raise ValueError("Result must be subclass of SeriesGroupBy")
raise ValueError("Grouped expressions must be a siu expression or scalar")
# Fast mutate ----
def _transform_args(args):
out = []
for expr in args:
if is_scalar(expr):
out.append(expr)
elif isinstance(expr, Call):
try:
call = call_listener.enter(expr)
call_validator.visit(call)
out.append(call)
except FunctionLookupError as e:
fallback_warning(expr, str(e))
return None
elif callable(expr):
return None
return out
def _copy_dispatch(dispatcher, cls, func = None):
if func is None:
return lambda f: _copy_dispatch(dispatcher, cls, f)
# Note stripping symbolics may occur twice. Once in the original, and once
# in this dispatcher.
new_dispatch = singledispatch2(cls, func)
new_dispatch.register(object, dispatcher)
return new_dispatch
@_copy_dispatch(mutate, DataFrameGroupBy)
def fast_mutate(__data, **kwargs):
"""Warning: this function is experimental"""
# transform call trees, potentially bail out to slow method --------
new_vals = _transform_args(kwargs.values())
if new_vals is None:
return mutate(__data, **kwargs)
# perform fast method ----
out = __data.obj.copy()
groupings = __data.grouper.groupings
for name, expr in zip(kwargs, new_vals):
res = grouped_eval(__data, expr)
out[name] = res
return out.groupby(groupings)
# Fast filter ----
@_copy_dispatch(filter, DataFrameGroupBy)
def fast_filter(__data, *args):
"""Warning: this function is experimental"""
# transform call trees, potentially bail out to slow method --------
new_vals = _transform_args(args)
if new_vals is None:
return filter(__data, *args)
# perform fast method ----
out = []
groupings = __data.grouper.groupings
for expr in args:
res = grouped_eval(__data, expr)
out.append(res)
filter_df = filter.dispatch(__data.obj.__class__)
df_result = filter_df(__data.obj, *out)
# TODO: research how to efficiently & robustly subset groupings
group_names = [ping.name for ping in groupings]
return df_result.groupby(group_names)
# Fast summarize ----
@_copy_dispatch(summarize, DataFrameGroupBy)
def fast_summarize(__data, **kwargs):
"""Warning: this function is experimental"""
# transform call trees, potentially bail out to slow method --------
new_vals = _transform_args(kwargs.values())
if new_vals is None:
return summarize(__data, **kwargs)
# perform fast method ----
groupings = __data.grouper.groupings
# TODO: better way of getting this frame?
out = __data.grouper.result_index.to_frame()
for name, expr in kwargs.items():
# special case: set scalars directly
res = grouped_eval(__data, expr, require_agg = True)
out[name] = res
return out.reset_index(drop = True)
| {
"content_hash": "3cea890606aef8858671334137be6fcc",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 104,
"avg_line_length": 29.74721189591078,
"alnum_prop": 0.6295926018495376,
"repo_name": "machow/siuba",
"id": "1697e5ac54fa98c0695a552af0fdfb19fc99802e",
"size": "8002",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "siuba/experimental/pd_groups/dialect.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Makefile",
"bytes": "1007"
},
{
"name": "Python",
"bytes": "573788"
}
],
"symlink_target": ""
} |
Treinamento de MEAN STACK do Alura
| {
"content_hash": "e9a55b570ac3480f3158d3a376c37741",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 34,
"avg_line_length": 35,
"alnum_prop": 0.8285714285714286,
"repo_name": "kaiocesar/treinamento-mean",
"id": "e75c7edb7d180489f0e7aad52bc322198271c358",
"size": "54",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "56268"
},
{
"name": "JavaScript",
"bytes": "3909"
}
],
"symlink_target": ""
} |
import {
OPEN_MAIN_MENU,
CLOSE_MAIN_MENU,
TERMS_MENU_VALUE,
ACCEPTED_PAYMENTS,
REMEMBER_USER,
FORGET_USER,
SHOW_ERROR,
HIDE_ERROR,
SELECT_CURRENCY,
SHOW_MESSAGE,
} from './actionTypes';
import { createActions } from 'redux-actions';
/**
* UI related actions.
*/
const uiActions = createActions(
OPEN_MAIN_MENU,
CLOSE_MAIN_MENU,
TERMS_MENU_VALUE,
ACCEPTED_PAYMENTS,
REMEMBER_USER,
FORGET_USER,
SELECT_CURRENCY,
SHOW_ERROR,
HIDE_ERROR,
SHOW_MESSAGE,
);
module.exports = uiActions;
| {
"content_hash": "bc97a26fdb7b719ead30ccc0870bf6fb",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 46,
"avg_line_length": 16.870967741935484,
"alnum_prop": 0.6902485659655831,
"repo_name": "TeamAusDigital/apec-connect",
"id": "7712c9468749a7fa0b5640737ba1501c0ce70c05",
"size": "523",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/src/state/actions/ui.actions.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1163"
},
{
"name": "HTML",
"bytes": "8194"
},
{
"name": "JavaScript",
"bytes": "334968"
},
{
"name": "Scala",
"bytes": "124800"
},
{
"name": "Shell",
"bytes": "7554"
},
{
"name": "TSQL",
"bytes": "2487"
}
],
"symlink_target": ""
} |
package org.takes.rs;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.takes.Response;
/**
* Plain text response decorator.
*
* <p>The class is immutable and thread-safe.
*
* @since 0.1
*/
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public final class RsText extends RsWrap {
/**
* Ctor.
* @since 0.10
*/
public RsText() {
this("");
}
/**
* Ctor.
* @param body Plain text body
*/
public RsText(final CharSequence body) {
this(new RsWithStatus(HttpURLConnection.HTTP_OK), body);
}
/**
* Ctor.
* @param body Plain text body
*/
public RsText(final byte[] body) {
this(new RsWithStatus(HttpURLConnection.HTTP_OK), body);
}
/**
* Ctor.
* @param body Plain text body
*/
public RsText(final InputStream body) {
this(new RsWithStatus(HttpURLConnection.HTTP_OK), body);
}
/**
* Ctor.
* @param url URL with body
* @since 0.10
*/
public RsText(final URL url) {
this(new RsWithStatus(HttpURLConnection.HTTP_OK), url);
}
/**
* Ctor.
* @param res Original response
* @param body HTML body
*/
public RsText(final Response res, final CharSequence body) {
this(new RsWithBody(res, body));
}
/**
* Ctor.
* @param res Original response
* @param body HTML body
*/
public RsText(final Response res, final byte[] body) {
this(new RsWithBody(res, body));
}
/**
* Ctor.
* @param res Original response
* @param body HTML body
*/
public RsText(final Response res, final InputStream body) {
this(new RsWithBody(res, new Body.TempFile(new Body.Stream(body))));
}
/**
* Ctor.
* @param res Original response
* @param url URL with body
*/
public RsText(final Response res, final URL url) {
this(new RsWithBody(res, url));
}
/**
* Ctor.
* @param res Original response
* @since 0.10
*/
public RsText(final Response res) {
super(
new RsWithType(res, "text/plain")
);
}
}
| {
"content_hash": "d35cab6bffc973b2c6cc85be506ed783",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 76,
"avg_line_length": 20.736363636363638,
"alnum_prop": 0.5778167470407716,
"repo_name": "simonjenga/takes",
"id": "17a6c9c11c2fdbc066df7e7672fca92c21a9c73b",
"size": "3434",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/org/takes/rs/RsText.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "4294"
},
{
"name": "Java",
"bytes": "1659567"
},
{
"name": "XSLT",
"bytes": "22893"
}
],
"symlink_target": ""
} |
@charset "utf-8";
/*
* CSS Document
* Written by Ryan Yonzon
* http://ryan.rawswift.com/
*/
/*
* IE hack
*/
html, body {
margin:0px;
overflow:hidden; /* hide browser's main scrollbar */
height:100%; /* make sure we'll use 100% of the page's height */
}
#main_container {
width:100%; /* make sure we'll use 100% of page's width */
background-color:#ffffff; /* DO NOT REMOVE THIS; or you'll have issue w/ the scrollbar, when the mouse pointer is on a white space */
overflow-x: hidden;
overflow-y: scroll;
}
| {
"content_hash": "867eef769c380f8347b73952c2b726ad",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 134,
"avg_line_length": 24.772727272727273,
"alnum_prop": 0.6330275229357798,
"repo_name": "digimark1/trackngo-dash",
"id": "5f419d6848d71b2dd7480cdfa37bfb30cf63d391",
"size": "545",
"binary": false,
"copies": "12",
"ref": "refs/heads/master",
"path": "css/chat/screen_ie.css",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "725"
},
{
"name": "CSS",
"bytes": "184707"
},
{
"name": "HTML",
"bytes": "6627"
},
{
"name": "JavaScript",
"bytes": "97555"
},
{
"name": "PHP",
"bytes": "4959406"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_45) on Fri Oct 28 15:16:22 BST 2016 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class com.github.rvesse.airline.annotations.restrictions.MaxOccurrences (Airline - Library 2.3.0-SNAPSHOT API)</title>
<meta name="date" content="2016-10-28">
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class com.github.rvesse.airline.annotations.restrictions.MaxOccurrences (Airline - Library 2.3.0-SNAPSHOT API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><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/github/rvesse/airline/annotations/restrictions/MaxOccurrences.html" title="annotation in com.github.rvesse.airline.annotations.restrictions">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/github/rvesse/airline/annotations/restrictions/class-use/MaxOccurrences.html" target="_top">Frames</a></li>
<li><a href="MaxOccurrences.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../../allclasses-noframe.html">All 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.github.rvesse.airline.annotations.restrictions.MaxOccurrences" class="title">Uses of Class<br>com.github.rvesse.airline.annotations.restrictions.MaxOccurrences</h2>
</div>
<div class="classUseContainer">No usage of com.github.rvesse.airline.annotations.restrictions.MaxOccurrences</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><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/github/rvesse/airline/annotations/restrictions/MaxOccurrences.html" title="annotation in com.github.rvesse.airline.annotations.restrictions">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/github/rvesse/airline/annotations/restrictions/class-use/MaxOccurrences.html" target="_top">Frames</a></li>
<li><a href="MaxOccurrences.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../../allclasses-noframe.html">All 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 © 2012–2016. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "0473ebf719595b1aa05021a8e6063c4e",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 193,
"avg_line_length": 40.88034188034188,
"alnum_prop": 0.6268032615513276,
"repo_name": "rvesse/airline",
"id": "feb147590f85225f235aa1b9f3d50b9678a42263",
"size": "4783",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "docs/javadoc/2.3.0-SNAPSHOT/airline/com/github/rvesse/airline/annotations/restrictions/class-use/MaxOccurrences.html",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "91"
},
{
"name": "Java",
"bytes": "2176058"
},
{
"name": "Shell",
"bytes": "4550"
}
],
"symlink_target": ""
} |
class VariantPolicy < Struct.new(:user, :variant)
def update?
Role.user_is_at_least_a?(user, :editor)
end
def destroy?
Role.user_is_at_least_a?(user, :editor)
end
end
| {
"content_hash": "54ad90d1ef31eac3ff76c44ac88da7d1",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 49,
"avg_line_length": 20.444444444444443,
"alnum_prop": 0.6630434782608695,
"repo_name": "ahwagner/civic-server",
"id": "7c0a3b297437bb49609d9a1d80fb7912228c1573",
"size": "184",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/policies/variant_policy.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "243955"
},
{
"name": "CoffeeScript",
"bytes": "29"
},
{
"name": "HTML",
"bytes": "3949349"
},
{
"name": "JavaScript",
"bytes": "1244736"
},
{
"name": "Perl",
"bytes": "8951"
},
{
"name": "Ruby",
"bytes": "667134"
}
],
"symlink_target": ""
} |
function [Tr, leafIdx] = iniTree(X, r, eps0)
% Initialize tree of nodes
% Inputs:
% X - initialization data. matrix of size [p x N]
% r - subspace demension
% eps0 = Error bound - if error for current nodes is greater than this, add a new level of nodes.
% Outputs:
% Tr - a tree of nodes, for all of the data.
% leafIdx - indexes of the leaf nodes (parents of the virtual children nodes)
[~,N] = size(X);
if N < 5*r
error('Not enough observations for initialization. Please provide at least %d initialization points.',5*r);
return;
end
Tr = batchIni(X, r); % Initialize the head node, with data from all patches.
Tr.weight = 1;
leafIdx = 1;
inspected = 1;
dataThisNode = {1:N};
while ~isempty(inspected)
eps = Tr(inspected(1)).error;
% if error for current tree is above some threshhold
if eps > eps0
% split patches into 2 clusters
[dataIdx, ~] = kmeans(X(:, dataThisNode{inspected(1)})', 2);
leftIdx = dataThisNode{inspected(1)}(dataIdx == 1);
rightIdx = dataThisNode{inspected(1)}(dataIdx == 2);
% Add two new children to the tree.
% NOTE: until recently, there was a requirement that there must be
% at least 5*r elements in each data cluster here. There may still
% be bugs for the special case where this is not true.
if (numel(leftIdx) >= r && numel(rightIdx) >= r)
Tr(end+1) = batchIni(X(:, leftIdx), r);
Tr(end).weight = length(leftIdx)/N;
Tr(end+1) = batchIni(X(:, rightIdx), r);
Tr(end).weight = length(rightIdx)/N;
Tr(inspected(1)).left = length(Tr)-1;
Tr(inspected(1)).right = length(Tr);
Tr(end-1).father = inspected(1);
Tr(end).father = inspected(1);
inspected = [inspected, length(Tr)-1, length(Tr)];
dataThisNode = [dataThisNode, leftIdx, rightIdx];
leafIdx(leafIdx == inspected(1)) = [];
leafIdx = [leafIdx, length(Tr)-1, length(Tr)];
end
end
inspected(1) = [];
end
% For each item still in leafIdx (leaf nodes, which were not given children because error
% was below the threshhold), add a left and right shadow node. they have quick and dirty
% aggregate approximations of the appropriate statistics.
for i = leafIdx
% kmeans division to be added
Tr(end+1) = Tr(i);
[maxLen, maxIdx] = max(Tr(i).spread);
majorAxis = Tr(i).basis(:, maxIdx);
Tr(end).center = Tr(i).center + sqrt(maxLen)/2*majorAxis;
% Tr(end).centerWeight = Tr(end).centerWeight' * Tr(end).centerWeight;
Tr(end).spread(maxIdx) = maxLen/4;
Tr(end).left = -inf;
Tr(end).right = -inf;
Tr(end).father = i;
Tr(end).weight = Tr(i).weight/2;
Tr(i).left = length(Tr);
Tr(end+1) = Tr(i);
Tr(end).center = Tr(i).center - sqrt(maxLen)/2*majorAxis;
% Tr(end).centerWeight = Tr(end).centerWeight' * Tr(end).centerWeight;
Tr(end).spread(maxIdx) = maxLen/4;
Tr(end).left = -inf;
Tr(end).right = -inf;
Tr(end).father = i;
Tr(end).weight = Tr(i).weight/2;
Tr(i).right = length(Tr);
end
| {
"content_hash": "03e762ead1d5d4e6388b0c547a9e6b45",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 111,
"avg_line_length": 32.96739130434783,
"alnum_prop": 0.6307286515001649,
"repo_name": "xinj987/Data_Thinning_Demo",
"id": "0add8eae16f3ad0f51263fbd5e5e4bf9458d242b",
"size": "3033",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Functions/iniTree.m",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "357200"
},
{
"name": "C++",
"bytes": "8195"
},
{
"name": "Matlab",
"bytes": "570451"
}
],
"symlink_target": ""
} |
<?php
require_once(dirname(__FILE__).'/../lib/BasertDefaultActions.class.php');
/**
* rtDefaultActions handles the default sytem pages: 404 etc..
*
* @package rtCorePlugin
* @subpackage modules
* @author Piers Warmers <[email protected]>
*/
class rtDefaultActions extends BasertDefaultActions
{
}
| {
"content_hash": "91cbe4d3c4afac56ec69865e77353ce2",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 73,
"avg_line_length": 21.2,
"alnum_prop": 0.710691823899371,
"repo_name": "pierswarmers/rtCorePlugin",
"id": "aea6b0a015d5c71d980a3e289033275481218f9e",
"size": "562",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/rtDefault/actions/actions.class.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "40349"
},
{
"name": "JavaScript",
"bytes": "42486"
},
{
"name": "PHP",
"bytes": "641340"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="Prévia carnavalesca de Ceará-Mirim - 2019 | Melhor prévia carnavalesca de Ceará Mirim e região. Aproveite nossos pacotes!">
<meta property="og:site_name" content="Jungle Turismo">
<meta property="og:description" content="Prévia carnavalesca. Pacote para uma excursão nos principais pontos religiosos do Brasil. Confira esta e muitas outras viagens no nosso site. Viaje bem, viaje com a Jungle Turismo!">
<meta property="og:author" content="Jungle Turismo">
<meta property="og:image" content="http://jungleturismo.com.br/img/previa-carnaval/previa-carnaval11.jpeg">
<meta property="og:image:type" content="image/jpeg">
<meta property="og:image:width" content="800">
<meta property="og:image:height" content="600">
<title>Jungle Turismo</title>
<link rel="shortcut icon" href="logo_fav.ico"/>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/agency.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
<link href='https://fonts.googleapis.com/css?family=Kaushan+Script' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700' rel='stylesheet' type='text/css'>
<style type="text/css">
@font-face{
font-family: secret;
src: url('fonts/Gravity-Light.otf');
}
.tit{
text-transform: none;
color: rgb(30, 60, 108);
font-family: secret;
font-size: 50px;
}
p{
font-size: 20px;
}
h3{
color: rgb(255, 192, 66);
}
#fb{
border: solid 5px rgb(59, 89, 152);
background-color: rgb(59, 89, 152);
color: white;
text-transform: none;
width: 125px;
border-radius: 5px;
}
a:hover{
text-decoration: none;
}
#fb:hover{
background-color: white;
color: rgb(59, 89, 152);
}
.img{
margin: 3px;
}
.contato{
font-family: secret;
font-weight: bold;
}
</style>
<script type="text/javascript">
var url_atual = window.location.href;
var viagem = "Prévia carnavalesca de Ceará-Mirim - 2019";
function mudar(){
document.getElementById("wpp").href = "whatsapp://send?text=Confira este pacote para "+viagem+": "+url_atual;
}
</script>
</head>
<body style="background-color: #f7f7f7;" id="page-top" class="index" onload="mudar()">
<!-- Navigation -->
<nav style="background-color: rgb(30, 60, 108); position: fixed;" class="navbar navbar-default navbar-fixed-top">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand page-scroll" href="index.html">Jungle Turismo</a> </div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="hidden">
<a href="#page-top"></a>
</li>
<li>
<a class="page-scroll" href="agencia.html">A agência</a>
</li>
<li>
<a class="page-scroll" href="index.html">Próximas Viagens</a>
</li>
<li>
<a class="page-scroll" href="index.html">Últimas Viagens</a>
</li>
<li>
<a class="page-scroll" href=".footer">Contatos</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<div style="margin-top: 14%;" class="container">
<div class="row">
<div style="" class="col-xs-12 col-sm-12 col-md-5 col-lg-5">
<img width="100%" src="img/previa-carnaval/previa-carnaval1.jpeg">
</div>
<div style="padding-bottom:20px; background-color: white;" class="col-xs-12 col-sm-12 col-md-7 col-lg-7">
<h1 class="tit"><span id="viagem">Prévia Carnavalesca de Ceará-Mirim 2019</span></h1>
<hr>
<h3>Data:</h3>
<p>16 de Fevereiro</p>
<h3>PROGRAMAÇÃO:</h3>
<p><b>SAÍDA:</b> Cantina de Xinga, às 18:30h<br></p>
<hr>
<h1 class="tit">Contatos</h1>
<hr>
<div style="text-align: center; width: 100%;" class="container">
<img width="50px" src="img/em.png">
<p class="contato" style="clor: rgb(36, 104, 255)">
Email:<br>
<span style="color: rgb(100, 100, 100);">[email protected]</span>
</p>
<img width="50px" src="img/wpp.png">
<p class="contato">
WhatsApp:<br>
<span style="color: rgb(45, 147, 57)">(84) 99958-1548</span>
</p>
<p class="contato">
<img width="50px" src="img/telefone.png"><br>
Telefones:<br>
<span style="color: rgb(100, 100, 100);">(84) 3274-2924</span><br><br>
</p>
<h3 style="color: rgb(30, 60, 108)">Visite nossos perfis</h3>
<a target="blank" href="http://facebook.com/jungleturismo"><img width="50px" src="img/fb.png" style="margin-bottom:10px;"></a><br>
<a target="blank" href="https://www.instagram.com/jungleturismo.cm/"><img width="60px" src="img/insta.png"></a>
</div>
<hr>
<div style="text-align: center; width: 100%;" class="container">
<h1 class="tit">Compartilhe esse pacote</h1>
<div style="text-align: center; width: 50%;" class="container">
<div class="row">
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<a href="#"><img width="50px" src="img/impressora.png"></a>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<a id="wpp" href=""><img width="50px" src="img/wpp2.png"></a>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<div class="fb-share-button" data-href="http://jungleturismo.com.br/previa-carnaval-cm.html" data-layout="button_count" data-size="large" data-mobile-iframe="true"><a class="fb-xfbml-parse-ignore" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fjungleturismo.com.br%2Fprevia-carnaval-cm.html&src=sdkpreparse"><img width="50px" src="img/fb2.png"></a></div>
</div>
</div>
</div>
</div>
<div class="col-md-6">
</div>
<div class="col-md-6">
</div>
</div>
</div>
</div>
</div>
<hr>
<footer class="footer">
<div class="container">
<div class="row">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<img width="80%" src="img/abav.png">
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<img width="70%" src="img/foco-op.png">
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<img width="80%" src="img/embratur.png">
</div>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3">
<img width="120%" src="img/ministerio.png">
</div>
</div>
<hr>
<div class="row">
<div class="col-md-5">
<ul class="list-inline quicklinks">
<li>Jungle Turismo 2016
</li><br>
<li>CNPJ 25.989.749/0001-34</li>
</ul>
</div>
<div class="col-md-1">
<ul class="list-inline social-buttons">
<li><a target="blank" href="http://facebook.com/jungleturismo"><i class="fa fa-facebook"></i></a>
</li>
</ul>
</div>
<div class="col-md-6">
<ul class="list-inline quicklinks">
<li>[email protected]
</li>
<li>Fone: (84) 3274-2924/(84) 99958-1548 <img style="margin-top: -8px" width="8%" src="img/whatsapp-logo.png"></li>
<li>Rua Manoel Francisco Sobral, 381 - Centro, Ceará-Mirim/RN</li>
</ul>
</div>
</div>
</div>
</footer>
<!-- Facebook -->
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/pt_BR/sdk.js#xfbml=1&version=v2.7";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<!-- jQuery -->
<script src="js/jquery.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<!-- Plugin JavaScript -->
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="js/classie.js"></script>
<script src="js/cbpAnimatedHeader.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Contact Form JavaScript -->
<script src="js/jqBootstrapValidation.js"></script>
<script src="js/contact_me.js"></script>
<!-- Custom Theme JavaScript -->
<script src="js/agency.js"></script>
</body>
</html>
| {
"content_hash": "b5e848537bedf2d5e5db5bd445e8830b",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 416,
"avg_line_length": 43.5,
"alnum_prop": 0.5021496885145214,
"repo_name": "fariias/fariias.github.io",
"id": "63773b506b97f3d930282dfad6c5db517bab9a05",
"size": "11416",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "previa-carnaval-cm.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "33018"
},
{
"name": "HTML",
"bytes": "710650"
},
{
"name": "JavaScript",
"bytes": "86077"
},
{
"name": "PHP",
"bytes": "1097"
}
],
"symlink_target": ""
} |
package org.apache.storm.redis.common.adapter;
import java.io.Closeable;
import java.io.IOException;
import java.util.Map;
import org.apache.storm.redis.common.commands.RedisCommands;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.ScanParams;
import redis.clients.jedis.ScanResult;
/**
* Adapter class to make Jedis instance play with BinaryRedisCommands interface.
*/
public class RedisCommandsAdapterJedis implements RedisCommands, Closeable {
private Jedis jedis;
public RedisCommandsAdapterJedis(Jedis resource) {
jedis = resource;
}
@Override
public byte[] hget(byte[] key, byte[] field) {
return jedis.hget(key, field);
}
@Override
public Boolean exists(byte[] key) {
return jedis.exists(key);
}
@Override
public String hmset(byte[] key, Map<byte[], byte[]> fieldValues) {
return jedis.hmset(key, fieldValues);
}
@Override
public Map<byte[], byte[]> hgetAll(byte[] key) {
return jedis.hgetAll(key);
}
@Override
public Long hdel(byte[] key, byte[]... fields) {
return jedis.hdel(key, fields);
}
@Override
public Long del(byte[] key) {
return jedis.del(key);
}
@Override
public Long del(String key) {
return jedis.del(key);
}
@Override
public String rename(byte[] oldkey, byte[] newkey) {
return jedis.rename(oldkey, newkey);
}
@Override
public String rename(String oldkey, String newkey) {
return jedis.rename(oldkey, newkey);
}
@Override
public ScanResult<Map.Entry<byte[], byte[]>> hscan(byte[] key, byte[] cursor, ScanParams params) {
return jedis.hscan(key, cursor, params);
}
@Override
public boolean exists(String key) {
return jedis.exists(key);
}
@Override
public Map<String, String> hgetAll(String key) {
return jedis.hgetAll(key);
}
@Override
public String hmset(String key, Map<String, String> fieldValues) {
return jedis.hmset(key, fieldValues);
}
@Override
public void close() throws IOException {
jedis.close();
}
}
| {
"content_hash": "18efb3088584bc37bf8a87227399a3ad",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 102,
"avg_line_length": 23.58695652173913,
"alnum_prop": 0.6423963133640553,
"repo_name": "srdo/storm",
"id": "89d759de9089c7fa4b16949700d025683c571519",
"size": "2971",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "external/storm-redis/src/main/java/org/apache/storm/redis/common/adapter/RedisCommandsAdapterJedis.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "53871"
},
{
"name": "CSS",
"bytes": "12597"
},
{
"name": "Clojure",
"bytes": "494628"
},
{
"name": "Fancy",
"bytes": "6234"
},
{
"name": "FreeMarker",
"bytes": "3512"
},
{
"name": "HTML",
"bytes": "187245"
},
{
"name": "Java",
"bytes": "11668041"
},
{
"name": "JavaScript",
"bytes": "74069"
},
{
"name": "M4",
"bytes": "1522"
},
{
"name": "Makefile",
"bytes": "1302"
},
{
"name": "PowerShell",
"bytes": "3405"
},
{
"name": "Python",
"bytes": "954624"
},
{
"name": "Ruby",
"bytes": "15777"
},
{
"name": "Shell",
"bytes": "23774"
},
{
"name": "Thrift",
"bytes": "31552"
},
{
"name": "XSLT",
"bytes": "1365"
}
],
"symlink_target": ""
} |
A Fathead for Pytest api
The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries.
source: http://doc.pytest.org/en/latest/builtin.html
## IA PAGE:
https://duck.co/ia/view/pytest
## DEPENDENCIES:
Python 3.5
BeautifulSoup 4 (pip install beautifulsoup4)
wget
## TEST AND RUN:
Run the following commands to generate output.txt file
bash fetch.sh
bash parse.sh
| {
"content_hash": "232fb5cbf5fc9afcaee751f487a5edfb",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 137,
"avg_line_length": 17.307692307692307,
"alnum_prop": 0.7666666666666667,
"repo_name": "souravbadami/zeroclickinfo-fathead",
"id": "1c73026156d63287d4bfdeb9696b257998520637",
"size": "467",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/fathead/pytest/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "648"
},
{
"name": "Go",
"bytes": "11301"
},
{
"name": "JavaScript",
"bytes": "136278"
},
{
"name": "Perl",
"bytes": "148281"
},
{
"name": "Python",
"bytes": "772504"
},
{
"name": "Ruby",
"bytes": "12324"
},
{
"name": "Shell",
"bytes": "42381"
},
{
"name": "Tcl",
"bytes": "2746"
},
{
"name": "XSLT",
"bytes": "10904"
}
],
"symlink_target": ""
} |
from os.path import dirname as _dn, join as _j
class MainFunc:
def __init__(self):
pass
def run(self, filename):
code = None
with open(_j(_dn(__file__), "main_func_template.py"), 'r') as f:
code = f.read()
out_file = filename
with open(out_file, 'w') as f:
f.write(code)
| {
"content_hash": "9cdf60b57eb33219693d331448dd8b39",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 72,
"avg_line_length": 19.666666666666668,
"alnum_prop": 0.5028248587570622,
"repo_name": "amol9/redcmd",
"id": "f448ced5b6860bd1a097fb8df6c58e1b1d86e380",
"size": "354",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "redcmd/init/main_func.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "106122"
},
{
"name": "Shell",
"bytes": "470"
}
],
"symlink_target": ""
} |
package codesample.frameworks.hibernate.many_to_many.unidirectional;
import codesample.frameworks.hibernate.HibernateUtil;
import org.hibernate.Session;
/**
* Example of many-to-many relationship. We have 2 tables - OurUser (Because simple User is not an appropriate name for
* postgres) and Option. Each user can have one or more special options turned on in his profile and we have to store
* this setting somewhere. In this example we will use an auxiliary table to store options which are turned on.
*/
class HibernateRunnerManyToManyUnidirectional {
public static void main(String[] args) {
try {
Option opt1 = new Option("Window mode");
Option opt2 = new Option("x32 compatable");
Option opt3 = new Option("Extra chees");
Option opt4 = new Option("Extra beacon");
try (Session session = HibernateUtil.getSessionFactory().openSession()) {
session.beginTransaction();
session.save(opt1);
session.save(opt2);
session.save(opt3);
session.save(opt4);
session.createQuery("from Option").list().forEach(System.out::println);
session.getTransaction().commit();
System.out.println();
}
OurUser ivan = new OurUser("Vegan");
ivan.addOption(opt1);
ivan.addOption(opt2);
OurUser vasily = new OurUser("Vasily");
vasily.addOption(opt1);
vasily.addOption(opt2);
vasily.addOption(opt4);
OurUser masha = new OurUser("Masha");
masha.addOption(opt2);
try (Session session = HibernateUtil.getSessionFactory().openSession()) {
session.beginTransaction();
session.save(ivan);
session.save(vasily);
session.save(masha);
session.createQuery("from OurUser").list().forEach(System.out::println);
System.out.println();
System.out.println("Let's get Ivan's options");
OurUser storedIvan = session.byId(OurUser.class).load(ivan.getId());
System.out.println(storedIvan.toString());
System.out.println();
session.getTransaction().commit();
}
} finally {
HibernateUtil.getSessionFactory().close();
}
}
}
| {
"content_hash": "c6cae953187a42babec32db8b2366699",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 119,
"avg_line_length": 35.507246376811594,
"alnum_prop": 0.5877551020408164,
"repo_name": "aquatir/remember_java_api",
"id": "728455492e145efa1cf7675074723fa9dba9edc8",
"size": "2450",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "code-sample-java/code-sample-java-hibernate/src/main/java/codesample/frameworks/hibernate/many_to_many/unidirectional/HibernateRunnerManyToManyUnidirectional.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "AspectJ",
"bytes": "827"
},
{
"name": "HTML",
"bytes": "76"
},
{
"name": "Java",
"bytes": "273768"
},
{
"name": "Python",
"bytes": "697"
},
{
"name": "Shell",
"bytes": "75"
}
],
"symlink_target": ""
} |
<componentContainer>
<table width="100%">
<tr>
<td valign="top" width="50%">
<component plugin="EC-Core" ref="urlLoader">
<plugin>@PLUGIN_KEY@</plugin>
<version>@PLUGIN_VERSION@</version>
<url>../../../plugins/@PLUGIN_KEY@/index.html</url>
</component>
</td>
</tr>
</table>
</componentContainer> | {
"content_hash": "ae111f1b579fe1330f1751dbf6b7df3f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 61,
"avg_line_length": 29,
"alnum_prop": 0.5278514588859416,
"repo_name": "electric-cloud/EC-DSLIDE",
"id": "f255b16077e1edd1a3addac6169ee62381032dc0",
"size": "377",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pages/dslide.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "328"
},
{
"name": "CSS",
"bytes": "4468"
},
{
"name": "Groovy",
"bytes": "12506"
},
{
"name": "HTML",
"bytes": "361950"
},
{
"name": "JavaScript",
"bytes": "300473"
},
{
"name": "Perl",
"bytes": "2961"
},
{
"name": "Shell",
"bytes": "1789"
}
],
"symlink_target": ""
} |
import Ember from 'ember';
import GithubInitializer from '../../../initializers/github';
import { module, test } from 'qunit';
let application;
module('Unit | Initializer | github', {
beforeEach() {
Ember.run(function() {
application = Ember.Application.create();
application.deferReadiness();
});
}
});
// Replace this with your real tests.
test('it works', function(assert) {
GithubInitializer.initialize(application);
// you would normally confirm the results of the initializer here
assert.ok(true);
});
| {
"content_hash": "ad52c06c3871534050b376f61ab64e36",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 67,
"avg_line_length": 24.636363636363637,
"alnum_prop": 0.6845018450184502,
"repo_name": "manukapoor/ember-cli-gh-badge",
"id": "03e0a0a5761ff76d1328511c51e114a51256c1c1",
"size": "542",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/unit/initializers/github-test.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2827"
},
{
"name": "HTML",
"bytes": "3601"
},
{
"name": "JavaScript",
"bytes": "14795"
}
],
"symlink_target": ""
} |
//=================================================================================================
//=================================================================================================
#ifndef _BLAZE_MATH_EXPRESSIONS_SMATTDMATMULTEXPR_H_
#define _BLAZE_MATH_EXPRESSIONS_SMATTDMATMULTEXPR_H_
//*************************************************************************************************
// Includes
//*************************************************************************************************
#include <stdexcept>
#include <blaze/math/constraints/DenseMatrix.h>
#include <blaze/math/constraints/MatMatMultExpr.h>
#include <blaze/math/constraints/SparseMatrix.h>
#include <blaze/math/constraints/StorageOrder.h>
#include <blaze/math/expressions/Computation.h>
#include <blaze/math/expressions/DenseMatrix.h>
#include <blaze/math/expressions/Forward.h>
#include <blaze/math/expressions/MatMatMultExpr.h>
#include <blaze/math/shims/Reset.h>
#include <blaze/math/shims/Serial.h>
#include <blaze/math/traits/ColumnExprTrait.h>
#include <blaze/math/traits/DMatDVecMultExprTrait.h>
#include <blaze/math/traits/DMatSVecMultExprTrait.h>
#include <blaze/math/traits/MultExprTrait.h>
#include <blaze/math/traits/MultTrait.h>
#include <blaze/math/traits/RowExprTrait.h>
#include <blaze/math/traits/SMatDVecMultExprTrait.h>
#include <blaze/math/traits/SubmatrixExprTrait.h>
#include <blaze/math/traits/TDMatDVecMultExprTrait.h>
#include <blaze/math/traits/TDMatSVecMultExprTrait.h>
#include <blaze/math/traits/TDVecDMatMultExprTrait.h>
#include <blaze/math/traits/TDVecSMatMultExprTrait.h>
#include <blaze/math/traits/TDVecTDMatMultExprTrait.h>
#include <blaze/math/traits/TSVecDMatMultExprTrait.h>
#include <blaze/math/traits/TSVecSMatMultExprTrait.h>
#include <blaze/math/traits/TSVecTDMatMultExprTrait.h>
#include <blaze/math/typetraits/Columns.h>
#include <blaze/math/typetraits/IsColumnMajorMatrix.h>
#include <blaze/math/typetraits/IsColumnVector.h>
#include <blaze/math/typetraits/IsComputation.h>
#include <blaze/math/typetraits/IsDenseMatrix.h>
#include <blaze/math/typetraits/IsDenseVector.h>
#include <blaze/math/typetraits/IsExpression.h>
#include <blaze/math/typetraits/IsLower.h>
#include <blaze/math/typetraits/IsRowMajorMatrix.h>
#include <blaze/math/typetraits/IsRowVector.h>
#include <blaze/math/typetraits/IsSparseMatrix.h>
#include <blaze/math/typetraits/IsSparseVector.h>
#include <blaze/math/typetraits/IsStrictlyLower.h>
#include <blaze/math/typetraits/IsStrictlyUpper.h>
#include <blaze/math/typetraits/IsSymmetric.h>
#include <blaze/math/typetraits/IsTriangular.h>
#include <blaze/math/typetraits/IsUniLower.h>
#include <blaze/math/typetraits/IsUniUpper.h>
#include <blaze/math/typetraits/IsUpper.h>
#include <blaze/math/typetraits/RequiresEvaluation.h>
#include <blaze/math/typetraits/Rows.h>
#include <blaze/system/Thresholds.h>
#include <blaze/util/Assert.h>
#include <blaze/util/EnableIf.h>
#include <blaze/util/InvalidType.h>
#include <blaze/util/logging/FunctionTrace.h>
#include <blaze/util/mpl/And.h>
#include <blaze/util/mpl/Or.h>
#include <blaze/util/SelectType.h>
#include <blaze/util/Types.h>
#include <blaze/util/typetraits/RemoveReference.h>
#include <blaze/util/valuetraits/IsTrue.h>
namespace blaze {
//=================================================================================================
//
// CLASS SMATTDMATMULTEXPR
//
//=================================================================================================
//*************************************************************************************************
/*!\brief Expression object for sparse matrix-transpose dense matrix multiplications.
// \ingroup dense_matrix_expression
//
// The SMatTDMatMultExpr class represents the compile time expression for multiplications between
// a row-major sparse matrix and a column-major dense matrix.
*/
template< typename MT1 // Type of the left-hand side sparse matrix
, typename MT2 > // Type of the right-hand side dense matrix
class SMatTDMatMultExpr : public DenseMatrix< SMatTDMatMultExpr<MT1,MT2>, false >
, private MatMatMultExpr
, private Computation
{
private:
//**Type definitions****************************************************************************
typedef typename MT1::ResultType RT1; //!< Result type of the left-hand side sparse matrix expression.
typedef typename MT2::ResultType RT2; //!< Result type of the right-hand side dense matrix expression.
typedef typename RT1::ElementType ET1; //!< Element type of the left-hand side dense matrix expression.
typedef typename RT2::ElementType ET2; //!< Element type of the right-hand side sparse matrix expression.
typedef typename MT1::CompositeType CT1; //!< Composite type of the left-hand side sparse matrix expression.
typedef typename MT2::CompositeType CT2; //!< Composite type of the right-hand side dense matrix expression.
//**********************************************************************************************
//**********************************************************************************************
//! Compilation switch for the composite type of the left-hand side sparse matrix expression.
enum { evaluateLeft = IsComputation<MT1>::value || RequiresEvaluation<MT1>::value };
//**********************************************************************************************
//**********************************************************************************************
//! Compilation switch for the composite type of the right-hand side dense matrix expression.
enum { evaluateRight = IsComputation<MT2>::value || RequiresEvaluation<MT2>::value };
//**********************************************************************************************
//**********************************************************************************************
/*! \cond BLAZE_INTERNAL */
//! Helper structure for the explicit application of the SFINAE principle.
/*! The CanExploitSymmetry struct is a helper struct for the selection of the optimal
evaluation strategy. In case the target matrix is row-major and the right-hand side
dense matrix operand is symmetric, \a value is set to 1 and an optimized evaluation
strategy is selected. Otherwise \a value is set to 0 and the default strategy is
chosen. */
template< typename T1, typename T2, typename T3 >
struct CanExploitSymmetry {
enum { value = IsRowMajorMatrix<T1>::value && IsSymmetric<T3>::value };
};
/*! \endcond */
//**********************************************************************************************
//**********************************************************************************************
/*! \cond BLAZE_INTERNAL */
//! Helper structure for the explicit application of the SFINAE principle.
/*! The IsEvaluationRequired struct is a helper struct for the selection of the parallel
evaluation strategy. In case either of the two matrix operands requires an intermediate
evaluation, the nested \value will be set to 1, otherwise it will be 0. */
template< typename T1, typename T2, typename T3 >
struct IsEvaluationRequired {
enum { value = ( evaluateLeft || evaluateRight ) &&
CanExploitSymmetry<T1,T2,T3>::value };
};
/*! \endcond */
//**********************************************************************************************
public:
//**Type definitions****************************************************************************
typedef SMatTDMatMultExpr<MT1,MT2> This; //!< Type of this SMatTDMatMultExpr instance.
typedef typename MultTrait<RT1,RT2>::Type ResultType; //!< Result type for expression template evaluations.
typedef typename ResultType::OppositeType OppositeType; //!< Result type with opposite storage order for expression template evaluations.
typedef typename ResultType::TransposeType TransposeType; //!< Transpose type for expression template evaluations.
typedef typename ResultType::ElementType ElementType; //!< Resulting element type.
typedef const ElementType ReturnType; //!< Return type for expression template evaluations.
typedef const ResultType CompositeType; //!< Data type for composite expression templates.
//! Composite type of the left-hand side sparse matrix expression.
typedef typename SelectType< IsExpression<MT1>::value, const MT1, const MT1& >::Type LeftOperand;
//! Composite type of the right-hand side dense matrix expression.
typedef typename SelectType< IsExpression<MT2>::value, const MT2, const MT2& >::Type RightOperand;
//! Type for the assignment of the left-hand side sparse matrix operand.
typedef typename SelectType< evaluateLeft, const RT1, CT1 >::Type LT;
//! Type for the assignment of the right-hand side dense matrix operand.
typedef typename SelectType< evaluateRight, const RT2, CT2 >::Type RT;
//**********************************************************************************************
//**Compilation flags***************************************************************************
//! Compilation switch for the expression template evaluation strategy.
enum { vectorizable = 0 };
//! Compilation switch for the expression template assignment strategy.
enum { smpAssignable = !evaluateLeft && MT1::smpAssignable &&
!evaluateRight && MT2::smpAssignable };
//**********************************************************************************************
//**Constructor*********************************************************************************
/*!\brief Constructor for the SMatTDMatMultExpr class.
//
// \param lhs The left-hand side sparse matrix operand of the multiplication expression.
// \param rhs The right-hand side dense matrix operand of the multiplication expression.
*/
explicit inline SMatTDMatMultExpr( const MT1& lhs, const MT2& rhs )
: lhs_( lhs ) // Left-hand side sparse matrix of the multiplication expression
, rhs_( rhs ) // Right-hand side dense matrix of the multiplication expression
{
BLAZE_INTERNAL_ASSERT( lhs.columns() == rhs.rows(), "Invalid matrix sizes" );
}
//**********************************************************************************************
//**Access operator*****************************************************************************
/*!\brief 2D-access to the matrix elements.
//
// \param i Access index for the row. The index has to be in the range \f$[0..M-1]\f$.
// \param j Access index for the column. The index has to be in the range \f$[0..N-1]\f$.
// \return The resulting value.
*/
inline ReturnType operator()( size_t i, size_t j ) const {
BLAZE_INTERNAL_ASSERT( i < lhs_.rows() , "Invalid row access index" );
BLAZE_INTERNAL_ASSERT( j < rhs_.columns(), "Invalid column access index" );
typedef typename RemoveReference<CT1>::Type::ConstIterator ConstIterator;
ElementType tmp = ElementType();
// Early exit
if( lhs_.columns() == 0UL )
return tmp;
// Fast computation in case the left-hand side sparse matrix directly provides iterators
if( !RequiresEvaluation<MT1>::value )
{
CT1 A( lhs_ ); // Evaluation of the left-hand side sparse matrix operand
const ConstIterator end( ( IsUpper<MT2>::value )
?( IsStrictlyUpper<MT2>::value ? A.lowerBound(i,j) : A.upperBound(i,j) )
:( A.end(i) ) );
ConstIterator element( ( IsLower<MT2>::value )
?( IsStrictlyLower<MT2>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
:( A.begin(i) ) );
if( element != end ) {
tmp = element->value() * rhs_(element->index(),j);
++element;
for( ; element!=end; ++element ) {
tmp += element->value() * rhs_(element->index(),j);
}
}
}
// Default computation in case the left-hand side sparse matrix doesn't provide iterators
else
{
const size_t kbegin( ( IsUpper<MT1>::value )
?( ( IsLower<MT2>::value )
?( max( ( IsStrictlyUpper<MT1>::value ? i+1UL : i )
, ( IsStrictlyLower<MT2>::value ? j+1UL : j ) ) )
:( IsStrictlyUpper<MT1>::value ? i+1UL : i ) )
:( ( IsLower<MT2>::value )
?( IsStrictlyLower<MT2>::value ? j+1UL : j )
:( 0UL ) ) );
const size_t kend( ( IsLower<MT1>::value )
?( ( IsUpper<MT2>::value )
?( min( ( IsStrictlyLower<MT1>::value ? i : i+1UL )
, ( IsStrictlyUpper<MT2>::value ? j : j+1UL ) ) )
:( IsStrictlyLower<MT1>::value ? i : i+1UL ) )
:( ( IsUpper<MT2>::value )
?( IsStrictlyUpper<MT2>::value ? j : j+1UL )
:( lhs_.columns() ) ) );
if( ( !IsTriangular<MT1>::value && !IsTriangular<MT2>::value ) || kbegin < kend ) {
tmp = lhs_(i,kbegin) * rhs_(kbegin,j);
for( size_t k=kbegin+1UL; k<kend; ++k ) {
tmp += lhs_(i,k) * rhs_(k,j);
}
}
}
return tmp;
}
//**********************************************************************************************
//**Rows function*******************************************************************************
/*!\brief Returns the current number of rows of the matrix.
//
// \return The number of rows of the matrix.
*/
inline size_t rows() const {
return lhs_.rows();
}
//**********************************************************************************************
//**Columns function****************************************************************************
/*!\brief Returns the current number of columns of the matrix.
//
// \return The number of columns of the matrix.
*/
inline size_t columns() const {
return rhs_.columns();
}
//**********************************************************************************************
//**Left operand access*************************************************************************
/*!\brief Returns the left-hand side sparse matrix operand.
//
// \return The left-hand side sparse matrix operand.
*/
inline LeftOperand leftOperand() const {
return lhs_;
}
//**********************************************************************************************
//**Right operand access************************************************************************
/*!\brief Returns the right-hand side transpose dense matrix operand.
//
// \return The right-hand side transpose dense matrix operand.
*/
inline RightOperand rightOperand() const {
return rhs_;
}
//**********************************************************************************************
//**********************************************************************************************
/*!\brief Returns whether the expression can alias with the given address \a alias.
//
// \param alias The alias to be checked.
// \return \a true in case the expression can alias, \a false otherwise.
*/
template< typename T >
inline bool canAlias( const T* alias ) const {
return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
}
//**********************************************************************************************
//**********************************************************************************************
/*!\brief Returns whether the expression is aliased with the given address \a alias.
//
// \param alias The alias to be checked.
// \return \a true in case an alias effect is detected, \a false otherwise.
*/
template< typename T >
inline bool isAliased( const T* alias ) const {
return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
}
//**********************************************************************************************
//**********************************************************************************************
/*!\brief Returns whether the operands of the expression are properly aligned in memory.
//
// \return \a true in case the operands are aligned, \a false if not.
*/
inline bool isAligned() const {
return rhs_.isAligned();
}
//**********************************************************************************************
//**********************************************************************************************
/*!\brief Returns whether the expression can be used in SMP assignments.
//
// \return \a true in case the expression can be used in SMP assignments, \a false if not.
*/
inline bool canSMPAssign() const {
return ( rows() > SMP_SMATTDMATMULT_THRESHOLD );
}
//**********************************************************************************************
private:
//**Member variables****************************************************************************
LeftOperand lhs_; //!< Left-hand side sparse matrix of the multiplication expression.
RightOperand rhs_; //!< Right-hand side dense matrix of the multiplication expression.
//**********************************************************************************************
//**Assignment to dense matrices****************************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Assignment of a sparse matrix-transpose dense matrix multiplication to a dense matrix
// (\f$ A=B*C \f$).
// \ingroup dense_matrix
//
// \param lhs The target left-hand side dense matrix.
// \param rhs The right-hand side multiplication expression to be assigned.
// \return void
//
// This function implements the performance optimized assignment of a sparse matrix-transpose
// dense matrix multiplication expression to a dense matrix.
*/
template< typename MT // Type of the target dense matrix
, bool SO > // Storage order of the target dense matrix
friend inline typename DisableIf< CanExploitSymmetry<MT,MT1,MT2> >::Type
assign( DenseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
{
BLAZE_FUNCTION_TRACE;
BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense matrix operand
BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
SMatTDMatMultExpr::selectAssignKernel( ~lhs, A, B );
}
/*! \endcond */
//**********************************************************************************************
//**Default assignment to dense matrices********************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Default assignment of a sparse matrix-transpose dense matrix multiplication
// (\f$ C=A*B \f$).
// \ingroup dense_matrix
//
// \param C The target left-hand side dense matrix.
// \param A The left-hand side multiplication operand.
// \param B The right-hand side multiplication operand.
// \return void
//
// This function implements the default assignment kernel for the sparse matrix-transpose
// dense matrix multiplication.
*/
template< typename MT3 // Type of the left-hand side target matrix
, typename MT4 // Type of the left-hand side matrix operand
, typename MT5 > // Type of the right-hand side matrix operand
static inline void selectAssignKernel( MT3& C, const MT4& A, const MT5& B )
{
typedef typename MT4::ConstIterator ConstIterator;
const size_t block( 256UL );
const size_t jpos( B.columns() & size_t(-4) );
BLAZE_INTERNAL_ASSERT( ( B.columns() - ( B.columns() % 4UL ) ) == jpos, "Invalid end calculation" );
for( size_t ii=0UL; ii<A.rows(); ii+=block ) {
const size_t iend( ( ii+block > A.rows() )?( A.rows() ):( ii+block ) );
for( size_t j=0UL; j<jpos; j+=4UL ) {
for( size_t i=ii; i<iend; ++i )
{
const ConstIterator end( ( IsUpper<MT5>::value )
?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j+4UL) : A.upperBound(i,j+4UL) )
:( A.end(i) ) );
ConstIterator element( ( IsLower<MT5>::value )
?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
:( A.begin(i) ) );
if( element!=end ) {
C(i,j ) = element->value() * B(element->index(),j );
C(i,j+1UL) = element->value() * B(element->index(),j+1UL);
C(i,j+2UL) = element->value() * B(element->index(),j+2UL);
C(i,j+3UL) = element->value() * B(element->index(),j+3UL);
++element;
for( ; element!=end; ++element ) {
C(i,j ) += element->value() * B(element->index(),j );
C(i,j+1UL) += element->value() * B(element->index(),j+1UL);
C(i,j+2UL) += element->value() * B(element->index(),j+2UL);
C(i,j+3UL) += element->value() * B(element->index(),j+3UL);
}
}
else {
reset( C(i,j ) );
reset( C(i,j+1UL) );
reset( C(i,j+2UL) );
reset( C(i,j+3UL) );
}
}
}
for( size_t j=jpos; j<B.columns(); ++j ) {
for( size_t i=ii; i<iend; ++i )
{
const ConstIterator end( ( IsUpper<MT5>::value )
?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j) : A.upperBound(i,j) )
:( A.end(i) ) );
ConstIterator element( ( IsLower<MT5>::value )
?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
:( A.begin(i) ) );
if( element!=end ) {
C(i,j) = element->value() * B(element->index(),j);
++element;
for( ; element!=end; ++element ) {
C(i,j) += element->value() * B(element->index(),j);
}
}
else {
reset( C(i,j) );
}
}
}
}
}
/*! \endcond */
//**********************************************************************************************
//**Assignment to sparse matrices***************************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Assignment of a sparse matrix-transpose dense matrix multiplication to a sparse matrix
// (\f$ A=B*C \f$).
// \ingroup dense_matrix
//
// \param lhs The target left-hand side sparse matrix.
// \param rhs The right-hand side multiplication expression to be assigned.
// \return void
//
// This function implements the performance optimized assignment of a sparse matrix-transpose
// dense matrix multiplication expression to a sparse matrix.
*/
template< typename MT // Type of the target sparse matrix
, bool SO > // Storage order of the target sparse matrix
friend inline typename DisableIf< CanExploitSymmetry<MT,MT1,MT2> >::Type
assign( SparseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
{
BLAZE_FUNCTION_TRACE;
typedef typename SelectType< SO, OppositeType, ResultType >::Type TmpType;
BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE( ResultType );
BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE( OppositeType );
BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE( ResultType );
BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( OppositeType );
BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER( MT, TmpType );
BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( typename TmpType::CompositeType );
BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
const TmpType tmp( serial( rhs ) );
assign( ~lhs, tmp );
}
/*! \endcond */
//**********************************************************************************************
//**Restructuring assignment to row-major matrices**********************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Restructuring assignment of a sparse matrix-transpose dense matrix multiplication to
// a row-major matrix (\f$ C=A*B \f$).
// \ingroup dense_matrix
//
// \param lhs The target left-hand side matrix.
// \param rhs The right-hand side multiplication expression to be assigned.
// \return void
//
// This function implements the symmetry-based restructuring assignment of a sparse matrix-
// transpose dense matrix multiplication expression to a row-major matrix. Due to the explicit
// application of the SFINAE principle this function can only be selected by the compiler in
// case the symmetry of either of the two matrix operands can be exploited.
*/
template< typename MT > // Type of the target matrix
friend inline typename EnableIf< CanExploitSymmetry<MT,MT1,MT2> >::Type
assign( Matrix<MT,false>& lhs, const SMatTDMatMultExpr& rhs )
{
BLAZE_FUNCTION_TRACE;
BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
assign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
}
/*! \endcond */
//**********************************************************************************************
//**Addition assignment to dense matrices*******************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Addition assignment of a sparse matrix-transpose dense matrix multiplication
// to a dense matrix (\f$ A+=B*C \f$).
// \ingroup dense_matrix
//
// \param lhs The target left-hand side dense matrix.
// \param rhs The right-hand side multiplication expression to be added.
// \return void
//
// This function implements the performance optimized addition assignment of a sparse matrix-
// transpose dense matrix multiplication expression to a dense matrix.
*/
template< typename MT // Type of the target dense matrix
, bool SO > // Storage order of the target dense matrix
friend inline typename DisableIf< CanExploitSymmetry<MT,MT1,MT2> >::Type
addAssign( DenseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
{
BLAZE_FUNCTION_TRACE;
BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense matrix operand
BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
SMatTDMatMultExpr::selectAddAssignKernel( ~lhs, A, B );
}
/*! \endcond */
//**********************************************************************************************
//**Default addition assignment to dense matrices***********************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Default addition assignment of a sparse matrix-transpose dense matrix multiplication
// (\f$ C+=A*B \f$).
// \ingroup dense_matrix
//
// \param C The target left-hand side dense matrix.
// \param A The left-hand side multiplication operand.
// \param B The right-hand side multiplication operand.
// \return void
//
// This function implements the default addition assignment kernel for the sparse matrix-
// transpose dense matrix multiplication.
*/
template< typename MT3 // Type of the left-hand side target matrix
, typename MT4 // Type of the left-hand side matrix operand
, typename MT5 > // Type of the right-hand side matrix operand
static inline void selectAddAssignKernel( MT3& C, const MT4& A, const MT5& B )
{
typedef typename MT4::ConstIterator ConstIterator;
const size_t block( 256UL );
const size_t jpos( B.columns() & size_t(-4) );
BLAZE_INTERNAL_ASSERT( ( B.columns() - ( B.columns() % 4UL ) ) == jpos, "Invalid end calculation" );
for( size_t ii=0UL; ii<A.rows(); ii+=block ) {
const size_t iend( ( ii+block > A.rows() )?( A.rows() ):( ii+block ) );
for( size_t j=0UL; j<jpos; j+=4UL ) {
for( size_t i=ii; i<iend; ++i )
{
const ConstIterator end( ( IsUpper<MT5>::value )
?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j+4UL) : A.upperBound(i,j+4UL) )
:( A.end(i) ) );
ConstIterator element( ( IsLower<MT5>::value )
?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
:( A.begin(i) ) );
for( ; element!=end; ++element ) {
C(i,j ) += element->value() * B(element->index(),j );
C(i,j+1UL) += element->value() * B(element->index(),j+1UL);
C(i,j+2UL) += element->value() * B(element->index(),j+2UL);
C(i,j+3UL) += element->value() * B(element->index(),j+3UL);
}
}
}
for( size_t j=jpos; j<B.columns(); ++j ) {
for( size_t i=ii; i<iend; ++i )
{
const ConstIterator end( ( IsUpper<MT5>::value )
?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j) : A.upperBound(i,j) )
:( A.end(i) ) );
ConstIterator element( ( IsLower<MT5>::value )
?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
:( A.begin(i) ) );
for( ; element!=end; ++element ) {
C(i,j) += element->value() * B(element->index(),j);
}
}
}
}
}
/*! \endcond */
//**********************************************************************************************
//**Restructuring addition assignment to row-major matrices*************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Restructuring addition assignment of a sparse matrix-transpose dense matrix
// multiplication to a row-major matrix (\f$ C+=A*B \f$).
// \ingroup dense_matrix
//
// \param lhs The target left-hand side matrix.
// \param rhs The right-hand side multiplication expression to be added.
// \return void
//
// This function implements the symmetry-based restructuring addition assignment of a sparse
// matrix-transpose dense matrix multiplication expression to a row-major matrix. Due to the
// explicit application of the SFINAE principle this function can only be selected by the
// compiler in case the symmetry of either of the two matrix operands can be exploited.
*/
template< typename MT > // Type of the target matrix
friend inline typename EnableIf< CanExploitSymmetry<MT,MT1,MT2> >::Type
addAssign( Matrix<MT,false>& lhs, const SMatTDMatMultExpr& rhs )
{
BLAZE_FUNCTION_TRACE;
BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
addAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
}
/*! \endcond */
//**********************************************************************************************
//**Addition assignment to sparse matrices******************************************************
// No special implementation for the addition assignment to sparse matrices.
//**********************************************************************************************
//**Subtraction assignment to dense matrices****************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Subtraction assignment of a sparse matrix-transpose dense matrix multiplication
// to a dense matrix (\f$ A-=B*C \f$).
// \ingroup dense_matrix
//
// \param lhs The target left-hand side dense matrix.
// \param rhs The right-hand side multiplication expression to be subtracted.
// \return void
//
// This function implements the performance optimized subtraction assignment of a sparse matrix-
// transpose dense matrix multiplication expression to a dense matrix.
*/
template< typename MT // Type of the target dense matrix
, bool SO > // Storage order of the target dense matrix
friend inline void subAssign( DenseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
{
BLAZE_FUNCTION_TRACE;
BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
LT A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
RT B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side dense matrix operand
BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
SMatTDMatMultExpr::selectSubAssignKernel( ~lhs, A, B );
}
/*! \endcond */
//**********************************************************************************************
//**Default subtraction assignment to dense matrices********************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Default subtraction assignment of a sparse matrix-transpose dense matrix multiplication
// (\f$ C-=A*B \f$).
// \ingroup dense_matrix
//
// \param C The target left-hand side dense matrix.
// \param A The left-hand side multiplication operand.
// \param B The right-hand side multiplication operand.
// \return void
//
// This function implements the default subtraction assignment kernel for the sparse matrix-
// transpose dense matrix multiplication.
*/
template< typename MT3 // Type of the left-hand side target matrix
, typename MT4 // Type of the left-hand side matrix operand
, typename MT5 > // Type of the right-hand side matrix operand
static inline void selectSubAssignKernel( MT3& C, const MT4& A, const MT5& B )
{
typedef typename MT4::ConstIterator ConstIterator;
const size_t block( 256UL );
const size_t jpos( B.columns() & size_t(-4) );
BLAZE_INTERNAL_ASSERT( ( B.columns() - ( B.columns() % 4UL ) ) == jpos, "Invalid end calculation" );
for( size_t ii=0UL; ii<A.rows(); ii+=block ) {
const size_t iend( ( ii+block > A.rows() )?( A.rows() ):( ii+block ) );
for( size_t j=0UL; j<jpos; j+=4UL ) {
for( size_t i=ii; i<iend; ++i )
{
const ConstIterator end( ( IsUpper<MT5>::value )
?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j+4UL) : A.upperBound(i,j+4UL) )
:( A.end(i) ) );
ConstIterator element( ( IsLower<MT5>::value )
?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
:( A.begin(i) ) );
for( ; element!=end; ++element ) {
C(i,j ) -= element->value() * B(element->index(),j );
C(i,j+1UL) -= element->value() * B(element->index(),j+1UL);
C(i,j+2UL) -= element->value() * B(element->index(),j+2UL);
C(i,j+3UL) -= element->value() * B(element->index(),j+3UL);
}
}
}
for( size_t j=jpos; j<B.columns(); ++j ) {
for( size_t i=ii; i<iend; ++i )
{
const ConstIterator end( ( IsUpper<MT5>::value )
?( IsStrictlyUpper<MT5>::value ? A.lowerBound(i,j) : A.upperBound(i,j) )
:( A.end(i) ) );
ConstIterator element( ( IsLower<MT5>::value )
?( IsStrictlyLower<MT5>::value ? A.upperBound(i,j) : A.lowerBound(i,j) )
:( A.begin(i) ) );
for( ; element!=end; ++element ) {
C(i,j) -= element->value() * B(element->index(),j);
}
}
}
}
}
/*! \endcond */
//**********************************************************************************************
//**Restructuring subtraction assignment to row-major matrices**********************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Restructuring subtraction assignment of a sparse matrix-transpose dense matrix
// multiplication to a row-major matrix (\f$ C-=A*B \f$).
// \ingroup dense_matrix
//
// \param lhs The target left-hand side matrix.
// \param rhs The right-hand side multiplication expression to be subtracted.
// \return void
//
// This function implements the symmetry-based restructuring subtraction assignment of a sparse
// matrix-transpose dense matrix multiplication expression to a row-major matrix. Due to the
// explicit application of the SFINAE principle this function can only be selected by the
// compiler in case the symmetry of either of the two matrix operands can be exploited.
*/
template< typename MT > // Type of the target matrix
friend inline typename EnableIf< CanExploitSymmetry<MT,MT1,MT2> >::Type
subAssign( Matrix<MT,false>& lhs, const SMatTDMatMultExpr& rhs )
{
BLAZE_FUNCTION_TRACE;
BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
subAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
}
/*! \endcond */
//**********************************************************************************************
//**Subtraction assignment to sparse matrices***************************************************
// No special implementation for the subtraction assignment to sparse matrices.
//**********************************************************************************************
//**Multiplication assignment to dense matrices*************************************************
// No special implementation for the multiplication assignment to dense matrices.
//**********************************************************************************************
//**Multiplication assignment to sparse matrices************************************************
// No special implementation for the multiplication assignment to sparse matrices.
//**********************************************************************************************
//**SMP assignment to dense matrices************************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief SMP assignment of a sparse matrix-transpose dense matrix multiplication to a dense
// matrix (\f$ A=B*C \f$).
// \ingroup dense_matrix
//
// \param lhs The target left-hand side dense matrix.
// \param rhs The right-hand side multiplication expression to be assigned.
// \return void
//
// This function implements the performance optimized SMP assignment of a sparse matrix-transpose
// dense matrix multiplication expression to a dense matrix. Due to the explicit application of
// the SFINAE principle this function can only be selected by the compiler in case either of the
// two matrix operands requires an intermediate evaluation and no symmetry can be exploited.
*/
template< typename MT // Type of the target dense matrix
, bool SO > // Storage order of the target dense matrix
friend inline typename EnableIf< IsEvaluationRequired<MT,MT1,MT2> >::Type
smpAssign( DenseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
{
BLAZE_FUNCTION_TRACE;
BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
LT A( rhs.lhs_ ); // Evaluation of the left-hand side sparse matrix operand
RT B( rhs.rhs_ ); // Evaluation of the right-hand side dense matrix operand
BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
smpAssign( ~lhs, A * B );
}
/*! \endcond */
//**********************************************************************************************
//**SMP assignment to sparse matrices***********************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief SMP assignment of a sparse matrix-transpose dense matrix multiplication to a sparse
// matrix (\f$ A=B*C \f$).
// \ingroup dense_matrix
//
// \param lhs The target left-hand side sparse matrix.
// \param rhs The right-hand side multiplication expression to be assigned.
// \return void
//
// This function implements the performance optimized SMP assignment of a sparse matrix-transpose
// dense matrix multiplication expression to a sparse matrix. Due to the explicit application of
// the SFINAE principle this function can only be selected by the compiler in case either of the
// two matrix operands requires an intermediate evaluation and no symmetry can be exploited.
*/
template< typename MT // Type of the target sparse matrix
, bool SO > // Storage order of the target sparse matrix
friend inline typename EnableIf< IsEvaluationRequired<MT,MT1,MT2> >::Type
smpAssign( SparseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
{
BLAZE_FUNCTION_TRACE;
typedef typename SelectType< SO, OppositeType, ResultType >::Type TmpType;
BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE( ResultType );
BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE( OppositeType );
BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE( ResultType );
BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( OppositeType );
BLAZE_CONSTRAINT_MATRICES_MUST_HAVE_SAME_STORAGE_ORDER( MT, TmpType );
BLAZE_CONSTRAINT_MUST_BE_REFERENCE_TYPE( typename TmpType::CompositeType );
BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
const TmpType tmp( rhs );
smpAssign( ~lhs, tmp );
}
/*! \endcond */
//**********************************************************************************************
//**Restructuring SMP assignment to row-major matrices******************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Restructuring SMP assignment of a sparse matrix-transpose dense matrix multiplication
// to a row-major matrix (\f$ C=A*B \f$).
// \ingroup dense_matrix
//
// \param lhs The target left-hand side matrix.
// \param rhs The right-hand side multiplication expression to be assigned.
// \return void
//
// This function implements the symmetry-based restructuring SMP assignment of a sparse matrix-
// transpose dense matrix multiplication expression to a row-major matrix. Due to the explicit
// application of the SFINAE principle this function can only be selected by the compiler in
// case the symmetry of either of the two matrix operands can be exploited.
*/
template< typename MT > // Type of the target matrix
friend inline typename EnableIf< CanExploitSymmetry<MT,MT1,MT2> >::Type
smpAssign( Matrix<MT,false>& lhs, const SMatTDMatMultExpr& rhs )
{
BLAZE_FUNCTION_TRACE;
BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
smpAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
}
/*! \endcond */
//**********************************************************************************************
//**SMP addition assignment to dense matrices***************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief SMP addition assignment of a sparse matrix-transpose dense matrix multiplication
// to a dense matrix (\f$ A+=B*C \f$).
// \ingroup dense_matrix
//
// \param lhs The target left-hand side dense matrix.
// \param rhs The right-hand side multiplication expression to be added.
// \return void
//
// This function implements the performance optimized SMP addition assignment of a sparse
// matrix-transpose dense matrix multiplication expression to a dense matrix. Due to the
// explicit application of the SFINAE principle this function can only be selected by the
// compiler in case either of the two matrix operands requires an intermediate evaluation
// and no symmetry can be exploited.
*/
template< typename MT // Type of the target dense matrix
, bool SO > // Storage order of the target dense matrix
friend inline typename EnableIf< IsEvaluationRequired<MT,MT1,MT2> >::Type
smpAddAssign( DenseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
{
BLAZE_FUNCTION_TRACE;
BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
LT A( rhs.lhs_ ); // Evaluation of the left-hand side sparse matrix operand
RT B( rhs.rhs_ ); // Evaluation of the right-hand side dense matrix operand
BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
smpAddAssign( ~lhs, A * B );
}
/*! \endcond */
//**********************************************************************************************
//**Restructuring SMP addition assignment to row-major matrices*********************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Restructuring SMP addition assignment of a sparse matrix-transpose dense matrix
// multiplication to a row-major matrix (\f$ C+=A*B \f$).
// \ingroup dense_matrix
//
// \param lhs The target left-hand side matrix.
// \param rhs The right-hand side multiplication expression to be added.
// \return void
//
// This function implements the symmetry-based restructuring SMP addition assignment of a
// sparse matrix-transpose dense matrix multiplication expression to a row-major matrix. Due
// to the explicit application of the SFINAE principle this function can only be selected by
// the compiler in case the symmetry of either of the two matrix operands can be exploited.
*/
template< typename MT > // Type of the target matrix
friend inline typename EnableIf< CanExploitSymmetry<MT,MT1,MT2> >::Type
smpAddAssign( Matrix<MT,false>& lhs, const SMatTDMatMultExpr& rhs )
{
BLAZE_FUNCTION_TRACE;
BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
smpAddAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
}
/*! \endcond */
//**********************************************************************************************
//**SMP addition assignment to sparse matrices**************************************************
// No special implementation for the SMP addition assignment to sparse matrices.
//**********************************************************************************************
//**SMP subtraction assignment to dense matrices************************************************
/*! \cond BLAZE_INTERNAL */
/*!\brief SMP subtraction assignment of a sparse matrix-transpose dense matrix multiplication
// to a dense matrix (\f$ A-=B*C \f$).
// \ingroup dense_matrix
//
// \param lhs The target left-hand side dense matrix.
// \param rhs The right-hand side multiplication expression to be subtracted.
// \return void
//
// This function implements the performance optimized SMP subtraction assignment of a sparse
// matrix-transpose dense matrix multiplication expression to a dense matrix. Due to the
// explicit application of the SFINAE principle this function can only be selected by the
// compiler in case either of the two matrix operands requires an intermediate evaluation
// and no symmetry can be exploited.
*/
template< typename MT // Type of the target dense matrix
, bool SO > // Storage order of the target dense matrix
friend inline typename EnableIf< IsEvaluationRequired<MT,MT1,MT2> >::Type
smpSubAssign( DenseMatrix<MT,SO>& lhs, const SMatTDMatMultExpr& rhs )
{
BLAZE_FUNCTION_TRACE;
BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
LT A( rhs.lhs_ ); // Evaluation of the left-hand side sparse matrix operand
RT B( rhs.rhs_ ); // Evaluation of the right-hand side dense matrix operand
BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
BLAZE_INTERNAL_ASSERT( A.rows() == (~lhs).rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( B.columns() == (~lhs).columns() , "Invalid number of columns" );
smpSubAssign( ~lhs, A * B );
}
/*! \endcond */
//**********************************************************************************************
//**Restructuring SMP subtraction assignment to row-major matrices******************************
/*! \cond BLAZE_INTERNAL */
/*!\brief Restructuring SMP subtraction assignment of a sparse matrix-transpose dense matrix
// multiplication to a row-major matrix (\f$ C-=A*B \f$).
// \ingroup dense_matrix
//
// \param lhs The target left-hand side matrix.
// \param rhs The right-hand side multiplication expression to be subtracted.
// \return void
//
// This function implements the symmetry-based restructuring SMP subtraction assignment of a
// sparse matrix-transpose dense matrix multiplication expression to a row-major matrix. Due
// to the explicit application of the SFINAE principle this function can only be selected by
// the compiler in case the symmetry of either of the two matrix operands can be exploited.
*/
template< typename MT > // Type of the target matrix
friend inline typename EnableIf< CanExploitSymmetry<MT,MT1,MT2> >::Type
smpSubAssign( Matrix<MT,false>& lhs, const SMatTDMatMultExpr& rhs )
{
BLAZE_FUNCTION_TRACE;
BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
smpSubAssign( ~lhs, rhs.lhs_ * trans( rhs.rhs_ ) );
}
/*! \endcond */
//**********************************************************************************************
//**SMP subtraction assignment to sparse matrices***********************************************
// No special implementation for the SMP subtraction assignment to sparse matrices.
//**********************************************************************************************
//**SMP multiplication assignment to dense matrices*********************************************
// No special implementation for the SMP multiplication assignment to dense matrices.
//**********************************************************************************************
//**SMP multiplication assignment to sparse matrices********************************************
// No special implementation for the SMP multiplication assignment to sparse matrices.
//**********************************************************************************************
//**Compile time checks*************************************************************************
/*! \cond BLAZE_INTERNAL */
BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE( MT1 );
BLAZE_CONSTRAINT_MUST_BE_ROW_MAJOR_MATRIX_TYPE( MT1 );
BLAZE_CONSTRAINT_MUST_BE_DENSE_MATRIX_TYPE( MT2 );
BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE( MT2 );
BLAZE_CONSTRAINT_MUST_FORM_VALID_MATMATMULTEXPR( MT1, MT2 );
/*! \endcond */
//**********************************************************************************************
};
//*************************************************************************************************
//=================================================================================================
//
// GLOBAL BINARY ARITHMETIC OPERATORS
//
//=================================================================================================
//*************************************************************************************************
/*!\brief Multiplication operator for the multiplication of a row-major sparse matrix and a
// column-major dense matrix (\f$ A=B*C \f$).
// \ingroup dense_matrix
//
// \param lhs The left-hand side sparse matrix for the multiplication.
// \param rhs The right-hand side dense matrix for the multiplication.
// \return The resulting matrix.
// \exception std::invalid_argument Matrix sizes do not match.
//
// This operator represents the multiplication of a row-major sparse matrix and a column-major
// dense matrix:
\code
using blaze::rowMajor;
using blaze::columnMajor;
blaze::CompressedMatrix<double,rowMajor> A;
blaze::DynamicMatrix<double,columnMajor> B;
blaze::DynamicMatrix<double,rowMajor> C;
// ... Resizing and initialization
C = A * B;
\endcode
// The operator returns an expression representing a dense matrix of the higher-order element
// type of the two involved matrix element types \a T1::ElementType and \a T2::ElementType.
// Both matrix types \a T1 and \a T2 as well as the two element types \a T1::ElementType and
// \a T2::ElementType have to be supported by the MultTrait class template.\n
// In case the current sizes of the two given matrices don't match, a \a std::invalid_argument
// is thrown.
*/
template< typename T1 // Type of the left-hand side sparse matrix
, typename T2 > // Type of the right-hand side dense matrix
inline const SMatTDMatMultExpr<T1,T2>
operator*( const SparseMatrix<T1,false>& lhs, const DenseMatrix<T2,true>& rhs )
{
BLAZE_FUNCTION_TRACE;
if( (~lhs).columns() != (~rhs).rows() )
throw std::invalid_argument( "Matrix sizes do not match" );
return SMatTDMatMultExpr<T1,T2>( ~lhs, ~rhs );
}
//*************************************************************************************************
//=================================================================================================
//
// ROWS SPECIALIZATIONS
//
//=================================================================================================
//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename MT1, typename MT2 >
struct Rows< SMatTDMatMultExpr<MT1,MT2> >
: public Rows<MT1>
{};
/*! \endcond */
//*************************************************************************************************
//=================================================================================================
//
// COLUMNS SPECIALIZATIONS
//
//=================================================================================================
//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename MT1, typename MT2 >
struct Columns< SMatTDMatMultExpr<MT1,MT2> >
: public Columns<MT2>
{};
/*! \endcond */
//*************************************************************************************************
//=================================================================================================
//
// ISLOWER SPECIALIZATIONS
//
//=================================================================================================
//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename MT1, typename MT2 >
struct IsLower< SMatTDMatMultExpr<MT1,MT2> >
: public IsTrue< And< IsLower<MT1>, IsLower<MT2> >::value >
{};
/*! \endcond */
//*************************************************************************************************
//=================================================================================================
//
// ISUNILOWER SPECIALIZATIONS
//
//=================================================================================================
//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename MT1, typename MT2 >
struct IsUniLower< SMatTDMatMultExpr<MT1,MT2> >
: public IsTrue< And< IsUniLower<MT1>, IsUniLower<MT2> >::value >
{};
/*! \endcond */
//*************************************************************************************************
//=================================================================================================
//
// ISSTRICTLYLOWER SPECIALIZATIONS
//
//=================================================================================================
//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename MT1, typename MT2 >
struct IsStrictlyLower< SMatTDMatMultExpr<MT1,MT2> >
: public IsTrue< Or< And< IsStrictlyLower<MT1>, IsLower<MT2> >
, And< IsStrictlyLower<MT2>, IsLower<MT1> > >::value >
{};
/*! \endcond */
//*************************************************************************************************
//=================================================================================================
//
// ISUPPER SPECIALIZATIONS
//
//=================================================================================================
//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename MT1, typename MT2 >
struct IsUpper< SMatTDMatMultExpr<MT1,MT2> >
: public IsTrue< And< IsUpper<MT1>, IsUpper<MT2> >::value >
{};
/*! \endcond */
//*************************************************************************************************
//=================================================================================================
//
// ISUNIUPPER SPECIALIZATIONS
//
//=================================================================================================
//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename MT1, typename MT2 >
struct IsUniUpper< SMatTDMatMultExpr<MT1,MT2> >
: public IsTrue< And< IsUniUpper<MT1>, IsUniUpper<MT2> >::value >
{};
/*! \endcond */
//*************************************************************************************************
//=================================================================================================
//
// ISSTRICTLYUPPER SPECIALIZATIONS
//
//=================================================================================================
//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename MT1, typename MT2 >
struct IsStrictlyUpper< SMatTDMatMultExpr<MT1,MT2> >
: public IsTrue< Or< And< IsStrictlyUpper<MT1>, IsUpper<MT2> >
, And< IsStrictlyUpper<MT2>, IsUpper<MT1> > >::value >
{};
/*! \endcond */
//*************************************************************************************************
//=================================================================================================
//
// EXPRESSION TRAIT SPECIALIZATIONS
//
//=================================================================================================
//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename MT1, typename MT2, typename VT >
struct DMatDVecMultExprTrait< SMatTDMatMultExpr<MT1,MT2>, VT >
{
public:
//**********************************************************************************************
typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
IsDenseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
IsDenseVector<VT>::value && IsColumnVector<VT>::value
, typename SMatDVecMultExprTrait< MT1, typename TDMatDVecMultExprTrait<MT2,VT>::Type >::Type
, INVALID_TYPE >::Type Type;
//**********************************************************************************************
};
/*! \endcond */
//*************************************************************************************************
//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename MT1, typename MT2, typename VT >
struct DMatSVecMultExprTrait< SMatTDMatMultExpr<MT1,MT2>, VT >
{
public:
//**********************************************************************************************
typedef typename SelectType< IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
IsDenseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value &&
IsSparseVector<VT>::value && IsColumnVector<VT>::value
, typename SMatDVecMultExprTrait< MT1, typename TDMatSVecMultExprTrait<MT2,VT>::Type >::Type
, INVALID_TYPE >::Type Type;
//**********************************************************************************************
};
/*! \endcond */
//*************************************************************************************************
//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename VT, typename MT1, typename MT2 >
struct TDVecDMatMultExprTrait< VT, SMatTDMatMultExpr<MT1,MT2> >
{
public:
//**********************************************************************************************
typedef typename SelectType< IsDenseVector<VT>::value && IsRowVector<VT>::value &&
IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
IsDenseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value
, typename TDVecTDMatMultExprTrait< typename TDVecSMatMultExprTrait<VT,MT1>::Type, MT2 >::Type
, INVALID_TYPE >::Type Type;
//**********************************************************************************************
};
/*! \endcond */
//*************************************************************************************************
//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename VT, typename MT1, typename MT2 >
struct TSVecDMatMultExprTrait< VT, SMatTDMatMultExpr<MT1,MT2> >
{
public:
//**********************************************************************************************
typedef typename SelectType< IsSparseVector<VT>::value && IsRowVector<VT>::value &&
IsSparseMatrix<MT1>::value && IsRowMajorMatrix<MT1>::value &&
IsDenseMatrix<MT2>::value && IsColumnMajorMatrix<MT2>::value
, typename TSVecTDMatMultExprTrait< typename TSVecSMatMultExprTrait<VT,MT1>::Type, MT2 >::Type
, INVALID_TYPE >::Type Type;
//**********************************************************************************************
};
/*! \endcond */
//*************************************************************************************************
//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename MT1, typename MT2, bool AF >
struct SubmatrixExprTrait< SMatTDMatMultExpr<MT1,MT2>, AF >
{
public:
//**********************************************************************************************
typedef typename MultExprTrait< typename SubmatrixExprTrait<const MT1,AF>::Type
, typename SubmatrixExprTrait<const MT2,AF>::Type >::Type Type;
//**********************************************************************************************
};
/*! \endcond */
//*************************************************************************************************
//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename MT1, typename MT2 >
struct RowExprTrait< SMatTDMatMultExpr<MT1,MT2> >
{
public:
//**********************************************************************************************
typedef typename MultExprTrait< typename RowExprTrait<const MT1>::Type, MT2 >::Type Type;
//**********************************************************************************************
};
/*! \endcond */
//*************************************************************************************************
//*************************************************************************************************
/*! \cond BLAZE_INTERNAL */
template< typename MT1, typename MT2 >
struct ColumnExprTrait< SMatTDMatMultExpr<MT1,MT2> >
{
public:
//**********************************************************************************************
typedef typename MultExprTrait< MT1, typename ColumnExprTrait<const MT2>::Type >::Type Type;
//**********************************************************************************************
};
/*! \endcond */
//*************************************************************************************************
} // namespace blaze
#endif
| {
"content_hash": "4bf4f3dd0c2e32ed5fb96390bb13675d",
"timestamp": "",
"source": "github",
"line_count": 1426,
"max_line_length": 144,
"avg_line_length": 49.694249649368864,
"alnum_prop": 0.49888518853014224,
"repo_name": "nyotis/blaze-lib",
"id": "f9a8df59d39d2b003bbe0b142258bc00649aa63f",
"size": "72756",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "blaze/math/expressions/SMatTDMatMultExpr.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "238612"
},
{
"name": "C++",
"bytes": "63338410"
},
{
"name": "Makefile",
"bytes": "517444"
},
{
"name": "Shell",
"bytes": "551420"
}
],
"symlink_target": ""
} |
@interface MYZNavController : UINavigationController
@end
| {
"content_hash": "2c7e80ec739cc70ecab9b5153bd459b0",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 52,
"avg_line_length": 19.666666666666668,
"alnum_prop": 0.847457627118644,
"repo_name": "MA806P/WeiboDemo",
"id": "d3a404b5be13ba7c53c20234eb9979485f21002f",
"size": "219",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "WeiboDemo/Classes/Main/Controller/MYZNavController.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Objective-C",
"bytes": "575535"
},
{
"name": "Ruby",
"bytes": "300"
}
],
"symlink_target": ""
} |
book_path: /mobile/_book.yaml
project_path: /mobile/_project.yaml
# Building TensorFlow on iOS
## Using CocoaPods
The simplest way to get started with TensorFlow on iOS is using the CocoaPods
package management system. You can add the `TensorFlow-experimental` pod to your
Podfile, which installs a universal binary framework. This makes it easy to get
started but has the disadvantage of being hard to customize, which is important
in case you want to shrink your binary size. If you do need the ability to
customize your libraries, see later sections on how to do that.
## Creating your own app
If you'd like to add TensorFlow capabilities to your own app, do the following:
- Create your own app or load your already-created app in XCode.
- Add a file named Podfile at the project root directory with the following content:
target 'YourProjectName'
pod 'TensorFlow-experimental'
- Run `pod install` to download and install the `TensorFlow-experimental` pod.
- Open `YourProjectName.xcworkspace` and add your code.
- In your app's **Build Settings**, make sure to add `$(inherited)` to the
**Other Linker Flags**, and **Header Search Paths** sections.
## Running the Samples
You'll need Xcode 7.3 or later to run our iOS samples.
There are currently three examples: simple, benchmark, and camera. For now, you
can download the sample code by cloning the main tensorflow repository (we are
planning to make the samples available as a separate repository later).
From the root of the tensorflow folder, download [Inception
v1](https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip),
and extract the label and graph files into the data folders inside both the
simple and camera examples using these steps:
mkdir -p ~/graphs
curl -o ~/graphs/inception5h.zip \
https://storage.googleapis.com/download.tensorflow.org/models/inception5h.zip \
&& unzip ~/graphs/inception5h.zip -d ~/graphs/inception5h
cp ~/graphs/inception5h/* tensorflow/examples/ios/benchmark/data/
cp ~/graphs/inception5h/* tensorflow/examples/ios/camera/data/
cp ~/graphs/inception5h/* tensorflow/examples/ios/simple/data/
Change into one of the sample directories, download the
[Tensorflow-experimental](https://cocoapods.org/pods/TensorFlow-experimental)
pod, and open the Xcode workspace. Note that installing the pod can take a long
time since it is big (~450MB). If you want to run the simple example, then:
cd tensorflow/examples/ios/simple
pod install
open tf_simple_example.xcworkspace # note .xcworkspace, not .xcodeproj
# this is created by pod install
Run the simple app in the XCode simulator. You should see a single-screen app
with a **Run Model** button. Tap that, and you should see some debug output
appear below indicating that the example Grace Hopper image in directory data
has been analyzed, with a military uniform recognized.
Run the other samples using the same process. The camera example requires a real
device connected. Once you build and run that, you should get a live camera view
that you can point at objects to get real-time recognition results.
### iOS Example details
There are three demo applications for iOS, all defined in Xcode projects inside
[tensorflow/examples/ios](https://www.tensorflow.org/code/tensorflow/examples/ios/).
- **Simple**: This is a minimal example showing how to load and run a TensorFlow
model in as few lines as possible. It just consists of a single view with a
button that executes the model loading and inference when its pressed.
- **Camera**: This is very similar to the Android TF Classify demo. It loads
Inception v3 and outputs its best label estimate for what’s in the live camera
view. As with the Android version, you can train your own custom model using
TensorFlow for Poets and drop it into this example with minimal code changes.
- **Benchmark**: is quite close to Simple, but it runs the graph repeatedly and
outputs similar statistics to the benchmark tool on Android.
### Troubleshooting
- Make sure you use the TensorFlow-experimental pod (and not TensorFlow).
- The TensorFlow-experimental pod is current about ~450MB. The reason it is so
big is because we are bundling multiple platforms, and the pod includes all
TensorFlow functionality (e.g. operations). The final app size after build is
substantially smaller though (~25MB). Working with the complete pod is
convenient during development, but see below section on how you can build your
own custom TensorFlow library to reduce the size.
## Building the TensorFlow iOS libraries from source
While Cocoapods is the quickest and easiest way of getting started, you sometimes
need more flexibility to determine which parts of TensorFlow your app should be
shipped with. For such cases, you can build the iOS libraries from the
sources. [This
guide](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/ios#building-the-tensorflow-ios-libraries-from-source)
contains detailed instructions on how to do that.
| {
"content_hash": "63bcf9ba8f17bf88dc47ff3950c0fb69",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 134,
"avg_line_length": 46.43636363636364,
"alnum_prop": 0.76938136256852,
"repo_name": "aselle/tensorflow",
"id": "6223707892ce7b288ecabf932b33cd39860446a6",
"size": "5110",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "tensorflow/contrib/lite/g3doc/tfmobile/ios_build.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "9258"
},
{
"name": "C",
"bytes": "321697"
},
{
"name": "C#",
"bytes": "7259"
},
{
"name": "C++",
"bytes": "46003590"
},
{
"name": "CMake",
"bytes": "207738"
},
{
"name": "Dockerfile",
"bytes": "6905"
},
{
"name": "Go",
"bytes": "1210133"
},
{
"name": "HTML",
"bytes": "4680032"
},
{
"name": "Java",
"bytes": "829230"
},
{
"name": "Jupyter Notebook",
"bytes": "2578736"
},
{
"name": "LLVM",
"bytes": "6536"
},
{
"name": "Makefile",
"bytes": "52243"
},
{
"name": "Objective-C",
"bytes": "15650"
},
{
"name": "Objective-C++",
"bytes": "99265"
},
{
"name": "PHP",
"bytes": "2140"
},
{
"name": "Perl",
"bytes": "7536"
},
{
"name": "PureBasic",
"bytes": "25356"
},
{
"name": "Python",
"bytes": "39898642"
},
{
"name": "Ruby",
"bytes": "533"
},
{
"name": "Shell",
"bytes": "447009"
},
{
"name": "Smarty",
"bytes": "6870"
}
],
"symlink_target": ""
} |
using Bookstore.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using Bookstore.Data;
namespace SearchForReviews
{
class SearchForReviews
{
static void Main()
{
string fileName = "../../reviews-search-results.xml";
using (XmlTextWriter writer = new XmlTextWriter(fileName, Encoding.UTF8))
{
writer.Formatting = Formatting.Indented;
writer.IndentChar = '\t';
writer.Indentation = 1;
writer.WriteStartDocument();
writer.WriteStartElement("search-results");
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("../../reviews-queries.xml");
string xPathQuery = "/review-queries/query";
XmlNodeList queryList = xmlDoc.SelectNodes(xPathQuery);
foreach (XmlNode query in queryList)
{
List<Review> reviews = new List<Review>();
string type = query.Attributes["type"].Value;
if (type == "by-author")
{
string authorName = query.SelectSingleNode("author-name").InnerText;
reviews = BookStoreDAL.SearchForReviewsByAuthor(authorName);
}
else
{
string startDate = query.SelectSingleNode("start-date").InnerText;
string endDate = query.SelectSingleNode("end-date").InnerText;
reviews = BookStoreDAL.SearchForReviewsByPeriod(startDate, endDate);
}
writer.WriteStartElement("result-set");
foreach (var review in reviews)
{
writer.WriteStartElement("review");
writer.WriteElementString("date", review.DateCreated.ToString());
writer.WriteElementString("content", review.Text.ToString());
writer.WriteStartElement("book");
writer.WriteElementString("title", review.Book.Title);
if (review.Book.Authors.Count != 0)
{
writer.WriteElementString("authors", string.Join(", ", review.Book.Authors.Select(x => x.Name).ToList()));
}
if (review.Book.ISBNnumber != null)
{
writer.WriteElementString("isbn", review.Book.ISBNnumber);
}
if (review.Book.Website != null)
{
writer.WriteElementString("url", review.Book.Website);
}
writer.WriteEndElement();
writer.WriteEndElement();
}
writer.WriteEndElement();
}
writer.WriteEndElement();
writer.WriteEndDocument();
}
}
}
}
| {
"content_hash": "7ebb7fb8114c59ef0c308360f35f81e4",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 134,
"avg_line_length": 39.13253012048193,
"alnum_prop": 0.48060344827586204,
"repo_name": "Ico093/TelerikAcademy",
"id": "71b07b1ae70eca9422c30341a69ce96fd6dc6a9e",
"size": "3250",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DataBases/Exams/DataBases-July-2013/DatabaseExam/SearchForReviews/SearchForReviews.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "172617"
},
{
"name": "C",
"bytes": "1487"
},
{
"name": "C#",
"bytes": "2694080"
},
{
"name": "CSS",
"bytes": "253424"
},
{
"name": "HTML",
"bytes": "518941"
},
{
"name": "Java",
"bytes": "47848"
},
{
"name": "JavaScript",
"bytes": "1224835"
},
{
"name": "Visual Basic",
"bytes": "540085"
}
],
"symlink_target": ""
} |
cask 'routeconverter' do
version '2.27.95'
sha256 '9883f301668d02cc03f63859399936bcd8156255f183c18ba260c74308948c44'
url 'https://static.routeconverter.com/download/RouteConverterMac.app.zip'
appcast 'https://static.routeconverter.com/download/previous-releases/',
configuration: version.major_minor
name 'RouteConverter'
homepage 'https://www.routeconverter.com/'
auto_updates true
app 'RouteConverterMacOpenSource.app'
end
| {
"content_hash": "68c6200a14c2d529cf3242cc06a3d732",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 76,
"avg_line_length": 32.42857142857143,
"alnum_prop": 0.7819383259911894,
"repo_name": "lantrix/homebrew-cask",
"id": "4fbd6894cbbbf712cfd81a710375f0b75d118df1",
"size": "454",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "Casks/routeconverter.rb",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Ruby",
"bytes": "2188808"
},
{
"name": "Shell",
"bytes": "35032"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jboss</groupId>
<artifactId>jboss-parent</artifactId>
<version>12</version>
</parent>
<groupId>com.techempower</groupId>
<artifactId>undertow-edge</artifactId>
<version>0.1</version>
<dependencies>
<!-- Web server -->
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-core</artifactId>
<version>1.0.0.Beta31</version>
<exclusions>
<exclusion>
<groupId>org.jboss.xnio</groupId>
<artifactId>xnio-nio</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.xnio</groupId>
<artifactId>xnio-api</artifactId>
<version>3.2.0.Beta4</version>
</dependency>
<dependency>
<groupId>org.jboss.xnio</groupId>
<artifactId>xnio-native</artifactId>
<version>1.0.0.Beta1</version>
</dependency>
<!-- Database drivers -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.25</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.0-801.jdbc4</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.11.2</version>
</dependency>
<!-- Database connection pooling -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<!-- Caching (and misc. utilities) -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>14.0.1</version>
</dependency>
<!-- JSON encoding -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.3.0</version>
</dependency>
<!-- HTML templates -->
<dependency>
<groupId>com.github.spullara.mustache.java</groupId>
<artifactId>compiler</artifactId>
<version>0.8.13</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<optimize>true</optimize>
<debug>false</debug>
</configuration>
</plugin>
<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>maven-download-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<id>install-xnio-native</id>
<phase>prepare-package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>http://downloads.jboss.org/xnio/native/1.0/1.0.0.Beta1/xnio-native-1.0.0.Beta1.zip</url>
<unpack>true</unpack>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<configuration>
<target>
<copy todir="${project.build.directory}" file="${project.build.directory}/${native.path}"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<mainClass>hello.HelloWebServer</mainClass>
</manifest>
</archive>
<attach>
</attach>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- this is used for inheritance merges -->
<phase>package</phase>
<!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>32bit-native</id>
<activation>
<os>
<arch>x86</arch>
</os>
</activation>
<properties>
<native.path>linux-i686/libxnio.so</native.path>
</properties>
</profile>
<profile>
<id>64bit-native</id>
<activation>
<os>
<arch>amd64</arch>
</os>
</activation>
<properties>
<native.path>linux-x86_64/libxnio.so</native.path>
</properties>
</profile>
</profiles>
<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
</project>
| {
"content_hash": "b6595876df6919e91e781a01458c0a11",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 123,
"avg_line_length": 36.306976744186045,
"alnum_prop": 0.4689982065078145,
"repo_name": "dmacd/FB-try1",
"id": "fd80f29786013d872ea7e2f7d0b48d85becc8897",
"size": "7806",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "undertow-edge/pom.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "838"
},
{
"name": "C",
"bytes": "37652"
},
{
"name": "C#",
"bytes": "128091"
},
{
"name": "C++",
"bytes": "387157"
},
{
"name": "CSS",
"bytes": "234858"
},
{
"name": "Clojure",
"bytes": "18712"
},
{
"name": "Dart",
"bytes": "28519"
},
{
"name": "Erlang",
"bytes": "7670"
},
{
"name": "Go",
"bytes": "25148"
},
{
"name": "Groovy",
"bytes": "16501"
},
{
"name": "Haskell",
"bytes": "8929"
},
{
"name": "IDL",
"bytes": "1736"
},
{
"name": "Java",
"bytes": "238135"
},
{
"name": "JavaScript",
"bytes": "394315"
},
{
"name": "Lua",
"bytes": "6991"
},
{
"name": "MoonScript",
"bytes": "2189"
},
{
"name": "Nimrod",
"bytes": "31172"
},
{
"name": "PHP",
"bytes": "17085753"
},
{
"name": "Perl",
"bytes": "14344"
},
{
"name": "PowerShell",
"bytes": "34846"
},
{
"name": "Python",
"bytes": "335974"
},
{
"name": "Racket",
"bytes": "1375"
},
{
"name": "Ruby",
"bytes": "74759"
},
{
"name": "Scala",
"bytes": "57177"
},
{
"name": "Shell",
"bytes": "55424"
},
{
"name": "Volt",
"bytes": "677"
}
],
"symlink_target": ""
} |
from .catalog_item import CatalogItem
class USqlPackage(CatalogItem):
"""A Data Lake Analytics catalog U-SQL package item.
:param compute_account_name: the name of the Data Lake Analytics account.
:type compute_account_name: str
:param version: the version of the catalog item.
:type version: str
:param database_name: the name of the database containing the package.
:type database_name: str
:param schema_name: the name of the schema associated with this package
and database.
:type schema_name: str
:param name: the name of the package.
:type name: str
:param definition: the definition of the package.
:type definition: str
"""
_attribute_map = {
'compute_account_name': {'key': 'computeAccountName', 'type': 'str'},
'version': {'key': 'version', 'type': 'str'},
'database_name': {'key': 'databaseName', 'type': 'str'},
'schema_name': {'key': 'schemaName', 'type': 'str'},
'name': {'key': 'packageName', 'type': 'str'},
'definition': {'key': 'definition', 'type': 'str'},
}
def __init__(self, compute_account_name=None, version=None, database_name=None, schema_name=None, name=None, definition=None):
super(USqlPackage, self).__init__(compute_account_name=compute_account_name, version=version)
self.database_name = database_name
self.schema_name = schema_name
self.name = name
self.definition = definition
| {
"content_hash": "dbbb079bfe037b95ffd186b618c1588d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 130,
"avg_line_length": 41.02777777777778,
"alnum_prop": 0.6445497630331753,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "bcb62ae92f1352e91f06e5fed8dd64edef0ce2e1",
"size": "1951",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "azure-mgmt-datalake-analytics/azure/mgmt/datalake/analytics/catalog/models/usql_package.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "42572767"
}
],
"symlink_target": ""
} |
package com.jme3.scene.plugins.blender.constraints;
import com.jme3.animation.Animation;
import com.jme3.math.Transform;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;
import com.jme3.scene.plugins.blender.BlenderContext;
import com.jme3.scene.plugins.blender.animations.Ipo;
import com.jme3.scene.plugins.blender.exceptions.BlenderFileException;
import com.jme3.scene.plugins.blender.file.Structure;
import com.jme3.scene.plugins.ogre.AnimData;
/**
* This class represents 'Size limit' constraint type in blender.
* @author Marcin Roguski (Kaelthas)
*/
/*package*/ class ConstraintSizeLimit extends Constraint {
private static final int LIMIT_XMIN = 0x01;
private static final int LIMIT_XMAX = 0x02;
private static final int LIMIT_YMIN = 0x04;
private static final int LIMIT_YMAX = 0x08;
private static final int LIMIT_ZMIN = 0x10;
private static final int LIMIT_ZMAX = 0x20;
protected float[][] limits = new float[3][2];
protected int flag;
/**
* This constructor creates the constraint instance.
*
* @param constraintStructure
* the constraint's structure (bConstraint clss in blender 2.49).
* @param ownerOMA
* the old memory address of the constraint owner
* @param influenceIpo
* the ipo curve of the influence factor
* @param blenderContext
* the blender context
* @throws BlenderFileException
* this exception is thrown when the blender file is somehow
* corrupted
*/
public ConstraintSizeLimit(Structure constraintStructure, Long ownerOMA,
Ipo influenceIpo, BlenderContext blenderContext) throws BlenderFileException {
super(constraintStructure, ownerOMA, influenceIpo, blenderContext);
flag = ((Number) data.getFieldValue("flag")).intValue();
if(blenderContext.getBlenderKey().isFixUpAxis()) {
limits[0][0] = ((Number) data.getFieldValue("xmin")).floatValue();
limits[0][1] = ((Number) data.getFieldValue("xmax")).floatValue();
limits[2][0] = -((Number) data.getFieldValue("ymin")).floatValue();
limits[2][1] = -((Number) data.getFieldValue("ymax")).floatValue();
limits[1][0] = ((Number) data.getFieldValue("zmin")).floatValue();
limits[1][1] = ((Number) data.getFieldValue("zmax")).floatValue();
//swapping Y and X limits flag in the bitwise flag
int ymin = flag & LIMIT_YMIN;
int ymax = flag & LIMIT_YMAX;
int zmin = flag & LIMIT_ZMIN;
int zmax = flag & LIMIT_ZMAX;
flag &= LIMIT_XMIN | LIMIT_XMAX;//clear the other flags to swap them
flag |= ymin << 2;
flag |= ymax << 2;
flag |= zmin >> 2;
flag |= zmax >> 2;
} else {
limits[0][0] = ((Number) data.getFieldValue("xmin")).floatValue();
limits[0][1] = ((Number) data.getFieldValue("xmax")).floatValue();
limits[1][0] = ((Number) data.getFieldValue("ymin")).floatValue();
limits[1][1] = ((Number) data.getFieldValue("ymax")).floatValue();
limits[2][0] = ((Number) data.getFieldValue("zmin")).floatValue();
limits[2][1] = ((Number) data.getFieldValue("zmax")).floatValue();
}
}
@Override
protected void bakeConstraint() {
Object owner = this.owner.getObject();
AnimData animData = blenderContext.getAnimData(this.owner.getOma());
if(animData != null) {
for(Animation animation : animData.anims) {
BlenderTrack track = this.getTrack(owner, animData.skeleton, animation);
Vector3f[] scales = track.getScales();
int maxFrames = scales.length;
for (int frame = 0; frame < maxFrames; ++frame) {
this.sizeLimit(scales[frame], ipo.calculateValue(frame));
}
track.setKeyframes(track.getTimes(), track.getTranslations(), track.getRotations(), scales);
}
}
if(owner instanceof Spatial) {
Transform ownerTransform = this.owner.getTransform();
this.sizeLimit(ownerTransform.getScale(), ipo.calculateValue(0));
this.owner.applyTransform(ownerTransform);
}
}
private void sizeLimit(Vector3f scale, float influence) {
if ((flag & LIMIT_XMIN) != 0) {
if (scale.x < limits[0][0]) {
scale.x -= (scale.x - limits[0][0]) * influence;
}
}
if ((flag & LIMIT_XMAX) != 0) {
if (scale.x > limits[0][1]) {
scale.x -= (scale.x - limits[0][1]) * influence;
}
}
if ((flag & LIMIT_YMIN) != 0) {
if (scale.y < limits[1][0]) {
scale.y -= (scale.y - limits[1][0]) * influence;
}
}
if ((flag & LIMIT_YMAX) != 0) {
if (scale.y > limits[1][1]) {
scale.y -= (scale.y - limits[1][1]) * influence;
}
}
if ((flag & LIMIT_ZMIN) != 0) {
if (scale.z < limits[2][0]) {
scale.z -= (scale.z - limits[2][0]) * influence;
}
}
if ((flag & LIMIT_ZMAX) != 0) {
if (scale.z > limits[2][1]) {
scale.z -= (scale.z - limits[2][1]) * influence;
}
}
}
}
| {
"content_hash": "330e957275ca688a08e8dedb9017f8bb",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 96,
"avg_line_length": 37.10687022900763,
"alnum_prop": 0.6414318041555236,
"repo_name": "indashnet/InDashNet.Open.UN2000",
"id": "5d58299581f67612266cf96f53224e676b26ff0d",
"size": "4861",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "android/external/jmonkeyengine/engine/src/blender/com/jme3/scene/plugins/blender/constraints/ConstraintSizeLimit.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?xml version='1.0' encoding='UTF-8'?>
<hudson.maven.MavenBuild plugin="[email protected]">
<actions>
<hudson.maven.reporters.SurefireReport>
<descriptions class="concurrent-hash-map"/>
<failCount>0</failCount>
<skipCount>0</skipCount>
<totalCount>1</totalCount>
<testData/>
</hudson.maven.reporters.SurefireReport>
<com.sonyericsson.rebuild.RebuildAction plugin="[email protected]"/>
<hudson.tasks.Fingerprinter_-FingerprintAction>
<record>
<entry>
<string>org.springframework:spring-aop-4.3.8.RELEASE.jar</string>
<string>5deeeecf0dfd3f9847818a6b1deecb7d</string>
</entry>
<entry>
<string>com.jayway.jsonpath:json-path-2.2.0.jar</string>
<string>98ec1b51b19c21a32845ba3498df6629</string>
</entry>
<entry>
<string>org.springframework.boot:spring-boot-1.5.3.RELEASE.jar</string>
<string>36bbf6aff3f56046cf4f8ac9373886be</string>
</entry>
<entry>
<string>org.springframework:spring-beans-4.3.8.RELEASE.jar</string>
<string>7c96285cc326b14a5d1aae925bf121f3</string>
</entry>
<entry>
<string>org.hibernate:hibernate-validator-5.3.5.Final.jar</string>
<string>bd241d9104768ad5ef698d58534c0bce</string>
</entry>
<entry>
<string>org.ow2.asm:asm-5.0.3.jar</string>
<string>ccebee99fb8cdd50e1967680a2eac0ba</string>
</entry>
<entry>
<string>org.apache.tomcat.embed:tomcat-embed-el-8.5.14.jar</string>
<string>6d38635ee4c9b16687cd2c8f6e67a4f9</string>
</entry>
<entry>
<string>ch.qos.logback:logback-core-1.1.11.jar</string>
<string>cc7a8deacd26b0aa2668779ce2721c0f</string>
</entry>
<entry>
<string>org.slf4j:jcl-over-slf4j-1.7.25.jar</string>
<string>56b22adc639b09b2e917f42d68b26600</string>
</entry>
<entry>
<string>org.springframework.boot:spring-boot-actuator-1.5.3.RELEASE.jar</string>
<string>1af39c61c8ff6bbfbf5e65d9d75a78f6</string>
</entry>
<entry>
<string>org.hamcrest:hamcrest-library-1.3.jar</string>
<string>110ad2ea84f7031a1798648b6b318e79</string>
</entry>
<entry>
<string>org.springframework:spring-test-4.3.8.RELEASE.jar</string>
<string>afa8fa874accdaf421dc0e8248f162a7</string>
</entry>
<entry>
<string>org.jboss.logging:jboss-logging-3.3.1.Final.jar</string>
<string>93cf8945ff84aaf9f0ed9a76991338fb</string>
</entry>
<entry>
<string>junit:junit-4.12.jar</string>
<string>5b38c40c97fbd0adee29f91e60405584</string>
</entry>
<entry>
<string>org.assertj:assertj-core-2.6.0.jar</string>
<string>1c7a969eeb11e3dd854a6a5f417f5cf2</string>
</entry>
<entry>
<string>org.springframework.boot:spring-boot-autoconfigure-1.5.3.RELEASE.jar</string>
<string>ed9fd89f47a140124a5e2b6d07517dd9</string>
</entry>
<entry>
<string>org.springframework.boot:spring-boot-starter-web-1.5.3.RELEASE.jar</string>
<string>cd4d64d2f32ae9193f5ec080fbba51a7</string>
</entry>
<entry>
<string>org.slf4j:log4j-over-slf4j-1.7.25.jar</string>
<string>fb818c7981d842875905587a61f2b942</string>
</entry>
<entry>
<string>org.objenesis:objenesis-2.1.jar</string>
<string>32ccb1d20a42b5aaaceb90c9082a2efa</string>
</entry>
<entry>
<string>net.minidev:json-smart-2.2.1.jar</string>
<string>4c82c537eb0ba92adad494283711cc11</string>
</entry>
<entry>
<string>org.skyscreamer:jsonassert-1.4.0.jar</string>
<string>5d8b0cc1089c3dc08214f86a873d895b</string>
</entry>
<entry>
<string>org.springframework:spring-core-4.3.8.RELEASE.jar</string>
<string>6cfb77086005e125dff38f180c90f093</string>
</entry>
<entry>
<string>org.hamcrest:hamcrest-core-1.3.jar</string>
<string>6393363b47ddcbba82321110c3e07519</string>
</entry>
<entry>
<string>com.fasterxml.jackson.core:jackson-annotations-2.8.0.jar</string>
<string>288e6537849f0c63e76409b515c4fbe4</string>
</entry>
<entry>
<string>org.springframework:spring-web-4.3.8.RELEASE.jar</string>
<string>8832270a6cc79dece124263cbe8b1bb7</string>
</entry>
<entry>
<string>org.apache.tomcat.embed:tomcat-embed-websocket-8.5.14.jar</string>
<string>2b780f27020e2fbf93194be96ea5b58c</string>
</entry>
<entry>
<string>org.slf4j:jul-to-slf4j-1.7.25.jar</string>
<string>ab28124cb05fec600f2ffe37b94629e0</string>
</entry>
<entry>
<string>org.slf4j:slf4j-api-1.7.25.jar</string>
<string>caafe376afb7086dcbee79f780394ca3</string>
</entry>
<entry>
<string>org.springframework.boot:spring-boot-starter-test-1.5.3.RELEASE.jar</string>
<string>7ef4b12d43a48dce7b86854f8de6ed82</string>
</entry>
<entry>
<string>org.apache.tomcat.embed:tomcat-embed-core-8.5.14.jar</string>
<string>2e7be3ef2d5347ef9719d16454019ec4</string>
</entry>
<entry>
<string>net.minidev:accessors-smart-1.1.jar</string>
<string>b75cda0d7dadff9e6c20f4e7f3c3bc82</string>
</entry>
<entry>
<string>javax.validation:validation-api-1.1.0.Final.jar</string>
<string>4c257f52462860b62ab3cdab45f53082</string>
</entry>
<entry>
<string>org.springframework.boot:spring-boot-test-1.5.3.RELEASE.jar</string>
<string>9116aa5363615823c80f90902eaeebd1</string>
</entry>
<entry>
<string>org.mockito:mockito-core-1.10.19.jar</string>
<string>c1967f0a515c4b8155f62478ec823464</string>
</entry>
<entry>
<string>com.fasterxml.jackson.core:jackson-core-2.8.8.jar</string>
<string>f85e0e9af65d644d909fe2d6acc0e64c</string>
</entry>
<entry>
<string>org.springframework.boot:spring-boot-starter-logging-1.5.3.RELEASE.jar</string>
<string>4fdfab90d61678a550e75ba40b2d080e</string>
</entry>
<entry>
<string>com.karsun:cicddemo-1.0.0-SNAPSHOT.jar</string>
<string>d7777fa0ec64acf5cca325fd88a39bbb</string>
</entry>
<entry>
<string>org.springframework:spring-context-4.3.8.RELEASE.jar</string>
<string>7512e2be5a2ef287b6625ea13ead6c37</string>
</entry>
<entry>
<string>org.springframework.boot:spring-boot-test-autoconfigure-1.5.3.RELEASE.jar</string>
<string>09e9393f9f2316ba70df15eb64e2488e</string>
</entry>
<entry>
<string>org.springframework.boot:spring-boot-starter-parent:spring-boot-starter-parent-1.5.3.RELEASE.pom</string>
<string>eace281f7d565b4bc114f2f28cf08389</string>
</entry>
<entry>
<string>com.vaadin.external.google:android-json-0.0.20131108.vaadin1.jar</string>
<string>10612241a9cc269501a7a2b8a984b949</string>
</entry>
<entry>
<string>com.karsun:cicddemo:pom.xml</string>
<string>d4ed354b7c255347eec95f238cf3f191</string>
</entry>
<entry>
<string>com.fasterxml.jackson.core:jackson-databind-2.8.8.jar</string>
<string>4a203a9b324e0096586857d2522d19b9</string>
</entry>
<entry>
<string>org.springframework.boot:spring-boot-starter-tomcat-1.5.3.RELEASE.jar</string>
<string>4c04660aad3543b38622a2f66e4591a1</string>
</entry>
<entry>
<string>org.springframework:spring-webmvc-4.3.8.RELEASE.jar</string>
<string>9b21dcf2dfc179ffcf26d3b6a0636870</string>
</entry>
<entry>
<string>org.springframework:spring-expression-4.3.8.RELEASE.jar</string>
<string>4f2642b43ef001ec3007f28fc6cd7c51</string>
</entry>
<entry>
<string>ch.qos.logback:logback-classic-1.1.11.jar</string>
<string>8064835579ddb2c86ae26b447b0c5f76</string>
</entry>
<entry>
<string>com.fasterxml:classmate-1.3.3.jar</string>
<string>85986d1c6a2a58901ab1ca64ff4d8a50</string>
</entry>
<entry>
<string>org.yaml:snakeyaml-1.17.jar</string>
<string>ab621c3cee316236ad04a6f0fe4dd17c</string>
</entry>
<entry>
<string>org.springframework.boot:spring-boot-starter-actuator-1.5.3.RELEASE.jar</string>
<string>27236ef57733bd24d3a6157d5261f0c0</string>
</entry>
<entry>
<string>org.springframework.boot:spring-boot-starter-1.5.3.RELEASE.jar</string>
<string>dbed0cb5ae026c536bebed50af82b417</string>
</entry>
<entry>
<string>org.springframework.boot:spring-boot-dependencies:spring-boot-dependencies-1.5.3.RELEASE.pom</string>
<string>0ff6b9b2a5ccba9c6f5f79872d76bf4f</string>
</entry>
<entry>
<string>com.karsun:cicddemo-1.0.0-SNAPSHOT-docker-info.jar</string>
<string>591e487bacfb983c8cfffd706d02f959</string>
</entry>
</record>
</hudson.tasks.Fingerprinter_-FingerprintAction>
<hudson.maven.reporters.MavenArtifactRecord>
<records/>
<parent reference="../../.."/>
<pomArtifact>
<groupId>com.karsun</groupId>
<artifactId>cicddemo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<fileName>pom.xml</fileName>
<canonicalName>cicddemo-1.0.0-SNAPSHOT.pom</canonicalName>
<md5sum>d4ed354b7c255347eec95f238cf3f191</md5sum>
</pomArtifact>
<mainArtifact>
<groupId>com.karsun</groupId>
<artifactId>cicddemo</artifactId>
<version>1.0.0-20170725.192340-1</version>
<type>jar</type>
<fileName>cicddemo-1.0.0-SNAPSHOT.jar</fileName>
<canonicalName>cicddemo-1.0.0-20170725.192340-1.jar</canonicalName>
<md5sum>1cf5bdec165601e63781d28ee9caf44e</md5sum>
</mainArtifact>
<attachedArtifacts>
<hudson.maven.reporters.MavenArtifact>
<groupId>com.karsun</groupId>
<artifactId>cicddemo</artifactId>
<version>1.0.0-20170725.192340-1</version>
<classifier>docker-info</classifier>
<type>docker-info</type>
<fileName>cicddemo-1.0.0-SNAPSHOT-docker-info.jar</fileName>
<canonicalName>cicddemo-1.0.0-20170725.192340-1-docker-info.jar</canonicalName>
<md5sum>33be3808bf47282d28aa4136077f754b</md5sum>
</hudson.maven.reporters.MavenArtifact>
<hudson.maven.reporters.MavenArtifact>
<groupId>com.karsun</groupId>
<artifactId>cicddemo</artifactId>
<version>1.0.0-20170725.192340-1</version>
<classifier>docker-info</classifier>
<type>docker-info</type>
<fileName>cicddemo-1.0.0-SNAPSHOT-docker-info.jar</fileName>
<canonicalName>cicddemo-1.0.0-20170725.192340-1-docker-info.jar</canonicalName>
<md5sum>33be3808bf47282d28aa4136077f754b</md5sum>
</hudson.maven.reporters.MavenArtifact>
<hudson.maven.reporters.MavenArtifact>
<groupId>com.karsun</groupId>
<artifactId>cicddemo</artifactId>
<version>1.0.0-20170725.192340-1</version>
<classifier>docker-info</classifier>
<type>docker-info</type>
<fileName>cicddemo-1.0.0-SNAPSHOT-docker-info.jar</fileName>
<canonicalName>cicddemo-1.0.0-20170725.192340-1-docker-info.jar</canonicalName>
<md5sum>33be3808bf47282d28aa4136077f754b</md5sum>
</hudson.maven.reporters.MavenArtifact>
<hudson.maven.reporters.MavenArtifact>
<groupId>com.karsun</groupId>
<artifactId>cicddemo</artifactId>
<version>1.0.0-20170725.192340-1</version>
<classifier>docker-info</classifier>
<type>docker-info</type>
<fileName>cicddemo-1.0.0-SNAPSHOT-docker-info.jar</fileName>
<canonicalName>cicddemo-1.0.0-20170725.192340-1-docker-info.jar</canonicalName>
<md5sum>33be3808bf47282d28aa4136077f754b</md5sum>
</hudson.maven.reporters.MavenArtifact>
</attachedArtifacts>
<repositoryId>snapshots</repositoryId>
<repositoryUrl>https://artifactory.golean.io/artifactory/libs-snapshot-local</repositoryUrl>
</hudson.maven.reporters.MavenArtifactRecord>
</actions>
<queueId>-1</queueId>
<timestamp>1501010592980</timestamp>
<startTime>1501010597371</startTime>
<result>SUCCESS</result>
<duration>33432</duration>
<keepLog>false</keepLog>
<builtOn></builtOn>
<workspace>/var/lib/jenkins/workspace/cicdRFIBuildDev</workspace>
<projectActionReporters>
<hudson.maven.reporters.SurefireArchiver_-FactoryImpl/>
<hudson.maven.reporters.SurefireArchiver_-FactoryImpl/>
</projectActionReporters>
<executedMojos class="java.util.concurrent.CopyOnWriteArrayList">
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6.1</version>
<goal>clean</goal>
<executionId>default-clean</executionId>
<duration>164</duration>
<digest>8dcc382dc49b8156a676b1074b4aacfe</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<goal>resources</goal>
<executionId>default-resources</executionId>
<duration>152</duration>
<digest>e7cc4bbb6888e6c9dd5acdad08cf4bd3</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<goal>compile</goal>
<executionId>default-compile</executionId>
<duration>1000</duration>
<digest>4a14a33ab69db9dadfb4d41449ebc651</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<goal>testResources</goal>
<executionId>default-testResources</executionId>
<duration>9</duration>
<digest>e7cc4bbb6888e6c9dd5acdad08cf4bd3</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<goal>testCompile</goal>
<executionId>default-testCompile</executionId>
<duration>261</duration>
<digest>4a14a33ab69db9dadfb4d41449ebc651</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<goal>test</goal>
<executionId>default-test</executionId>
<duration>6030</duration>
<digest>32c355be4424c35f6aab5f6954b06011</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<goal>jar</goal>
<executionId>default-jar</executionId>
<duration>700</duration>
<digest>a96e43f51ae2520c93e491ff1c89d491</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.3.RELEASE</version>
<goal>repackage</goal>
<executionId>default</executionId>
<duration>555</duration>
<digest>f75707b9c22e3e6c9851dcd2c6b24280</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.4</version>
<goal>build</goal>
<executionId>default</executionId>
<duration>6491</duration>
<digest>015c4ab097e7eda4de8a195fe71c4a95</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.4</version>
<goal>tag</goal>
<executionId>default-dev</executionId>
<duration>113</duration>
<digest>015c4ab097e7eda4de8a195fe71c4a95</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<goal>integration-test</goal>
<executionId>default</executionId>
<duration>114</duration>
<digest>5cbb0b67d681003d67fbbaea95c3bb2d</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<goal>verify</goal>
<executionId>default</executionId>
<duration>16</duration>
<digest>5cbb0b67d681003d67fbbaea95c3bb2d</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<goal>install</goal>
<executionId>default-install</executionId>
<duration>155</duration>
<digest>5d888555943fb34ffc35eac586e7747e</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<goal>resources</goal>
<executionId>default-resources</executionId>
<duration>3</duration>
<digest>e7cc4bbb6888e6c9dd5acdad08cf4bd3</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<goal>compile</goal>
<executionId>default-compile</executionId>
<duration>6</duration>
<digest>4a14a33ab69db9dadfb4d41449ebc651</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<goal>testResources</goal>
<executionId>default-testResources</executionId>
<duration>2</duration>
<digest>e7cc4bbb6888e6c9dd5acdad08cf4bd3</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<goal>testCompile</goal>
<executionId>default-testCompile</executionId>
<duration>3</duration>
<digest>4a14a33ab69db9dadfb4d41449ebc651</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<goal>test</goal>
<executionId>default-test</executionId>
<duration>5</duration>
<digest>32c355be4424c35f6aab5f6954b06011</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<goal>jar</goal>
<executionId>default-jar</executionId>
<duration>87</duration>
<digest>a96e43f51ae2520c93e491ff1c89d491</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.3.RELEASE</version>
<goal>repackage</goal>
<executionId>default</executionId>
<duration>4</duration>
<digest>f75707b9c22e3e6c9851dcd2c6b24280</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.4</version>
<goal>build</goal>
<executionId>default</executionId>
<duration>1747</duration>
<digest>015c4ab097e7eda4de8a195fe71c4a95</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.4</version>
<goal>tag</goal>
<executionId>default-dev</executionId>
<duration>43</duration>
<digest>015c4ab097e7eda4de8a195fe71c4a95</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<goal>integration-test</goal>
<executionId>default</executionId>
<duration>6</duration>
<digest>5cbb0b67d681003d67fbbaea95c3bb2d</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<goal>verify</goal>
<executionId>default</executionId>
<duration>7</duration>
<digest>5cbb0b67d681003d67fbbaea95c3bb2d</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<goal>install</goal>
<executionId>default-install</executionId>
<duration>33</duration>
<digest>5d888555943fb34ffc35eac586e7747e</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<goal>deploy</goal>
<executionId>default-deploy</executionId>
<duration>2093</duration>
<digest>c9f211a7ddbaae0583dde1408c48138a</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.4</version>
<goal>push</goal>
<executionId>default</executionId>
<duration>7791</duration>
<digest>015c4ab097e7eda4de8a195fe71c4a95</digest>
</hudson.maven.ExecutedMojo>
<hudson.maven.ExecutedMojo>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.4</version>
<goal>push</goal>
<executionId>default-dev</executionId>
<duration>328</duration>
<digest>015c4ab097e7eda4de8a195fe71c4a95</digest>
</hudson.maven.ExecutedMojo>
</executedMojos>
</hudson.maven.MavenBuild> | {
"content_hash": "90cfc0056383eb54c8a9d6c7c37f1c5d",
"timestamp": "",
"source": "github",
"line_count": 561,
"max_line_length": 123,
"avg_line_length": 41.61140819964349,
"alnum_prop": 0.664025017135024,
"repo_name": "Karsun/cicddemo",
"id": "157fb75b150c3ecb1446e9cc678b6bbf48d535a1",
"size": "23344",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "resource/jenkins/cicdRFIBuildDev/modules/com.karsun$cicddemo/builds/9/build.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "6126"
},
{
"name": "Shell",
"bytes": "133"
}
],
"symlink_target": ""
} |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE476_NULL_Pointer_Dereference__int64_t_67a.c
Label Definition File: CWE476_NULL_Pointer_Dereference.label.xml
Template File: sources-sinks-67a.tmpl.c
*/
/*
* @description
* CWE: 476 NULL Pointer Dereference
* BadSource: Set data to NULL
* GoodSource: Initialize data
* Sinks:
* GoodSink: Check for NULL before attempting to print data
* BadSink : Print data
* Flow Variant: 67 Data flow: data passed in a struct from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
typedef struct _CWE476_NULL_Pointer_Dereference__int64_t_67_structType
{
int64_t * structFirst;
} CWE476_NULL_Pointer_Dereference__int64_t_67_structType;
#ifndef OMITBAD
/* bad function declaration */
void CWE476_NULL_Pointer_Dereference__int64_t_67b_badSink(CWE476_NULL_Pointer_Dereference__int64_t_67_structType myStruct);
void CWE476_NULL_Pointer_Dereference__int64_t_67_bad()
{
int64_t * data;
CWE476_NULL_Pointer_Dereference__int64_t_67_structType myStruct;
/* POTENTIAL FLAW: Set data to NULL */
data = NULL;
myStruct.structFirst = data;
CWE476_NULL_Pointer_Dereference__int64_t_67b_badSink(myStruct);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE476_NULL_Pointer_Dereference__int64_t_67b_goodG2BSink(CWE476_NULL_Pointer_Dereference__int64_t_67_structType myStruct);
static void goodG2B()
{
int64_t * data;
int64_t tmpData = 5LL;
CWE476_NULL_Pointer_Dereference__int64_t_67_structType myStruct;
/* FIX: Initialize data */
{
data = &tmpData;
}
myStruct.structFirst = data;
CWE476_NULL_Pointer_Dereference__int64_t_67b_goodG2BSink(myStruct);
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE476_NULL_Pointer_Dereference__int64_t_67b_goodB2GSink(CWE476_NULL_Pointer_Dereference__int64_t_67_structType myStruct);
static void goodB2G()
{
int64_t * data;
CWE476_NULL_Pointer_Dereference__int64_t_67_structType myStruct;
/* POTENTIAL FLAW: Set data to NULL */
data = NULL;
myStruct.structFirst = data;
CWE476_NULL_Pointer_Dereference__int64_t_67b_goodB2GSink(myStruct);
}
void CWE476_NULL_Pointer_Dereference__int64_t_67_good()
{
goodG2B();
goodB2G();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE476_NULL_Pointer_Dereference__int64_t_67_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE476_NULL_Pointer_Dereference__int64_t_67_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| {
"content_hash": "4a2c9b3b5da633a3c0d30c48544120fd",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 127,
"avg_line_length": 29.91588785046729,
"alnum_prop": 0.6888472352389878,
"repo_name": "JianpingZeng/xcc",
"id": "b605b4abae5cd42f3bba1e65cf8cc3e2b0983345",
"size": "3201",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "xcc/test/juliet/testcases/CWE476_NULL_Pointer_Dereference/CWE476_NULL_Pointer_Dereference__int64_t_67a.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
namespace CslaContrib.Caliburn.Micro
{
using Caliburn.Micro;
/// <summary>
/// Base class used to create ScreenWithModel objects,
/// with pre-existing verbs for use by
/// InvokeMethod or Invoke.
/// </summary>
/// <typeparam name="T">Type of the Model object.</typeparam>
public abstract class ScreenWithModel<T> : ScreenWithModelBase<T>
{
#region Verbs
/// <summary>
/// Saves the Model, first committing changes
/// if ManagedObjectLifetime is true.
/// </summary>
public virtual void Save(object sender, ExecuteEventArgs e)
{
BeginSave();
}
/// <summary>
/// Cancels changes made to the model
/// if ManagedObjectLifetime is true.
/// </summary>
public virtual void Cancel(object sender, ExecuteEventArgs e)
{
DoCancel();
}
/// <summary>
/// Adds a new item to the Model (if it
/// is a collection).
/// </summary>
public virtual void AddNew(object sender, ExecuteEventArgs e)
{
#if SILVERLIGHT
BeginAddNew();
#else
DoAddNew();
#endif
}
/// <summary>
/// Removes an item from the Model (if it
/// is a collection).
/// </summary>
public virtual void Remove(object sender, ExecuteEventArgs e)
{
DoRemove(e.MethodParameter);
}
/// <summary>
/// Marks the Model for deletion (if it is an
/// editable root object).
/// </summary>
public virtual void Delete(object sender, ExecuteEventArgs e)
{
DoDelete();
}
#endregion
}
}
| {
"content_hash": "f55cb147656524374ea0429ac0b920aa",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 69,
"avg_line_length": 26.37878787878788,
"alnum_prop": 0.5422171165996553,
"repo_name": "MarimerLLC/cslacontrib",
"id": "79324c39e6751fadda6b37ca4e30f2ee9f58dbbf",
"size": "1743",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "trunk/Source/CslaContrib.Caliburn.Micro.WPF.Net45/ScreenWithModel.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP.NET",
"bytes": "28641"
},
{
"name": "Batchfile",
"bytes": "3396"
},
{
"name": "C#",
"bytes": "4796548"
},
{
"name": "C++",
"bytes": "120475"
},
{
"name": "CSS",
"bytes": "4998"
},
{
"name": "HTML",
"bytes": "1172"
},
{
"name": "JavaScript",
"bytes": "17332"
},
{
"name": "Pascal",
"bytes": "58216"
},
{
"name": "Pawn",
"bytes": "2428"
},
{
"name": "PowerShell",
"bytes": "31128"
},
{
"name": "Rich Text Format",
"bytes": "42874"
},
{
"name": "SourcePawn",
"bytes": "4822"
},
{
"name": "TSQL",
"bytes": "93394"
},
{
"name": "Visual Basic .NET",
"bytes": "687437"
}
],
"symlink_target": ""
} |
require 'cardshark/dimension'
RSpec.describe Cardshark::Dimension do
describe '::new' do
it 'raises an Error::AbstractClass' do
expect { described_class.new(:id) }
.to raise_exception(Cardshark::Error::AbstractClass)
end
end
context 'when subclassed' do
let(:subclass) { Class.new(described_class) }
describe '::new' do
context 'invalid arguments' do
context 'no arguments' do
it 'raises an ArgumentError' do
expect { subclass.new }.to raise_exception(ArgumentError)
end
end
context 'invalid arguments' do
it 'raises an ArgumentError' do
expect { subclass.new('invalid-argument') }
.to raise_exception(ArgumentError)
end
end
end
context 'valid arguments' do
before do
@result = subclass.new(:id)
end
context 'return value' do
it 'is a an instance of the class' do
expect(@result).to be_an_instance_of(subclass)
end
it 'is a subclass of the described class' do
expect(@result.class.superclass).to eq(described_class)
end
it 'returns the same object for the same id' do
expect(@result).to equal(subclass.new(:id))
end
end
end
end
describe '::all' do
before { @result = subclass.all }
it 'returns an Array' do
expect(@result).to be_an(Array)
end
context 'it has not been instantiated' do
it 'returns an empty Array' do
expect(@result.count).to eq(0)
end
end
context 'it has been instantiated' do
before do
@instances = []
3.times { |i| @instances.push(subclass.new(i.to_s.to_sym)) }
@result = subclass.all
end
after { clear_instance_metadata }
it 'returns an array of instances' do
expect(@result.first.class).to eq(subclass)
end
it 'returns all of the instances' do
expect(@result).to match_array(@instances)
end
end
end
describe '::id' do
it 'returns a symbol' do
expect(subclass.id.class).to eq(Symbol)
end
context 'named subclass' do
before { class NamedClassExample < described_class; end }
after { Object.send(:remove_const, 'NamedClassExample') }
it 'returns a symbol version of the class name' do
expect(NamedClassExample.id).to eq(:named_class_example)
end
end
end
describe '#to_s' do
let(:instance) { subclass.new(:name) }
it 'returns a capitalized string' do
expect(instance.to_s).to eq('Name')
end
end
end
# This cleans up metadata about subclasses so that
# these specs can be run reliably in any order
def clear_instance_metadata
subclass.instance_variable_set(:@instances, {})
end
end
| {
"content_hash": "2f838b3c1b9a1f405d0b77f371b65a77",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 70,
"avg_line_length": 26.56756756756757,
"alnum_prop": 0.5876568328246863,
"repo_name": "johndbritton/cardshark",
"id": "022b34b0a92af57d1bf8f1aa70653003715715df",
"size": "2980",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/cardshark/dimension_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "20488"
}
],
"symlink_target": ""
} |
package com.lite.library.utils;
import android.content.Context;
import android.os.Environment;
import android.util.Log;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* Created by lxx on 2016/5/12 14:07
* 文件操作工具类
*/
public class FileUtils {
/**
* 保存内容到文件中
*
* @param dirName 目录名字
* @param fileName 文件名字
* @param comtent 要存储的内容
*/
private static void savaFiles(String dirName, String fileName, String comtent) {
// String fileName = "crash-test" + ".log";
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
try {
// File dir = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "QIYueUserCrash" + File.separator);
File dir = new File(dirName);
Log.i("CrashHandler", dir.toString());
boolean isCreadteSuccess = true;
if (!dir.exists()) {
isCreadteSuccess = dir.mkdirs();
}
if (isCreadteSuccess) {
FileOutputStream fos = new FileOutputStream(new File(dir, fileName));
fos.write(comtent.getBytes());
fos.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* 得到文件的绝对路径
*/
public String getFileAbsPath(String dirName, Context context) {
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
return Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + dirName + File.separator;
} else {
return context.getFilesDir().getPath() + dirName;
}
}
/**
* 得到文件的绝对路径
*
* @param dirName 目录的名字
* @return 返回含有系统路径名字
*/
public String getFileAbsPath(String dirName) {
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
return Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + dirName + File.separator;
} else {
return "/data/data/" + dirName;
}
}
/**
* @return 得到系统的决定路径
*/
public String getSysAbsPath() {
return getFileAbsPath("");
}
}
| {
"content_hash": "09ee50459db80b5e5f03abc0590a11b5",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 152,
"avg_line_length": 30.32051282051282,
"alnum_prop": 0.5822410147991544,
"repo_name": "mlick/LiteLibrary",
"id": "0b0bdc5763d846b99038ad8b5a1c4afcf4f80b6f",
"size": "2507",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "library/src/main/java/com/lite/library/utils/FileUtils.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "299577"
},
{
"name": "Stata",
"bytes": "3241"
}
],
"symlink_target": ""
} |
<div class="panel panel-default" ng-controller="ServiceRequestCtrl">
<div class="panel-heading">
<div><span class="lead">Pending Requests</span></div>
</div>
<div class="panel-body">
<div class="tablecontainer">
<table class="table table-hover">
<thead>
<tr>
<th>Request Id</th>
<th>Request Title</th>
<th>Request Description</th>
<th>Hotel</th>
<th>Room No</th>
<th>Customer Name</th>
<th>Request Time</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="request in pendingRequests">
<td><span ng-bind="request.id"></span></td>
<td><span ng-bind="request.title"></span></td>
<td><span ng-bind="request.description"></span></td>
<td><span ng-bind="request.hotel"></span></td>
<td><span ng-bind="request.roomNo"></span></td>
<td><span ng-bind="request.customerName"></span></td>
<td><span ng-bind="request.requestTime | date: 'dd MMM h:mm:ss a'"></span></td>
<td>
<button type="button" ng-click="resolve(request.id)" class="btn btn-success custom-width">
Resolve
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel-heading">
<div><span class="lead">Resolved Requests</span></div>
</div>
<div class="panel-body">
<div class="tablecontainer">
<table class="table table-hover">
<thead>
<tr>
<th>Request Id</th>
<th>Request Title</th>
<th>Request Description</th>
<th>Hotel</th>
<th>Room No</th>
<th>Customer Name</th>
<th>Request Time</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="request in solvedRequests">
<td><span ng-bind="request.id"></span></td>
<td><span ng-bind="request.title"></span></td>
<td><span ng-bind="request.description"></span></td>
<td><span ng-bind="request.hotel"></span></td>
<td><span ng-bind="request.roomNo"></span></td>
<td><span ng-bind="request.customerName"></span></td>
<td><span ng-bind="request.requestTime | date: 'dd MMM h:mm:ss a'"></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div> | {
"content_hash": "3d26194f7bde199789898d6776f43144",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 114,
"avg_line_length": 40.666666666666664,
"alnum_prop": 0.4207650273224044,
"repo_name": "njnareshjoshi/articles",
"id": "009c29628bf5e16da07059532c72f857de5d645f",
"size": "2928",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "springboot-angularjs-crud-app/src/main/resources/static/templates/list-service-request.html",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "165"
},
{
"name": "HTML",
"bytes": "9662"
},
{
"name": "Java",
"bytes": "65408"
},
{
"name": "JavaScript",
"bytes": "3517"
},
{
"name": "TSQL",
"bytes": "356"
}
],
"symlink_target": ""
} |
package org.lnu.is.domain.order.employee.timesheet;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.lnu.is.annotation.dbtable.DT;
import org.lnu.is.domain.InformationModel;
import org.lnu.is.domain.employee.Employee;
import org.lnu.is.domain.order.Order;
import org.lnu.is.domain.timesheet.type.TimeSheetType;
/**
* Order Employee Time Sheet entity.
*
* @author kushnir
*
*/
@DT
@Entity
@Table(name = "q_dt_orderemployeetimesheet")
public class OrderEmployeeTimeSheet extends InformationModel {
private static final long serialVersionUID = 1L;
@ManyToOne
@JoinColumn(name = "order_id")
private Order order;
@ManyToOne
@JoinColumn(name = "employee_id")
private Employee employee;
@ManyToOne
@JoinColumn(name = "timesheettype_id")
private TimeSheetType timeSheetType;
@Column(name = "dayamount")
private Date dayAmount;
@Column(name = "houramount")
private Date hourAmount;
@Column(name = "enddate")
private Date endDate;
@Column(name = "begdate")
private Date begDate;
public Order getOrder() {
return order;
}
public void setOrder(final Order order) {
this.order = order;
}
public Employee getEmployee() {
return employee;
}
public void setEmployee(final Employee employee) {
this.employee = employee;
}
public TimeSheetType getTimeSheetType() {
return timeSheetType;
}
public void setTimeSheetType(final TimeSheetType timeSheetType) {
this.timeSheetType = timeSheetType;
}
public Date getDayAmount() {
return dayAmount;
}
public void setDayAmount(final Date dayAmount) {
this.dayAmount = dayAmount;
}
public Date getHourAmount() {
return hourAmount;
}
public void setHourAmount(final Date hourAmount) {
this.hourAmount = hourAmount;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(final Date endDate) {
this.endDate = endDate;
}
public Date getBegDate() {
return begDate;
}
public void setBegDate(final Date begDate) {
this.begDate = begDate;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((begDate == null) ? 0 : begDate.hashCode());
result = prime * result
+ ((dayAmount == null) ? 0 : dayAmount.hashCode());
result = prime * result + ((endDate == null) ? 0 : endDate.hashCode());
result = prime * result
+ ((hourAmount == null) ? 0 : hourAmount.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
OrderEmployeeTimeSheet other = (OrderEmployeeTimeSheet) obj;
if (begDate == null) {
if (other.begDate != null) {
return false;
}
} else if (!begDate.equals(other.begDate)) {
return false;
}
if (dayAmount == null) {
if (other.dayAmount != null) {
return false;
}
} else if (!dayAmount.equals(other.dayAmount)) {
return false;
}
if (endDate == null) {
if (other.endDate != null) {
return false;
}
} else if (!endDate.equals(other.endDate)) {
return false;
}
if (hourAmount == null) {
if (other.hourAmount != null) {
return false;
}
} else if (!hourAmount.equals(other.hourAmount)) {
return false;
}
return true;
}
@Override
public String toString() {
return "OrderEmployeeTimeSheet [dayAmount=" + dayAmount
+ ", hourAmount=" + hourAmount + ", endDate=" + endDate
+ ", begDate=" + begDate + "]";
}
}
| {
"content_hash": "cfdf8ee8b80a2b141dbab50feed642f5",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 73,
"avg_line_length": 21.25,
"alnum_prop": 0.6859097127222982,
"repo_name": "ifnul/ums-backend",
"id": "2471e61a4922bdc9f9844b73a76fd3a6d4ced6a0",
"size": "3655",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "is-lnu-domain/src/main/java/org/lnu/is/domain/order/employee/timesheet/OrderEmployeeTimeSheet.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "7045"
},
{
"name": "Java",
"bytes": "4184188"
},
{
"name": "Scala",
"bytes": "217850"
},
{
"name": "Shell",
"bytes": "1100"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using xClient.Core.NetSerializer.TypeSerializers;
namespace xClient.Core.NetSerializer
{
public class Serializer
{
Dictionary<Type, ushort> m_typeIDMap;
delegate void SerializerSwitch(Serializer serializer, Stream stream, object ob);
delegate void DeserializerSwitch(Serializer serializer, Stream stream, out object ob);
SerializerSwitch m_serializerSwitch;
DeserializerSwitch m_deserializerSwitch;
static ITypeSerializer[] s_typeSerializers = new ITypeSerializer[] {
new ObjectSerializer(),
new PrimitivesSerializer(),
new ArraySerializer(),
new EnumSerializer(),
new DictionarySerializer(),
new GenericSerializer(),
};
ITypeSerializer[] m_userTypeSerializers;
/// <summary>
/// Initialize NetSerializer
/// </summary>
/// <param name="rootTypes">Types to be (de)serialized</param>
public Serializer(IEnumerable<Type> rootTypes)
: this(rootTypes, new ITypeSerializer[0])
{
}
/// <summary>
/// Initialize NetSerializer
/// </summary>
/// <param name="rootTypes">Types to be (de)serialized</param>
/// <param name="userTypeSerializers">Array of custom serializers</param>
public Serializer(IEnumerable<Type> rootTypes, ITypeSerializer[] userTypeSerializers)
{
if (userTypeSerializers.All(s => s is IDynamicTypeSerializer || s is IStaticTypeSerializer) == false)
throw new ArgumentException("TypeSerializers have to implement IDynamicTypeSerializer or IStaticTypeSerializer");
m_userTypeSerializers = userTypeSerializers;
var typeDataMap = GenerateTypeData(rootTypes);
GenerateDynamic(typeDataMap);
m_typeIDMap = typeDataMap.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.TypeID);
#if GENERATE_DEBUGGING_ASSEMBLY
// Note: GenerateDebugAssembly overwrites some fields from typeDataMap
GenerateDebugAssembly(typeDataMap);
#endif
}
public void Serialize(Stream stream, object data)
{
m_serializerSwitch(this, stream, data);
}
public object Deserialize(Stream stream)
{
object o;
m_deserializerSwitch(this, stream, out o);
return o;
}
Dictionary<Type, TypeData> GenerateTypeData(IEnumerable<Type> rootTypes)
{
var map = new Dictionary<Type, TypeData>();
var stack = new Stack<Type>(PrimitivesSerializer.GetSupportedTypes().Concat(rootTypes));
stack.Push(typeof(object));
// TypeID 0 is reserved for null
ushort typeID = 1;
while (stack.Count > 0)
{
var type = stack.Pop();
if (map.ContainsKey(type))
continue;
if (type.IsAbstract || type.IsInterface)
continue;
if (type.ContainsGenericParameters)
throw new NotSupportedException(String.Format("Type {0} contains generic parameters", type.FullName));
var serializer = m_userTypeSerializers.FirstOrDefault(h => h.Handles(type));
if (serializer == null)
serializer = s_typeSerializers.FirstOrDefault(h => h.Handles(type));
if (serializer == null)
throw new NotSupportedException(String.Format("No serializer for {0}", type.FullName));
foreach (var t in serializer.GetSubtypes(type))
stack.Push(t);
TypeData typeData;
if (serializer is IStaticTypeSerializer)
{
var sts = (IStaticTypeSerializer)serializer;
MethodInfo writer;
MethodInfo reader;
sts.GetStaticMethods(type, out writer, out reader);
Debug.Assert(writer != null && reader != null);
typeData = new TypeData(typeID++, writer, reader);
}
else if (serializer is IDynamicTypeSerializer)
{
var dts = (IDynamicTypeSerializer)serializer;
typeData = new TypeData(typeID++, dts);
}
else
{
throw new Exception();
}
map[type] = typeData;
}
return map;
}
void GenerateDynamic(Dictionary<Type, TypeData> map)
{
/* generate stubs */
foreach (var kvp in map)
{
var type = kvp.Key;
var td = kvp.Value;
if (!td.IsGenerated)
continue;
td.WriterMethodInfo = Helpers.GenerateDynamicSerializerStub(type);
td.ReaderMethodInfo = Helpers.GenerateDynamicDeserializerStub(type);
}
var ctx = new CodeGenContext(map);
/* generate bodies */
foreach (var kvp in map)
{
var type = kvp.Key;
var td = kvp.Value;
if (!td.IsGenerated)
continue;
var writerDm = (DynamicMethod)td.WriterMethodInfo;
td.TypeSerializer.GenerateWriterMethod(type, ctx, writerDm.GetILGenerator());
var readerDm = (DynamicMethod)td.ReaderMethodInfo;
td.TypeSerializer.GenerateReaderMethod(type, ctx, readerDm.GetILGenerator());
}
var writer = (DynamicMethod)ctx.GetWriterMethodInfo(typeof(object));
var reader = (DynamicMethod)ctx.GetReaderMethodInfo(typeof(object));
m_serializerSwitch = (SerializerSwitch)writer.CreateDelegate(typeof(SerializerSwitch));
m_deserializerSwitch = (DeserializerSwitch)reader.CreateDelegate(typeof(DeserializerSwitch));
}
#if GENERATE_DEBUGGING_ASSEMBLY
static void GenerateDebugAssembly(Dictionary<Type, TypeData> map)
{
var ab = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("NetSerializerDebug"), AssemblyBuilderAccess.RunAndSave);
var modb = ab.DefineDynamicModule("NetSerializerDebug.dll");
var tb = modb.DefineType("NetSerializer", TypeAttributes.Public);
/* generate stubs */
foreach (var kvp in map)
{
var type = kvp.Key;
var td = kvp.Value;
if (!td.IsGenerated)
continue;
td.WriterMethodInfo = Helpers.GenerateStaticSerializerStub(tb, type);
td.ReaderMethodInfo = Helpers.GenerateStaticDeserializerStub(tb, type);
}
var ctx = new CodeGenContext(map);
/* generate bodies */
foreach (var kvp in map)
{
var type = kvp.Key;
var td = kvp.Value;
if (!td.IsGenerated)
continue;
var writerMb = (MethodBuilder)td.WriterMethodInfo;
td.TypeSerializer.GenerateWriterMethod(type, ctx, writerMb.GetILGenerator());
var readerMb = (MethodBuilder)td.ReaderMethodInfo;
td.TypeSerializer.GenerateReaderMethod(type, ctx, readerMb.GetILGenerator());
}
tb.CreateType();
ab.Save("NetSerializerDebug.dll");
}
#endif
/* called from the dynamically generated code */
ushort GetTypeID(object ob)
{
ushort id;
if (ob == null)
return 0;
var type = ob.GetType();
if (m_typeIDMap.TryGetValue(type, out id) == false)
throw new InvalidOperationException(String.Format("Unknown type {0}", type.FullName));
return id;
}
}
}
| {
"content_hash": "0812f8b020ecad90cf7d37f3ed4393d9",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 132,
"avg_line_length": 26.447580645161292,
"alnum_prop": 0.7092544595212685,
"repo_name": "AdvCode/QuasarRAT-Edit",
"id": "96f5f39fb17a27634565c67ad780710c38ed9c72",
"size": "6806",
"binary": false,
"copies": "13",
"ref": "refs/heads/master",
"path": "Client/Core/NetSerializer/Serializer.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "354"
},
{
"name": "C#",
"bytes": "1593020"
}
],
"symlink_target": ""
} |
package common;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Created by rage on 24.05.15.
*/
public class ReadKeys {
public static PrivateKey readPrivateKey(File selectedFile) {
return null;
}
public static PubKey readPubKey(File selectedFile) {
String keyInString = readFile(selectedFile);
String[] split = keyInString.split("\n");
List<String> listBasicNum = listBasicNum(split[0]);
String controlSum = split[1];
return new PubKey(listBasicNum, controlSum);
}
private static List<String> listBasicNum(String tipaList) {
tipaList = tipaList.replace("[", "").replace("]", "").replace(" ", "");
List<String> result = new ArrayList<String>();
String[] split = tipaList.split(",");
Collections.addAll(result, split);
return result;
}
private static String readFile(File selectedFile) {
try {
BufferedReader in = null;
StringBuilder stringBuilder = new StringBuilder();
try {
in = new BufferedReader(new FileReader(selectedFile));
String line = in.readLine();
while (line != null) {
stringBuilder.append(line).append("\n");
line = in.readLine();
}
in.readLine();
return stringBuilder.toString();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (in != null) {
in.close();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
| {
"content_hash": "83cda58d50d54d9eb4eaee7b99c16962",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 79,
"avg_line_length": 27.64179104477612,
"alnum_prop": 0.5534557235421166,
"repo_name": "CandleInTheWind/demo",
"id": "9777e26bc4cd2a2d205296046e584f1f37b9d558",
"size": "1852",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/common/ReadKeys.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "20155"
}
],
"symlink_target": ""
} |
package nl.fontys.sofa.limo.service.distribution;
import java.util.List;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
*
* @author Ben
*/
public class DistributionTypeFactoryImplTest {
/**
* Test of getDistributionTypes method, of class DistributionFactoryImpl.
* All calls of testDistributionTypeAvailability call
* testGetDistributionTypes and check whether the requested distribType is
* available in the string[]
*/
@Test
public void testGetDistributionTypes() {
System.out.println("getDistributionTypes");
testDistributionTypeAvailability("Cauchy", true);
testDistributionTypeAvailability("Chi Squared", true);
testDistributionTypeAvailability("Discrete", true);
testDistributionTypeAvailability("Exponential", true);
testDistributionTypeAvailability("F", true);
testDistributionTypeAvailability("Gamma", true);
testDistributionTypeAvailability("Log Normal", true);
testDistributionTypeAvailability("Normal", true);
testDistributionTypeAvailability("Poisson", true);
testDistributionTypeAvailability("Triangular", true);
testDistributionTypeAvailability("Weibull", true);
testDistributionTypeAvailability("NotAvailableDistribType", false);
}
/**
* needed by testGetDistributionTypes to easily check whether a distribType
* is avail in string[]
*
* @param distribName : the distribution name which is searched for
* @param shouldBeFound : whether or not it should actually be the case that
* a type is found based on the distribName as search input
*/
private void testDistributionTypeAvailability(String distribName, boolean shouldBeFound) {
DistributionFactoryImpl instance = new DistributionFactoryImpl();
boolean found = false;
for (String distribType : instance.getDistributionTypes()) {
if (distribType.equals(distribName)) {
found = true;
}
}
if (shouldBeFound) {
assertTrue("DistribType " + distribName + " should be found", found);
} else {
assertFalse("DistribType " + distribName + " should NOT be found", found);
}
}
/**
* Test of getDistributionTypeByName method, of class
* DistributionFactoryImpl.
*/
@Test
public void testGetDistributionTypeByName_normal() {
System.out.println("getDistributionTypeByName_normal");
DistributionFactoryImpl instance = new DistributionFactoryImpl();
List<String> inputValuesNormalDistrib = instance.getDistributionTypeByName("Normal").getNames();
assertTrue("For a normal distrib, Lower Bound should be input value", inputValuesNormalDistrib.contains("Lower Bound"));
assertTrue("For a normal distrib, Standard Deviation should be input value", inputValuesNormalDistrib.contains("Standard Deviation"));
}
}
| {
"content_hash": "5228d68cfc60848e8edc19ef53c470eb",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 142,
"avg_line_length": 39.75,
"alnum_prop": 0.6997682886461437,
"repo_name": "LogisticsImpactModel/LIMO",
"id": "5a0359f323e91919eb7f6edf5d18d5b8785a1378",
"size": "3021",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "service/src/test/java/nl/fontys/sofa/limo/service/distribution/DistributionTypeFactoryImplTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "701"
},
{
"name": "Java",
"bytes": "1275682"
},
{
"name": "Shell",
"bytes": "966"
}
],
"symlink_target": ""
} |
name: Bug report
about: Report a bug for "kn"
title: ''
labels: kind/bug
assignees: ''
---
<!-- If you need to report a security issue with Knative, send an email to [email protected]. -->
### Bug report
<!-- Please describe what is actually happening -->
### Expected behavior
<!-- Please describe what you expect to happen -->
### Steps to reproduce the problem
<!-- How can a maintainer reproduce this issue (please be detailed) -->
### kn version
<!-- Please paste the output of 'kn version' in the code block below -->
```
```
### Knative (serving/eventing) version
<!-- Remove all except the known affected versions of Knative running on the cluster on which you have detected the issue -->
> Nightly
> 0.12.x
> 0.11.x
> 0.10.x
> 0.9.x
<!--
Optional classifications: Remove ">" to add corresponding label
> /kind good-first-issue
> /kind doc
> /kind cleanup
-->
| {
"content_hash": "fb77348ca367785d71022fb70ebaacb9",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 125,
"avg_line_length": 19.977777777777778,
"alnum_prop": 0.6829810901001112,
"repo_name": "knative/client",
"id": "23958aeb0afa11bc30633a246e74af279b652540",
"size": "903",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": ".github/ISSUE_TEMPLATE/bug-report.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "832"
},
{
"name": "Go",
"bytes": "2069067"
},
{
"name": "Shell",
"bytes": "35618"
}
],
"symlink_target": ""
} |
In this step, you create your first classes and run tests on it.
**Note**: Throughout this code lab, continue to edit the files in `s1_basics`.
You can use the files in the other `samples` subdirectories to compare to your code
or to recover if you get off track.
_**Keywords**: class, test_
### Create `Country` class
Edit `lib/src/map.dart`, as follows.
→ Add the following class:
```Dart
/// Country class.
class Country {
/// The country id.
final String id;
/// The country neighbours.
final List<String> neighbours;
Country(this.id, this.neighbours);
}
```
You've just implemented a class!
Key information:
* It defines `Country` class with two fields: `id` which is the country Id and `neighbours` which is the list of country neighbours.
* The fields are `final`, it means that they can only be initialized once, in constructors.
* Generic types allow to define a `List` of `String` with `List<String>`.
* The constructor `Country(this.id, this.neighbours);` use syntactic sugar for setting `id` and `neighbours` before the constructor body runs.
* Lines starting with `///` or `/**` are documentation comments, used to generate documentation.
### Instantiate a `Country` class
Edit `bin/main.dart`, as follows.
→ Instantiate a `Country` class and run this code:
```Dart
library risk.main;
import '../lib/risk.dart';
main() {
Country country = new Country('eastern_australia', ['western_australia', 'new_guinea']);
var neighbours = country.neighbours;
print("Hello ${country.id} and $neighbours!");
}
```
* The `import` is used to import a namespace from one library in the local scope.
* The `../lib/risk.dart` import is a library defined in the `lib` directory. `lib/src/map.dart` is already part of this library.
* Either `'string'` or `"string"` can be used to define a `String`.
* `['western_australia', 'new_guinea']` allows to easily define `List`.
* `var` is a way to declare a variable without specifying its type.
* `$neighbours` and `${country.id}` are string interpolations. It includes the variable or expression’s string equivalent inside of a string literal.
### Create `Continent` class
Continue to edit `lib/src/map.dart`.
→ Implements the `Continent`:
* The `Continent` class has three fields `id`, `bonus` and `countries`:
* `id` (a `String`) is the continent id.
* `bonus` (an `int`) is the reinforcement bonus given if the same player owns all continent countries.
* `countries` (a `List` of `String`) is the list of the ids of the countries of this continent.
* Like `Country`, fields must be immutable.
* The `Continent` class must be instanciable with the following instruction:
```Dart
new Continent('australia', 2, ["eastern_australia", "indonesia"])
```
### Add `Country` and `Continent` constants
Edit `lib/src/map.dart`, as follows.
→ Add the following top-level constants:
```Dart
/// List of all existing countries
final List<Country> COUNTRIES = [//
// australia
new Country('eastern_australia', ['western_australia', 'new_guinea', 'eastern_australia']), //
new Country('indonesia', ['siam', 'new_guinea', 'western_australia']), //
new Country('new_guinea', ['indonesia', 'eastern_australia', 'western_australia']), //
new Country('western_australia', ['eastern_australia', 'indonesia', 'new_guinea']), //
// south_america
new Country('argentina', ['brazil', 'peru']), //
new Country('brazil', ['north_africa', 'venezuela', 'argentina', 'peru']), //
new Country('peru', ['venezuela', 'brazil', 'argentina']), //
new Country('venezuela', ['central_america', 'brazil', 'peru']), //
// africa
new Country('congo', ['east_africa', 'south_africa', 'north_africa']), //
new Country('egypt', ['southern_europe', 'middle_east', 'east_africa', 'north_africa']), //
new Country('east_africa', ['middle_east', 'madagascar', 'south_africa', 'congo', 'north_africa', 'egypt']), //
new Country('madagascar', ['east_africa', 'south_africa']), //
new Country('north_africa', ['southern_europe', 'western_europe', 'brazil', 'egypt', 'east_africa', 'congo']), //
new Country('south_africa', ['madagascar', 'east_africa', 'congo']), //
// north_america
new Country('alaska', ['kamchatka', 'northwest_territory', 'alberta']), //
new Country('alberta', ['alaska', 'ontario', 'northwest_territory', 'western_united_states']), //
new Country('central_america', ['venezuela', 'eastern_united_states', 'western_united_states']), //
new Country('eastern_united_states', ['quebec', 'ontario', 'western_united_states', 'central_america']), //
new Country('greenland', ['iceland', 'ontario', 'northwest_territory', 'quebec']), //
new Country('northwest_territory', ['alaska', 'ontario', 'greenland', 'alberta']), //
new Country('ontario', ['northwest_territory', 'greenland', 'eastern_united_states', 'western_united_states', 'quebec', 'alberta']), //
new Country('quebec', ['greenland', 'ontario', 'eastern_united_states']), //
new Country('western_united_states', ['alberta', 'ontario', 'eastern_united_states', 'central_america']), //
// europe
new Country('great_britain', ['iceland', 'western_europe', 'northern_europe', 'scandinavia']), //
new Country('iceland', ['greenland', 'great_britain', 'scandinavia']), //
new Country('northern_europe', ['ukraine', 'scandinavia', 'great_britain', 'western_europe', 'southern_europe']), //
new Country('scandinavia', ['iceland', 'great_britain', 'northern_europe', 'ukraine']), //
new Country('southern_europe', ['north_africa', 'egypt', 'middle_east', 'ukraine', 'northern_europe', 'western_europe']), //
new Country('ukraine', ['ural', 'afghanistan', 'middle_east', 'southern_europe', 'northern_europe', 'scandinavia']), //
new Country('western_europe', ['north_africa', 'southern_europe', 'northern_europe', 'great_britain']), //
// asia
new Country('afghanistan', ['ukraine', 'ural', 'china', 'india', 'middle_east']), //
new Country('china', ['siberia', 'ural', 'afghanistan', 'india', 'siam', 'mongolia']), //
new Country('india', ['middle_east', 'afghanistan', 'china', 'siam']), //
new Country('irkutsk', ['siberia', 'kamchatka', 'mongolia', 'yakursk']), //
new Country('japan', ['kamchatka', 'mongolia']), //
new Country('kamchatka', ['alaska', 'yakursk', 'irkutsk', 'mongolia', 'japan']), //
new Country('ural', ['siberia', 'china', 'afghanistan', 'ukraine']), //
new Country('middle_east', ['southern_europe', 'ukraine', 'afghanistan', 'india', 'egypt', 'east_africa']), //
new Country('mongolia', ['china', 'siberia', 'irkutsk', 'kamchatka', 'japan']), //
new Country('siam', ['india', 'china', 'indonesia']), //
new Country('siberia', ['yakursk', 'irkutsk', 'mongolia', 'china', 'ural']), //
new Country('yakursk', ['kamchatka', 'siberia', 'irkutsk', 'eastern_australia']),//
new Country('indonesia', ['siam', 'new_guinea', 'western_australia']), //
];
/// All [Country]s indexed by country id
final Map<String, Country> COUNTRY_BY_ID = new Map.fromIterable(COUNTRIES, key: (country) => country.id);
/// List of all existing continents
final List<Continent> CONTINENTS = [//
new Continent('australia', 2, ["eastern_australia", "indonesia", "new_guinea"]), //
new Continent('north_america', 5, ["alaska", "alberta", "central_america", "eastern_united_states", "greenland", "northwest_territory", "ontario", "quebec",
"western_united_states"]), //
new Continent('south_america', 2, ["argentina", "brazil", "peru", "venezuela"]), //
new Continent('africa', 3, ["congo", "egypt", "east_africa", "madagascar", "north_africa", "south_africa"]), //
new Continent('europe', 5, ["great_britain", "iceland", "northern_europe", "scandinavia", "southern_europe", "ukraine", "western_europe"]), //
new Continent('asia', 7, ["afghanistan", "china", "india", "irkutsk", "japan", "kamchatka", "ural", "middle_east", "mongolia", "siam", "siberia", "yakursk", "eastern_australia"]),//
];
```
Key information:
* Those constants defines the countries and continents for the Risk game.
* `COUNTRY_BY_ID` is a [Map](https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart-core.Map) built from `COUNTRIES`. It helps to find quickly a `Country` by its `id`.
* **Some errors are hidden in those constants, they need to be fixed!**
### Run tests on the implementations
To check if `Country` and `Continent` classes are well implemented and to fix errors in constants,
it's a good pratice to run unit tests.
Open `test/s2_classes_test.dart`.
→ Get familiar with the code:
```Dart
library risk.map.test;
import 'package:unittest/unittest.dart';
import '../lib/risk.dart';
main() {
test('Country should be instanciable', () {
var country = new Country('eastern_australia', ['western_australia', 'new_guinea']);
expect(country, isNotNull);
expect(country.id, equals('eastern_australia'));
expect(country.neighbours, equals(['western_australia', 'new_guinea']));
});
group('COUNTRIES', () {
test('for each country should have at least 1 neighbour', () { ... });
// ...
});
group('COUNTRY_BY_ID', () { ... });
group('CONTINENTS', () { ... });
}
```
→ Then run tests: right-click `test/s2_classes_test.dart` and select **Run**.
→ **You should have test failures in console, fix classes and/or constants**.
Key information:
* Note how a test is written: we wrap it in a call to `test(String testName, functionToTest);`.
* Within the function we are testing, we write assertions, using `expect(actualValue, expectedValueMatcher);`.
* The `unittest` package provides a set of built-in `Matcher` like `equals(xxx)`, `isPositive`, `isNotNull`, `isTrue`...
* It can be helpful to group similar tests together, which can be done with `group()`.
* Use the `solo_` prefix to quickly run just one unit test or one group: `solo_test(...)` or `solo_group(...)`
* Use the `skip_` prefix to exclude unit tests or groups you don't want to run: `skip_test(...)` or `skip_group(...)`
### Write a test
Open `test/s2_classes_test.dart`.
→ Test that `COUNTRIES` and `COUNTRY_BY_ID` have exactly 42 countries.
→ Fix `COUNTRIES` removing the duplicated country.
### Learn more
- [Dart Language - Classes](https://www.dartlang.org/docs/dart-up-and-running/contents/ch02.html#classes)
- [Dart Language - Documentation Comments](https://www.dartlang.org/docs/dart-up-and-running/ch02.html#documentation-comments)
- [Unit Testing with Dart](https://www.dartlang.org/articles/dart-unit-tests/)
### Problems?
Check your code against the files in [s2_classes](../samples/s2_classes) ([diff](../../../compare/s1_basics...s2_classes)).
## [Home](../README.md#code-lab-polymerdart) | [< Previous](step-1.md#step-1-run-the-app-and-view-its-code) | [Next >](step-3.md#step-3-polymer-custom-element)
| {
"content_hash": "0381a41922617055f9822d1ac30f3849",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 183,
"avg_line_length": 49.04545454545455,
"alnum_prop": 0.6771084337349398,
"repo_name": "dartlangfr/risk-polymer-codelab",
"id": "0486d86b934574ffb55260ba4207aa9d3561c6f9",
"size": "10817",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/step-2.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dart",
"bytes": "80244"
}
],
"symlink_target": ""
} |
Page Fragments Plugin for Wheelhouse CMS
========================================
This gem enables the development of single-page sites in Wheelhouse CMS. It allows pages to be defined as *page fragments*, which are then included within a containing page. The navigation is updated to link to the anchor div for each page fragment.
Installation & Usage
--------------------
**1. Add `wheelhouse-page-fragments` to your Gemfile:**
gem "wheelhouse-page-fragments", :git => "git://github.com/mullendev/wheelhouse-page-fragments.git"
Then run `bundle install`.
**2. Turn each child page into a page fragment by selecting 'This is a page fragment' from within the page's Navigation Options.**
** To show fragments html use :**
<%= fragments %>
** To get a hash of fragments use:**
<% fragments_hash %>
Then assign this template/layout to your containing page (which should not be a page fragment).
| {
"content_hash": "fe0e5df7c7cf9b5e108dd9eb51fd9009",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 249,
"avg_line_length": 35.65384615384615,
"alnum_prop": 0.6839266450916937,
"repo_name": "mullendev/wheelhouse-page-fragments",
"id": "2ce5d2228bcae755c3b6914d8d216e534322f716",
"size": "927",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "807"
},
{
"name": "Perl",
"bytes": "1071"
},
{
"name": "Ruby",
"bytes": "2655"
}
],
"symlink_target": ""
} |
<?php
namespace Symfony\Component\Security\Acl\Dbal;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\Statement;
use Symfony\Component\Security\Acl\Model\AclInterface;
use Symfony\Component\Security\Acl\Domain\Acl;
use Symfony\Component\Security\Acl\Domain\Entry;
use Symfony\Component\Security\Acl\Domain\FieldEntry;
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
use Symfony\Component\Security\Acl\Domain\RoleSecurityIdentity;
use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;
use Symfony\Component\Security\Acl\Exception\AclNotFoundException;
use Symfony\Component\Security\Acl\Exception\NotAllAclsFoundException;
use Symfony\Component\Security\Acl\Model\AclCacheInterface;
use Symfony\Component\Security\Acl\Model\AclProviderInterface;
use Symfony\Component\Security\Acl\Model\ObjectIdentityInterface;
use Symfony\Component\Security\Acl\Model\PermissionGrantingStrategyInterface;
/**
* An ACL provider implementation.
*
* This provider assumes that all ACLs share the same PermissionGrantingStrategy.
*
* @author Johannes M. Schmitt <[email protected]>
*/
class AclProvider implements AclProviderInterface
{
const MAX_BATCH_SIZE = 30;
protected $aclCache;
protected $connection;
protected $loadedAces;
protected $loadedAcls;
protected $options;
protected $permissionGrantingStrategy;
/**
* Constructor
*
* @param Connection $connection
* @param PermissionGrantingStrategyInterface $permissionGrantingStrategy
* @param array $options
* @param AclCacheInterface $aclCache
*/
public function __construct(Connection $connection, PermissionGrantingStrategyInterface $permissionGrantingStrategy, array $options, AclCacheInterface $aclCache = null)
{
$this->aclCache = $aclCache;
$this->connection = $connection;
$this->loadedAces = array();
$this->loadedAcls = array();
$this->options = $options;
$this->permissionGrantingStrategy = $permissionGrantingStrategy;
}
/**
* {@inheritDoc}
*/
public function findChildren(ObjectIdentityInterface $parentOid, $directChildrenOnly = false)
{
$sql = $this->getFindChildrenSql($parentOid, $directChildrenOnly);
$children = array();
foreach ($this->connection->executeQuery($sql)->fetchAll() as $data) {
$children[] = new ObjectIdentity($data['object_identifier'], $data['class_type']);
}
return $children;
}
/**
* {@inheritDoc}
*/
public function findAcl(ObjectIdentityInterface $oid, array $sids = array())
{
return $this->findAcls(array($oid), $sids)->offsetGet($oid);
}
/**
* {@inheritDoc}
*/
public function findAcls(array $oids, array $sids = array())
{
$result = new \SplObjectStorage();
$currentBatch = array();
$oidLookup = array();
for ($i=0,$c=count($oids); $i<$c; $i++) {
$oid = $oids[$i];
$oidLookupKey = $oid->getIdentifier().$oid->getType();
$oidLookup[$oidLookupKey] = $oid;
$aclFound = false;
// check if result already contains an ACL
if ($result->contains($oid)) {
$aclFound = true;
}
// check if this ACL has already been hydrated
if (!$aclFound && isset($this->loadedAcls[$oid->getType()][$oid->getIdentifier()])) {
$acl = $this->loadedAcls[$oid->getType()][$oid->getIdentifier()];
if (!$acl->isSidLoaded($sids)) {
// FIXME: we need to load ACEs for the missing SIDs. This is never
// reached by the default implementation, since we do not
// filter by SID
throw new \RuntimeException('This is not supported by the default implementation.');
} else {
$result->attach($oid, $acl);
$aclFound = true;
}
}
// check if we can locate the ACL in the cache
if (!$aclFound && null !== $this->aclCache) {
$acl = $this->aclCache->getFromCacheByIdentity($oid);
if (null !== $acl) {
if ($acl->isSidLoaded($sids)) {
// check if any of the parents has been loaded since we need to
// ensure that there is only ever one ACL per object identity
$parentAcl = $acl->getParentAcl();
while (null !== $parentAcl) {
$parentOid = $parentAcl->getObjectIdentity();
if (isset($this->loadedAcls[$parentOid->getType()][$parentOid->getIdentifier()])) {
$acl->setParentAcl($this->loadedAcls[$parentOid->getType()][$parentOid->getIdentifier()]);
break;
} else {
$this->loadedAcls[$parentOid->getType()][$parentOid->getIdentifier()] = $parentAcl;
$this->updateAceIdentityMap($parentAcl);
}
$parentAcl = $parentAcl->getParentAcl();
}
$this->loadedAcls[$oid->getType()][$oid->getIdentifier()] = $acl;
$this->updateAceIdentityMap($acl);
$result->attach($oid, $acl);
$aclFound = true;
} else {
$this->aclCache->evictFromCacheByIdentity($oid);
foreach ($this->findChildren($oid) as $childOid) {
$this->aclCache->evictFromCacheByIdentity($childOid);
}
}
}
}
// looks like we have to load the ACL from the database
if (!$aclFound) {
$currentBatch[] = $oid;
}
// Is it time to load the current batch?
if ((self::MAX_BATCH_SIZE === count($currentBatch) || ($i + 1) === $c) && count($currentBatch) > 0) {
$loadedBatch = $this->lookupObjectIdentities($currentBatch, $sids, $oidLookup);
foreach ($loadedBatch as $loadedOid) {
$loadedAcl = $loadedBatch->offsetGet($loadedOid);
if (null !== $this->aclCache) {
$this->aclCache->putInCache($loadedAcl);
}
if (isset($oidLookup[$loadedOid->getIdentifier().$loadedOid->getType()])) {
$result->attach($loadedOid, $loadedAcl);
}
}
$currentBatch = array();
}
}
// check that we got ACLs for all the identities
foreach ($oids as $oid) {
if (!$result->contains($oid)) {
if (1 === count($oids)) {
throw new AclNotFoundException(sprintf('No ACL found for %s.', $oid));
}
$partialResultException = new NotAllAclsFoundException('The provider could not find ACLs for all object identities.');
$partialResultException->setPartialResult($result);
throw $partialResultException;
}
}
return $result;
}
/**
* This method is called when an ACL instance is retrieved from the cache.
*
* @param AclInterface $acl
* @return void
*/
protected function updateAceIdentityMap(AclInterface $acl)
{
foreach (array('classAces', 'classFieldAces', 'objectAces', 'objectFieldAces') as $property) {
$reflection = new \ReflectionProperty($acl, $property);
$reflection->setAccessible(true);
$value = $reflection->getValue($acl);
if ('classAces' === $property || 'objectAces' === $property) {
$this->doUpdateAceIdentityMap($value);
} else {
foreach ($value as $field => $aces) {
$this->doUpdateAceIdentityMap($value[$field]);
}
}
$reflection->setValue($acl, $value);
$reflection->setAccessible(false);
}
}
/**
* Does either overwrite the passed ACE, or saves it in the global identity
* map to ensure every ACE only gets instantiated once.
*
* @param array $aces
* @return void
*/
protected function doUpdateAceIdentityMap(array &$aces)
{
foreach ($aces as $index => $ace) {
if (isset($this->loadedAces[$ace->getId()])) {
$aces[$index] = $this->loadedAces[$ace->getId()];
} else {
$this->loadedAces[$ace->getId()] = $ace;
}
}
}
/**
* This method is called for object identities which could not be retrieved
* from the cache, and for which thus a database query is required.
*
* @param array $batch
* @param array $sids
* @param array $oidLookup
* @return \SplObjectStorage mapping object identites to ACL instances
*/
protected function lookupObjectIdentities(array $batch, array $sids, array $oidLookup)
{
$sql = $this->getLookupSql($batch, $sids);
$stmt = $this->connection->executeQuery($sql);
return $this->hydrateObjectIdentities($stmt, $oidLookup, $sids);
}
/**
* This method is called to hydrate ACLs and ACEs.
*
* This method was designed for performance; thus, a lot of code has been
* inlined at the cost of readability, and maintainability.
*
* Keep in mind that changes to this method might severely reduce the
* performance of the entire ACL system.
*
* @param Statement $stmt
* @param array $oidLookup
* @param array $sids
* @throws \RuntimeException
* @return \SplObjectStorage
*/
protected function hydrateObjectIdentities(Statement $stmt, array $oidLookup, array $sids) {
$parentIdToFill = new \SplObjectStorage();
$acls = $aces = $emptyArray = array();
$oidCache = $oidLookup;
$result = new \SplObjectStorage();
$loadedAces =& $this->loadedAces;
$loadedAcls =& $this->loadedAcls;
$permissionGrantingStrategy = $this->permissionGrantingStrategy;
// we need these to set protected properties on hydrated objects
$aclReflection = new \ReflectionClass('Symfony\Component\Security\Acl\Domain\Acl');
$aclClassAcesProperty = $aclReflection->getProperty('classAces');
$aclClassAcesProperty->setAccessible(true);
$aclClassFieldAcesProperty = $aclReflection->getProperty('classFieldAces');
$aclClassFieldAcesProperty->setAccessible(true);
$aclObjectAcesProperty = $aclReflection->getProperty('objectAces');
$aclObjectAcesProperty->setAccessible(true);
$aclObjectFieldAcesProperty = $aclReflection->getProperty('objectFieldAces');
$aclObjectFieldAcesProperty->setAccessible(true);
$aclParentAclProperty = $aclReflection->getProperty('parentAcl');
$aclParentAclProperty->setAccessible(true);
// fetchAll() consumes more memory than consecutive calls to fetch(),
// but it is faster
foreach ($stmt->fetchAll(\PDO::FETCH_NUM) as $data) {
list($aclId,
$objectIdentifier,
$parentObjectIdentityId,
$entriesInheriting,
$classType,
$aceId,
$objectIdentityId,
$fieldName,
$aceOrder,
$mask,
$granting,
$grantingStrategy,
$auditSuccess,
$auditFailure,
$username,
$securityIdentifier) = $data;
// has the ACL been hydrated during this hydration cycle?
if (isset($acls[$aclId])) {
$acl = $acls[$aclId];
// has the ACL been hydrated during any previous cycle, or was possibly loaded
// from cache?
} else if (isset($loadedAcls[$classType][$objectIdentifier])) {
$acl = $loadedAcls[$classType][$objectIdentifier];
// keep reference in local array (saves us some hash calculations)
$acls[$aclId] = $acl;
// attach ACL to the result set; even though we do not enforce that every
// object identity has only one instance, we must make sure to maintain
// referential equality with the oids passed to findAcls()
if (!isset($oidCache[$objectIdentifier.$classType])) {
$oidCache[$objectIdentifier.$classType] = $acl->getObjectIdentity();
}
$result->attach($oidCache[$objectIdentifier.$classType], $acl);
// so, this hasn't been hydrated yet
} else {
// create object identity if we haven't done so yet
$oidLookupKey = $objectIdentifier.$classType;
if (!isset($oidCache[$oidLookupKey])) {
$oidCache[$oidLookupKey] = new ObjectIdentity($objectIdentifier, $classType);
}
$acl = new Acl((integer) $aclId, $oidCache[$oidLookupKey], $permissionGrantingStrategy, $emptyArray, !!$entriesInheriting);
// keep a local, and global reference to this ACL
$loadedAcls[$classType][$objectIdentifier] = $acl;
$acls[$aclId] = $acl;
// try to fill in parent ACL, or defer until all ACLs have been hydrated
if (null !== $parentObjectIdentityId) {
if (isset($acls[$parentObjectIdentityId])) {
$aclParentAclProperty->setValue($acl, $acls[$parentObjectIdentityId]);
} else {
$parentIdToFill->attach($acl, $parentObjectIdentityId);
}
}
$result->attach($oidCache[$oidLookupKey], $acl);
}
// check if this row contains an ACE record
if (null !== $aceId) {
// have we already hydrated ACEs for this ACL?
if (!isset($aces[$aclId])) {
$aces[$aclId] = array($emptyArray, $emptyArray, $emptyArray, $emptyArray);
}
// has this ACE already been hydrated during a previous cycle, or
// possible been loaded from cache?
// It is important to only ever have one ACE instance per actual row since
// some ACEs are shared between ACL instances
if (!isset($loadedAces[$aceId])) {
if (!isset($sids[$key = ($username?'1':'0').$securityIdentifier])) {
if ($username) {
$sids[$key] = new UserSecurityIdentity(
substr($securityIdentifier, 1 + $pos = strpos($securityIdentifier, '-')),
substr($securityIdentifier, 0, $pos)
);
} else {
$sids[$key] = new RoleSecurityIdentity($securityIdentifier);
}
}
if (null === $fieldName) {
$loadedAces[$aceId] = new Entry((integer) $aceId, $acl, $sids[$key], $grantingStrategy, (integer) $mask, !!$granting, !!$auditFailure, !!$auditSuccess);
} else {
$loadedAces[$aceId] = new FieldEntry((integer) $aceId, $acl, $fieldName, $sids[$key], $grantingStrategy, (integer) $mask, !!$granting, !!$auditFailure, !!$auditSuccess);
}
}
$ace = $loadedAces[$aceId];
// assign ACE to the correct property
if (null === $objectIdentityId) {
if (null === $fieldName) {
$aces[$aclId][0][$aceOrder] = $ace;
} else {
$aces[$aclId][1][$fieldName][$aceOrder] = $ace;
}
} else {
if (null === $fieldName) {
$aces[$aclId][2][$aceOrder] = $ace;
} else {
$aces[$aclId][3][$fieldName][$aceOrder] = $ace;
}
}
}
}
// We do not sort on database level since we only want certain subsets to be sorted,
// and we are going to read the entire result set anyway.
// Sorting on DB level increases query time by an order of magnitude while it is
// almost negligible when we use PHPs array sort functions.
foreach ($aces as $aclId => $aceData) {
$acl = $acls[$aclId];
ksort($aceData[0]);
$aclClassAcesProperty->setValue($acl, $aceData[0]);
foreach (array_keys($aceData[1]) as $fieldName) {
ksort($aceData[1][$fieldName]);
}
$aclClassFieldAcesProperty->setValue($acl, $aceData[1]);
ksort($aceData[2]);
$aclObjectAcesProperty->setValue($acl, $aceData[2]);
foreach (array_keys($aceData[3]) as $fieldName) {
ksort($aceData[3][$fieldName]);
}
$aclObjectFieldAcesProperty->setValue($acl, $aceData[3]);
}
// fill-in parent ACLs where this hasn't been done yet cause the parent ACL was not
// yet available
$processed = 0;
foreach ($parentIdToFill as $acl)
{
$parentId = $parentIdToFill->offsetGet($acl);
// let's see if we have already hydrated this
if (isset($acls[$parentId])) {
$aclParentAclProperty->setValue($acl, $acls[$parentId]);
$processed += 1;
continue;
}
}
// reset reflection changes
$aclClassAcesProperty->setAccessible(false);
$aclClassFieldAcesProperty->setAccessible(false);
$aclObjectAcesProperty->setAccessible(false);
$aclObjectFieldAcesProperty->setAccessible(false);
$aclParentAclProperty->setAccessible(false);
// this should never be true if the database integrity hasn't been compromised
if ($processed < count($parentIdToFill)) {
throw new \RuntimeException('Not all parent ids were populated. This implies an integrity problem.');
}
return $result;
}
/**
* Constructs the query used for looking up object identites and associated
* ACEs, and security identities.
*
* @param array $batch
* @param array $sids
* @throws AclNotFoundException
* @return string
*/
protected function getLookupSql(array $batch, array $sids)
{
// FIXME: add support for filtering by sids (right now we select all sids)
$ancestorIds = $this->getAncestorIds($batch);
if (0 === count($ancestorIds)) {
throw new AclNotFoundException('There is no ACL for the given object identity.');
}
$sql = <<<SELECTCLAUSE
SELECT
o.id as acl_id,
o.object_identifier,
o.parent_object_identity_id,
o.entries_inheriting,
c.class_type,
e.id as ace_id,
e.object_identity_id,
e.field_name,
e.ace_order,
e.mask,
e.granting,
e.granting_strategy,
e.audit_success,
e.audit_failure,
s.username,
s.identifier as security_identifier
FROM
{$this->options['oid_table_name']} o
INNER JOIN {$this->options['class_table_name']} c ON c.id = o.class_id
LEFT JOIN {$this->options['entry_table_name']} e ON (
e.class_id = o.class_id AND (e.object_identity_id = o.id OR {$this->connection->getDatabasePlatform()->getIsNullExpression('e.object_identity_id')})
)
LEFT JOIN {$this->options['sid_table_name']} s ON (
s.id = e.security_identity_id
)
WHERE (o.id =
SELECTCLAUSE;
$sql .= implode(' OR o.id = ', $ancestorIds).')';
return $sql;
}
/**
* Retrieves all the ids which need to be queried from the database
* including the ids of parent ACLs.
*
* @param array $batch
* @return array
*/
protected function getAncestorIds(array &$batch)
{
$sql = <<<SELECTCLAUSE
SELECT a.ancestor_id
FROM acl_object_identities o
INNER JOIN acl_classes c ON c.id = o.class_id
INNER JOIN acl_object_identity_ancestors a ON a.object_identity_id = o.id
WHERE (
SELECTCLAUSE;
$where = '(o.object_identifier = %s AND c.class_type = %s)';
for ($i=0,$c=count($batch); $i<$c; $i++) {
$sql .= sprintf(
$where,
$this->connection->quote($batch[$i]->getIdentifier()),
$this->connection->quote($batch[$i]->getType())
);
if ($i+1 < $c) {
$sql .= ' OR ';
}
}
$sql .= ')';
$ancestorIds = array();
foreach ($this->connection->executeQuery($sql)->fetchAll() as $data) {
// FIXME: skip ancestors which are cached
$ancestorIds[] = $data['ancestor_id'];
}
return $ancestorIds;
}
/**
* Constructs the SQL for retrieving child object identities for the given
* object identities.
*
* @param ObjectIdentityInterface $oid
* @param Boolean $directChildrenOnly
* @return string
*/
protected function getFindChildrenSql(ObjectIdentityInterface $oid, $directChildrenOnly)
{
if (false === $directChildrenOnly) {
$query = <<<FINDCHILDREN
SELECT o.object_identifier, c.class_type
FROM
{$this->options['oid_table_name']} as o
INNER JOIN {$this->options['class_table_name']} as c ON c.id = o.class_id
INNER JOIN {$this->options['oid_ancestors_table_name']} as a ON a.object_identity_id = o.id
WHERE
a.ancestor_id = %d AND a.object_identity_id != a.ancestor_id
FINDCHILDREN;
} else {
$query = <<<FINDCHILDREN
SELECT o.object_identifier, c.class_type
FROM {$this->options['oid_table_name']} as o
INNER JOIN {$this->options['class_table_name']} as c ON c.id = o.class_id
WHERE o.parent_object_identity_id = %d
FINDCHILDREN;
}
return sprintf($query, $this->retrieveObjectIdentityPrimaryKey($oid));
}
/**
* Constructs the SQL for retrieving the primary key of the given object
* identity.
*
* @param ObjectIdentityInterface $oid
* @return string
*/
protected function getSelectObjectIdentityIdSql(ObjectIdentityInterface $oid)
{
$query = <<<QUERY
SELECT o.id
FROM %s o
INNER JOIN %s c ON c.id = o.class_id
WHERE o.object_identifier = %s AND c.class_type = %s
LIMIT 1
QUERY;
return sprintf(
$query,
$this->options['oid_table_name'],
$this->options['class_table_name'],
$this->connection->quote($oid->getIdentifier()),
$this->connection->quote($oid->getType())
);
}
/**
* Returns the primary key of the passed object identity.
*
* @param ObjectIdentityInterface $oid
* @return integer
*/
protected function retrieveObjectIdentityPrimaryKey(ObjectIdentityInterface $oid)
{
return $this->connection->executeQuery($this->getSelectObjectIdentityIdSql($oid))->fetchColumn();
}
}
| {
"content_hash": "251a7185acd9179411814a6b7eb78236",
"timestamp": "",
"source": "github",
"line_count": 625,
"max_line_length": 193,
"avg_line_length": 38.7648,
"alnum_prop": 0.5456909361069836,
"repo_name": "servergrove/ServerGroveLiveChat",
"id": "40bd0676ee92c11ebb5c303c2ce1e142c8106d09",
"size": "24475",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "vendor/symfony/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1298"
},
{
"name": "PHP",
"bytes": "130061"
},
{
"name": "Shell",
"bytes": "11"
}
],
"symlink_target": ""
} |
import random
import pprint as pp
import logging as log
import ctpy
log.basicConfig(level=log.DEBUG, format='%(asctime)s %(levelname)s: %(message)s')
def build_even_dimension(simconfig, num_modes):
mode_boundaries = []
mode_width = float(simconfig.MAXALLELES) / float(num_modes)
lower_val = 0.0
upper_val = 0.0
for mode in range(0, num_modes):
upper_val += mode_width
mode_boundaries.append(dict(lower=lower_val, upper=upper_val))
lower_val = upper_val
log.debug("boundaries: %s", mode_boundaries)
return mode_boundaries
def build_random_dimension(simconfig, num_modes):
iboundaries = []
mode_boundaries = []
num_internal_boundaries = num_modes - 1
for i in range(0, num_internal_boundaries):
random_variate = random.random()
iboundaries.append(random_variate)
# add the final upper boundary
iboundaries.append(1.0)
lower_val = 0.0
upper_val = 0.0
iboundaries.sort()
for mode in range(0, num_modes):
lower_val = lower_val * simconfig.MAXALLELES
upper_val = iboundaries[mode] * simconfig.MAXALLELES
mode_boundaries.append(dict(lower=lower_val, upper=upper_val))
lower_val = iboundaries[mode]
log.debug("boundaries: %s", mode_boundaries)
return mode_boundaries
# # TODO: needs to deal with cases where maxalleles % num_modes leaves a remainder...
#
#
# def build_even_partitions_all_dimensions(num_modes, sim_param):
# """
#
#
# :param num_modes:
# :param sim_param:
# :return:
# """
# dimensions = {}
#
# # to start, we partition into quarters for each locus (dimension)
# mode_width = sim_param["maxalleles"] / num_modes
#
# for dimension in range(0, sim_param["numloci"]):
# mode_boundaries_dict = {}
# lower_val = 0.0
# upper_val = 0.0
# for mode in range(0,num_modes):
# upper_val += mode_width
# mode_boundaries_dict[mode] = dict(lower=lower_val, upper=upper_val)
# lower_val = upper_val
# dimensions[dimension] = mode_boundaries_dict
# return dimensions
#
#
# def build_random_partitions_all_dimensions(num_modes, sim_param):
# """
# For k desired modes, generate random mode boundaries within maxalleles.
# Algorithm generates k-1 "internal" boundaries on the unit interval [0,1]
# and then scales maxalleles by the unit interval partitions. Upper
# and lower internal boundaries are equivalent, since they will be
# interpreted with open/closed interval semantics.
#
#
# :param num_modes:
# :param sim_param:
# :return: dict of dimension-specific dicts, within each of which a mode maps to a dict of upper and lower boundaries
# """
# dimensions = {}
# num_internal_boundaries = num_modes - 1
#
# for dimension in range(0, sim_param["numloci"]):
# tempboundary = list()
# mode_boundaries_dict = {}
# maxalleles = sim_param["maxalleles"]
#
# for i in range(0, num_internal_boundaries):
# random_variate = random.random()
# tempboundary.append(random_variate)
#
# # add the final upper boundary
# tempboundary.append(1.0)
#
# lower_val = 0.0
# upper_val = 0.0
# tempboundary.sort()
#
# for mode in range(0, num_modes):
# lower_val = int(lower_val * maxalleles)
# upper_val = int(tempboundary[mode] * maxalleles)
# mode_boundaries_dict[mode] = dict(lower=lower_val, upper=upper_val)
# lower_val = tempboundary[mode]
#
# dimensions[dimension] = mode_boundaries_dict
# # TODO: missing logic for scaling to maxalleles, need to debug this first...
# return dimensions
#
#
# if __name__ == "__main__":
# sim_param = {}
# sim_param["numloci"] = 3
# sim_param["maxalleles"] = 100000000
#
#
# print "Testing random partitions for 3 dimensions, 4 modes"
# result_dict = build_random_partitions_all_dimensions(4, sim_param)
# pp.pprint(result_dict)
#
# print "Testing even partitions for 3 dimensions, 4 modes"
# result_dict = build_even_partitions_all_dimensions(4, sim_param)
# pp.pprint(result_dict) | {
"content_hash": "b5cc145e0ccd748b4dcdc956cd578caa",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 121,
"avg_line_length": 32.3587786259542,
"alnum_prop": 0.6301014390186365,
"repo_name": "mmadsen/CTPy",
"id": "62849a69842ce7dbee2c5ee40a4976ff010dba01",
"size": "4963",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ctpy/coarsegraining/dimension_mode_builder.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "29478"
},
{
"name": "JavaScript",
"bytes": "37933"
},
{
"name": "Python",
"bytes": "197849"
},
{
"name": "Shell",
"bytes": "1406"
},
{
"name": "TeX",
"bytes": "252609"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "4e89eabc6bf8202bedfa16ee26cae423",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "920ab37a941a1d9b2af0cdb38bdd84c953e3c72c",
"size": "186",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Gentianales/Apocynaceae/Caralluma/Caralluma frerei/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.