text
stringlengths 4
5.48M
| meta
stringlengths 14
6.54k
|
---|---|
package org.rythmengine.template;
import org.rythmengine.Rythm;
import org.rythmengine.RythmEngine;
import org.rythmengine.conf.RythmConfiguration;
import org.rythmengine.extension.ICodeType;
import org.rythmengine.internal.compiler.TemplateClass;
import org.rythmengine.utils.Escape;
import org.rythmengine.utils.JSONWrapper;
import java.io.OutputStream;
import java.io.Writer;
import java.util.Locale;
import java.util.Map;
import java.util.Stack;
/**
* Define a template instance API
*/
public interface ITemplate extends ITag, Cloneable {
/**
* Return the engine instance that is running this template
*
* @return the {@link org.rythmengine.RythmEngine engine} instance
*/
RythmEngine __engine();
/**
* Return the template class of this template instance
*
* @param useCaller if set to true then return caller template class if this template has no template class
* @return the template class
*/
TemplateClass __getTemplateClass(boolean useCaller);
/**
* Set binary output stream to the template instance.
*
* @param os
* @throws NullPointerException if os specified is null
* @throws IllegalStateException if output stream or {@link #__setWriter(java.io.Writer) writer}
* is already set
* @return this template instance
*/
ITemplate __setOutputStream(OutputStream os);
/**
* Set a character based writer to the template instance
*
* @param writer
* @throws NullPointerException if os specified is null
* @throws IllegalStateException if {@link #__setOutputStream(java.io.OutputStream) output stream}
* or writer is already set
* @return this template instance
*/
ITemplate __setWriter(Writer writer);
/**
* Set user context to the template instance
*
* @param userContext
* @return this template instance
*/
ITemplate __setUserContext(Map<String, Object> userContext);
/**
* Return user context previously set to this template instance.
* if there is no user context has been set, then an empty Map is returned.
*
* @return the user context
*/
Map<String, Object> __getUserContext();
/**
* Set renderArgs in name-value pair
*
* @param args
* @return this template instance
*/
ITemplate __setRenderArgs(Map<String, Object> args);
/**
* Set renderArgs in position
*
* @param args
* @return this template instance
*/
ITemplate __setRenderArgs(Object... args);
/**
* Set a render arg by name
*
* @param name
* @param arg
* @return this template instance
*/
ITemplate __setRenderArg(String name, Object arg);
/**
* Return a render arg value by name
*
* @param name
* @param <T>
* @return render arg by name
*/
<T> T __getRenderArg(String name);
/**
* Set a render arg by position
*
* @param position
* @param arg
* @return this template instance
*/
ITemplate __setRenderArg(int position, Object arg);
/**
* Set renderArgs using JSON data
*
* @param jsonData
* @return this template instance
*/
ITemplate __setRenderArg(JSONWrapper jsonData);
/**
* Render the template and return result as String
*
* @return render result
*/
String render();
/**
* Render the template and put the result into outputstream
*
* @param os
*/
void render(OutputStream os);
/**
* Render the template and put the result into writer
*
* @param w
*/
void render(Writer w);
/**
* Must be called before real render() happened.
* Also if the template extends a parent template, then
* the parent template's __init() must be called before this template's __init()
*/
void __init();
/**
* Return the internal buffer
*
* @return buffer
*/
StringBuilder __getBuffer();
/**
* Set secure code (for sandbox purpse)
*
* @param secureCode
* @return this template
*/
ITemplate __setSecureCode(String secureCode);
/**
* Get a copy of this template instance and pass in the engine and caller
*
* @param engine the rythm engine
* @param caller the caller template
* @return a cloned instance of this template class
*/
ITemplate __cloneMe(RythmEngine engine, ITemplate caller);
/**
* (not API)
* Return the current locale
*
* @return the locale
*/
Locale __curLocale();
/**
* (not API)
* Return the current escape scheme
*
* @return the escape
*/
Escape __curEscape();
/**
* (not API)
* Return current code type.
*
* @return current {@link org.rythmengine.extension.ICodeType type}
*/
ICodeType __curCodeType();
/**
* The render time context. Not to be used in user application or template
*/
public static class __Context {
/**
* Code type stack. Used to enable the
* {@link org.rythmengine.conf.RythmConfigurationKey#FEATURE_NATURAL_TEMPLATE_ENABLED}
*
* @see {@link #localeStack}
*/
public Stack<ICodeType> codeTypeStack = new Stack<ICodeType>();
/**
* template escape stack. Used to enable the
* {@link org.rythmengine.conf.RythmConfigurationKey#FEATURE_SMART_ESCAPE_ENABLED}
*/
private Stack<Escape> escapeStack = new Stack<Escape>();
/**
* template locale stack. Used to track the locale in the current context.
*/
private Stack<Locale> localeStack = new Stack<Locale>();
private TemplateBase tmpl;
private RythmConfiguration conf;
private void setTemplate(TemplateBase tmpl, RythmConfiguration conf) {
this.tmpl = tmpl;
this.conf = conf;
}
/**
* init the context with template and base code type
*
* @param templateBase
* @param type
* @param locale
*/
public void init(TemplateBase templateBase, ICodeType type, Locale locale, TemplateClass tc, RythmEngine engine) {
if (null == type) {
type = engine.renderSettings.codeType();
if (null == type) type = tc.codeType;
}
if (null == locale) {
locale = engine.renderSettings.locale();
}
codeTypeStack.push(type);
localeStack.push(locale);
setTemplate(templateBase, engine.conf());
}
public ICodeType currentCodeType() {
if (codeTypeStack.isEmpty()) {
return conf.defaultCodeType();
} else {
return codeTypeStack.peek();
}
}
public void pushCodeType(ICodeType type) {
ICodeType cur = currentCodeType();
if (null != cur) {
type.setParent(cur);
}
codeTypeStack.push(type);
Rythm.RenderTime.setCodeType(type);
}
public ICodeType popCodeType() {
ICodeType cur = codeTypeStack.pop();
cur.setParent(null);
return cur;
}
public Locale currentLocale() {
if (localeStack.isEmpty()) {
return conf.locale();
} else {
return localeStack.peek();
}
}
public void pushLocale(Locale locale) {
localeStack.push(locale);
}
public Locale popLocale() {
return localeStack.pop();
}
public Escape currentEscape() {
if (!escapeStack.isEmpty()) {
return escapeStack.peek();
} else {
return currentCodeType().escape();
}
}
public void pushEscape(Escape escape) {
escapeStack.push(escape);
Rythm.RenderTime.setEscape(escape);
}
public Escape popEscape() {
return escapeStack.pop();
}
public __Context() {
codeTypeStack = new Stack<ICodeType>();
escapeStack = new Stack<Escape>();
localeStack = new Stack<Locale>();
// codeTypeStack.addAll(clone.codeTypeStack);
// escapeStack.addAll(clone.escapeStack);
// localeStack.addAll(clone.localeStack);
// setTemplate(tmpl, conf);
}
}
}
| {'content_hash': '78e9701cc80fa90b865bf551835616fc', 'timestamp': '', 'source': 'github', 'line_count': 325, 'max_line_length': 123, 'avg_line_length': 26.88, 'alnum_prop': 0.5730311355311355, 'repo_name': 'alfishe/Rythm', 'id': '1fa20f0b4cab542768103dcac8a9e0d1312362aa', 'size': '9630', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/org/rythmengine/template/ITemplate.java', 'mode': '33261', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '2206'}, {'name': 'HTML', 'bytes': '1979'}, {'name': 'Java', 'bytes': '1305979'}, {'name': 'JavaScript', 'bytes': '26'}]} |
<!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_71) on Thu Sep 10 12:29:42 NZST 2015 -->
<title>BallNode</title>
<meta name="date" content="2015-09-10">
<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="BallNode";
}
//-->
</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 class="navBarCell1Rev">Class</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 Class</li>
<li><a href="../../../../weka/core/neighboursearch/balltrees/BallSplitter.html" title="class in weka.core.neighboursearch.balltrees"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?weka/core/neighboursearch/balltrees/BallNode.html" target="_top">Frames</a></li>
<li><a href="BallNode.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>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">weka.core.neighboursearch.balltrees</div>
<h2 title="Class BallNode" class="title">Class BallNode</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>weka.core.neighboursearch.balltrees.BallNode</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>java.io.Serializable, <a href="../../../../weka/core/RevisionHandler.html" title="interface in weka.core">RevisionHandler</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">BallNode</span>
extends java.lang.Object
implements java.io.Serializable, <a href="../../../../weka/core/RevisionHandler.html" title="interface in weka.core">RevisionHandler</a></pre>
<div class="block">Class representing a node of a BallTree.</div>
<dl><dt><span class="strong">Version:</span></dt>
<dd>$Revision: 8034 $</dd>
<dt><span class="strong">Author:</span></dt>
<dd>Ashraf M. Kibriya (amk14[at-the-rate]cs[dot]waikato[dot]ac[dot]nz)</dd>
<dt><span class="strong">See Also:</span></dt><dd><a href="../../../../serialized-form.html#weka.core.neighboursearch.balltrees.BallNode">Serialized Form</a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#m_End">m_End</a></strong></code>
<div class="block">The end index of the portion of the master index array,
which stores indices of the instances/points the node
contains.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html" title="class in weka.core.neighboursearch.balltrees">BallNode</a></code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#m_Left">m_Left</a></strong></code>
<div class="block">The left child of the node.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#m_NodeNumber">m_NodeNumber</a></strong></code>
<div class="block">The node number/id.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#m_NumInstances">m_NumInstances</a></strong></code>
<div class="block">The number of instances/points in the node.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html" title="class in weka.core.neighboursearch.balltrees">BallNode</a></code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#m_Right">m_Right</a></strong></code>
<div class="block">The right child of the node.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#m_SplitAttrib">m_SplitAttrib</a></strong></code>
<div class="block">The attribute that splits this node (not
always used).</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#m_SplitVal">m_SplitVal</a></strong></code>
<div class="block">The value of m_SpiltAttrib that splits this
node (not always used).</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#m_Start">m_Start</a></strong></code>
<div class="block">The start index of the portion of the master index array,
which stores the indices of the instances/points the node
contains.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#BallNode(int)">BallNode</a></strong>(int nodeNumber)</code>
<div class="block">Constructor.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#BallNode(int,%20int,%20int)">BallNode</a></strong>(int start,
int end,
int nodeNumber)</code>
<div class="block">Creates a new instance of BallNode.</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#BallNode(int,%20int,%20int,%20weka.core.Instance,%20double)">BallNode</a></strong>(int start,
int end,
int nodeNumber,
<a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a> pivot,
double radius)</code>
<div class="block">Creates a new instance of BallNode.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a></code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#calcCentroidPivot(int[],%20weka.core.Instances)">calcCentroidPivot</a></strong>(int[] instList,
<a href="../../../../weka/core/Instances.html" title="class in weka.core">Instances</a> insts)</code>
<div class="block">Calculates the centroid pivot of a node.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static <a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a></code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#calcCentroidPivot(int,%20int,%20int[],%20weka.core.Instances)">calcCentroidPivot</a></strong>(int start,
int end,
int[] instList,
<a href="../../../../weka/core/Instances.html" title="class in weka.core">Instances</a> insts)</code>
<div class="block">Calculates the centroid pivot of a node.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a></code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#calcPivot(weka.core.neighboursearch.balltrees.BallNode,%20weka.core.neighboursearch.balltrees.BallNode,%20weka.core.Instances)">calcPivot</a></strong>(<a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html" title="class in weka.core.neighboursearch.balltrees">BallNode</a> child1,
<a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html" title="class in weka.core.neighboursearch.balltrees">BallNode</a> child2,
<a href="../../../../weka/core/Instances.html" title="class in weka.core">Instances</a> insts)</code>
<div class="block">Calculates the centroid pivot of a node based on its
two child nodes (if merging two nodes).</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#calcRadius(weka.core.neighboursearch.balltrees.BallNode,%20weka.core.neighboursearch.balltrees.BallNode,%20weka.core.Instance,%20weka.core.DistanceFunction)">calcRadius</a></strong>(<a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html" title="class in weka.core.neighboursearch.balltrees">BallNode</a> child1,
<a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html" title="class in weka.core.neighboursearch.balltrees">BallNode</a> child2,
<a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a> pivot,
<a href="../../../../weka/core/DistanceFunction.html" title="interface in weka.core">DistanceFunction</a> distanceFunction)</code>
<div class="block">Calculates the radius of a node based on its two
child nodes (if merging two nodes).</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#calcRadius(int[],%20weka.core.Instances,%20weka.core.Instance,%20weka.core.DistanceFunction)">calcRadius</a></strong>(int[] instList,
<a href="../../../../weka/core/Instances.html" title="class in weka.core">Instances</a> insts,
<a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a> pivot,
<a href="../../../../weka/core/DistanceFunction.html" title="interface in weka.core">DistanceFunction</a> distanceFunction)</code>
<div class="block">Calculates the radius of node.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#calcRadius(int,%20int,%20int[],%20weka.core.Instances,%20weka.core.Instance,%20weka.core.DistanceFunction)">calcRadius</a></strong>(int start,
int end,
int[] instList,
<a href="../../../../weka/core/Instances.html" title="class in weka.core">Instances</a> insts,
<a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a> pivot,
<a href="../../../../weka/core/DistanceFunction.html" title="interface in weka.core">DistanceFunction</a> distanceFunction)</code>
<div class="block">Calculates the radius of a node.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a></code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#getPivot()">getPivot</a></strong>()</code>
<div class="block">Returns the pivot/centre of the
node's ball.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#getRadius()">getRadius</a></strong>()</code>
<div class="block">Returns the radius of the node's ball.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#getRevision()">getRevision</a></strong>()</code>
<div class="block">Returns the revision string.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#isALeaf()">isALeaf</a></strong>()</code>
<div class="block">Returns true if the node is a leaf node (if
both its left and right child are null).</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#numInstances()">numInstances</a></strong>()</code>
<div class="block">Returns the number of instances in the
hyper-spherical region of this node.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#setPivot(weka.core.Instance)">setPivot</a></strong>(<a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a> pivot)</code>
<div class="block">Sets the pivot/centre of this nodes
ball.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#setRadius(double)">setRadius</a></strong>(double radius)</code>
<div class="block">Sets the radius of the node's
ball.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html#setStartEndIndices(int,%20int)">setStartEndIndices</a></strong>(int start,
int end)</code>
<div class="block">Sets the the start and end index of the
portion of the master index array that is
assigned to this node.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="m_Start">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_Start</h4>
<pre>public int m_Start</pre>
<div class="block">The start index of the portion of the master index array,
which stores the indices of the instances/points the node
contains.</div>
</li>
</ul>
<a name="m_End">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_End</h4>
<pre>public int m_End</pre>
<div class="block">The end index of the portion of the master index array,
which stores indices of the instances/points the node
contains.</div>
</li>
</ul>
<a name="m_NumInstances">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_NumInstances</h4>
<pre>public int m_NumInstances</pre>
<div class="block">The number of instances/points in the node.</div>
</li>
</ul>
<a name="m_NodeNumber">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_NodeNumber</h4>
<pre>public int m_NodeNumber</pre>
<div class="block">The node number/id.</div>
</li>
</ul>
<a name="m_SplitAttrib">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_SplitAttrib</h4>
<pre>public int m_SplitAttrib</pre>
<div class="block">The attribute that splits this node (not
always used).</div>
</li>
</ul>
<a name="m_SplitVal">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_SplitVal</h4>
<pre>public double m_SplitVal</pre>
<div class="block">The value of m_SpiltAttrib that splits this
node (not always used).</div>
</li>
</ul>
<a name="m_Left">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>m_Left</h4>
<pre>public <a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html" title="class in weka.core.neighboursearch.balltrees">BallNode</a> m_Left</pre>
<div class="block">The left child of the node.</div>
</li>
</ul>
<a name="m_Right">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>m_Right</h4>
<pre>public <a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html" title="class in weka.core.neighboursearch.balltrees">BallNode</a> m_Right</pre>
<div class="block">The right child of the node.</div>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="BallNode(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>BallNode</h4>
<pre>public BallNode(int nodeNumber)</pre>
<div class="block">Constructor.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>nodeNumber</code> - The node's number/id.</dd></dl>
</li>
</ul>
<a name="BallNode(int, int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>BallNode</h4>
<pre>public BallNode(int start,
int end,
int nodeNumber)</pre>
<div class="block">Creates a new instance of BallNode.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>start</code> - The begining index of the portion of
the master index array belonging to this node.</dd><dd><code>end</code> - The end index of the portion of the
master index array belonging to this node.</dd><dd><code>nodeNumber</code> - The node's number/id.</dd></dl>
</li>
</ul>
<a name="BallNode(int, int, int, weka.core.Instance, double)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>BallNode</h4>
<pre>public BallNode(int start,
int end,
int nodeNumber,
<a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a> pivot,
double radius)</pre>
<div class="block">Creates a new instance of BallNode.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>start</code> - The begining index of the portion of
the master index array belonging to this node.</dd><dd><code>end</code> - The end index of the portion of the
master index array belonging to this node.</dd><dd><code>nodeNumber</code> - The node's number/id.</dd><dd><code>pivot</code> - The pivot/centre of the node's ball.</dd><dd><code>radius</code> - The radius of the node's ball.</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="isALeaf()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isALeaf</h4>
<pre>public boolean isALeaf()</pre>
<div class="block">Returns true if the node is a leaf node (if
both its left and right child are null).</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>true if the node is a leaf node.</dd></dl>
</li>
</ul>
<a name="setStartEndIndices(int, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setStartEndIndices</h4>
<pre>public void setStartEndIndices(int start,
int end)</pre>
<div class="block">Sets the the start and end index of the
portion of the master index array that is
assigned to this node.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>start</code> - The start index of the
master index array.</dd><dd><code>end</code> - The end index of the master
indext array.</dd></dl>
</li>
</ul>
<a name="setPivot(weka.core.Instance)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setPivot</h4>
<pre>public void setPivot(<a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a> pivot)</pre>
<div class="block">Sets the pivot/centre of this nodes
ball.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>pivot</code> - The centre/pivot.</dd></dl>
</li>
</ul>
<a name="getPivot()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPivot</h4>
<pre>public <a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a> getPivot()</pre>
<div class="block">Returns the pivot/centre of the
node's ball.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>The ball pivot/centre.</dd></dl>
</li>
</ul>
<a name="setRadius(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setRadius</h4>
<pre>public void setRadius(double radius)</pre>
<div class="block">Sets the radius of the node's
ball.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>radius</code> - The radius of the nodes ball.</dd></dl>
</li>
</ul>
<a name="getRadius()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRadius</h4>
<pre>public double getRadius()</pre>
<div class="block">Returns the radius of the node's ball.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>Radius of node's ball.</dd></dl>
</li>
</ul>
<a name="numInstances()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>numInstances</h4>
<pre>public int numInstances()</pre>
<div class="block">Returns the number of instances in the
hyper-spherical region of this node.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>The number of instances in the
node.</dd></dl>
</li>
</ul>
<a name="calcCentroidPivot(int[], weka.core.Instances)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>calcCentroidPivot</h4>
<pre>public static <a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a> calcCentroidPivot(int[] instList,
<a href="../../../../weka/core/Instances.html" title="class in weka.core">Instances</a> insts)</pre>
<div class="block">Calculates the centroid pivot of a node. The node is given
in the form of an indices array that contains the
indices of the points inside the node.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>instList</code> - The indices array pointing to the
instances in the node.</dd><dd><code>insts</code> - The actual instances. The instList
points to instances in this object.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The calculated centre/pivot of the node.</dd></dl>
</li>
</ul>
<a name="calcCentroidPivot(int, int, int[], weka.core.Instances)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>calcCentroidPivot</h4>
<pre>public static <a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a> calcCentroidPivot(int start,
int end,
int[] instList,
<a href="../../../../weka/core/Instances.html" title="class in weka.core">Instances</a> insts)</pre>
<div class="block">Calculates the centroid pivot of a node. The node is given
in the form of the portion of an indices array that
contains the indices of the points inside the node.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>start</code> - The start index marking the start of
the portion belonging to the node.</dd><dd><code>end</code> - The end index marking the end of the
portion in the indices array that belongs to the node.</dd><dd><code>instList</code> - The indices array pointing to the
instances in the node.</dd><dd><code>insts</code> - The actual instances. The instList
points to instances in this object.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The calculated centre/pivot of the node.</dd></dl>
</li>
</ul>
<a name="calcRadius(int[], weka.core.Instances, weka.core.Instance, weka.core.DistanceFunction)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>calcRadius</h4>
<pre>public static double calcRadius(int[] instList,
<a href="../../../../weka/core/Instances.html" title="class in weka.core">Instances</a> insts,
<a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a> pivot,
<a href="../../../../weka/core/DistanceFunction.html" title="interface in weka.core">DistanceFunction</a> distanceFunction)
throws java.lang.Exception</pre>
<div class="block">Calculates the radius of node.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>instList</code> - The indices array containing the indices of the
instances inside the node.</dd><dd><code>insts</code> - The actual instances object. instList points to
instances in this object.</dd><dd><code>pivot</code> - The centre/pivot of the node.</dd><dd><code>distanceFunction</code> - The distance fuction to use to calculate
the radius.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The radius of the node.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code> - If there is some problem in calculating the
radius.</dd></dl>
</li>
</ul>
<a name="calcRadius(int, int, int[], weka.core.Instances, weka.core.Instance, weka.core.DistanceFunction)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>calcRadius</h4>
<pre>public static double calcRadius(int start,
int end,
int[] instList,
<a href="../../../../weka/core/Instances.html" title="class in weka.core">Instances</a> insts,
<a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a> pivot,
<a href="../../../../weka/core/DistanceFunction.html" title="interface in weka.core">DistanceFunction</a> distanceFunction)
throws java.lang.Exception</pre>
<div class="block">Calculates the radius of a node.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>start</code> - The start index of the portion in indices array
that belongs to the node.</dd><dd><code>end</code> - The end index of the portion in indices array
that belongs to the node.</dd><dd><code>instList</code> - The indices array holding indices of
instances.</dd><dd><code>insts</code> - The actual instances. instList points to
instances in this object.</dd><dd><code>pivot</code> - The centre/pivot of the node.</dd><dd><code>distanceFunction</code> - The distance function to use to
calculate the radius.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The radius of the node.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code> - If there is some problem calculating the
radius.</dd></dl>
</li>
</ul>
<a name="calcPivot(weka.core.neighboursearch.balltrees.BallNode, weka.core.neighboursearch.balltrees.BallNode, weka.core.Instances)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>calcPivot</h4>
<pre>public static <a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a> calcPivot(<a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html" title="class in weka.core.neighboursearch.balltrees">BallNode</a> child1,
<a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html" title="class in weka.core.neighboursearch.balltrees">BallNode</a> child2,
<a href="../../../../weka/core/Instances.html" title="class in weka.core">Instances</a> insts)
throws java.lang.Exception</pre>
<div class="block">Calculates the centroid pivot of a node based on its
two child nodes (if merging two nodes).</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>child1</code> - The first child of the node.</dd><dd><code>child2</code> - The second child of the node.</dd><dd><code>insts</code> - The set of instances on which
the tree is (or is to be) built.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The centre/pivot of the node.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code> - If there is some problem calculating
the pivot.</dd></dl>
</li>
</ul>
<a name="calcRadius(weka.core.neighboursearch.balltrees.BallNode, weka.core.neighboursearch.balltrees.BallNode, weka.core.Instance, weka.core.DistanceFunction)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>calcRadius</h4>
<pre>public static double calcRadius(<a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html" title="class in weka.core.neighboursearch.balltrees">BallNode</a> child1,
<a href="../../../../weka/core/neighboursearch/balltrees/BallNode.html" title="class in weka.core.neighboursearch.balltrees">BallNode</a> child2,
<a href="../../../../weka/core/Instance.html" title="interface in weka.core">Instance</a> pivot,
<a href="../../../../weka/core/DistanceFunction.html" title="interface in weka.core">DistanceFunction</a> distanceFunction)
throws java.lang.Exception</pre>
<div class="block">Calculates the radius of a node based on its two
child nodes (if merging two nodes).</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>child1</code> - The first child of the node.</dd><dd><code>child2</code> - The second child of the node.</dd><dd><code>pivot</code> - The centre/pivot of the node.</dd><dd><code>distanceFunction</code> - The distance function to
use to calculate the radius</dd>
<dt><span class="strong">Returns:</span></dt><dd>The radius of the node.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code> - If there is some problem
in calculating the radius.</dd></dl>
</li>
</ul>
<a name="getRevision()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getRevision</h4>
<pre>public java.lang.String getRevision()</pre>
<div class="block">Returns the revision string.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../weka/core/RevisionHandler.html#getRevision()">getRevision</a></code> in interface <code><a href="../../../../weka/core/RevisionHandler.html" title="interface in weka.core">RevisionHandler</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>the revision</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= 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 class="navBarCell1Rev">Class</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 Class</li>
<li><a href="../../../../weka/core/neighboursearch/balltrees/BallSplitter.html" title="class in weka.core.neighboursearch.balltrees"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?weka/core/neighboursearch/balltrees/BallNode.html" target="_top">Frames</a></li>
<li><a href="BallNode.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>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {'content_hash': '9d5e335d63db07c412e0de8635d2eb91', 'timestamp': '', 'source': 'github', 'line_count': 807, 'max_line_length': 437, 'avg_line_length': 44.581164807930605, 'alnum_prop': 0.6610334380298524, 'repo_name': 'royhpr/KDDProject', 'id': '874128b10724460f2248b5d18a124f2056351cce', 'size': '35977', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'HelloWorldJava/weka-3-7-13/doc/weka/core/neighboursearch/balltrees/BallNode.html', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '11649'}, {'name': 'HTML', 'bytes': '46976575'}, {'name': 'Java', 'bytes': '21827'}]} |
from django import template
from django.urls import reverse
from osf.models import Node, OSFUser
register = template.Library()
@register.filter
def reverse_node(value):
if isinstance(value, Node):
value = value._id
return reverse('nodes:node', kwargs={'guid': value})
@register.filter
def reverse_preprint(value):
return reverse('preprints:preprint', kwargs={'guid': value})
@register.filter
def reverse_user(user_id):
if isinstance(user_id, int):
user = OSFUser.objects.get(id=user_id)
else:
user = OSFUser.load(user_id)
return reverse('users:user', kwargs={'guid': user._id})
@register.filter
def reverse_osf_group(value):
return reverse('osf_groups:osf_group', kwargs={'id': value})
| {'content_hash': '5ae295d93edcd6a1e3c0c511268b3c03', 'timestamp': '', 'source': 'github', 'line_count': 29, 'max_line_length': 64, 'avg_line_length': 25.689655172413794, 'alnum_prop': 0.6926174496644295, 'repo_name': 'baylee-d/osf.io', 'id': 'b8b00e4aa203d8d2c86d086b47d0f1c654fdb359', 'size': '745', 'binary': False, 'copies': '3', 'ref': 'refs/heads/develop', 'path': 'admin/nodes/templatetags/node_extras.py', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '92773'}, {'name': 'Dockerfile', 'bytes': '5721'}, {'name': 'HTML', 'bytes': '318459'}, {'name': 'JavaScript', 'bytes': '1792442'}, {'name': 'Jupyter Notebook', 'bytes': '41326'}, {'name': 'Mako', 'bytes': '654930'}, {'name': 'Python', 'bytes': '10662092'}, {'name': 'VCL', 'bytes': '13885'}]} |
from ..mod_db import db
from passlib.hash import argon2
class User(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(128), unique=True)
username = db.Column(db.String(32), unique=True)
password = db.Column(db.String(128))
email = db.Column(db.String(64), unique=True)
def __init__(self, name, username, password, email):
self.name = name
self.username = username
self.email = email
self.password = argon2.using(time_cost=160, memory_cost=10240, parallelism=8).hash(password)
def __repr__(self):
return f'<User name="{self.name}" username="{self.username}">'
| {'content_hash': 'cd40c6068900335cdcca97284a8281ca', 'timestamp': '', 'source': 'github', 'line_count': 19, 'max_line_length': 100, 'avg_line_length': 35.94736842105263, 'alnum_prop': 0.6559297218155198, 'repo_name': 'nmpiazza/Hermes', 'id': '168d42a24fe669721412711139ca7096b68c9b16', 'size': '683', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/mod_user/models.py', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Python', 'bytes': '22840'}, {'name': 'Shell', 'bytes': '688'}]} |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>da Hora</logradouro><bairro>Graças</bairro><cidade>Recife</cidade><uf>PE</uf><cep>52020217</cep></feed>
| {'content_hash': 'f2eac4ef4fb8001d524a671111818d86', 'timestamp': '', 'source': 'github', 'line_count': 2, 'max_line_length': 137, 'avg_line_length': 97.0, 'alnum_prop': 0.711340206185567, 'repo_name': 'chesarex/webservice-cep', 'id': 'd3f173b11cf7b4b5ed7c1f7da075bf404bb56aa7', 'size': '195', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'public/ceps/52/020/217/cep.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
import os, re, yaml
class Convertible:
def read_yaml(self, path):
""" read the yaml front matter """
with open(path) as stream:
content = stream.read()
groups = re.match('---\s+(.*?)\s+---\s+(.*)', content, re.S)
if groups:
return (yaml.load(groups.group(1)), groups.group(2))
return (None, None)
def render(self):
# get the desired template file from the environment
template = self.site.template_environment.get_template('%s.html' % self.meta['layout'])
# create the base path if it does not exist
base_path = os.path.relpath(os.path.join(self.site.settings['destination'], os.path.dirname(self.url)))
if not os.path.exists(base_path):
os.makedirs(base_path)
# write the rendered post to disk
with open(os.path.relpath(os.path.join(self.site.settings['destination'], self.url)), 'w') as stream:
stream.writelines(template.render(self.context)) | {'content_hash': '6861fd9099bdb575d7a85d0a156fadc3', 'timestamp': '', 'source': 'github', 'line_count': 32, 'max_line_length': 111, 'avg_line_length': 34.5, 'alnum_prop': 0.552536231884058, 'repo_name': 'ryancole/toaster', 'id': '30ebf2db6f521a8ceacb581dad3627debd1395c1', 'size': '1129', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'toaster/convertible.py', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Python', 'bytes': '12070'}]} |
infodir="/mnt/var/lib/info"
shutdown="/mnt/var/lib/instance-controller/public/shutdown-actions"
facility="local0"
logfile="/dev/shm/emr.log"
protocol="@@" ## TCP
VERSION="0.0.2"
SELF=`basename $0 .sh`
print_version()
{
echo $SELF version:$VERSION
}
print_usage()
{
cat << EOF
USAGE: ${0} -options
OPTIONS DESCRIPTION
OPTIONAL
-s <s3path> S3 path for logfile upload. ie. <bucket>/logs
-f <facility> Facility for EMR syslog traffic. Default:$facility
-l <logfile> EMR logfile. Default:$logfile
FLAGS
-D Enable debug mode
-V Print version
-h Print usage
-u Enable udp mode
EOF
}
while getopts ":f:s:l:DVhu" optname; do
case $optname in
D) set -x ;;
s) s3="$OPTARG" ;;
f) facility="$OPTARG" ;;
l) logfile="$OPTARG" ;;
u) protocol="@" ;;
h) print_usage
exit 0 ;;
V) print_version
exit 0 ;;
?) if [ "$optname" == ":" ]; then
echo "Option ${OPTARG} requires a parameter" 1>&2
else
echo "Option ${OPTARG} unkown" 1>&2
fi
exit 1;;
esac
done
if grep '"isMaster": true' $infodir/instance.json > /dev/null; then
## Verify logfile is accessible
sudo touch $logfile
## Install deps
sudo yum -y install aws-cli rsyslog logrotate
## Syslogd config
cat <<EOF | sudo tee /etc/rsyslog.d/master.conf 1>/dev/null
\$ModLoad imudp
\$UDPServerRun 514
\$ModLoad imtcp
\$InputTCPServerRun 514
\$SystemLogRateLimitInterval 0
${facility}.*$(echo -en "\t\t\t\t\t")-${logfile}
EOF
## LogRotate config
logname=`basename ${logfile} .log`
cat <<EOF | sudo tee /etc/logrotate.d/$logname 1>/dev/null
${logfile}
{
size 1024M
rotate 10
postrotate
/bin/kill -HUP \`cat /var/run/syslogd.pid 2>/dev/null\` 2>/dev/null || true
endscript
compress
dateext
dateformat .%s
EOF
## Set backup to log-uri if available and location not set
if [ -z "$s3" ]; then
eval $(grep -A2 " type: USER_LOG" $infodir/job-flow-state.txt | tr -d ' ' | tr ':' '=' | tr '"' \')
if [ -n "$bucket" ]; then
s3="$bucket/${keyPrefix}syslog/"
else
: ## S3 backup not enabled
fi
else
jobid=`awk -F':' '/jobFlowId/ {
gsub(/(^ *|"|,)/,"",$2)
print $2
}' $infodir/job-flow.json`
s3="$s3/$jobid/syslog/"
fi
if [ -n "$s3" ]; then
## Enable backup to s3
eval `echo ${s3#*//} | sed -e 's@^\([^/]*\).*@bucket=\1@'`
region=`aws s3api get-bucket-location --bucket $bucket --query \
'LocationConstraint'`
: ${region:=us-east-1}
## Location returns null in newer version of cli
if [ "$region" == "null" ]; then
region='us-east-1'
fi
## Add upload to S3 script
cat <<EOF | sudo tee -a /etc/logrotate.d/$logname 1>/dev/null
lastaction
for i in \${1//[[:space:]]}.*.gz; do
aws s3 mv "\$i" "s3://$s3" --region ${region//\"/} --sse
done
endscript
EOF
## Force logrotate on term
cat <<EOF | sudo tee $shutdown/logrotate-$logname 1>/dev/null
#!/bin/bash
sudo /usr/sbin/logrotate -f /etc/logrotate.d/$logname
EOF
sudo chmod +x $shutdown/logrotate-$logname
fi
## Closing brace
cat <<EOF | sudo tee -a /etc/logrotate.d/$logname 1>/dev/null
}
EOF
## Run more frequent
sudo cat <<EOF | sudo tee /etc/cron.d/$logname 1>/dev/null
*/5 * * * * root /usr/sbin/logrotate /etc/logrotate.d/$logname
EOF
else
## Install deps
sudo yum -y install rsyslog
master=`awk -F':' '/masterPrivateDnsName/ {
gsub(/(^ *|"|,)/,"",$2)
print $2
}' $infodir/job-flow.json`
## Create syslog fwd rule
cat <<EOF | sudo tee /etc/rsyslog.d/fwd-master.conf 1>/dev/null
\$SystemLogRateLimitInterval 0
# ### begin forwarding rule ###
\$WorkDirectory /var/lib/rsyslog
\$ActionQueueFileName fwdRule1
\$ActionQueueMaxDiskSpace 2g
\$ActionQueueSaveOnShutdown on
\$ActionQueueType LinkedList
\$ActionResumeRetryCount -1
${facility}.* ${protocol}${master}:514
# ### end of the forwarding rule ###
EOF
fi
## Remove facility from standard /var/log/messages
sudo sed -i".org" \
-e '/messages$/s@^\([^ ]*\)\(.*\)@\1;'${facility}'.none\2@' \
/etc/rsyslog.conf
sudo service rsyslog restart
| {'content_hash': '6b1bcac86959b30d98504fd92f6fdc88', 'timestamp': '', 'source': 'github', 'line_count': 174, 'max_line_length': 108, 'avg_line_length': 26.603448275862068, 'alnum_prop': 0.5482825664290344, 'repo_name': 'IanMeyers/aws-big-data-blog', 'id': '1fc76434dc4b860228ae66f73f2b38b7f47a9daf', 'size': '4645', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'aws-blog-campanile/bootstrap/syslog-setup.sh', 'mode': '33261', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '2126'}, {'name': 'HTML', 'bytes': '14729'}, {'name': 'Java', 'bytes': '208543'}, {'name': 'JavaScript', 'bytes': '79896'}, {'name': 'PLpgSQL', 'bytes': '1907'}, {'name': 'Python', 'bytes': '9207'}, {'name': 'Scala', 'bytes': '4446'}, {'name': 'Shell', 'bytes': '2201'}]} |
<?php
/**
* wallee SDK
*
* This library allows to interact with the wallee payment service.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Wallee\Sdk\Model;
use \ArrayAccess;
use \Wallee\Sdk\ObjectSerializer;
/**
* ProductPeriodFeeUpdate model
*
* @category Class
* @description
* @package Wallee\Sdk
* @author customweb GmbH
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License v2
*/
class ProductPeriodFeeUpdate implements ModelInterface, ArrayAccess
{
const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $swaggerModelName = 'ProductPeriodFee.Update';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $swaggerTypes = [
'id' => 'int',
'version' => 'int',
'component' => 'int',
'description' => '\Wallee\Sdk\Model\DatabaseTranslatedStringCreate',
'ledger_entry_title' => '\Wallee\Sdk\Model\DatabaseTranslatedStringCreate',
'name' => '\Wallee\Sdk\Model\DatabaseTranslatedStringCreate',
'number_of_free_trial_periods' => 'int',
'period_fee' => '\Wallee\Sdk\Model\PersistableCurrencyAmountUpdate[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $swaggerFormats = [
'id' => 'int64',
'version' => 'int64',
'component' => 'int64',
'description' => null,
'ledger_entry_title' => null,
'name' => null,
'number_of_free_trial_periods' => 'int32',
'period_fee' => null
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'id' => 'id',
'version' => 'version',
'component' => 'component',
'description' => 'description',
'ledger_entry_title' => 'ledgerEntryTitle',
'name' => 'name',
'number_of_free_trial_periods' => 'numberOfFreeTrialPeriods',
'period_fee' => 'periodFee'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'id' => 'setId',
'version' => 'setVersion',
'component' => 'setComponent',
'description' => 'setDescription',
'ledger_entry_title' => 'setLedgerEntryTitle',
'name' => 'setName',
'number_of_free_trial_periods' => 'setNumberOfFreeTrialPeriods',
'period_fee' => 'setPeriodFee'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'id' => 'getId',
'version' => 'getVersion',
'component' => 'getComponent',
'description' => 'getDescription',
'ledger_entry_title' => 'getLedgerEntryTitle',
'name' => 'getName',
'number_of_free_trial_periods' => 'getNumberOfFreeTrialPeriods',
'period_fee' => 'getPeriodFee'
];
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->container['id'] = isset($data['id']) ? $data['id'] : null;
$this->container['version'] = isset($data['version']) ? $data['version'] : null;
$this->container['component'] = isset($data['component']) ? $data['component'] : null;
$this->container['description'] = isset($data['description']) ? $data['description'] : null;
$this->container['ledger_entry_title'] = isset($data['ledger_entry_title']) ? $data['ledger_entry_title'] : null;
$this->container['name'] = isset($data['name']) ? $data['name'] : null;
$this->container['number_of_free_trial_periods'] = isset($data['number_of_free_trial_periods']) ? $data['number_of_free_trial_periods'] : null;
$this->container['period_fee'] = isset($data['period_fee']) ? $data['period_fee'] : null;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['version'] === null) {
$invalidProperties[] = "'version' can't be null";
}
return $invalidProperties;
}
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function swaggerTypes()
{
return self::$swaggerTypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function swaggerFormats()
{
return self::$swaggerFormats;
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$swaggerModelName;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets id
*
* @return int
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param int $id The ID is the primary key of the entity. The ID identifies the entity uniquely.
*
* @return $this
*/
public function setId($id)
{
$this->container['id'] = $id;
return $this;
}
/**
* Gets version
*
* @return int
*/
public function getVersion()
{
return $this->container['version'];
}
/**
* Sets version
*
* @param int $version The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
*
* @return $this
*/
public function setVersion($version)
{
$this->container['version'] = $version;
return $this;
}
/**
* Gets component
*
* @return int
*/
public function getComponent()
{
return $this->container['component'];
}
/**
* Sets component
*
* @param int $component
*
* @return $this
*/
public function setComponent($component)
{
$this->container['component'] = $component;
return $this;
}
/**
* Gets description
*
* @return \Wallee\Sdk\Model\DatabaseTranslatedStringCreate
*/
public function getDescription()
{
return $this->container['description'];
}
/**
* Sets description
*
* @param \Wallee\Sdk\Model\DatabaseTranslatedStringCreate $description The description of a component fee describes the fee to the subscriber. The description may be shown in documents or on certain user interfaces.
*
* @return $this
*/
public function setDescription($description)
{
$this->container['description'] = $description;
return $this;
}
/**
* Gets ledger_entry_title
*
* @return \Wallee\Sdk\Model\DatabaseTranslatedStringCreate
*/
public function getLedgerEntryTitle()
{
return $this->container['ledger_entry_title'];
}
/**
* Sets ledger_entry_title
*
* @param \Wallee\Sdk\Model\DatabaseTranslatedStringCreate $ledger_entry_title The ledger entry title will be used for the title in the ledger entry and in the invoice.
*
* @return $this
*/
public function setLedgerEntryTitle($ledger_entry_title)
{
$this->container['ledger_entry_title'] = $ledger_entry_title;
return $this;
}
/**
* Gets name
*
* @return \Wallee\Sdk\Model\DatabaseTranslatedStringCreate
*/
public function getName()
{
return $this->container['name'];
}
/**
* Sets name
*
* @param \Wallee\Sdk\Model\DatabaseTranslatedStringCreate $name The name of the fee should describe for the subscriber in few words for what the fee is for.
*
* @return $this
*/
public function setName($name)
{
$this->container['name'] = $name;
return $this;
}
/**
* Gets number_of_free_trial_periods
*
* @return int
*/
public function getNumberOfFreeTrialPeriods()
{
return $this->container['number_of_free_trial_periods'];
}
/**
* Sets number_of_free_trial_periods
*
* @param int $number_of_free_trial_periods The number of free trial periods specify how many periods are free of charge at the begining of the subscription.
*
* @return $this
*/
public function setNumberOfFreeTrialPeriods($number_of_free_trial_periods)
{
$this->container['number_of_free_trial_periods'] = $number_of_free_trial_periods;
return $this;
}
/**
* Gets period_fee
*
* @return \Wallee\Sdk\Model\PersistableCurrencyAmountUpdate[]
*/
public function getPeriodFee()
{
return $this->container['period_fee'];
}
/**
* Sets period_fee
*
* @param \Wallee\Sdk\Model\PersistableCurrencyAmountUpdate[] $period_fee The period fee is charged for every period of the subscription except for those periods which are trial periods.
*
* @return $this
*/
public function setPeriodFee($period_fee)
{
$this->container['period_fee'] = $period_fee;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed
*/
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
/**
* Sets value based on offset.
*
* @param integer $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
}
}
| {'content_hash': '172940661760cc051aaadebbaeee3d21', 'timestamp': '', 'source': 'github', 'line_count': 528, 'max_line_length': 220, 'avg_line_length': 24.577651515151516, 'alnum_prop': 0.5686214071048779, 'repo_name': 'wallee-payment/shopware', 'id': '8c7bf95f850ea77ff7060cb2be6d16510def0869', 'size': '12977', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'custom/plugins/WalleePayment/vendor/Wallee/Sdk/lib/Model/ProductPeriodFeeUpdate.php', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '1773'}, {'name': 'JavaScript', 'bytes': '128071'}, {'name': 'PHP', 'bytes': '300706'}, {'name': 'Smarty', 'bytes': '6305'}]} |
<footer class="main-footer">
<div class="pull-right hidden-xs">
Supported by<b> CodeIgniter and <a href="http://almsaeedstudio.com">AdminLTE</a></b>
</div>
<strong>© 2016 - 2017 <a href="#">ICSITech 2017 Developer Team</a></strong>
</footer>
</div>
<!-- ./wrapper -->
<!-- jQuery 2.2.3 -->
<script src="<?php echo base_url(); ?>assets/js/jquery-1.9.1.min.js"></script>
<!-- jQuery UI 1.11.4 -->
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
$.widget.bridge('uibutton', $.ui.button);
</script>
<!-- Bootstrap 3.3.6 -->
<script src="<?php echo base_url(); ?>assets/js/bootstrap.min.js"></script>
<!-- Morris.js charts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<!-- AdminLTE App -->
<script src="<?php echo base_url(); ?>assets/js/adminlte/app.min.js"></script>
<script src="<?php echo base_url(); ?>assets/datatables/jquery.dataTables.min.js"></script>
<script src="<?php echo base_url(); ?>assets/datatables/dataTables.bootstrap.js"></script>
<script src="<?php echo base_url(); ?>assets/js/highchart.js"></script>
<script>
$('.pop').popover();
$('#allAcc').DataTable();
$(function () {
Highcharts.chart('myChart', {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: true,
type: 'pie'
},
title: {
text: 'ICSITech2017 Verified Participant'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
}
},
series: [{
name: 'Participant',
colorByPoint: true,
data: [{
name: 'Verified',
y: <?php if(isset($v)) echo $v; else echo "0"; ?>,
color :'yellow'
}, {
name: 'Unverified',
y: <?php if(isset($v)) echo $uv; else echo "0";?>,
color : 'skyblue'
// sliced: true
}]
}]
});
});
</script>
</body>
</html> | {'content_hash': 'e4c1b18bce5d202a8cc2d1b14a15ebfe', 'timestamp': '', 'source': 'github', 'line_count': 76, 'max_line_length': 99, 'avg_line_length': 34.55263157894737, 'alnum_prop': 0.507996953541508, 'repo_name': 'trisamsul/ICSITech', 'id': 'a86ca231047dfd5323f6ca54d9ca68a5503cf488', 'size': '2626', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'application/views/dashboard/layout/footer.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '401'}, {'name': 'CSS', 'bytes': '335519'}, {'name': 'HTML', 'bytes': '1697940'}, {'name': 'JavaScript', 'bytes': '1045249'}, {'name': 'PHP', 'bytes': '1922153'}]} |
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages/"/>
<property name="suffix" value=".jsp"/>
<property name="order" value="2" />
</bean>
</beans> | {'content_hash': '3fff44a464d988767decb6a4ec88e21d', 'timestamp': '', 'source': 'github', 'line_count': 12, 'max_line_length': 84, 'avg_line_length': 43.5, 'alnum_prop': 0.6762452107279694, 'repo_name': 'if045/tender', 'id': 'd9d613ed5559daa558d106628cca576748d61aae', 'size': '522', 'binary': False, 'copies': '1', 'ref': 'refs/heads/develop', 'path': 'src/main/webapp/WEB-INF/spring-servlet.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '44348'}, {'name': 'Java', 'bytes': '242946'}, {'name': 'JavaScript', 'bytes': '131167'}]} |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_loop_45.c
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE193.label.xml
Template File: sources-sink-45.tmpl.c
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: Allocate memory for a string, but do not allocate space for NULL terminator
* GoodSource: Allocate enough memory for a string and the NULL terminator
* Sinks: loop
* BadSink : Copy array to data using a loop
* Flow Variant: 45 Data flow: data passed as a static global variable from one function to another in the same source file
*
* */
#include "std_testcase.h"
#ifndef _WIN32
#include <wchar.h>
#endif
/* MAINTENANCE NOTE: The length of this string should equal the 10 */
#define SRC_STRING "AAAAAAAAAA"
static char * CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_loop_45_badData;
static char * CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_loop_45_goodG2BData;
#ifndef OMITBAD
static void badSink()
{
char * data = CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_loop_45_badData;
{
char source[10+1] = SRC_STRING;
size_t i, sourceLen;
sourceLen = strlen(source);
/* Copy length + 1 to include NUL terminator from source */
/* POTENTIAL FLAW: data may not have enough space to hold source */
for (i = 0; i < sourceLen + 1; i++)
{
data[i] = source[i];
}
printLine(data);
free(data);
}
}
void CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_loop_45_bad()
{
char * data;
data = NULL;
/* FLAW: Did not leave space for a null terminator */
data = (char *)malloc(10*sizeof(char));
CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_loop_45_badData = data;
badSink();
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() uses the GoodSource with the BadSink */
static void goodG2BSink()
{
char * data = CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_loop_45_goodG2BData;
{
char source[10+1] = SRC_STRING;
size_t i, sourceLen;
sourceLen = strlen(source);
/* Copy length + 1 to include NUL terminator from source */
/* POTENTIAL FLAW: data may not have enough space to hold source */
for (i = 0; i < sourceLen + 1; i++)
{
data[i] = source[i];
}
printLine(data);
free(data);
}
}
static void goodG2B()
{
char * data;
data = NULL;
/* FIX: Allocate space for a null terminator */
data = (char *)malloc((10+1)*sizeof(char));
CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_loop_45_goodG2BData = data;
goodG2BSink();
}
void CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_loop_45_good()
{
goodG2B();
}
#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()...");
CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_loop_45_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_loop_45_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| {'content_hash': 'f6964d9f90b8f1bfa05d323df724f5d4', 'timestamp': '', 'source': 'github', 'line_count': 123, 'max_line_length': 123, 'avg_line_length': 30.130081300813007, 'alnum_prop': 0.635456017269293, 'repo_name': 'maurer/tiamat', 'id': '607f4d38f0d7e35dbde3a8b2cdaf24f3e8ca6e09', 'size': '3706', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'samples/Juliet/testcases/CWE122_Heap_Based_Buffer_Overflow/s06/CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_loop_45.c', 'mode': '33188', 'license': 'mit', 'language': []} |
Introduction
============
AngryNinjas is a complete game sample built using the Cocos2D-XNA game
engine. The program shows how to implement a level menu, as well as
how to build a Cocos2D game using C# and demostrates the use of Box2D
for physics.
Cocos2D-XNA is a pure C# port of Cocos2D built on top of the
MonoGame/XNA engine.

Features
========
Supports multiple platforms and form factors:
* Android
* MacOS X
* Ouya
* iPad
* iPhone
* Windows
* Windows Phone
* XBox 360 with XNA
Building AngryNinjas
====================
To build AngryNinjas, create a directory where you will want to build
the source code, and checkout cocos2d-xna and MonoGame, side by side
AngryNinjas. You can use the following command in your shell to do
so:
git clone git://github.com/mono/cocos2d-xna.git
git clone git://github.com/mono/MonoGame.git
git clone git://github.com/xamarin/AngryNinjas
Then open the solution for the platform that you want to target.
Currently there are solutions for: Android, MacOS X, Ouya, iOS,
Windows, Windows Phone and XNA.
License and Copyright
=====================
AngryNinjas was originally developed by CartoonSmart. Xamarin
purchased the rights to distribute the C# port code under the MIT X11
license. Additional porting work was contributed by Totally Evil
Entertainment.
The contents of this git module are licensed under the terms of the
MIT X11 license, including both the C# code as well as the artwork in
the game and can be reused as you see fit.
CartoonSmart: http://www.cartoonsmart.com
Xamarin: http://www.xamarin.com
Totally Evil Entertainment: http://www.totallyevil.com
| {'content_hash': '67975954ec892a4e504264e14525bb67', 'timestamp': '', 'source': 'github', 'line_count': 60, 'max_line_length': 88, 'avg_line_length': 28.65, 'alnum_prop': 0.7527632344386271, 'repo_name': 'sammosampson/AngryNinjas', 'id': '462756588783c99215891e731260376bbbd506b2', 'size': '1719', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'README.md', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '188720'}]} |
<?php
declare(strict_types=1);
namespace spec\Sylius\Bundle\UserBundle\Form\Model;
use PhpSpec\ObjectBehavior;
use Sylius\Bundle\UserBundle\Form\Model\PasswordReset;
/**
* @author Łukasz Chruściel <[email protected]>
*/
final class PasswordResetSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->shouldHaveType(PasswordReset::class);
}
function it_has_new_password()
{
$this->setPassword('testPassword');
$this->getPassword()->shouldReturn('testPassword');
}
}
| {'content_hash': '0f32257c5c86fee6225b9d554a62f18a', 'timestamp': '', 'source': 'github', 'line_count': 27, 'max_line_length': 59, 'avg_line_length': 20.25925925925926, 'alnum_prop': 0.696526508226691, 'repo_name': 'gruberro/Sylius', 'id': 'd053a580fadb73def61e00d9d87c600a10db76a0', 'size': '760', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'src/Sylius/Bundle/UserBundle/spec/Form/Model/PasswordResetSpec.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '601'}, {'name': 'CSS', 'bytes': '2150'}, {'name': 'Gherkin', 'bytes': '789207'}, {'name': 'HTML', 'bytes': '302984'}, {'name': 'JavaScript', 'bytes': '70954'}, {'name': 'PHP', 'bytes': '6677913'}, {'name': 'Shell', 'bytes': '28860'}]} |
ACCEPTED
#### According to
Interim Register of Marine and Nonmarine Genera
#### Published in
Bull. Surv. Geol. Oklahoma, No. 53, 15.
#### Original name
null
### Remarks
null | {'content_hash': '2603a925748d4ffe6d7b84e243cac409', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 47, 'avg_line_length': 13.615384615384615, 'alnum_prop': 0.7005649717514124, 'repo_name': 'mdoering/backbone', 'id': '3f62b98434dc57d89d8495774e49219cdd6006ed', 'size': '228', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Protozoa/Granuloreticulosea/Foraminiferida/Rectocornuspira/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
// Copyright (c) 2015 Cloudera, Inc.
package com.cloudera.director.spi.tck;
import static com.cloudera.director.spi.tck.util.Preconditions.checkNotNull;
import com.cloudera.director.spi.tck.util.ClassReference;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.logging.Logger;
import org.apache.commons.io.IOUtils;
/**
* Plugin metadata extracted from the packaged jar file that contains
* the cloud provider implementation.
*/
public class PluginMetadata {
private static final Logger LOG = Logger.getLogger(PluginMetadata.class.getName());
private static final String CLASS_FILE_EXTENSION = ".class";
private static final String PROVIDER_CONFIGURATION_START = "META-INF/services/";
private static final int PROVIDER_CONFIGURATION_START_LEN = PROVIDER_CONFIGURATION_START.length();
/**
* Loads the plugin metadata from the JAR.
*
* @param jar plugin JAR
* @return plugin metadata
* @throws IllegalStateException if an unknown launcher interface is found
*/
public static PluginMetadata fromExternalJarFile(JarFile jar) throws IOException {
// Collect all the entries in the jar file and group them:
// - classes
// - provider configuration files, which should describe launchers
// - regular files
Map<String, List<ClassReference>> launchers = new HashMap<String, List<ClassReference>>();
List<String> classes = new ArrayList<String>();
List<String> files = new ArrayList<String>();
Enumeration<JarEntry> entries = jar.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
if (entry.isDirectory()) {
continue;
}
String name = entry.getName();
if (name.endsWith(CLASS_FILE_EXTENSION)) {
classes.add(compiledFilePathToClassName(name));
} else if (name.startsWith(PROVIDER_CONFIGURATION_START)) {
// file is META-INF/services/binary.name.of.launcher.interface
// content is list of launcher implementation, one per line, with # comments
String spiVersion = getSpiVersion(name.substring(PROVIDER_CONFIGURATION_START_LEN));
if (spiVersion == null) {
continue;
}
List<String> launcherClasses = IOUtils.readLines(jar.getInputStream(entry), "UTF-8");
List<ClassReference> refs = new ArrayList<ClassReference>();
for (String launcherClass : launcherClasses) {
if (launcherClass.startsWith("#")) {
continue;
}
int firstCommentMarker = launcherClass.indexOf("#");
if (firstCommentMarker != -1) {
launcherClass = launcherClass.substring(0, firstCommentMarker);
}
refs.add(new ClassReference(launcherClass.trim()));
}
// the expectation is that there is exactly one launcher interface per
// SPI version
launchers.put(spiVersion, refs);
} else {
files.add(name);
}
}
return new PluginMetadata(launchers, classes, files);
}
private static String compiledFilePathToClassName(String path) {
return path.replace("/", ".").substring(0, path.length() - CLASS_FILE_EXTENSION.length());
}
private static final Map<String, String> LAUNCHER_INTERFACE_VERSIONS;
static {
LAUNCHER_INTERFACE_VERSIONS = new HashMap<String, String>();
LAUNCHER_INTERFACE_VERSIONS.put("com.cloudera.director.spi.v1.provider.Launcher", "v1");
// add future interface versions here
}
/**
* Gets the SPI version for a named launcher interface.
*
* @param launcherInterface launcher interface name
* @return SPI version, or null if this doesn't appear to be a launcher interface
* @throws IllegalStateException if the launcher interface is unknown
*/
static String getSpiVersion(String launcherInterface) {
String spiVersion = LAUNCHER_INTERFACE_VERSIONS.get(launcherInterface);
if (spiVersion == null) {
if (!launcherInterface.startsWith("com.cloudera.director.spi")) {
LOG.warning("Found provider configuration file for " + launcherInterface +
", assuming not an SPI launcher interface");
return null; // must be for some other service
}
// missing from table!
throw new IllegalStateException("Unknown launcher interface " + launcherInterface);
}
return spiVersion;
}
private final Map<String, List<ClassReference>> launchers;
private final List<String> classes;
private final List<String> files;
/**
* Creates new plugin metadata.
*
* @param launchers map of SPI versions to launcher references
* @param classes list of classes in plugin
* @param files list of other files in plugin
* @throws NullPointerException if any argument is null
*/
public PluginMetadata(Map<String, List<ClassReference>> launchers,
List<String> classes, List<String> files) {
Map<String, List<ClassReference>> launchersCopy = new HashMap<String, List<ClassReference>>();
for (Map.Entry<String, List<ClassReference>> e :
checkNotNull(launchers, "launchers is null").entrySet()) {
launchersCopy.put(e.getKey(), Collections.unmodifiableList(new ArrayList(e.getValue())));
}
this.launchers = Collections.unmodifiableMap(launchersCopy);
this.classes = Collections.unmodifiableList(new ArrayList<String>(classes));
this.files = Collections.unmodifiableList(new ArrayList<String>(files));
}
/**
* Gets the launchers in the plugin.
*
* @return launchers, as a map of SPI versions to launcher references
*/
public Map<String, List<ClassReference>> getLaunchers() {
return launchers;
}
/**
* Gets the SPI versions supported by the plugin.
*
* @return SPI versions
*/
public Set<String> getSpiVersions() {
return Collections.unmodifiableSet(launchers.keySet());
}
/**
* Gets references to the launcher classes available for the given SPI
* version.
*
* @param spiVersion SPI version
* @return list of launcher class references, or null if none available
*/
public List<ClassReference> getLauncherClasses(String spiVersion) {
return launchers.get(spiVersion);
}
/**
* Gets the names of classes in the plugin.
*
* @return class names
*/
public List<String> getClasses() {
return classes;
}
/**
* Gets the names of non-class files in the plugin.
*
* @return non-class file names
*/
public List<String> getFiles() {
return files;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PluginMetadata that = (PluginMetadata) o;
if (!launchers.equals(that.launchers)) return false;
if (!classes.equals(that.classes)) return false;
if (!files.equals(that.files)) return false;
return true;
}
@Override
public int hashCode() {
int result = launchers.hashCode();
result = 31 * result + classes.hashCode();
result = 31 * result + files.hashCode();
return result;
}
@Override
public String toString() {
return "PluginMetadata{" +
"launchers=" + launchers +
", classesCount=" + classes.size() +
", filesCount=" + files.size() +
'}';
}
}
| {'content_hash': 'b046f5d92cdb5c1db195a832f7c44761', 'timestamp': '', 'source': 'github', 'line_count': 234, 'max_line_length': 100, 'avg_line_length': 32.01282051282051, 'alnum_prop': 0.6821519156320919, 'repo_name': 'mbrukman/cloudera-director-spi-tck', 'id': 'c47866e364e86f92ee742119c867df586f60b7ba', 'size': '7491', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/com/cloudera/director/spi/tck/PluginMetadata.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '49344'}]} |
package org.apache.parquet.column.values.plain;
import java.io.IOException;
import java.nio.charset.Charset;
import org.apache.parquet.bytes.ByteBufferAllocator;
import org.apache.parquet.bytes.BytesInput;
import org.apache.parquet.bytes.CapacityByteArrayOutputStream;
import org.apache.parquet.bytes.LittleEndianDataOutputStream;
import org.apache.parquet.column.Encoding;
import org.apache.parquet.column.values.ValuesWriter;
import org.apache.parquet.io.ParquetEncodingException;
import org.apache.parquet.io.api.Binary;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Plain encoding except for booleans
*/
public class PlainValuesWriter extends ValuesWriter {
private static final Logger LOG = LoggerFactory.getLogger(PlainValuesWriter.class);
public static final Charset CHARSET = Charset.forName("UTF-8");
private CapacityByteArrayOutputStream arrayOut;
private LittleEndianDataOutputStream out;
public PlainValuesWriter(int initialSize, int pageSize, ByteBufferAllocator allocator) {
arrayOut = new CapacityByteArrayOutputStream(initialSize, pageSize, allocator);
out = new LittleEndianDataOutputStream(arrayOut);
}
@Override
public final void writeBytes(Binary v) {
try {
out.writeInt(v.length());
v.writeTo(out);
} catch (IOException e) {
throw new ParquetEncodingException("could not write bytes", e);
}
}
@Override
public final void writeInteger(int v) {
try {
out.writeInt(v);
} catch (IOException e) {
throw new ParquetEncodingException("could not write int", e);
}
}
@Override
public final void writeLong(long v) {
try {
out.writeLong(v);
} catch (IOException e) {
throw new ParquetEncodingException("could not write long", e);
}
}
@Override
public final void writeFloat(float v) {
try {
out.writeFloat(v);
} catch (IOException e) {
throw new ParquetEncodingException("could not write float", e);
}
}
@Override
public final void writeDouble(double v) {
try {
out.writeDouble(v);
} catch (IOException e) {
throw new ParquetEncodingException("could not write double", e);
}
}
@Override
public void writeByte(int value) {
try {
out.write(value);
} catch (IOException e) {
throw new ParquetEncodingException("could not write byte", e);
}
}
@Override
public long getBufferedSize() {
return arrayOut.size();
}
@Override
public BytesInput getBytes() {
try {
out.flush();
} catch (IOException e) {
throw new ParquetEncodingException("could not write page", e);
}
if (LOG.isDebugEnabled()) LOG.debug("writing a buffer of size {}", arrayOut.size());
return BytesInput.from(arrayOut);
}
@Override
public void reset() {
arrayOut.reset();
}
@Override
public void close() {
arrayOut.close();
out.close();
}
@Override
public long getAllocatedSize() {
return arrayOut.getCapacity();
}
@Override
public Encoding getEncoding() {
return Encoding.PLAIN;
}
@Override
public String memUsageString(String prefix) {
return arrayOut.memUsageString(prefix + " PLAIN");
}
}
| {'content_hash': 'afdf95c536cab1d170659c8e3fe89028', 'timestamp': '', 'source': 'github', 'line_count': 131, 'max_line_length': 90, 'avg_line_length': 24.480916030534353, 'alnum_prop': 0.6962893670096664, 'repo_name': 'apache/parquet-mr', 'id': 'bc5bdda0a1eec9044351d07014d5fd131f36a690', 'size': '4017', 'binary': False, 'copies': '6', 'ref': 'refs/heads/master', 'path': 'parquet-column/src/main/java/org/apache/parquet/column/values/plain/PlainValuesWriter.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '5572665'}, {'name': 'Python', 'bytes': '14771'}, {'name': 'Scala', 'bytes': '8436'}, {'name': 'Shell', 'bytes': '14860'}, {'name': 'Thrift', 'bytes': '10354'}]} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
null
#### Original name
Teichospora moriformis Fuckel
### Remarks
null | {'content_hash': '15ee4bf4b72ecfbfa51a2b59edf1e632', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 29, 'avg_line_length': 10.307692307692308, 'alnum_prop': 0.7238805970149254, 'repo_name': 'mdoering/backbone', 'id': 'd6b345148a445528db71748decd37a7f6f367adb', 'size': '187', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Fungi/Ascomycota/Dothideomycetes/Pleosporales/Dacampiaceae/Teichospora/Teichospora moriformis/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
package com.google.api.ads.dfp.jaxws.v201306;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
*
* Gets a {@link ProductTemplatePage} of {@link ProductTemplate} objects
* that satisfy the filtering criteria specified by given {@link Statement#query}.
* The following fields are supported for filtering:
*
* <table>
* <tr>
* <th scope="col">PQL Property</th> <th scope="col">Object Property</th>
* </tr>
* <tr>
* <td>{@code id}</td>
* <td>{@link ProductTemplate#id}</td>
* </tr>
* <tr>
* <td>{@code name}</td>
* <td>{@link ProductTemplate#name}</td>
* </tr>
* <tr>
* <td>{@code nameMacro}</td>
* <td>{@link ProductTemplate#nameMacro}</td>
* </tr>
* <tr>
* <td>{@code description}</td>
* <td>{@link ProductTemplate#description}</td>
* </tr>
* <tr>
* <td>{@code status}</td>
* <td>{@link ProductTemplate#status}</td>
* </tr>
* <tr>
* <td>{@code lastModifiedDateTime}</td>
* <td>{@link ProductTemplate#lastModifiedDateTime}</td>
* </tr>
* <tr>
* <td>{@code lineItemType}</td>
* <td>{@link LineItemType}</td>
* </tr>
* <tr>
* <td>{@code productType}</td>
* <td>{@link ProductType}</td>
* </tr>
* <tr>
* <td>{@code rateType}</td>
* <td>{@link RateType}</td>
* </tr>
* </table>
*
* @param statement a Publisher Query Language statement which specifies the
* filtering criteria over productTemplates
* @return the productTemplates that match the given statement
*
*
* <p>Java class for getProductTemplatesByStatement element declaration.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <element name="getProductTemplatesByStatement">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="statement" type="{https://www.google.com/apis/ads/publisher/v201306}Statement" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"statement"
})
@XmlRootElement(name = "getProductTemplatesByStatement")
public class ProductTemplateServiceInterfacegetProductTemplatesByStatement {
protected Statement statement;
/**
* Gets the value of the statement property.
*
* @return
* possible object is
* {@link Statement }
*
*/
public Statement getStatement() {
return statement;
}
/**
* Sets the value of the statement property.
*
* @param value
* allowed object is
* {@link Statement }
*
*/
public void setStatement(Statement value) {
this.statement = value;
}
}
| {'content_hash': 'b6c838bec55cd1e50a88c52717e0eb5f', 'timestamp': '', 'source': 'github', 'line_count': 116, 'max_line_length': 125, 'avg_line_length': 30.732758620689655, 'alnum_prop': 0.5270687237026648, 'repo_name': 'nafae/developer', 'id': '0c9e2120988e2d7012b5416e298ac6c44e667df1', 'size': '3565', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'modules/dfp_appengine/src/main/java/com/google/api/ads/dfp/jaxws/v201306/ProductTemplateServiceInterfacegetProductTemplatesByStatement.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '127846798'}, {'name': 'Perl', 'bytes': '28418'}]} |
package com.tyrant.aboutme;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
| {'content_hash': 'aeb6cd9b34022ce5f9a8ba79c25320fc', 'timestamp': '', 'source': 'github', 'line_count': 38, 'max_line_length': 46, 'avg_line_length': 17.0, 'alnum_prop': 0.5743034055727554, 'repo_name': 'fscorro/aboutme', 'id': '6417f4acc68561c00539ff8b45325ca74d6975a8', 'size': '646', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/test/java/com/tyrant/aboutme/AppTest.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '566'}, {'name': 'Java', 'bytes': '1325'}, {'name': 'JavaScript', 'bytes': '1071'}]} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>DcMotorImpl</title>
<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="DcMotorImpl";
}
//-->
</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 class="navBarCell1Rev">Class</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><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorEx.html" title="interface in com.qualcomm.robotcore.hardware"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImplEx.html" title="class in com.qualcomm.robotcore.hardware"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/qualcomm/robotcore/hardware/DcMotorImpl.html" target="_top">Frames</a></li>
<li><a href="DcMotorImpl.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>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.qualcomm.robotcore.hardware</div>
<h2 title="Class DcMotorImpl" class="title">Class DcMotorImpl</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>com.qualcomm.robotcore.hardware.DcMotorImpl</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a>, <a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html" title="interface in com.qualcomm.robotcore.hardware">DcMotorSimple</a>, <a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html" title="interface in com.qualcomm.robotcore.hardware">HardwareDevice</a></dd>
</dl>
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImplEx.html" title="class in com.qualcomm.robotcore.hardware">DcMotorImplEx</a></dd>
</dl>
<hr>
<br>
<pre>public class <span class="strong">DcMotorImpl</span>
extends java.lang.Object
implements <a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></pre>
<div class="block">Control a DC Motor attached to a DC Motor Controller</div>
<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorController.html" title="interface in com.qualcomm.robotcore.hardware"><code>DcMotorController</code></a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested_class_summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="nested_classes_inherited_from_class_com.qualcomm.robotcore.hardware.DcMotor">
<!-- -->
</a>
<h3>Nested classes/interfaces inherited from interface com.qualcomm.robotcore.hardware.<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></h3>
<code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.RunMode.html" title="enum in com.qualcomm.robotcore.hardware">DcMotor.RunMode</a>, <a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.ZeroPowerBehavior.html" title="enum in com.qualcomm.robotcore.hardware">DcMotor.ZeroPowerBehavior</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="nested_classes_inherited_from_class_com.qualcomm.robotcore.hardware.DcMotorSimple">
<!-- -->
</a>
<h3>Nested classes/interfaces inherited from interface com.qualcomm.robotcore.hardware.<a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html" title="interface in com.qualcomm.robotcore.hardware">DcMotorSimple</a></h3>
<code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.Direction.html" title="enum in com.qualcomm.robotcore.hardware">DcMotorSimple.Direction</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="nested_classes_inherited_from_class_com.qualcomm.robotcore.hardware.HardwareDevice">
<!-- -->
</a>
<h3>Nested classes/interfaces inherited from interface com.qualcomm.robotcore.hardware.<a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html" title="interface in com.qualcomm.robotcore.hardware">HardwareDevice</a></h3>
<code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.Manufacturer.html" title="enum in com.qualcomm.robotcore.hardware">HardwareDevice.Manufacturer</a></code></li>
</ul>
</li>
</ul>
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected <a href="../../../../com/qualcomm/robotcore/hardware/DcMotorController.html" title="interface in com.qualcomm.robotcore.hardware">DcMotorController</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#controller">controller</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected <a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.Direction.html" title="enum in com.qualcomm.robotcore.hardware">DcMotorSimple.Direction</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#direction">direction</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected <a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.RunMode.html" title="enum in com.qualcomm.robotcore.hardware">DcMotor.RunMode</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#mode">mode</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected int</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#portNumber">portNumber</a></strong></code> </td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#DcMotorImpl(com.qualcomm.robotcore.hardware.DcMotorController,%20int)">DcMotorImpl</a></strong>(<a href="../../../../com/qualcomm/robotcore/hardware/DcMotorController.html" title="interface in com.qualcomm.robotcore.hardware">DcMotorController</a> controller,
int portNumber)</code>
<div class="block">Constructor</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#DcMotorImpl(com.qualcomm.robotcore.hardware.DcMotorController,%20int,%20com.qualcomm.robotcore.hardware.DcMotorSimple.Direction)">DcMotorImpl</a></strong>(<a href="../../../../com/qualcomm/robotcore/hardware/DcMotorController.html" title="interface in com.qualcomm.robotcore.hardware">DcMotorController</a> controller,
int portNumber,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.Direction.html" title="enum in com.qualcomm.robotcore.hardware">DcMotorSimple.Direction</a> direction)</code>
<div class="block">Constructor</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#close()">close</a></strong>()</code>
<div class="block">Closes this device</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#getConnectionInfo()">getConnectionInfo</a></strong>()</code>
<div class="block">Get connection information about this device in a human readable format</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorController.html" title="interface in com.qualcomm.robotcore.hardware">DcMotorController</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#getController()">getController</a></strong>()</code>
<div class="block">Get DC motor controller</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#getCurrentPosition()">getCurrentPosition</a></strong>()</code>
<div class="block">Get the current encoder value.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#getDeviceName()">getDeviceName</a></strong>()</code>
<div class="block">Returns a string suitable for display to the user as to the type of device</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.Direction.html" title="enum in com.qualcomm.robotcore.hardware">DcMotorSimple.Direction</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#getDirection()">getDirection</a></strong>()</code>
<div class="block">Get the direction</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.Manufacturer.html" title="enum in com.qualcomm.robotcore.hardware">HardwareDevice.Manufacturer</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#getManufacturer()">getManufacturer</a></strong>()</code>
<div class="block">Returns an indication of the manufacturer of this device.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#getMaxSpeed()">getMaxSpeed</a></strong>()</code>
<div class="block">Returns the current maximum targetable speed for this motor when the motor is
running in one of the PID modes.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.RunMode.html" title="enum in com.qualcomm.robotcore.hardware">DcMotor.RunMode</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#getMode()">getMode</a></strong>()</code>
<div class="block">Get the current mode</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#getPortNumber()">getPortNumber</a></strong>()</code>
<div class="block">Get port number</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#getPower()">getPower</a></strong>()</code>
<div class="block">Get the current motor power</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#getPowerFloat()">getPowerFloat</a></strong>()</code>
<div class="block">Is motor power set to float?</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#getTargetPosition()">getTargetPosition</a></strong>()</code>
<div class="block">Get the current motor target position.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#getVersion()">getVersion</a></strong>()</code>
<div class="block">Version</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.ZeroPowerBehavior.html" title="enum in com.qualcomm.robotcore.hardware">DcMotor.ZeroPowerBehavior</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#getZeroPowerBehavior()">getZeroPowerBehavior</a></strong>()</code>
<div class="block">Returns the current behavior of the motor were a power level of zero to be applied.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#internalSetMode(com.qualcomm.robotcore.hardware.DcMotor.RunMode)">internalSetMode</a></strong>(<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.RunMode.html" title="enum in com.qualcomm.robotcore.hardware">DcMotor.RunMode</a> mode)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#internalSetPower(double)">internalSetPower</a></strong>(double power)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#internalSetTargetPosition(int)">internalSetTargetPosition</a></strong>(int position)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#isBusy()">isBusy</a></strong>()</code>
<div class="block">Is the motor busy?</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#resetDeviceConfigurationForOpMode()">resetDeviceConfigurationForOpMode</a></strong>()</code>
<div class="block">Resets the device's configuration to that which is expected at the beginning of an OpMode.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#setDirection(com.qualcomm.robotcore.hardware.DcMotorSimple.Direction)">setDirection</a></strong>(<a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.Direction.html" title="enum in com.qualcomm.robotcore.hardware">DcMotorSimple.Direction</a> direction)</code>
<div class="block">Set the direction</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#setMaxSpeed(int)">setMaxSpeed</a></strong>(int encoderTicksPerSecond)</code>
<div class="block">When the motor is running in one of the <a href="https://en.wikipedia.org/wiki/PID_controller">PID modes</a>
the value set using the <a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html#setPower(double)"><code>setPower()</code></a> method is indicative of a
desired motor <em>velocity</em> rather than a raw <em>power</em> level.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#setMode(com.qualcomm.robotcore.hardware.DcMotor.RunMode)">setMode</a></strong>(<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.RunMode.html" title="enum in com.qualcomm.robotcore.hardware">DcMotor.RunMode</a> mode)</code>
<div class="block">Set the current mode</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#setPower(double)">setPower</a></strong>(double power)</code>
<div class="block">Set the current motor power</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#setPowerFloat()">setPowerFloat</a></strong>()</code>
<div class="block"><strong>Deprecated.</strong> </div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#setTargetPosition(int)">setTargetPosition</a></strong>(int position)</code>
<div class="block">Set the motor target position, using an integer.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImpl.html#setZeroPowerBehavior(com.qualcomm.robotcore.hardware.DcMotor.ZeroPowerBehavior)">setZeroPowerBehavior</a></strong>(<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.ZeroPowerBehavior.html" title="enum in com.qualcomm.robotcore.hardware">DcMotor.ZeroPowerBehavior</a> zeroPowerBehavior)</code>
<div class="block">Sets the behavior of the motor when a power level of zero is applied.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="controller">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>controller</h4>
<pre>protected <a href="../../../../com/qualcomm/robotcore/hardware/DcMotorController.html" title="interface in com.qualcomm.robotcore.hardware">DcMotorController</a> controller</pre>
</li>
</ul>
<a name="portNumber">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>portNumber</h4>
<pre>protected int portNumber</pre>
</li>
</ul>
<a name="direction">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>direction</h4>
<pre>protected <a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.Direction.html" title="enum in com.qualcomm.robotcore.hardware">DcMotorSimple.Direction</a> direction</pre>
</li>
</ul>
<a name="mode">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>mode</h4>
<pre>protected <a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.RunMode.html" title="enum in com.qualcomm.robotcore.hardware">DcMotor.RunMode</a> mode</pre>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="DcMotorImpl(com.qualcomm.robotcore.hardware.DcMotorController, int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DcMotorImpl</h4>
<pre>public DcMotorImpl(<a href="../../../../com/qualcomm/robotcore/hardware/DcMotorController.html" title="interface in com.qualcomm.robotcore.hardware">DcMotorController</a> controller,
int portNumber)</pre>
<div class="block">Constructor</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>controller</code> - DC motor controller this motor is attached to</dd><dd><code>portNumber</code> - portNumber position on the controller</dd></dl>
</li>
</ul>
<a name="DcMotorImpl(com.qualcomm.robotcore.hardware.DcMotorController, int, com.qualcomm.robotcore.hardware.DcMotorSimple.Direction)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>DcMotorImpl</h4>
<pre>public DcMotorImpl(<a href="../../../../com/qualcomm/robotcore/hardware/DcMotorController.html" title="interface in com.qualcomm.robotcore.hardware">DcMotorController</a> controller,
int portNumber,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.Direction.html" title="enum in com.qualcomm.robotcore.hardware">DcMotorSimple.Direction</a> direction)</pre>
<div class="block">Constructor</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>controller</code> - DC motor controller this motor is attached to</dd><dd><code>portNumber</code> - portNumber port number on the controller</dd><dd><code>direction</code> - direction this motor should spin</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getManufacturer()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getManufacturer</h4>
<pre>public <a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.Manufacturer.html" title="enum in com.qualcomm.robotcore.hardware">HardwareDevice.Manufacturer</a> getManufacturer()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html#getManufacturer()">HardwareDevice</a></code></strong></div>
<div class="block">Returns an indication of the manufacturer of this device.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html#getManufacturer()">getManufacturer</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html" title="interface in com.qualcomm.robotcore.hardware">HardwareDevice</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>the device's manufacturer</dd></dl>
</li>
</ul>
<a name="getDeviceName()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDeviceName</h4>
<pre>public java.lang.String getDeviceName()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html#getDeviceName()">HardwareDevice</a></code></strong></div>
<div class="block">Returns a string suitable for display to the user as to the type of device</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html#getDeviceName()">getDeviceName</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html" title="interface in com.qualcomm.robotcore.hardware">HardwareDevice</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>device manufacturer and name</dd></dl>
</li>
</ul>
<a name="getConnectionInfo()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getConnectionInfo</h4>
<pre>public java.lang.String getConnectionInfo()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html#getConnectionInfo()">HardwareDevice</a></code></strong></div>
<div class="block">Get connection information about this device in a human readable format</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html#getConnectionInfo()">getConnectionInfo</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html" title="interface in com.qualcomm.robotcore.hardware">HardwareDevice</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>connection info</dd></dl>
</li>
</ul>
<a name="getVersion()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getVersion</h4>
<pre>public int getVersion()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html#getVersion()">HardwareDevice</a></code></strong></div>
<div class="block">Version</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html#getVersion()">getVersion</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html" title="interface in com.qualcomm.robotcore.hardware">HardwareDevice</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>get the version of this device</dd></dl>
</li>
</ul>
<a name="resetDeviceConfigurationForOpMode()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>resetDeviceConfigurationForOpMode</h4>
<pre>public void resetDeviceConfigurationForOpMode()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html#resetDeviceConfigurationForOpMode()">HardwareDevice</a></code></strong></div>
<div class="block">Resets the device's configuration to that which is expected at the beginning of an OpMode.
For example, motors will reset the their direction to 'forward'.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html#resetDeviceConfigurationForOpMode()">resetDeviceConfigurationForOpMode</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html" title="interface in com.qualcomm.robotcore.hardware">HardwareDevice</a></code></dd>
</dl>
</li>
</ul>
<a name="close()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>close</h4>
<pre>public void close()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html#close()">HardwareDevice</a></code></strong></div>
<div class="block">Closes this device</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html#close()">close</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/HardwareDevice.html" title="interface in com.qualcomm.robotcore.hardware">HardwareDevice</a></code></dd>
</dl>
</li>
</ul>
<a name="getController()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getController</h4>
<pre>public <a href="../../../../com/qualcomm/robotcore/hardware/DcMotorController.html" title="interface in com.qualcomm.robotcore.hardware">DcMotorController</a> getController()</pre>
<div class="block">Get DC motor controller</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getController()">getController</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>controller</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getPortNumber()"><code>DcMotor.getPortNumber()</code></a></dd></dl>
</li>
</ul>
<a name="setDirection(com.qualcomm.robotcore.hardware.DcMotorSimple.Direction)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setDirection</h4>
<pre>public void setDirection(<a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.Direction.html" title="enum in com.qualcomm.robotcore.hardware">DcMotorSimple.Direction</a> direction)</pre>
<div class="block">Set the direction</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html#setDirection(com.qualcomm.robotcore.hardware.DcMotorSimple.Direction)">setDirection</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html" title="interface in com.qualcomm.robotcore.hardware">DcMotorSimple</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>direction</code> - direction</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html#getDirection()"><code>DcMotorSimple.getDirection()</code></a></dd></dl>
</li>
</ul>
<a name="getDirection()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDirection</h4>
<pre>public <a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.Direction.html" title="enum in com.qualcomm.robotcore.hardware">DcMotorSimple.Direction</a> getDirection()</pre>
<div class="block">Get the direction</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html#getDirection()">getDirection</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html" title="interface in com.qualcomm.robotcore.hardware">DcMotorSimple</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>direction</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html#setDirection(com.qualcomm.robotcore.hardware.DcMotorSimple.Direction)"><code>DcMotorSimple.setDirection(Direction)</code></a></dd></dl>
</li>
</ul>
<a name="getPortNumber()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPortNumber</h4>
<pre>public int getPortNumber()</pre>
<div class="block">Get port number</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getPortNumber()">getPortNumber</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>portNumber</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getController()"><code>DcMotor.getController()</code></a></dd></dl>
</li>
</ul>
<a name="setPower(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setPower</h4>
<pre>public void setPower(double power)</pre>
<div class="block">Set the current motor power</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html#setPower(double)">setPower</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html" title="interface in com.qualcomm.robotcore.hardware">DcMotorSimple</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>power</code> - from -1.0 to 1.0</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html#getPower()"><code>DcMotorSimple.getPower()</code></a>,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setMode(com.qualcomm.robotcore.hardware.DcMotor.RunMode)"><code>DcMotor.setMode(DcMotor.RunMode)</code></a>,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setPowerFloat()"><code>DcMotor.setPowerFloat()</code></a></dd></dl>
</li>
</ul>
<a name="internalSetPower(double)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>internalSetPower</h4>
<pre>protected void internalSetPower(double power)</pre>
</li>
</ul>
<a name="setMaxSpeed(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setMaxSpeed</h4>
<pre>public void setMaxSpeed(int encoderTicksPerSecond)</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setMaxSpeed(int)">DcMotor</a></code></strong></div>
<div class="block">When the motor is running in one of the <a href="https://en.wikipedia.org/wiki/PID_controller">PID modes</a>
the value set using the <a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html#setPower(double)"><code>setPower()</code></a> method is indicative of a
desired motor <em>velocity</em> rather than a raw <em>power</em> level. In those modes, the
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setMaxSpeed(int)"><code>setMaxSpeed()</code></a> method provides the interpretation of the speed to which
a value of 1.0 passed to <a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html#setPower(double)"><code>setPower()</code></a> should correspond.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setMaxSpeed(int)">setMaxSpeed</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>encoderTicksPerSecond</code> - the maximum targetable speed for this motor when the motor is
in one of the PID modes, in units of encoder ticks per second.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.RunMode.html#RUN_USING_ENCODER"><code>DcMotor.RunMode.RUN_USING_ENCODER</code></a>,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.RunMode.html#RUN_TO_POSITION"><code>DcMotor.RunMode.RUN_TO_POSITION</code></a>,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getMaxSpeed()"><code>DcMotor.getMaxSpeed()</code></a></dd></dl>
</li>
</ul>
<a name="getMaxSpeed()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMaxSpeed</h4>
<pre>public int getMaxSpeed()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getMaxSpeed()">DcMotor</a></code></strong></div>
<div class="block">Returns the current maximum targetable speed for this motor when the motor is
running in one of the PID modes.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getMaxSpeed()">getMaxSpeed</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>the current maximum targetable speed for this motor, in units of encoder
ticks per second</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setMaxSpeed(int)"><code>DcMotor.setMaxSpeed(int)</code></a></dd></dl>
</li>
</ul>
<a name="getPower()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPower</h4>
<pre>public double getPower()</pre>
<div class="block">Get the current motor power</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html#getPower()">getPower</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html" title="interface in com.qualcomm.robotcore.hardware">DcMotorSimple</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>scaled from -1.0 to 1.0</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html#setPower(double)"><code>DcMotorSimple.setPower(double)</code></a></dd></dl>
</li>
</ul>
<a name="isBusy()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isBusy</h4>
<pre>public boolean isBusy()</pre>
<div class="block">Is the motor busy?</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#isBusy()">isBusy</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>true if the motor is busy</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setTargetPosition(int)"><code>DcMotor.setTargetPosition(int)</code></a></dd></dl>
</li>
</ul>
<a name="setZeroPowerBehavior(com.qualcomm.robotcore.hardware.DcMotor.ZeroPowerBehavior)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setZeroPowerBehavior</h4>
<pre>public void setZeroPowerBehavior(<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.ZeroPowerBehavior.html" title="enum in com.qualcomm.robotcore.hardware">DcMotor.ZeroPowerBehavior</a> zeroPowerBehavior)</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setZeroPowerBehavior(com.qualcomm.robotcore.hardware.DcMotor.ZeroPowerBehavior)">DcMotor</a></code></strong></div>
<div class="block">Sets the behavior of the motor when a power level of zero is applied.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setZeroPowerBehavior(com.qualcomm.robotcore.hardware.DcMotor.ZeroPowerBehavior)">setZeroPowerBehavior</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>zeroPowerBehavior</code> - the new behavior of the motor when a power level of zero is applied.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.ZeroPowerBehavior.html" title="enum in com.qualcomm.robotcore.hardware"><code>DcMotor.ZeroPowerBehavior</code></a>,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html#setPower(double)"><code>DcMotorSimple.setPower(double)</code></a></dd></dl>
</li>
</ul>
<a name="getZeroPowerBehavior()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getZeroPowerBehavior</h4>
<pre>public <a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.ZeroPowerBehavior.html" title="enum in com.qualcomm.robotcore.hardware">DcMotor.ZeroPowerBehavior</a> getZeroPowerBehavior()</pre>
<div class="block"><strong>Description copied from interface: <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getZeroPowerBehavior()">DcMotor</a></code></strong></div>
<div class="block">Returns the current behavior of the motor were a power level of zero to be applied.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getZeroPowerBehavior()">getZeroPowerBehavior</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>the current behavior of the motor were a power level of zero to be applied.</dd></dl>
</li>
</ul>
<a name="setPowerFloat()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setPowerFloat</h4>
<pre>@Deprecated
public void setPowerFloat()</pre>
<div class="block"><span class="strong">Deprecated.</span> </div>
<div class="block">Allow motor to float</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setPowerFloat()">setPowerFloat</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></code></dd>
<dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorSimple.html#setPower(double)"><code>DcMotorSimple.setPower(double)</code></a>,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getPowerFloat()"><code>DcMotor.getPowerFloat()</code></a>,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setZeroPowerBehavior(com.qualcomm.robotcore.hardware.DcMotor.ZeroPowerBehavior)"><code>DcMotor.setZeroPowerBehavior(ZeroPowerBehavior)</code></a></dd></dl>
</li>
</ul>
<a name="getPowerFloat()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPowerFloat</h4>
<pre>public boolean getPowerFloat()</pre>
<div class="block">Is motor power set to float?</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getPowerFloat()">getPowerFloat</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>true of motor is set to float</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setPowerFloat()"><code>DcMotor.setPowerFloat()</code></a></dd></dl>
</li>
</ul>
<a name="setTargetPosition(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setTargetPosition</h4>
<pre>public void setTargetPosition(int position)</pre>
<div class="block">Set the motor target position, using an integer. If this motor has been set to REVERSE,
the passed-in "position" value will be multiplied by -1.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setTargetPosition(int)">setTargetPosition</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>position</code> - range from Integer.MIN_VALUE to Integer.MAX_VALUE</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getCurrentPosition()"><code>DcMotor.getCurrentPosition()</code></a>,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setMode(com.qualcomm.robotcore.hardware.DcMotor.RunMode)"><code>DcMotor.setMode(RunMode)</code></a>,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.RunMode.html#RUN_TO_POSITION"><code>DcMotor.RunMode.RUN_TO_POSITION</code></a>,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getTargetPosition()"><code>DcMotor.getTargetPosition()</code></a>,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#isBusy()"><code>DcMotor.isBusy()</code></a></dd></dl>
</li>
</ul>
<a name="internalSetTargetPosition(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>internalSetTargetPosition</h4>
<pre>protected void internalSetTargetPosition(int position)</pre>
</li>
</ul>
<a name="getTargetPosition()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTargetPosition</h4>
<pre>public int getTargetPosition()</pre>
<div class="block">Get the current motor target position. If this motor has been set to REVERSE, the returned
"position" will be multiplied by -1.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getTargetPosition()">getTargetPosition</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>integer, unscaled</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setTargetPosition(int)"><code>DcMotor.setTargetPosition(int)</code></a></dd></dl>
</li>
</ul>
<a name="getCurrentPosition()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCurrentPosition</h4>
<pre>public int getCurrentPosition()</pre>
<div class="block">Get the current encoder value. If this motor has been set to REVERSE, the returned "position"
will be multiplied by -1.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getCurrentPosition()">getCurrentPosition</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>double indicating current position</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getTargetPosition()"><code>DcMotor.getTargetPosition()</code></a>,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.RunMode.html#STOP_AND_RESET_ENCODER"><code>DcMotor.RunMode.STOP_AND_RESET_ENCODER</code></a></dd></dl>
</li>
</ul>
<a name="setMode(com.qualcomm.robotcore.hardware.DcMotor.RunMode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setMode</h4>
<pre>public void setMode(<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.RunMode.html" title="enum in com.qualcomm.robotcore.hardware">DcMotor.RunMode</a> mode)</pre>
<div class="block">Set the current mode</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setMode(com.qualcomm.robotcore.hardware.DcMotor.RunMode)">setMode</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>mode</code> - run mode</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.RunMode.html" title="enum in com.qualcomm.robotcore.hardware"><code>DcMotor.RunMode</code></a>,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getMode()"><code>DcMotor.getMode()</code></a></dd></dl>
</li>
</ul>
<a name="internalSetMode(com.qualcomm.robotcore.hardware.DcMotor.RunMode)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>internalSetMode</h4>
<pre>protected void internalSetMode(<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.RunMode.html" title="enum in com.qualcomm.robotcore.hardware">DcMotor.RunMode</a> mode)</pre>
</li>
</ul>
<a name="getMode()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getMode</h4>
<pre>public <a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.RunMode.html" title="enum in com.qualcomm.robotcore.hardware">DcMotor.RunMode</a> getMode()</pre>
<div class="block">Get the current mode</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#getMode()">getMode</a></code> in interface <code><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html" title="interface in com.qualcomm.robotcore.hardware">DcMotor</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>run mode</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.RunMode.html" title="enum in com.qualcomm.robotcore.hardware"><code>DcMotor.RunMode</code></a>,
<a href="../../../../com/qualcomm/robotcore/hardware/DcMotor.html#setMode(com.qualcomm.robotcore.hardware.DcMotor.RunMode)"><code>DcMotor.setMode(RunMode)</code></a></dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= 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 class="navBarCell1Rev">Class</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><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorEx.html" title="interface in com.qualcomm.robotcore.hardware"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../com/qualcomm/robotcore/hardware/DcMotorImplEx.html" title="class in com.qualcomm.robotcore.hardware"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/qualcomm/robotcore/hardware/DcMotorImpl.html" target="_top">Frames</a></li>
<li><a href="DcMotorImpl.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>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {'content_hash': '493d56ff381d7770b73befb8b517cc7a', 'timestamp': '', 'source': 'github', 'line_count': 939, 'max_line_length': 432, 'avg_line_length': 57.480298189563364, 'alnum_prop': 0.6934264645940638, 'repo_name': 'victoryforphil/TitanPlanner', 'id': '665e0cb544d735984a83b1bc107b18f4ff8d028e', 'size': '53974', 'binary': False, 'copies': '16', 'ref': 'refs/heads/master', 'path': 'RobotController/doc/javadoc/com/qualcomm/robotcore/hardware/DcMotorImpl.html', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C#', 'bytes': '44770'}, {'name': 'Java', 'bytes': '1162829'}, {'name': 'JavaScript', 'bytes': '376'}]} |
package com.intellij.ui;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.util.ArrayUtil;
import com.intellij.util.SystemProperties;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.tree.WideSelectionTreeUI;
import org.jetbrains.annotations.NonNls;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.swing.*;
import javax.swing.plaf.TreeUI;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeCellRenderer;
import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
public abstract class MultilineTreeCellRenderer extends JComponent implements Accessible, TreeCellRenderer {
private boolean myWrapsCalculated = false;
private boolean myTooSmall = false;
private int myHeightCalculated = -1;
private int myWrapsCalculatedForWidth = -1;
private ArrayList myWraps = new ArrayList();
private int myMinHeight = 1;
private Insets myTextInsets;
private final Insets myLabelInsets = new Insets(1, 2, 1, 2);
private boolean mySelected;
private boolean myHasFocus;
private Icon myIcon;
private String[] myLines = ArrayUtil.EMPTY_STRING_ARRAY;
private String myPrefix;
private int myTextLength;
private int myPrefixWidth;
@NonNls protected static final String FONT_PROPERTY_NAME = "font";
private JTree myTree;
public MultilineTreeCellRenderer() {
myTextInsets = new Insets(0,0,0,0);
addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent e) {
onSizeChanged();
}
});
addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (FONT_PROPERTY_NAME.equalsIgnoreCase(evt.getPropertyName())) {
onFontChanged();
}
}
});
updateUI();
}
@Override
public void updateUI() {
UISettings.setupComponentAntialiasing(this);
}
protected void setMinHeight(int height) {
myMinHeight = height;
myHeightCalculated = Math.max(myMinHeight, myHeightCalculated);
}
protected void setTextInsets(Insets textInsets) {
myTextInsets = textInsets;
onSizeChanged();
}
private void onFontChanged() {
myWrapsCalculated = false;
}
private void onSizeChanged() {
int currWidth = getWidth();
if (currWidth != myWrapsCalculatedForWidth) {
myWrapsCalculated = false;
myHeightCalculated = -1;
myWrapsCalculatedForWidth = -1;
}
}
private FontMetrics getCurrFontMetrics() {
return getFontMetrics(getFont());
}
public void paint(Graphics g) {
int height = getHeight();
int width = getWidth();
int borderX = myLabelInsets.left - 1;
int borderY = myLabelInsets.top - 1;
int borderW = width - borderX - myLabelInsets.right + 2;
int borderH = height - borderY - myLabelInsets.bottom + 1;
if (myIcon != null) {
int verticalIconPosition = (height - myIcon.getIconHeight())/2;
myIcon.paintIcon(this, g, 0, isIconVerticallyCentered() ? verticalIconPosition : myTextInsets.top);
borderX += myIcon.getIconWidth();
borderW -= myIcon.getIconWidth();
}
Color bgColor;
Color fgColor;
if (mySelected && myHasFocus){
bgColor = UIUtil.getTreeSelectionBackground();
fgColor = UIUtil.getTreeSelectionForeground();
}
else{
bgColor = UIUtil.getTreeTextBackground();
fgColor = getForeground();
}
// fill background
if (!WideSelectionTreeUI.isWideSelection(myTree)) {
g.setColor(bgColor);
g.fillRect(borderX, borderY, borderW, borderH);
// draw border
if (mySelected) {
g.setColor(UIUtil.getTreeSelectionBorderColor());
UIUtil.drawDottedRectangle(g, borderX, borderY, borderX + borderW - 1, borderY + borderH - 1);
}
}
// paint text
recalculateWraps();
if (myTooSmall) { // TODO ???
return;
}
int fontHeight = getCurrFontMetrics().getHeight();
int currBaseLine = getCurrFontMetrics().getAscent();
currBaseLine += myTextInsets.top;
g.setFont(getFont());
g.setColor(fgColor);
UISettings.setupAntialiasing(g);
if (!StringUtil.isEmpty(myPrefix)) {
g.drawString(myPrefix, myTextInsets.left - myPrefixWidth + 1, currBaseLine);
}
for (int i = 0; i < myWraps.size(); i++) {
String currLine = (String)myWraps.get(i);
g.drawString(currLine, myTextInsets.left, currBaseLine);
currBaseLine += fontHeight; // first is getCurrFontMetrics().getAscent()
}
}
public void setText(String[] lines, String prefix) {
myLines = lines;
myTextLength = 0;
for (int i = 0; i < lines.length; i++) {
myTextLength += lines[i].length();
}
myPrefix = prefix;
myWrapsCalculated = false;
myHeightCalculated = -1;
myWrapsCalculatedForWidth = -1;
}
public void setIcon(Icon icon) {
myIcon = icon;
myWrapsCalculated = false;
myHeightCalculated = -1;
myWrapsCalculatedForWidth = -1;
}
public Dimension getMinimumSize() {
if (getFont() != null) {
int minHeight = getCurrFontMetrics().getHeight();
return new Dimension(minHeight, minHeight);
}
return new Dimension(
MIN_WIDTH + myTextInsets.left + myTextInsets.right,
MIN_WIDTH + myTextInsets.top + myTextInsets.bottom
);
}
private static final int MIN_WIDTH = 10;
// Calculates height for current width.
public Dimension getPreferredSize() {
recalculateWraps();
return new Dimension(myWrapsCalculatedForWidth, myHeightCalculated);
}
// Calculate wraps for the current width
private void recalculateWraps() {
int currwidth = getWidth();
if (myWrapsCalculated) {
if (currwidth == myWrapsCalculatedForWidth) {
return;
}
else {
myWrapsCalculated = false;
}
}
int wrapsCount = calculateWraps(currwidth);
myTooSmall = (wrapsCount == -1);
if (myTooSmall) {
wrapsCount = myTextLength;
}
int fontHeight = getCurrFontMetrics().getHeight();
myHeightCalculated = wrapsCount * fontHeight + myTextInsets.top + myTextInsets.bottom;
myHeightCalculated = Math.max(myMinHeight, myHeightCalculated);
int maxWidth = 0;
for (int i=0; i < myWraps.size(); i++) {
String s = (String)myWraps.get(i);
int width = getCurrFontMetrics().stringWidth(s);
maxWidth = Math.max(maxWidth, width);
}
myWrapsCalculatedForWidth = myTextInsets.left + maxWidth + myTextInsets.right;
myWrapsCalculated = true;
}
private int calculateWraps(int width) {
myTooSmall = width < MIN_WIDTH;
if (myTooSmall) {
return -1;
}
int result = 0;
myWraps = new ArrayList();
for (int i = 0; i < myLines.length; i++) {
String aLine = myLines[i];
int lineFirstChar = 0;
int lineLastChar = aLine.length() - 1;
int currFirst = lineFirstChar;
int printableWidth = width - myTextInsets.left - myTextInsets.right;
if (aLine.length() == 0) {
myWraps.add(aLine);
result++;
}
else {
while (currFirst <= lineLastChar) {
int currLast = calculateLastVisibleChar(aLine, printableWidth, currFirst, lineLastChar);
if (currLast < lineLastChar) {
int currChar = currLast + 1;
if (!Character.isWhitespace(aLine.charAt(currChar))) {
while (currChar >= currFirst) {
if (Character.isWhitespace(aLine.charAt(currChar))) {
break;
}
currChar--;
}
if (currChar > currFirst) {
currLast = currChar;
}
}
}
myWraps.add(aLine.substring(currFirst, currLast + 1));
currFirst = currLast + 1;
while ((currFirst <= lineLastChar) && (Character.isWhitespace(aLine.charAt(currFirst)))) {
currFirst++;
}
result++;
}
}
}
return result;
}
private int calculateLastVisibleChar(String line, int viewWidth, int firstChar, int lastChar) {
if (firstChar == lastChar) return lastChar;
if (firstChar > lastChar) throw new IllegalArgumentException("firstChar=" + firstChar + ", lastChar=" + lastChar);
int totalWidth = getCurrFontMetrics().stringWidth(line.substring(firstChar, lastChar + 1));
if (totalWidth == 0 || viewWidth > totalWidth) {
return lastChar;
}
else {
int newApprox = (lastChar - firstChar + 1) * viewWidth / totalWidth;
int currChar = firstChar + Math.max(newApprox - 1, 0);
int currWidth = getCurrFontMetrics().stringWidth(line.substring(firstChar, currChar + 1));
while (true) {
if (currWidth > viewWidth) {
currChar--;
if (currChar <= firstChar) {
return firstChar;
}
currWidth -= getCurrFontMetrics().charWidth(line.charAt(currChar + 1));
if (currWidth <= viewWidth) {
return currChar;
}
}
else {
currChar++;
if (currChar > lastChar) {
return lastChar;
}
currWidth += getCurrFontMetrics().charWidth(line.charAt(currChar));
if (currWidth >= viewWidth) {
return currChar - 1;
}
}
}
}
}
private int getChildIndent(JTree tree) {
TreeUI newUI = tree.getUI();
if (newUI instanceof javax.swing.plaf.basic.BasicTreeUI) {
javax.swing.plaf.basic.BasicTreeUI btreeui = (javax.swing.plaf.basic.BasicTreeUI)newUI;
return btreeui.getLeftChildIndent() + btreeui.getRightChildIndent();
}
else {
return ((Integer)UIUtil.getTreeLeftChildIndent()).intValue() + ((Integer)UIUtil.getTreeRightChildIndent()).intValue();
}
}
private int getAvailableWidth(Object forValue, JTree tree) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)forValue;
int busyRoom = tree.getInsets().left + tree.getInsets().right + getChildIndent(tree) * node.getLevel();
return tree.getVisibleRect().width - busyRoom - 2;
}
protected abstract void initComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus);
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
setFont(UIUtil.getTreeFont());
initComponent(tree, value, selected, expanded, leaf, row, hasFocus);
mySelected = selected;
myHasFocus = hasFocus;
myTree = tree;
int availWidth = getAvailableWidth(value, tree);
if (availWidth > 0) {
setSize(availWidth, 100); // height will be calculated automatically
}
int leftInset = myLabelInsets.left;
if (myIcon != null) {
leftInset += myIcon.getIconWidth() + 2;
}
if (!StringUtil.isEmpty(myPrefix)) {
myPrefixWidth = getCurrFontMetrics().stringWidth(myPrefix) + 5;
leftInset += myPrefixWidth;
}
setTextInsets(new Insets(myLabelInsets.top, leftInset, myLabelInsets.bottom, myLabelInsets.right));
if (myIcon != null) {
setMinHeight(myIcon.getIconHeight());
}
else {
setMinHeight(1);
}
setSize(getPreferredSize());
recalculateWraps();
return this;
}
/**
* Returns {@code true} if icon should be vertically centered. Otherwise, icon will be placed on top
* @return
*/
protected boolean isIconVerticallyCentered() {
return false;
}
public static JScrollPane installRenderer(final JTree tree, final MultilineTreeCellRenderer renderer) {
final TreeCellRenderer defaultRenderer = tree.getCellRenderer();
JScrollPane scrollpane = new JBScrollPane(tree){
private int myAddRemoveCounter = 0;
private boolean myShouldResetCaches = false;
public void setSize(Dimension d) {
boolean isChanged = getWidth() != d.width || myShouldResetCaches;
super.setSize(d);
if (isChanged) resetCaches();
}
public void reshape(int x, int y, int w, int h) {
boolean isChanged = w != getWidth() || myShouldResetCaches;
super.reshape(x, y, w, h);
if (isChanged) resetCaches();
}
private void resetCaches() {
resetHeightCache(tree, defaultRenderer, renderer);
myShouldResetCaches = false;
}
public void addNotify() {
super.addNotify();
if (myAddRemoveCounter == 0) myShouldResetCaches = true;
myAddRemoveCounter++;
}
public void removeNotify() {
super.removeNotify();
myAddRemoveCounter--;
}
};
scrollpane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
scrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
tree.setCellRenderer(renderer);
scrollpane.addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent e) {
resetHeightCache(tree, defaultRenderer, renderer);
}
public void componentShown(ComponentEvent e) {
// componentResized not called when adding to opened tool window.
// Seems to be BUG#4765299, however I failed to create same code to reproduce it.
// To reproduce it with IDEA: 1. remove this method, 2. Start any Ant task, 3. Keep message window open 4. start Ant task again.
resetHeightCache(tree, defaultRenderer, renderer);
}
});
return scrollpane;
}
private static void resetHeightCache(final JTree tree,
final TreeCellRenderer defaultRenderer,
final MultilineTreeCellRenderer renderer) {
tree.setCellRenderer(defaultRenderer);
tree.setCellRenderer(renderer);
}
// private static class DelegatingScrollablePanel extends JPanel implements Scrollable {
// private final Scrollable myDelegatee;
//
// public DelegatingScrollablePanel(Scrollable delegatee) {
// super(new BorderLayout(0, 0));
// myDelegatee = delegatee;
// add((JComponent)delegatee, BorderLayout.CENTER);
// }
//
// public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) {
// return myDelegatee.getScrollableUnitIncrement(visibleRect, orientation, direction);
// }
//
// public boolean getScrollableTracksViewportWidth() {
// return myDelegatee.getScrollableTracksViewportWidth();
// }
//
// public Dimension getPreferredScrollableViewportSize() {
// return myDelegatee.getPreferredScrollableViewportSize();
// }
//
// public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) {
// return myDelegatee.getScrollableBlockIncrement(visibleRect, orientation, direction);
// }
//
// public boolean getScrollableTracksViewportHeight() {
// return myDelegatee.getScrollableTracksViewportHeight();
// }
// }
@Override
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleMultilineTreeCellRenderer();
}
return accessibleContext;
}
protected class AccessibleMultilineTreeCellRenderer extends AccessibleJComponent {
@Override
public String getAccessibleName() {
String name = accessibleName;
if (name == null) {
name = (String)getClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY);
}
if (name == null) {
StringBuilder sb = new StringBuilder();
for (String aLine : myLines) {
sb.append(aLine);
sb.append(SystemProperties.getLineSeparator());
}
if (sb.length() > 0) name = sb.toString();
}
if (name == null) {
name = super.getAccessibleName();
}
return name;
}
@Override
public AccessibleRole getAccessibleRole() {
return AccessibleRole.LABEL;
}
}
}
| {'content_hash': '96386e54d18725852ae0d30e3f3251d7', 'timestamp': '', 'source': 'github', 'line_count': 517, 'max_line_length': 152, 'avg_line_length': 31.38878143133462, 'alnum_prop': 0.6619423219127434, 'repo_name': 'xfournet/intellij-community', 'id': '549a4f2e1e70f47c9ed4e6da0c8c049d3b638ddd', 'size': '16828', 'binary': False, 'copies': '11', 'ref': 'refs/heads/master', 'path': 'platform/platform-impl/src/com/intellij/ui/MultilineTreeCellRenderer.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'AMPL', 'bytes': '20665'}, {'name': 'AspectJ', 'bytes': '182'}, {'name': 'Batchfile', 'bytes': '60827'}, {'name': 'C', 'bytes': '211454'}, {'name': 'C#', 'bytes': '1264'}, {'name': 'C++', 'bytes': '199030'}, {'name': 'CMake', 'bytes': '1675'}, {'name': 'CSS', 'bytes': '201445'}, {'name': 'CoffeeScript', 'bytes': '1759'}, {'name': 'Erlang', 'bytes': '10'}, {'name': 'Groovy', 'bytes': '3289024'}, {'name': 'HLSL', 'bytes': '57'}, {'name': 'HTML', 'bytes': '1901772'}, {'name': 'J', 'bytes': '5050'}, {'name': 'Java', 'bytes': '166392304'}, {'name': 'JavaScript', 'bytes': '570364'}, {'name': 'Jupyter Notebook', 'bytes': '93222'}, {'name': 'Kotlin', 'bytes': '4720744'}, {'name': 'Lex', 'bytes': '147486'}, {'name': 'Makefile', 'bytes': '2352'}, {'name': 'NSIS', 'bytes': '51061'}, {'name': 'Objective-C', 'bytes': '27861'}, {'name': 'Perl', 'bytes': '903'}, {'name': 'Perl 6', 'bytes': '26'}, {'name': 'Protocol Buffer', 'bytes': '6680'}, {'name': 'Python', 'bytes': '25477371'}, {'name': 'Roff', 'bytes': '37534'}, {'name': 'Ruby', 'bytes': '1217'}, {'name': 'Shell', 'bytes': '64141'}, {'name': 'Smalltalk', 'bytes': '338'}, {'name': 'TeX', 'bytes': '25473'}, {'name': 'Thrift', 'bytes': '1846'}, {'name': 'TypeScript', 'bytes': '9469'}, {'name': 'Visual Basic', 'bytes': '77'}, {'name': 'XSLT', 'bytes': '113040'}]} |
namespace net {
class SocketLibevent;
// Unix Domain Server Socket Implementation. Supports abstract namespaces on
// Linux and Android.
class NET_EXPORT UnixDomainServerSocket : public ServerSocket {
public:
// Credentials of a peer process connected to the socket.
struct NET_EXPORT Credentials {
#if defined(OS_LINUX) || defined(OS_ANDROID)
// Linux/Android API provides more information about the connected peer
// than Windows/OS X. It's useful for permission-based authorization on
// Android.
pid_t process_id;
#endif
uid_t user_id;
gid_t group_id;
};
// Callback that returns whether the already connected client, identified by
// its credentials, is allowed to keep the connection open. Note that
// the socket is closed immediately in case the callback returns false.
typedef base::Callback<bool (const Credentials&)> AuthCallback;
UnixDomainServerSocket(const AuthCallback& auth_callack,
bool use_abstract_namespace);
virtual ~UnixDomainServerSocket();
// Gets credentials of peer to check permissions.
static bool GetPeerCredentials(SocketDescriptor socket_fd,
Credentials* credentials);
// ServerSocket implementation.
virtual int Listen(const IPEndPoint& address, int backlog) OVERRIDE;
virtual int ListenWithAddressAndPort(const std::string& unix_domain_path,
int port_unused,
int backlog) OVERRIDE;
virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE;
virtual int Accept(scoped_ptr<StreamSocket>* socket,
const CompletionCallback& callback) OVERRIDE;
private:
void AcceptCompleted(scoped_ptr<StreamSocket>* socket,
const CompletionCallback& callback,
int rv);
bool AuthenticateAndGetStreamSocket(scoped_ptr<StreamSocket>* socket);
scoped_ptr<SocketLibevent> listen_socket_;
const AuthCallback auth_callback_;
const bool use_abstract_namespace_;
scoped_ptr<SocketLibevent> accept_socket_;
DISALLOW_COPY_AND_ASSIGN(UnixDomainServerSocket);
};
} // namespace net
#endif // NET_SOCKET_UNIX_DOMAIN_SOCKET_POSIX_H_
| {'content_hash': '1a3d4bde2fa43b84de0381f24f83f0e1', 'timestamp': '', 'source': 'github', 'line_count': 60, 'max_line_length': 78, 'avg_line_length': 37.1, 'alnum_prop': 0.6990116801437556, 'repo_name': 'ondra-novak/chromium.src', 'id': '85c743d2b8fcc6613afba713cec729687c13eb42', 'size': '2775', 'binary': False, 'copies': '6', 'ref': 'refs/heads/nw', 'path': 'net/socket/unix_domain_server_socket_posix.h', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'AppleScript', 'bytes': '6973'}, {'name': 'Arduino', 'bytes': '464'}, {'name': 'Assembly', 'bytes': '35318'}, {'name': 'Batchfile', 'bytes': '7621'}, {'name': 'C', 'bytes': '8692951'}, {'name': 'C++', 'bytes': '206833388'}, {'name': 'CSS', 'bytes': '871479'}, {'name': 'HTML', 'bytes': '24541148'}, {'name': 'Java', 'bytes': '5457985'}, {'name': 'JavaScript', 'bytes': '17791684'}, {'name': 'Makefile', 'bytes': '92563'}, {'name': 'Objective-C', 'bytes': '1312233'}, {'name': 'Objective-C++', 'bytes': '7105758'}, {'name': 'PHP', 'bytes': '97817'}, {'name': 'PLpgSQL', 'bytes': '218379'}, {'name': 'Perl', 'bytes': '69392'}, {'name': 'Protocol Buffer', 'bytes': '387183'}, {'name': 'Python', 'bytes': '6929739'}, {'name': 'Shell', 'bytes': '473664'}, {'name': 'Standard ML', 'bytes': '4131'}, {'name': 'XSLT', 'bytes': '418'}, {'name': 'nesC', 'bytes': '15206'}]} |
@if ($user->providers->count())
@foreach ($user->providers as $social)
<a href="{{ route( 'admin.auth.user.social.unlink', [$user, $social]) }}" data-toggle="tooltip" data-placement="top" title="@lang('buttons.backend.access.users.unlink')" data-method="delete">
<i class="fab fa-{{ $social->provider }}"></i>
</a>
@endforeach
@else
@lang('labels.general.none')
@endif
| {'content_hash': '547b56b1a9d754905171b3feaaf1671d', 'timestamp': '', 'source': 'github', 'line_count': 9, 'max_line_length': 199, 'avg_line_length': 45.44444444444444, 'alnum_prop': 0.60880195599022, 'repo_name': 'viralsolani/laravel-adminpanel', 'id': '770a38bc06d38d340efbc9b2e61879e552bfa0a0', 'size': '409', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'resources/views/backend/auth/user/includes/social-buttons.blade.php', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '188225'}, {'name': 'Dockerfile', 'bytes': '2045'}, {'name': 'HTML', 'bytes': '257938'}, {'name': 'PHP', 'bytes': '765666'}, {'name': 'Shell', 'bytes': '2644'}, {'name': 'TSQL', 'bytes': '2666'}, {'name': 'Vue', 'bytes': '2241'}]} |
div.sheet-tab-content { display: none; }
input.sheet-tab1:checked ~ div.sheet-tab1,
input.sheet-tab3:checked ~ div.sheet-tab3,
input.sheet-tab4:checked ~ div.sheet-tab4,
input.sheet-tab5:checked ~ div.sheet-tab5,
input.sheet-tab6:checked ~ div.sheet-tab6
{
display: block;
}
input.sheet-tab
{
width: 150px;
height: 20px;
position: relative;
top: 5px;
left: 6px;
margin: -1.5px;
cursor: pointer;
z-index: 1;
}
input.sheet-tab::before
{
content: attr(title);
border: solid 1px #a8a8a8;
border-bottom-color: black;
text-align: center;
display: inline-block;
background: #fff;
background: -moz-linear-gradient(to top, #c8c8c8, #fff, #c8c8c8);
background: -webkit-linear-gradient(to top, #c8c8c8, #fff, #c8c8c8);
background: -ms-linear-gradient(to top, #c8c8c8, #fff, #c8c8c8);
background: -o-linear-gradient(to top, #c8c8c8, #fff, #c8c8c8);
background: linear-gradient(to top, #c8c8c8, #fff, #c8c8c8);
width: 150px;
height: 20px;
font-size: 18px;
}
input.sheet-tab:checked::before
{
background: #dcdcdc;
background: -moz-linear-gradient(to top, #fcfcfc, #dcdcdc, #fcfcfc);
background: -webkit-linear-gradient(to top, #fcfcfc, #dcdcdc, #fcfcfc);
background: -ms-linear-gradient(to top, #fcfcfc, #dcdcdc, #fcfcfc);
background: -o-linear-gradient(to top, #fcfcfc, #dcdcdc, #fcfcfc);
background: linear-gradient(to top, #fcfcfc, #dcdcdc, #fcfcfc);
border-bottom-color: #fff;
}
input.sheet-tab:not(:first-child)::before
{
border-left: none;
}
input.sheet-settings-checkbox {
width: 15px;
height: 15px;
position: relative;
top: 21px;
right: 4px;
cursor: pointer;
z-index: 1;
float: right;
}
input.sheet-settings-checkbox::before {
content: "y";
font-family: pictos;
text-align: center;
display: inline-block;
background: #fff;
width: 17px;
height: 17px;
font-size: 15px;
color: darkgrey;
}
input.sheet-settings-checkbox:checked::before{
color: black;
}
div.sheet-settings {
display: none;
}
input.sheet-settings-checkbox:checked + div.sheet-settings{
display: inline-block;
float: right;
position: relative;
top: 23px;
right: 4px;
border: solid 1px #a8a8a8;
border-bottom-color: black;
text-align: center;
display: inline-block;
padding: 2px;
}
button.sheet-hidden {
display:none;
}
/*
input.sheet-tab2::before
{
background: #fee;
background: -moz-linear-gradient(to top, #fcfcfc, #dcdcdc, #fcfcfc);
background: -webkit-linear-gradient(to top, #f8c8c8, #fee, #f8c8c8);
background: -ms-linear-gradient(to top, #f8c8c8, #fee, #f8c8c8);
background: -o-linear-gradient(to top, #f8c8c8, #fee, #f8c8c8);
background: linear-gradient(to top, #f8c8c8, #fee, #f8c8c8);
}
input.sheet-tab2:checked::before
{
background: #dcdcdc;
background: -moz-linear-gradient(to top, #fcecec, #f8c8c8, #fcecec);
background: -webkit-linear-gradient(to top, #fcecec, #f8c8c8, #fcecec);
background: -ms-linear-gradient(to top, #fcecec, #f8c8c8, #fcecec);
background: -o-linear-gradient(to top, #fcecec, #f8c8c8, #fcecec);
background: linear-gradient(to top, #fcecec, #f8c8c8, #fcecec);
border-bottom-color: #fcecec;
}
*/
div.sheet-tab-content
{
border: 1px solid #a8a8a8;
border-top-color: #000;
margin: 2px 0 0 5px;
padding: 5px;
}
/*
div.sheet-tab2
{
background-color: #fcecec;
}
*/
@font-face {
font-family: 'Play';
font-style: normal;
font-weight: 700;
src: local('Play-Bold'), url(http://themes.googleusercontent.com/static/fonts/play/v4/ZzUearZLklGfoL18Ti0GaQ.woff) format('woff');
}
.charsheet {
background-image: url("");
background-color: white;
}
.charsheet h3 {
margin-bottom:0;
}
.charsheet .sheet-small {
font-size: 10px;
line-height:9px;
}
.charsheet label {
display: inline-block;
text-align: right;
font-size:14px;
width: auto;
}
.charsheet label.sheet-long {
width: 80px;
}
.charsheet label.sheet-short {
width: 40px;
}
.charsheet input {
border-left: 1px solid black;
border-right: 1px solid black;
border-bottom: 1px solid black;
display: inline-block;
}
.charsheet input.sheet-header {
width: 160px;
}
.charsheet input.sheet-skills{
width:42px !important;
}
.charsheet select {
display: inline-block;
}
.charsheet select.sheet-modtype {
width: 65px;
}
.charsheet div.sheet-textHead {
background-color: black;
color: white;
font-size: 15px;
font-weight: bold;
text-align:center;
-webkit-border-radius: 5px;
-moz-border-radius: 5px; /*[top-left] [top-right] [bottom-right] [bottom-left] */
border-radius: 5px;
width:100%;
padding:1px 2px;
border-spacing: 0px 4px;
}
.charsheet div.sheet-textHeadsm {
background-color: black;
color: white;
font-size: 12px;
font-weight: bold;
text-align:center;
-webkit-border-radius: 5px;
-moz-border-radius: 5px; /*[top-left] [top-right] [bottom-right] [bottom-left] */
border-radius: 5px;
width:100%;
padding:1px 2px;
border-spacing: 0px 4px;
}
.charsheet div.sheet-record {
color: black;
font-size: 14px;
font-weight: bold;
text-align:center;
font-family: 'play';
width:100%;
}
.charsheet table{
text-align: center;
width: 100%;
}
.charsheet table td.sheet-col1, .charsheet table td.sheet-skillsCol1,.charsheet table td.sheet-skillsCrewCol1 {
font-size: 13px;
font-weight: bold;
text-align: left;
margin-left: 5px;
text-indent: -5px;
padding-left: 10px
}
.charsheet table td.sheet-col1{
background-color: #C4C4C4;
-webkit-border-radius: 5px;
-moz-border-radius: 5px; /*[top-left] [top-right] [bottom-right] [bottom-left] */
border-radius: 5px;
}
.charsheet table td.sheet-skillsCol1{
width: 150px;
}
.charsheet table th {
font-size: 13px;
font-weight: bold;
text-align: Center;
}
.charsheet table th.sheet-lheader{
font-size: 13px;
font-weight: bold;
text-align: left;
}
.charsheet table.sheet-spacing {
border-spacing: 1px 1px;
border-collapse: separate;
padding: 0px 1px;
}
.charsheet textarea {
width: 98%;
border-left: 1px solid black;
border-right: 1px solid black;
border-bottom: 1px solid black;
margin-bottom:0;
}
.charsheet textarea.sheet-atkNotes {
font-size: 12px;
height: 30px;
}
.charsheet textarea.sheet-ActionNotes {
font-size: 12px;
height:60px;
}
.charsheet div.sheet-clear { clear:both; }
.charsheet button[type=roll] {
padding: 5px 10px 5px !important;
font-size: 20px !important;
background-color: #C4C4C4;
font-weight: bold;
text-shadow: 1px 1px #D0D0D0;
color: #000000;
border-radius: 100px;
-moz-border-radius: 100px;
-webkit-border-radius: 100px;
border: 1px solid #D0D0D0;
cursor: pointer;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
}
.charsheet select{
margin:0;
}
.sheet-rolltemplate-skill table {
width: 189px;
padding: 2px;
border: 1px solid;
background-color: #ffffff;
}
.sheet-rolltemplate-skill th {
color: rgb(100, 100, 100);
padding-left: 5px;
line-height: 1.3em;
font-size: 1.2em;
text-align: left;
font-family: "Times New Roman", Times, serif;
font-variant: small-caps;
}
.sheet-rolltemplate-skill .sheet-subheader {
color: #000;
font-size: 1em;
text-align: left;
}
.sheet-rolltemplate-skill .sheet-arrow-right {
border-top: 3px solid transparent;
border-bottom: 3px solid transparent;
border-left: 180px solid rgb(90, 90, 90);
}
.sheet-rolltemplate-skill .sheet-tcat {
font-weight: bold;
}
.sheet-rolltemplate-skill td {
padding-left: 5px;
}
.sheet-rolltemplate-skill .inlinerollresult {
background-color: #ffffff;
border: none;
}
.sheet-rolltemplate-skill .inlinerollresult.fullcrit {
color: #3FB315;
border: none;
}
.sheet-rolltemplate-skill .inlinerollresult.fullfail {
color: #B31515;
border: none;
}
.sheet-rolltemplate-skill .inlinerollresult.importantroll {
color: #4A57ED;
border: none;
}
.sheet-rolltemplate-possibility table {
width: 189px;
padding: 2px;
border: 1px solid;
background-color: #ffffff;
}
.sheet-rolltemplate-possibility th {
color: rgb(100, 100, 100);
padding-left: 5px;
line-height: 1.3em;
font-size: 1.2em;
text-align: left;
font-family: "Times New Roman", Times, serif;
font-variant: small-caps;
}
.sheet-rolltemplate-possibility .sheet-subheader {
color: #000;
font-size: 1em;
text-align: left;
}
.sheet-rolltemplate-possibility .sheet-arrow-right {
border-top: 3px solid transparent;
border-bottom: 3px solid transparent;
border-left: 180px solid rgb(90, 90, 90);
}
.sheet-rolltemplate-possibility .sheet-tcat {
font-weight: bold;
}
.sheet-rolltemplate-possibility td {
padding-left: 5px;
}
.sheet-rolltemplate-possibility .inlinerollresult {
background-color: #ffffff;
border: none;
}
.sheet-rolltemplate-possibility .inlinerollresult.fullcrit {
color: #3FB315;
border: none;
}
.sheet-rolltemplate-possibility .inlinerollresult.fullfail {
color: #B31515;
border: none;
}
.sheet-rolltemplate-possibility .inlinerollresult.importantroll {
color: #4A57ED;
border: none;
}
.sheet-rolltemplate-defensebonus table {
width: 189px;
padding: 2px;
border: 1px solid;
background-color: #ffffff;
}
.sheet-rolltemplate-defensebonus th {
color: rgb(100, 100, 100);
padding-left: 5px;
line-height: 1.3em;
font-size: 1.2em;
text-align: left;
font-family: "Times New Roman", Times, serif;
font-variant: small-caps;
}
.sheet-rolltemplate-defensebonus .sheet-subheader {
color: #000;
font-size: 1em;
text-align: left;
}
.sheet-rolltemplate-defensebonus .sheet-arrow-right {
border-top: 3px solid transparent;
border-bottom: 3px solid transparent;
border-left: 180px solid rgb(90, 90, 90);
}
.sheet-rolltemplate-defensebonus .sheet-tcat {
font-weight: bold;
}
.sheet-rolltemplate-defensebonus td {
padding-left: 5px;
}
.sheet-rolltemplate-defensebonus .inlinerollresult {
background-color: #ffffff;
border: none;
}
.sheet-rolltemplate-defensebonus .inlinerollresult.fullcrit {
color: #3FB315;
border: none;
}
.sheet-rolltemplate-defensebonus .inlinerollresult.fullfail {
color: #B31515;
border: none;
}
.sheet-rolltemplate-defensebonus .inlinerollresult.importantroll {
color: #4A57ED;
border: none;
}
.sheet-rolltemplate-attack table {
width: 189px;
padding: 2px;
border: 1px solid;
background-color: #ffffff;
}
.sheet-rolltemplate-attack th {
color: rgb(100, 100, 100);
padding-left: 5px;
line-height: 1.3em;
font-size: 1.2em;
text-align: left;
font-family: "Times New Roman", Times, serif;
font-variant: small-caps;
}
.sheet-rolltemplate-attack .sheet-subheader {
color: #000;
font-size: 1em;
text-align: left;
}
.sheet-rolltemplate-attack .sheet-arrow-right {
border-top: 3px solid transparent;
border-bottom: 3px solid transparent;
border-left: 180px solid rgb(90, 90, 90);
}
.sheet-rolltemplate-attack .sheet-tcat {
font-weight: bold;
}
.sheet-rolltemplate-attack td {
padding-left: 5px;
}
.sheet-rolltemplate-attack .inlinerollresult {
background-color: #ffffff;
border: none;
}
.sheet-rolltemplate-attack .inlinerollresult.fullcrit {
color: #3FB315;
border: none;
}
.sheet-rolltemplate-attack .inlinerollresult.fullfail {
color: #B31515;
border: none;
}
.sheet-rolltemplate-attack .inlinerollresult.importantroll {
color: #4A57ED;
border: none;
}
.sheet-rolltemplate-damage table {
width: 189px;
padding: 2px;
border: 1px solid;
background-color: #ffffff;
}
.sheet-rolltemplate-damage th {
color: rgb(100, 100, 100);
padding-left: 5px;
line-height: 1.3em;
font-size: 1.2em;
text-align: left;
font-family: "Times New Roman", Times, serif;
font-variant: small-caps;
}
.sheet-rolltemplate-damage .sheet-subheader {
color: #000;
font-size: 1em;
text-align: left;
}
.sheet-rolltemplate-damage .sheet-arrow-right {
border-top: 3px solid transparent;
border-bottom: 3px solid transparent;
border-left: 180px solid rgb(90, 90, 90);
}
.sheet-rolltemplate-damage .sheet-tcat {
font-weight: bold;
}
.sheet-rolltemplate-damage td {
padding-left: 5px;
}
.sheet-rolltemplate-damage .inlinerollresult {
background-color: #ffffff;
border: none;
}
.sheet-rolltemplate-damage .inlinerollresult.fullcrit {
color: #3FB315;
border: none;
}
.sheet-rolltemplate-damage .inlinerollresult.fullfail {
color: #B31515;
border: none;
}
.sheet-rolltemplate-damage .inlinerollresult.importantroll {
color: #4A57ED;
border: none;
}
.sheet-rolltemplate-coupdegras table {
width: 189px;
padding: 2px;
border: 1px solid;
background-color: #ffffff;
}
.sheet-rolltemplate-coupdegras th {
color: rgb(100, 100, 100);
padding-left: 5px;
line-height: 1.3em;
font-size: 1.2em;
text-align: left;
font-family: "Times New Roman", Times, serif;
font-variant: small-caps;
}
.sheet-rolltemplate-coupdegras .sheet-subheader {
color: #000;
font-size: 1em;
text-align: left;
}
.sheet-rolltemplate-coupdegras .sheet-arrow-right {
border-top: 3px solid transparent;
border-bottom: 3px solid transparent;
border-left: 180px solid rgb(90, 90, 90);
}
.sheet-rolltemplate-coupdegras .sheet-tcat {
font-weight: bold;
}
.sheet-rolltemplate-coupdegras td {
padding-left: 5px;
}
.sheet-rolltemplate-coupdegras .inlinerollresult {
background-color: #ffffff;
border: none;
}
.sheet-rolltemplate-coupdegras .inlinerollresult.fullcrit {
color: #3FB315;
border: none;
}
.sheet-rolltemplate-coupdegras .inlinerollresult.fullfail {
color: #B31515;
border: none;
}
.sheet-rolltemplate-coupdegras .inlinerollresult.importantroll {
color: #4A57ED;
border: none;
}
.sheet-rolltemplate-power table {
width: 189px;
padding: 2px;
border: 1px solid;
background-color: #ffffff;
}
.sheet-rolltemplate-power th {
color: rgb(100, 100, 100);
padding-left: 5px;
line-height: 1.3em;
font-size: 1.2em;
text-align: left;
font-family: "Times New Roman", Times, serif;
font-variant: small-caps;
}
.sheet-rolltemplate-power .sheet-subheader {
color: #000;
font-size: 1em;
text-align: left;
}
.sheet-rolltemplate-power .sheet-arrow-right {
border-top: 3px solid transparent;
border-bottom: 3px solid transparent;
border-left: 180px solid rgb(90, 90, 90);
}
.sheet-rolltemplate-power .sheet-tcat {
font-weight: bold;
}
.sheet-rolltemplate-power td {
padding-left: 5px;
}
.sheet-rolltemplate-power .inlinerollresult {
background-color: #ffffff;
border: none;
}
.sheet-rolltemplate-power .inlinerollresult.fullcrit {
color: #3FB315;
border: none;
}
.sheet-rolltemplate-power .inlinerollresult.fullfail {
color: #B31515;
border: none;
}
.sheet-rolltemplate-power .inlinerollresult.importantroll {
color: #4A57ED;
border: none;.sheet-rolltemplate-power .sheet-arrow-right {
border-top: 3px solid transparent;
border-bottom: 3px solid transparent;
border-left: 180px solid rgb(126, 45, 64);
} | {'content_hash': '41244fec5ba4ec937b533b018a4c8182', 'timestamp': '', 'source': 'github', 'line_count': 724, 'max_line_length': 132, 'avg_line_length': 21.325966850828728, 'alnum_prop': 0.677979274611399, 'repo_name': 'mlenser/roll20-character-sheets', 'id': 'd27890d54d72bc9f16633aeca6a0d95eed430062', 'size': '15440', 'binary': False, 'copies': '12', 'ref': 'refs/heads/master', 'path': 'Torg Eternity/Torg Eternity.css', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '154'}, {'name': 'CSS', 'bytes': '10923835'}, {'name': 'HTML', 'bytes': '109140684'}, {'name': 'JavaScript', 'bytes': '847270'}, {'name': 'Makefile', 'bytes': '50'}, {'name': 'Shell', 'bytes': '909'}]} |
import io
import unittest
from payment_terminal.drivers.bbs.connection import read_frame, write_frame
class TestBBSFrames(unittest.TestCase):
def test_read_one(self):
port = io.BytesIO(b'\x00\x0512345')
self.assertEqual(read_frame(port), b'12345')
def test_read_two(self):
port = io.BytesIO(b'\x00\x0512345\x00\x06123456')
self.assertEqual(read_frame(port), b'12345')
self.assertEqual(read_frame(port), b'123456')
def test_read_end_of_file(self):
port = io.BytesIO(b'')
# TODO more specific
self.assertRaises(Exception, read_frame, port)
def test_read_truncated_header(self):
port = io.BytesIO(b'a')
# TODO more specific
self.assertRaises(Exception, read_frame, port)
def test_read_truncated_body(self):
port = io.BytesIO(b'\x00\x09trunca')
# TODO more specific
self.assertRaises(Exception, read_frame, port)
def test_write_one(self):
port = io.BytesIO()
write_frame(port, b'hello world')
self.assertEqual(port.getvalue(), b'\x00\x0bhello world')
def test_write_two(self):
port = io.BytesIO()
write_frame(port, b'12345')
write_frame(port, b'123456')
self.assertEqual(port.getvalue(), b'\x00\x0512345\x00\x06123456')
def test_write_too_much(self):
port = io.BytesIO()
# TODO more specific
self.assertRaises(Exception, write_frame, port, b'x' * 2**16)
| {'content_hash': 'eb5b8bab03500bf815a33eb1100c2bd9', 'timestamp': '', 'source': 'github', 'line_count': 46, 'max_line_length': 75, 'avg_line_length': 32.26086956521739, 'alnum_prop': 0.6340970350404312, 'repo_name': 'bwhmather/python-payment-terminal', 'id': '9d1d2915b589cf49b49d98342f1d078805a9b01c', 'size': '1484', 'binary': False, 'copies': '2', 'ref': 'refs/heads/develop', 'path': 'payment_terminal/drivers/bbs/tests/test_frames.py', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Python', 'bytes': '65134'}]} |
<?php
namespace Skytells\Contracts\Debug;
use Exception;
interface ExceptionHandler
{
/**
* Report or log an exception.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e);
/**
* Render an exception into an HTTP response.
*
* @param \Skytells\Http\Request $request
* @param \Exception $e
* @return \Symfony\Component\HttpFoundation\Response
*/
public function render($request, Exception $e);
/**
* Render an exception to the console.
*
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param \Exception $e
* @return void
*/
public function renderForConsole($output, Exception $e);
}
| {'content_hash': 'e8363a6d208cedc6e947e92db757a511', 'timestamp': '', 'source': 'github', 'line_count': 34, 'max_line_length': 73, 'avg_line_length': 22.205882352941178, 'alnum_prop': 0.6158940397350994, 'repo_name': 'Skytells/Framework', 'id': 'f24f1a7f342139a24439180dfb09584e657d8842', 'size': '755', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Core/Kernel/Composer/vendor/skytells/contracts/Debug/ExceptionHandler.php', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '41471'}, {'name': 'HTML', 'bytes': '20031'}, {'name': 'Hack', 'bytes': '3230'}, {'name': 'Io', 'bytes': '9463'}, {'name': 'PHP', 'bytes': '1994365'}]} |
import mock
import os.path
import uuid
from solum.openstack.common.gettextutils import _
from solum.tests import base
from solum.tests import fakes
from solum.tests import utils
from solum.worker.handlers import shell as shell_handler
class HandlerTest(base.BaseTestCase):
def setUp(self):
super(HandlerTest, self).setUp()
self.ctx = utils.dummy_context()
@mock.patch('solum.worker.handlers.shell.LOG')
def test_echo(self, fake_LOG):
shell_handler.Handler().echo({}, 'foo')
fake_LOG.debug.assert_called_once_with(_('%s') % 'foo')
@mock.patch('solum.worker.handlers.shell.Handler._get_environment')
@mock.patch('solum.objects.registry')
@mock.patch('solum.conductor.api.API.build_job_update')
@mock.patch('solum.deployer.api.API.deploy')
@mock.patch('subprocess.Popen')
def test_build(self, mock_popen, mock_deploy, mock_updater, mock_registry,
mock_get_env):
handler = shell_handler.Handler()
fake_assembly = fakes.FakeAssembly()
fake_glance_id = str(uuid.uuid4())
mock_registry.Assembly.get_by_id.return_value = fake_assembly
handler._update_assembly_status = mock.MagicMock()
mock_popen.return_value.communicate.return_value = [
'foo\ncreated_image_id=%s' % fake_glance_id, None]
test_env = {'PATH': '/bin'}
mock_get_env.return_value = test_env
handler.build(self.ctx, 5, 'git://example.com/foo', 'new_app',
'1-2-3-4', 'heroku',
'docker', 44)
proj_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', '..', '..', '..'))
script = os.path.join(proj_dir, 'contrib/lp-cedarish/docker/build-app')
mock_popen.assert_called_once_with([script, 'git://example.com/foo',
'new_app', self.ctx.tenant,
'1-2-3-4'], env=test_env, stdout=-1)
expected = [mock.call(5, 'BUILDING', 'Starting the image build',
None, 44),
mock.call(5, 'COMPLETE', 'built successfully',
fake_glance_id, 44)]
self.assertEqual(expected, mock_updater.call_args_list)
expected = [mock.call(assembly_id=44, image_id=fake_glance_id)]
self.assertEqual(expected, mock_deploy.call_args_list)
@mock.patch('solum.worker.handlers.shell.Handler._get_environment')
@mock.patch('solum.objects.registry')
@mock.patch('solum.conductor.api.API.build_job_update')
@mock.patch('subprocess.Popen')
def test_build_fail(self, mock_popen, mock_updater, mock_registry,
mock_get_env):
handler = shell_handler.Handler()
fake_assembly = fakes.FakeAssembly()
mock_registry.Assembly.get_by_id.return_value = fake_assembly
handler._update_assembly_status = mock.MagicMock()
mock_popen.return_value.communicate.return_value = [
'foo\ncreated_image_id= \n', None]
test_env = {'PATH': '/bin'}
mock_get_env.return_value = test_env
handler.build(self.ctx, 5, 'git://example.com/foo', 'new_app',
'1-2-3-4', 'heroku',
'docker', 44)
proj_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', '..', '..', '..'))
script = os.path.join(proj_dir, 'contrib/lp-cedarish/docker/build-app')
mock_popen.assert_called_once_with([script, 'git://example.com/foo',
'new_app', self.ctx.tenant,
'1-2-3-4'], env=test_env, stdout=-1)
expected = [mock.call(5, 'BUILDING', 'Starting the image build',
None, 44),
mock.call(5, 'ERROR', 'image not created', None, 44)]
self.assertEqual(expected, mock_updater.call_args_list)
class TestNotifications(base.BaseTestCase):
def setUp(self):
super(TestNotifications, self).setUp()
self.ctx = utils.dummy_context()
self.db = self.useFixture(utils.Database())
@mock.patch('solum.objects.registry')
def test_update_assembly_status(self, mock_registry):
mock_assembly = mock.MagicMock()
mock_registry.Assembly.get_by_id.return_value = mock_assembly
shell_handler.update_assembly_status(self.ctx, '1234',
'BUILDING')
mock_registry.Assembly.get_by_id.assert_called_once_with(self.ctx,
'1234')
mock_assembly.save.assert_called_once_with(self.ctx)
self.assertEqual(mock_assembly.status, 'BUILDING')
@mock.patch('solum.objects.registry')
def test_update_assembly_status_pass(self, mock_registry):
shell_handler.update_assembly_status(self.ctx, None,
'BUILDING')
self.assertEqual(mock_registry.call_count, 0)
class TestBuildCommand(base.BaseTestCase):
scenarios = [
('docker',
dict(source_format='heroku', image_format='docker',
base_image_id='auto',
expect='lp-cedarish/docker/build-app')),
('vmslug',
dict(source_format='heroku', image_format='qcow2',
base_image_id='auto',
expect='lp-cedarish/vm-slug/build-app')),
('dib',
dict(source_format='dib', image_format='qcow2',
base_image_id='xyz',
expect='diskimage-builder/vm-slug/build-app'))]
def test_build_cmd(self):
ctx = utils.dummy_context()
handler = shell_handler.Handler()
cmd = handler._get_build_command(ctx,
'http://example.com/a.git',
'testa',
self.base_image_id,
self.source_format,
self.image_format)
self.assertIn(self.expect, cmd[0])
self.assertEqual('http://example.com/a.git', cmd[1])
self.assertEqual('testa', cmd[2])
self.assertEqual(ctx.tenant, cmd[3])
if self.base_image_id == 'auto' and self.image_format == 'qcow2':
self.assertEqual('cedarish', cmd[4])
else:
self.assertEqual(self.base_image_id, cmd[4])
| {'content_hash': 'd9f26d31b66d1631568fb2008c527922', 'timestamp': '', 'source': 'github', 'line_count': 144, 'max_line_length': 79, 'avg_line_length': 45.44444444444444, 'alnum_prop': 0.5545537897310513, 'repo_name': 'jamesyli/solum', 'id': '8f16bd9ab6fa76816efcb250362b2e514f8ccf2d', 'size': '7129', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'solum/tests/worker/handlers/test_shell.py', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
<!DOCTYPE html>
<!--
Template Name: Metronic - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.3.1
Version: 3.6
Author: KeenThemes
Website: http://www.keenthemes.com/
Contact: [email protected]
Follow: www.twitter.com/keenthemes
Like: www.facebook.com/keenthemes
Purchase: http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes
License: You must have a valid license purchased only from themeforest(the above link) in order to legally use the theme for your project.
-->
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" dir="rtl">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8"/>
<title>Metronic | UI Features - Tabs, Accordions & Navs</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta content="" name="description"/>
<meta content="" name="author"/>
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/plugins/bootstrap/css/bootstrap-rtl.min.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/plugins/bootstrap-switch/css/bootstrap-switch-rtl.min.css" rel="stylesheet" type="text/css"/>
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN THEME STYLES -->
<link href="../../assets/global/css/components-rtl.css" id="style_components" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/css/plugins-rtl.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/admin/layout/css/layout-rtl.css" rel="stylesheet" type="text/css"/>
<link id="style_color" href="../../assets/admin/layout/css/themes/darkblue-rtl.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/admin/layout/css/custom-rtl.css" rel="stylesheet" type="text/css"/>
<!-- END THEME STYLES -->
<link rel="shortcut icon" href="favicon.ico"/>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<!-- DOC: Apply "page-header-fixed-mobile" and "page-footer-fixed-mobile" class to body element to force fixed header or footer in mobile devices -->
<!-- DOC: Apply "page-sidebar-closed" class to the body and "page-sidebar-menu-closed" class to the sidebar menu element to hide the sidebar by default -->
<!-- DOC: Apply "page-sidebar-hide" class to the body to make the sidebar completely hidden on toggle -->
<!-- DOC: Apply "page-sidebar-closed-hide-logo" class to the body element to make the logo hidden on sidebar toggle -->
<!-- DOC: Apply "page-sidebar-hide" class to body element to completely hide the sidebar on sidebar toggle -->
<!-- DOC: Apply "page-sidebar-fixed" class to have fixed sidebar -->
<!-- DOC: Apply "page-footer-fixed" class to the body element to have fixed footer -->
<!-- DOC: Apply "page-sidebar-reversed" class to put the sidebar on the right side -->
<!-- DOC: Apply "page-full-width" class to the body element to have full width page without the sidebar menu -->
<body class="page-header-fixed page-quick-sidebar-over-content ">
<!-- BEGIN HEADER -->
<div class="page-header navbar navbar-fixed-top">
<!-- BEGIN HEADER INNER -->
<div class="page-header-inner">
<!-- BEGIN LOGO -->
<div class="page-logo">
<a href="index.html">
<img src="../../assets/admin/layout/img/logo.png" alt="logo" class="logo-default"/>
</a>
<div class="menu-toggler sidebar-toggler hide">
<!-- DOC: Remove the above "hide" to enable the sidebar toggler button on header -->
</div>
</div>
<!-- END LOGO -->
<!-- BEGIN RESPONSIVE MENU TOGGLER -->
<a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse" data-target=".navbar-collapse">
</a>
<!-- END RESPONSIVE MENU TOGGLER -->
<!-- BEGIN TOP NAVIGATION MENU -->
<div class="top-menu">
<ul class="nav navbar-nav pull-right">
<!-- BEGIN NOTIFICATION DROPDOWN -->
<!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
<li class="dropdown dropdown-extended dropdown-notification" id="header_notification_bar">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-bell"></i>
<span class="badge badge-default">
7 </span>
</a>
<ul class="dropdown-menu">
<li class="external">
<h3><span class="bold">12 pending</span> notifications</h3>
<a href="extra_profile.html">view all</a>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height: 250px;" data-handle-color="#637283">
<li>
<a href="javascript:;">
<span class="time">just now</span>
<span class="details">
<span class="label label-sm label-icon label-success">
<i class="fa fa-plus"></i>
</span>
New user registered. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">3 mins</span>
<span class="details">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span>
Server #12 overloaded. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">10 mins</span>
<span class="details">
<span class="label label-sm label-icon label-warning">
<i class="fa fa-bell-o"></i>
</span>
Server #2 not responding. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">14 hrs</span>
<span class="details">
<span class="label label-sm label-icon label-info">
<i class="fa fa-bullhorn"></i>
</span>
Application error. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">2 days</span>
<span class="details">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span>
Database overloaded 68%. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">3 days</span>
<span class="details">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span>
A user IP blocked. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">4 days</span>
<span class="details">
<span class="label label-sm label-icon label-warning">
<i class="fa fa-bell-o"></i>
</span>
Storage Server #4 not responding dfdfdfd. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">5 days</span>
<span class="details">
<span class="label label-sm label-icon label-info">
<i class="fa fa-bullhorn"></i>
</span>
System Error. </span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="time">9 days</span>
<span class="details">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span>
Storage server failed. </span>
</a>
</li>
</ul>
</li>
</ul>
</li>
<!-- END NOTIFICATION DROPDOWN -->
<!-- BEGIN INBOX DROPDOWN -->
<!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
<li class="dropdown dropdown-extended dropdown-inbox" id="header_inbox_bar">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-envelope-open"></i>
<span class="badge badge-default">
4 </span>
</a>
<ul class="dropdown-menu">
<li class="external">
<h3>You have <span class="bold">7 New</span> Messages</h3>
<a href="page_inbox.html">view all</a>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height: 275px;" data-handle-color="#637283">
<li>
<a href="inbox.html?a=view">
<span class="photo">
<img src="../../assets/admin/layout3/img/avatar2.jpg" class="img-circle" alt="">
</span>
<span class="subject">
<span class="from">
Lisa Wong </span>
<span class="time">Just Now </span>
</span>
<span class="message">
Vivamus sed auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
<li>
<a href="inbox.html?a=view">
<span class="photo">
<img src="../../assets/admin/layout3/img/avatar3.jpg" class="img-circle" alt="">
</span>
<span class="subject">
<span class="from">
Richard Doe </span>
<span class="time">16 mins </span>
</span>
<span class="message">
Vivamus sed congue nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
<li>
<a href="inbox.html?a=view">
<span class="photo">
<img src="../../assets/admin/layout3/img/avatar1.jpg" class="img-circle" alt="">
</span>
<span class="subject">
<span class="from">
Bob Nilson </span>
<span class="time">2 hrs </span>
</span>
<span class="message">
Vivamus sed nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
<li>
<a href="inbox.html?a=view">
<span class="photo">
<img src="../../assets/admin/layout3/img/avatar2.jpg" class="img-circle" alt="">
</span>
<span class="subject">
<span class="from">
Lisa Wong </span>
<span class="time">40 mins </span>
</span>
<span class="message">
Vivamus sed auctor 40% nibh congue nibh... </span>
</a>
</li>
<li>
<a href="inbox.html?a=view">
<span class="photo">
<img src="../../assets/admin/layout3/img/avatar3.jpg" class="img-circle" alt="">
</span>
<span class="subject">
<span class="from">
Richard Doe </span>
<span class="time">46 mins </span>
</span>
<span class="message">
Vivamus sed congue nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
</ul>
</li>
</ul>
</li>
<!-- END INBOX DROPDOWN -->
<!-- BEGIN TODO DROPDOWN -->
<!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
<li class="dropdown dropdown-extended dropdown-tasks" id="header_task_bar">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-calendar"></i>
<span class="badge badge-default">
3 </span>
</a>
<ul class="dropdown-menu extended tasks">
<li class="external">
<h3>You have <span class="bold">12 pending</span> tasks</h3>
<a href="page_todo.html">view all</a>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height: 275px;" data-handle-color="#637283">
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">New release v1.2 </span>
<span class="percent">30%</span>
</span>
<span class="progress">
<span style="width: 40%;" class="progress-bar progress-bar-success" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"><span class="sr-only">40% Complete</span></span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">Application deployment</span>
<span class="percent">65%</span>
</span>
<span class="progress">
<span style="width: 65%;" class="progress-bar progress-bar-danger" aria-valuenow="65" aria-valuemin="0" aria-valuemax="100"><span class="sr-only">65% Complete</span></span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">Mobile app release</span>
<span class="percent">98%</span>
</span>
<span class="progress">
<span style="width: 98%;" class="progress-bar progress-bar-success" aria-valuenow="98" aria-valuemin="0" aria-valuemax="100"><span class="sr-only">98% Complete</span></span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">Database migration</span>
<span class="percent">10%</span>
</span>
<span class="progress">
<span style="width: 10%;" class="progress-bar progress-bar-warning" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100"><span class="sr-only">10% Complete</span></span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">Web server upgrade</span>
<span class="percent">58%</span>
</span>
<span class="progress">
<span style="width: 58%;" class="progress-bar progress-bar-info" aria-valuenow="58" aria-valuemin="0" aria-valuemax="100"><span class="sr-only">58% Complete</span></span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">Mobile development</span>
<span class="percent">85%</span>
</span>
<span class="progress">
<span style="width: 85%;" class="progress-bar progress-bar-success" aria-valuenow="85" aria-valuemin="0" aria-valuemax="100"><span class="sr-only">85% Complete</span></span>
</span>
</a>
</li>
<li>
<a href="javascript:;">
<span class="task">
<span class="desc">New UI release</span>
<span class="percent">38%</span>
</span>
<span class="progress progress-striped">
<span style="width: 38%;" class="progress-bar progress-bar-important" aria-valuenow="18" aria-valuemin="0" aria-valuemax="100"><span class="sr-only">38% Complete</span></span>
</span>
</a>
</li>
</ul>
</li>
</ul>
</li>
<!-- END TODO DROPDOWN -->
<!-- BEGIN USER LOGIN DROPDOWN -->
<!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
<li class="dropdown dropdown-user">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<img alt="" class="img-circle" src="../../assets/admin/layout/img/avatar3_small.jpg"/>
<span class="username username-hide-on-mobile">
Nick </span>
<i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu dropdown-menu-default">
<li>
<a href="extra_profile.html">
<i class="icon-user"></i> My Profile </a>
</li>
<li>
<a href="page_calendar.html">
<i class="icon-calendar"></i> My Calendar </a>
</li>
<li>
<a href="inbox.html">
<i class="icon-envelope-open"></i> My Inbox <span class="badge badge-danger">
3 </span>
</a>
</li>
<li>
<a href="page_todo.html">
<i class="icon-rocket"></i> My Tasks <span class="badge badge-success">
7 </span>
</a>
</li>
<li class="divider">
</li>
<li>
<a href="extra_lock.html">
<i class="icon-lock"></i> Lock Screen </a>
</li>
<li>
<a href="login.html">
<i class="icon-key"></i> Log Out </a>
</li>
</ul>
</li>
<!-- END USER LOGIN DROPDOWN -->
<!-- BEGIN QUICK SIDEBAR TOGGLER -->
<!-- DOC: Apply "dropdown-dark" class after below "dropdown-extended" to change the dropdown styte -->
<li class="dropdown dropdown-quick-sidebar-toggler">
<a href="javascript:;" class="dropdown-toggle">
<i class="icon-logout"></i>
</a>
</li>
<!-- END QUICK SIDEBAR TOGGLER -->
</ul>
</div>
<!-- END TOP NAVIGATION MENU -->
</div>
<!-- END HEADER INNER -->
</div>
<!-- END HEADER -->
<div class="clearfix">
</div>
<!-- BEGIN CONTAINER -->
<div class="page-container">
<!-- BEGIN SIDEBAR -->
<div class="page-sidebar-wrapper">
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<div class="page-sidebar navbar-collapse collapse">
<!-- BEGIN SIDEBAR MENU -->
<!-- DOC: Apply "page-sidebar-menu-light" class right after "page-sidebar-menu" to enable light sidebar menu style(without borders) -->
<!-- DOC: Apply "page-sidebar-menu-hover-submenu" class right after "page-sidebar-menu" to enable hoverable(hover vs accordion) sub menu mode -->
<!-- DOC: Apply "page-sidebar-menu-closed" class right after "page-sidebar-menu" to collapse("page-sidebar-closed" class must be applied to the body element) the sidebar sub menu mode -->
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Set data-keep-expand="true" to keep the submenues expanded -->
<!-- DOC: Set data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<ul class="page-sidebar-menu" data-keep-expanded="false" data-auto-scroll="true" data-slide-speed="200">
<!-- DOC: To remove the sidebar toggler from the sidebar you just need to completely remove the below "sidebar-toggler-wrapper" LI element -->
<li class="sidebar-toggler-wrapper">
<!-- BEGIN SIDEBAR TOGGLER BUTTON -->
<div class="sidebar-toggler">
</div>
<!-- END SIDEBAR TOGGLER BUTTON -->
</li>
<!-- DOC: To remove the search box from the sidebar you just need to completely remove the below "sidebar-search-wrapper" LI element -->
<li class="sidebar-search-wrapper">
<!-- BEGIN RESPONSIVE QUICK SEARCH FORM -->
<!-- DOC: Apply "sidebar-search-bordered" class the below search form to have bordered search box -->
<!-- DOC: Apply "sidebar-search-bordered sidebar-search-solid" class the below search form to have bordered & solid search box -->
<form class="sidebar-search " action="extra_search.html" method="POST">
<a href="javascript:;" class="remove">
<i class="icon-close"></i>
</a>
<div class="input-group">
<input type="text" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<a href="javascript:;" class="btn submit"><i class="icon-magnifier"></i></a>
</span>
</div>
</form>
<!-- END RESPONSIVE QUICK SEARCH FORM -->
</li>
<li class="start ">
<a href="javascript:;">
<i class="icon-home"></i>
<span class="title">Dashboard</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="index.html">
<i class="icon-bar-chart"></i>
Default Dashboard</a>
</li>
<li>
<a href="index_2.html">
<i class="icon-bulb"></i>
New Dashboard #1</a>
</li>
<li>
<a href="index_3.html">
<i class="icon-graph"></i>
New Dashboard #2</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-basket"></i>
<span class="title">eCommerce</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="ecommerce_index.html">
<i class="icon-home"></i>
Dashboard</a>
</li>
<li>
<a href="ecommerce_orders.html">
<i class="icon-basket"></i>
Orders</a>
</li>
<li>
<a href="ecommerce_orders_view.html">
<i class="icon-tag"></i>
Order View</a>
</li>
<li>
<a href="ecommerce_products.html">
<i class="icon-handbag"></i>
Products</a>
</li>
<li>
<a href="ecommerce_products_edit.html">
<i class="icon-pencil"></i>
Product Edit</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-rocket"></i>
<span class="title">Page Layouts</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="layout_horizontal_sidebar_menu.html">
Horizontal & Sidebar Menu</a>
</li>
<li>
<a href="index_horizontal_menu.html">
Dashboard & Mega Menu</a>
</li>
<li>
<a href="layout_horizontal_menu1.html">
Horizontal Mega Menu 1</a>
</li>
<li>
<a href="layout_horizontal_menu2.html">
Horizontal Mega Menu 2</a>
</li>
<li>
<a href="layout_fontawesome_icons.html">
<span class="badge badge-roundless badge-danger">new</span>Layout with Fontawesome Icons</a>
</li>
<li>
<a href="layout_glyphicons.html">
Layout with Glyphicon</a>
</li>
<li>
<a href="layout_full_height_portlet.html">
<span class="badge badge-roundless badge-success">new</span>Full Height Portlet</a>
</li>
<li>
<a href="layout_full_height_content.html">
<span class="badge badge-roundless badge-warning">new</span>Full Height Content</a>
</li>
<li>
<a href="layout_search_on_header1.html">
Search Box On Header 1</a>
</li>
<li>
<a href="layout_search_on_header2.html">
Search Box On Header 2</a>
</li>
<li>
<a href="layout_sidebar_search_option1.html">
Sidebar Search Option 1</a>
</li>
<li>
<a href="layout_sidebar_search_option2.html">
Sidebar Search Option 2</a>
</li>
<li>
<a href="layout_sidebar_reversed.html">
<span class="badge badge-roundless badge-warning">new</span>Right Sidebar Page</a>
</li>
<li>
<a href="layout_sidebar_fixed.html">
Sidebar Fixed Page</a>
</li>
<li>
<a href="layout_sidebar_closed.html">
Sidebar Closed Page</a>
</li>
<li>
<a href="layout_ajax.html">
Content Loading via Ajax</a>
</li>
<li>
<a href="layout_disabled_menu.html">
Disabled Menu Links</a>
</li>
<li>
<a href="layout_blank_page.html">
Blank Page</a>
</li>
<li>
<a href="layout_boxed_page.html">
Boxed Page</a>
</li>
<li>
<a href="layout_language_bar.html">
Language Switch Bar</a>
</li>
</ul>
</li>
<li class="active open">
<a href="javascript:;">
<i class="icon-diamond"></i>
<span class="title">UI Features</span>
<span class="selected"></span>
<span class="arrow open"></span>
</a>
<ul class="sub-menu">
<li>
<a href="ui_general.html">
General Components</a>
</li>
<li>
<a href="ui_buttons.html">
Buttons</a>
</li>
<li>
<a href="ui_confirmations.html">
Popover Confirmations</a>
</li>
<li>
<a href="ui_icons.html">
<span class="badge badge-roundless badge-danger">new</span>Font Icons</a>
</li>
<li>
<a href="ui_colors.html">
Flat UI Colors</a>
</li>
<li>
<a href="ui_typography.html">
Typography</a>
</li>
<li class="active">
<a href="ui_tabs_accordions_navs.html">
Tabs, Accordions & Navs</a>
</li>
<li>
<a href="ui_tree.html">
<span class="badge badge-roundless badge-danger">new</span>Tree View</a>
</li>
<li>
<a href="ui_page_progress_style_1.html">
<span class="badge badge-roundless badge-warning">new</span>Page Progress Bar</a>
</li>
<li>
<a href="ui_blockui.html">
Block UI</a>
</li>
<li>
<a href="ui_notific8.html">
Notific8 Notifications</a>
</li>
<li>
<a href="ui_toastr.html">
Toastr Notifications</a>
</li>
<li>
<a href="ui_alert_dialog_api.html">
<span class="badge badge-roundless badge-danger">new</span>Alerts & Dialogs API</a>
</li>
<li>
<a href="ui_session_timeout.html">
Session Timeout</a>
</li>
<li>
<a href="ui_idle_timeout.html">
User Idle Timeout</a>
</li>
<li>
<a href="ui_modals.html">
Modals</a>
</li>
<li>
<a href="ui_extended_modals.html">
Extended Modals</a>
</li>
<li>
<a href="ui_tiles.html">
Tiles</a>
</li>
<li>
<a href="ui_datepaginator.html">
<span class="badge badge-roundless badge-success">new</span>Date Paginator</a>
</li>
<li>
<a href="ui_nestable.html">
Nestable List</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-puzzle"></i>
<span class="title">UI Components</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="components_pickers.html">
Pickers</a>
</li>
<li>
<a href="components_dropdowns.html">
Custom Dropdowns</a>
</li>
<li>
<a href="components_form_tools.html">
Form Tools</a>
</li>
<li>
<a href="components_editors.html">
Markdown & WYSIWYG Editors</a>
</li>
<li>
<a href="components_ion_sliders.html">
Ion Range Sliders</a>
</li>
<li>
<a href="components_noui_sliders.html">
NoUI Range Sliders</a>
</li>
<li>
<a href="components_jqueryui_sliders.html">
jQuery UI Sliders</a>
</li>
<li>
<a href="components_knob_dials.html">
Knob Circle Dials</a>
</li>
</ul>
</li>
<!-- BEGIN ANGULARJS LINK -->
<li class="tooltips" data-container="body" data-placement="right" data-html="true" data-original-title="AngularJS version demo">
<a href="angularjs" target="_blank">
<i class="icon-paper-plane"></i>
<span class="title">
AngularJS Version </span>
</a>
</li>
<!-- END ANGULARJS LINK -->
<li class="heading">
<h3 class="uppercase">Features</h3>
</li>
<li>
<a href="javascript:;">
<i class="icon-settings"></i>
<span class="title">Form Stuff</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="form_controls.html">
Form Controls</a>
</li>
<li>
<a href="form_icheck.html">
iCheck Controls</a>
</li>
<li>
<a href="form_layouts.html">
Form Layouts</a>
</li>
<li>
<a href="form_editable.html">
<span class="badge badge-roundless badge-warning">new</span>Form X-editable</a>
</li>
<li>
<a href="form_wizard.html">
Form Wizard</a>
</li>
<li>
<a href="form_validation.html">
Form Validation</a>
</li>
<li>
<a href="form_image_crop.html">
<span class="badge badge-roundless badge-danger">new</span>Image Cropping</a>
</li>
<li>
<a href="form_fileupload.html">
Multiple File Upload</a>
</li>
<li>
<a href="form_dropzone.html">
Dropzone File Upload</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-briefcase"></i>
<span class="title">Data Tables</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="table_basic.html">
Basic Datatables</a>
</li>
<li>
<a href="table_responsive.html">
Responsive Datatables</a>
</li>
<li>
<a href="table_managed.html">
Managed Datatables</a>
</li>
<li>
<a href="table_editable.html">
Editable Datatables</a>
</li>
<li>
<a href="table_advanced.html">
Advanced Datatables</a>
</li>
<li>
<a href="table_ajax.html">
Ajax Datatables</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-wallet"></i>
<span class="title">Portlets</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="portlet_general.html">
General Portlets</a>
</li>
<li>
<a href="portlet_general2.html">
<span class="badge badge-roundless badge-danger">new</span>New Portlets #1</a>
</li>
<li>
<a href="portlet_general3.html">
<span class="badge badge-roundless badge-danger">new</span>New Portlets #2</a>
</li>
<li>
<a href="portlet_ajax.html">
Ajax Portlets</a>
</li>
<li>
<a href="portlet_draggable.html">
Draggable Portlets</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-bar-chart"></i>
<span class="title">Charts</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="charts_amcharts.html">
amChart</a>
</li>
<li>
<a href="charts_flotcharts.html">
Flotchart</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-docs"></i>
<span class="title">Pages</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="page_todo.html">
<i class="icon-check"></i>
Todo</a>
</li>
<li>
<a href="inbox.html">
<i class="icon-envelope"></i>
<span class="badge badge-danger">4</span>Inbox</a>
</li>
<li>
<a href="extra_profile.html">
<i class="icon-user-following"></i>
<span class="badge badge-success badge-roundless">new</span>New User Profile</a>
</li>
<li>
<a href="extra_profile_old.html">
<i class="icon-user"></i>
Old User Profile</a>
</li>
<li>
<a href="extra_faq.html">
<i class="icon-question"></i>
FAQ</a>
</li>
<li>
<a href="page_calendar.html">
<i class="icon-calendar"></i>
<span class="badge badge-danger">14</span>Calendar</a>
</li>
<li>
<a href="page_timeline_old.html">
<i class="icon-clock"></i>
<span class="badge badge-info">4</span>Old Timeline</a>
</li>
<li>
<a href="page_coming_soon.html">
<i class="icon-flag"></i>
Coming Soon</a>
</li>
<li>
<a href="page_blog.html">
<i class="icon-speech"></i>
Blog</a>
</li>
<li>
<a href="page_blog_item.html">
<i class="icon-link"></i>
Blog Post</a>
</li>
<li>
<a href="page_news.html">
<i class="icon-eye"></i>
<span class="badge badge-success">9</span>News</a>
</li>
<li>
<a href="page_news_item.html">
<i class="icon-bell"></i>
News View</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-present"></i>
<span class="title">Extra</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="page_about.html">
About Us</a>
</li>
<li>
<a href="page_contact.html">
Contact Us</a>
</li>
<li>
<a href="extra_search.html">
Search Results</a>
</li>
<li>
<a href="extra_invoice.html">
Invoice</a>
</li>
<li>
<a href="page_portfolio.html">
Portfolio</a>
</li>
<li>
<a href="extra_pricing_table.html">
Pricing Tables</a>
</li>
<li>
<a href="extra_404_option1.html">
404 Page Option 1</a>
</li>
<li>
<a href="extra_404_option2.html">
404 Page Option 2</a>
</li>
<li>
<a href="extra_404_option3.html">
404 Page Option 3</a>
</li>
<li>
<a href="extra_500_option1.html">
500 Page Option 1</a>
</li>
<li>
<a href="extra_500_option2.html">
500 Page Option 2</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-folder"></i>
<span class="title">Multi Level Menu</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="javascript:;">
<i class="icon-settings"></i> Item 1 <span class="arrow"></span>
</a>
<ul class="sub-menu">
<li>
<a href="javascript:;">
<i class="icon-user"></i>
Sample Link 1 <span class="arrow"></span>
</a>
<ul class="sub-menu">
<li>
<a href="#"><i class="icon-power"></i> Sample Link 1</a>
</li>
<li>
<a href="#"><i class="icon-paper-plane"></i> Sample Link 1</a>
</li>
<li>
<a href="#"><i class="icon-star"></i> Sample Link 1</a>
</li>
</ul>
</li>
<li>
<a href="#"><i class="icon-camera"></i> Sample Link 1</a>
</li>
<li>
<a href="#"><i class="icon-link"></i> Sample Link 2</a>
</li>
<li>
<a href="#"><i class="icon-pointer"></i> Sample Link 3</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-globe"></i> Item 2 <span class="arrow"></span>
</a>
<ul class="sub-menu">
<li>
<a href="#"><i class="icon-tag"></i> Sample Link 1</a>
</li>
<li>
<a href="#"><i class="icon-pencil"></i> Sample Link 1</a>
</li>
<li>
<a href="#"><i class="icon-graph"></i> Sample Link 1</a>
</li>
</ul>
</li>
<li>
<a href="#">
<i class="icon-bar-chart"></i>
Item 3 </a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-user"></i>
<span class="title">Login Options</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="login.html">
Login Form 1</a>
</li>
<li>
<a href="login_2.html">
Login Form 2</a>
</li>
<li>
<a href="login_3.html">
Login Form 3</a>
</li>
<li>
<a href="login_soft.html">
Login Form 4</a>
</li>
<li>
<a href="extra_lock.html">
Lock Screen 1</a>
</li>
<li>
<a href="extra_lock2.html">
Lock Screen 2</a>
</li>
</ul>
</li>
<li class="heading">
<h3 class="uppercase">More</h3>
</li>
<li>
<a href="javascript:;">
<i class="icon-logout"></i>
<span class="title">Quick Sidebar</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="quick_sidebar_push_content.html">
Push Content</a>
</li>
<li>
<a href="quick_sidebar_over_content.html">
Over Content</a>
</li>
<li>
<a href="quick_sidebar_over_content_transparent.html">
Over Content & Transparent</a>
</li>
<li>
<a href="quick_sidebar_on_boxed_layout.html">
Boxed Layout</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-envelope-open"></i>
<span class="title">Email Templates</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="email_newsletter.html">
Responsive Newsletter<br>
Email Template</a>
</li>
<li>
<a href="email_system.html">
Responsive System<br>
Email Template</a>
</li>
</ul>
</li>
<li class="last ">
<a href="javascript:;">
<i class="icon-pointer"></i>
<span class="title">Maps</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="maps_google.html">
Google Maps</a>
</li>
<li>
<a href="maps_vector.html">
Vector Maps</a>
</li>
</ul>
</li>
</ul>
<!-- END SIDEBAR MENU -->
</div>
</div>
<!-- END SIDEBAR -->
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<div class="page-content">
<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body">
Widget settings form goes here
</div>
<div class="modal-footer">
<button type="button" class="btn blue">Save changes</button>
<button type="button" class="btn default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<!-- BEGIN STYLE CUSTOMIZER -->
<div class="theme-panel hidden-xs hidden-sm">
<div class="toggler">
</div>
<div class="toggler-close">
</div>
<div class="theme-options">
<div class="theme-option theme-colors clearfix">
<span>
THEME COLOR </span>
<ul>
<li class="color-default current tooltips" data-style="default" data-container="body" data-original-title="Default">
</li>
<li class="color-darkblue tooltips" data-style="darkblue" data-container="body" data-original-title="Dark Blue">
</li>
<li class="color-blue tooltips" data-style="blue" data-container="body" data-original-title="Blue">
</li>
<li class="color-grey tooltips" data-style="grey" data-container="body" data-original-title="Grey">
</li>
<li class="color-light tooltips" data-style="light" data-container="body" data-original-title="Light">
</li>
<li class="color-light2 tooltips" data-style="light2" data-container="body" data-html="true" data-original-title="Light 2">
</li>
</ul>
</div>
<div class="theme-option">
<span>
Layout </span>
<select class="layout-option form-control input-sm">
<option value="fluid" selected="selected">Fluid</option>
<option value="boxed">Boxed</option>
</select>
</div>
<div class="theme-option">
<span>
Header </span>
<select class="page-header-option form-control input-sm">
<option value="fixed" selected="selected">Fixed</option>
<option value="default">Default</option>
</select>
</div>
<div class="theme-option">
<span>
Top Menu Dropdown</span>
<select class="page-header-top-dropdown-style-option form-control input-sm">
<option value="light" selected="selected">Light</option>
<option value="dark">Dark</option>
</select>
</div>
<div class="theme-option">
<span>
Sidebar Mode</span>
<select class="sidebar-option form-control input-sm">
<option value="fixed">Fixed</option>
<option value="default" selected="selected">Default</option>
</select>
</div>
<div class="theme-option">
<span>
Sidebar Menu </span>
<select class="sidebar-menu-option form-control input-sm">
<option value="accordion" selected="selected">Accordion</option>
<option value="hover">Hover</option>
</select>
</div>
<div class="theme-option">
<span>
Sidebar Style </span>
<select class="sidebar-style-option form-control input-sm">
<option value="default" selected="selected">Default</option>
<option value="light">Light</option>
</select>
</div>
<div class="theme-option">
<span>
Sidebar Position </span>
<select class="sidebar-pos-option form-control input-sm">
<option value="left" selected="selected">Left</option>
<option value="right">Right</option>
</select>
</div>
<div class="theme-option">
<span>
Footer </span>
<select class="page-footer-option form-control input-sm">
<option value="fixed">Fixed</option>
<option value="default" selected="selected">Default</option>
</select>
</div>
</div>
</div>
<!-- END STYLE CUSTOMIZER -->
<!-- BEGIN PAGE HEADER-->
<h3 class="page-title">
Tabs, Accordions & Navs <small>tabs, accordions & navbars</small>
</h3>
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<i class="fa fa-home"></i>
<a href="index.html">Home</a>
<i class="fa fa-angle-right"></i>
</li>
<li>
<a href="#">UI Features</a>
<i class="fa fa-angle-right"></i>
</li>
<li>
<a href="#">Tabs, Accordions & Navs</a>
</li>
</ul>
<div class="page-toolbar">
<div class="btn-group pull-right">
<button type="button" class="btn btn-fit-height grey-salt dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="true">
Actions <i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li>
<a href="#">Action</a>
</li>
<li>
<a href="#">Another action</a>
</li>
<li>
<a href="#">Something else here</a>
</li>
<li class="divider">
</li>
<li>
<a href="#">Separated link</a>
</li>
</ul>
</div>
</div>
</div>
<!-- END PAGE HEADER-->
<!-- BEGIN PAGE CONTENT-->
<div class="row">
<div class="col-md-6">
<div class="portlet box green">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Default Tabs
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
</div>
</div>
<div class="portlet-body">
<ul class="nav nav-tabs">
<li class="active">
<a href="#tab_1_1" data-toggle="tab">
Home </a>
</li>
<li>
<a href="#tab_1_2" data-toggle="tab">
Profile </a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Dropdown <i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#tab_1_3" tabindex="-1" data-toggle="tab">
Option 1 </a>
</li>
<li>
<a href="#tab_1_4" tabindex="-1" data-toggle="tab">
Option 2 </a>
</li>
<li>
<a href="#tab_1_3" tabindex="-1" data-toggle="tab">
Option 3 </a>
</li>
<li>
<a href="#tab_1_4" tabindex="-1" data-toggle="tab">
Option 4 </a>
</li>
</ul>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="tab_1_1">
<p>
Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.
</p>
</div>
<div class="tab-pane fade" id="tab_1_2">
<p>
Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.
</p>
</div>
<div class="tab-pane fade" id="tab_1_3">
<p>
Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.
</p>
</div>
<div class="tab-pane fade" id="tab_1_4">
<p>
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
</p>
</div>
</div>
<div class="clearfix margin-bottom-20">
</div>
<ul class="nav nav-tabs tabs-reversed">
<li class="active">
<a href="#tab_reversed_1_1" data-toggle="tab">
Home </a>
</li>
<li>
<a href="#tab_reversed_1_2" data-toggle="tab">
Profile </a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Dropdown <i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#tab_reversed_1_3" tabindex="-1" data-toggle="tab">
Option 1 </a>
</li>
<li>
<a href="#tab_reversed_1_4" tabindex="-1" data-toggle="tab">
Option 2 </a>
</li>
<li>
<a href="#tab_reversed_1_3" tabindex="-1" data-toggle="tab">
Option 3 </a>
</li>
<li>
<a href="#tab_reversed_1_4" tabindex="-1" data-toggle="tab">
Option 4 </a>
</li>
</ul>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="tab_reversed_1_1">
<p>
Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.
</p>
</div>
<div class="tab-pane fade" id="tab_reversed_1_2">
<p>
Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.
</p>
</div>
<div class="tab-pane fade" id="tab_reversed_1_3">
<p>
Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.
</p>
</div>
<div class="tab-pane fade" id="tab_reversed_1_4">
<p>
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
</p>
</div>
</div>
</div>
</div>
<div class="portlet box purple">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Default Pills
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
</div>
</div>
<div class="portlet-body">
<ul class="nav nav-pills">
<li class="active">
<a href="#tab_2_1" data-toggle="tab">
Home </a>
</li>
<li>
<a href="#tab_2_2" data-toggle="tab">
Profile </a>
</li>
<li class="dropdown">
<a href="#" id="myTabDrop1" class="dropdown-toggle" data-toggle="dropdown">
Dropdown <i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="myTabDrop1">
<li>
<a href="#tab_2_3" tabindex="-1" data-toggle="tab">
Option 1 </a>
</li>
<li>
<a href="#tab_2_4" tabindex="-1" data-toggle="tab">
Option 2 </a>
</li>
<li>
<a href="#tab_2_3" tabindex="-1" data-toggle="tab">
Option 3 </a>
</li>
<li>
<a href="#tab_2_4" tabindex="-1" data-toggle="tab">
Option 4 </a>
</li>
</ul>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="tab_2_1">
<p>
Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.
</p>
</div>
<div class="tab-pane fade" id="tab_2_2">
<p>
Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.
</p>
</div>
<div class="tab-pane fade" id="tab_2_3">
<p>
Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.
</p>
</div>
<div class="tab-pane fade" id="tab_2_4">
<p>
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
</p>
</div>
</div>
</div>
</div>
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Below Tabs
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
</div>
</div>
<div class="portlet-body tabs-below">
<div class="tab-content">
<div class="tab-pane active" id="tab_3_1">
<p>
Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.
</p>
</div>
<div class="tab-pane fade" id="tab_3_2">
<p>
Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.
</p>
</div>
<div class="tab-pane fade" id="tab_3_3">
<p>
Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.
</p>
</div>
<div class="tab-pane fade" id="tab_3_4">
<p>
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
</p>
</div>
</div>
<ul class="nav nav-tabs">
<li class="active">
<a href="#tab_3_1" data-toggle="tab">
Home </a>
</li>
<li>
<a href="#tab_3_2" data-toggle="tab">
Profile </a>
</li>
<li class="dropdown dropup">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Dropdown <i class="fa fa-angle-up"></i>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#tab_3_3" tabindex="-1" data-toggle="tab">
Option 1 </a>
</li>
<li>
<a href="#tab_3_4" tabindex="-1" data-toggle="tab">
Option 2 </a>
</li>
<li>
<a href="#tab_3_3" tabindex="-1" data-toggle="tab">
Option 3 </a>
</li>
<li>
<a href="#tab_3_4" tabindex="-1" data-toggle="tab">
Option 4 </a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="portlet box red">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Below Pills
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
</div>
</div>
<div class="portlet-body tabs-below">
<div class="tab-content">
<div class="tab-pane active" id="tab_4_1">
<p>
Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.
</p>
</div>
<div class="tab-pane fade" id="tab_4_2">
<p>
Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.
</p>
</div>
<div class="tab-pane fade" id="tab_4_3">
<p>
Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.
</p>
</div>
<div class="tab-pane fade" id="tab_4_4">
<p>
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
</p>
</div>
</div>
<ul class="nav nav-pills">
<li class="active">
<a href="#tab_4_1" data-toggle="tab">
Home </a>
</li>
<li>
<a href="#tab_4_2" data-toggle="tab">
Profile </a>
</li>
<li class="dropdown dropup">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Dropdown <i class="fa fa-angle-up"></i>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#tab_4_3" tabindex="-1" data-toggle="tab">
Option 1 </a>
</li>
<li>
<a href="#tab_4_4" tabindex="-1" data-toggle="tab">
Option 2 </a>
</li>
<li>
<a href="#tab_4_3" tabindex="-1" data-toggle="tab">
Option 3 </a>
</li>
<li>
<a href="#tab_4_4" tabindex="-1" data-toggle="tab">
Option 4 </a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Left Tabs
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
</div>
</div>
<div class="portlet-body">
<div class="row">
<div class="col-md-3 col-sm-3 col-xs-3">
<ul class="nav nav-tabs tabs-left">
<li class="active">
<a href="#tab_6_1" data-toggle="tab">
Home </a>
</li>
<li>
<a href="#tab_6_2" data-toggle="tab">
Profile </a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
More <i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#tab_6_3" tabindex="-1" data-toggle="tab">
Option 1 </a>
</li>
<li>
<a href="#tab_6_4" tabindex="-1" data-toggle="tab">
Option 2 </a>
</li>
<li>
<a href="#tab_6_3" tabindex="-1" data-toggle="tab">
Option 3 </a>
</li>
<li>
<a href="#tab_6_4" tabindex="-1" data-toggle="tab">
Option 4 </a>
</li>
</ul>
</li>
<li>
<a href="#tab_6_1" data-toggle="tab">
Settings </a>
</li>
<li>
<a href="#tab_6_1" data-toggle="tab">
More </a>
</li>
</ul>
</div>
<div class="col-md-9 col-sm-9 col-xs-9">
<div class="tab-content">
<div class="tab-pane active" id="tab_6_1">
<p>
Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.
</p>
</div>
<div class="tab-pane fade" id="tab_6_2">
<p>
Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.
</p>
</div>
<div class="tab-pane fade" id="tab_6_3">
<p>
Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.
</p>
</div>
<div class="tab-pane fade" id="tab_6_4">
<p>
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="portlet box green">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Right Tabs
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
</div>
</div>
<div class="portlet-body">
<div class="row">
<div class="col-md-9 col-sm-9 col-xs-9">
<div class="tab-content">
<div class="tab-pane active" id="tab_7_1">
<p>
Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.
</p>
</div>
<div class="tab-pane fade" id="tab_7_2">
<p>
Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.
</p>
</div>
<div class="tab-pane fade" id="tab_7_3">
<p>
Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.
</p>
</div>
<div class="tab-pane fade" id="tab_7_4">
<p>
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
</p>
</div>
</div>
</div>
<div class="col-md-3 col-sm-3 col-xs-3">
<ul class="nav nav-tabs tabs-right">
<li class="active">
<a href="#tab_7_1" data-toggle="tab">
Home </a>
</li>
<li>
<a href="#tab_7_2" data-toggle="tab">
Profile </a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
More <i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#tab_7_3" tabindex="-1" data-toggle="tab">
Option 1 </a>
</li>
<li>
<a href="#tab_7_4" tabindex="-1" data-toggle="tab">
Option 2 </a>
</li>
<li>
<a href="#tab_7_3" tabindex="-1" data-toggle="tab">
Option 3 </a>
</li>
<li>
<a href="#tab_7_4" tabindex="-1" data-toggle="tab">
Option 4 </a>
</li>
</ul>
</li>
<li>
<a href="#tab_7_1" data-toggle="tab">
Settings </a>
</li>
<li>
<a href="#tab_7_1" data-toggle="tab">
More </a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="portlet box yellow">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Styled Tabs
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
</div>
</div>
<div class="portlet-body">
<h3>Default Tab</h3>
<div class="tabbable-line">
<ul class="nav nav-tabs ">
<li class="active">
<a href="#tab_15_1" data-toggle="tab">
Section 1 </a>
</li>
<li>
<a href="#tab_15_2" data-toggle="tab">
Section 2 </a>
</li>
<li>
<a href="#tab_15_3" data-toggle="tab">
Section 3 </a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab_15_1">
<p>
I'm in Section 1.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.
</p>
</div>
<div class="tab-pane" id="tab_15_2">
<p>
Howdy, I'm in Section 2.
</p>
<p>
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat. Ut wisi enim ad minim veniam, quis nostrud exerci tation.
</p>
<p>
<a class="btn green" href="ui_tabs_accordions_navs.html#tab_15_2" target="_blank">
Activate this tab via URL </a>
</p>
</div>
<div class="tab-pane" id="tab_15_3">
<p>
Howdy, I'm in Section 3.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat
</p>
<p>
<a class="btn yellow" href="ui_tabs_accordions_navs.html#tab_15_3" target="_blank">
Activate this tab via URL </a>
</p>
</div>
</div>
</div>
<h3>Below Tab</h3>
<div class="tabbable-line tabs-below">
<div class="tab-content">
<div class="tab-pane active" id="tab_16_2_1">
<p>
I'm in Section 1.
</p>
<p>
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.
</p>
<p>
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat dolor in hendrerit in vulputate velit esse molestie consequat.
</p>
</div>
<div class="tab-pane" id="tab_16_2_2">
<p>
Howdy, I'm in Section 2.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.
</p>
<p>
<a class="btn yellow" href="ui_tabs_accordions_navs.html#tab_16_2_2" target="_blank">
Activate this tab via URL </a>
</p>
</div>
<div class="tab-pane" id="tab_16_2_3">
<p>
Howdy, I'm in Section 3.
</p>
<p>
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate.
</p>
<p>
<a class="btn purple" href="ui_tabs_accordions_navs.html#tab_16_2_3" target="_blank">
Activate this tab via URL </a>
</p>
</div>
</div>
<ul class="nav nav-tabs">
<li class="active">
<a href="#tab_16_2_1" data-toggle="tab">
Section 1 </a>
</li>
<li>
<a href="#tab_16_2_2" data-toggle="tab">
Section 2 </a>
</li>
<li>
<a href="#tab_16_2_3" data-toggle="tab">
Section 3 </a>
</li>
</ul>
</div>
</div>
</div>
<div class="portlet box yellow">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Styled Tabs #2
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
</div>
</div>
<div class="portlet-body">
<div class="tabbable-custom ">
<ul class="nav nav-tabs ">
<li class="active">
<a href="#tab_5_1" data-toggle="tab">
Section 1 </a>
</li>
<li>
<a href="#tab_5_2" data-toggle="tab">
Section 2 </a>
</li>
<li>
<a href="#tab_5_3" data-toggle="tab">
Section 3 </a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab_5_1">
<p>
I'm in Section 1.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.
</p>
</div>
<div class="tab-pane" id="tab_5_2">
<p>
Howdy, I'm in Section 2.
</p>
<p>
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat. Ut wisi enim ad minim veniam, quis nostrud exerci tation.
</p>
<p>
<a class="btn green" href="ui_tabs_accordions_navs.html#tab_5_2" target="_blank">
Activate this tab via URL </a>
</p>
</div>
<div class="tab-pane" id="tab_5_3">
<p>
Howdy, I'm in Section 3.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat
</p>
<p>
<a class="btn yellow" href="ui_tabs_accordions_navs.html#tab_5_3" target="_blank">
Activate this tab via URL </a>
</p>
</div>
</div>
</div>
<div class="tabbable-custom tabs-below">
<div class="tab-content">
<div class="tab-pane active" id="tab_6_2_1">
<p>
I'm in Section 1.
</p>
<p>
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.
</p>
<p>
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat dolor in hendrerit in vulputate velit esse molestie consequat.
</p>
</div>
<div class="tab-pane" id="tab_6_2_2">
<p>
Howdy, I'm in Section 2.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.
</p>
<p>
<a class="btn yellow" href="ui_tabs_accordions_navs.html#tab_6_2_2" target="_blank">
Activate this tab via URL </a>
</p>
</div>
<div class="tab-pane" id="tab_6_2_3">
<p>
Howdy, I'm in Section 3.
</p>
<p>
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate.
</p>
<p>
<a class="btn purple" href="ui_tabs_accordions_navs.html#tab_6_2_3" target="_blank">
Activate this tab via URL </a>
</p>
</div>
</div>
<ul class="nav nav-tabs">
<li class="active">
<a href="#tab_6_2_1" data-toggle="tab">
Section 1 </a>
</li>
<li>
<a href="#tab_6_2_2" data-toggle="tab">
Section 2 </a>
</li>
<li>
<a href="#tab_6_2_3" data-toggle="tab">
Section 3 </a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<!-- BEGIN TAB PORTLET-->
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Portlet Tabs
</div>
<ul class="nav nav-tabs">
<li>
<a href="#portlet_tab3" data-toggle="tab">
Tab 3 </a>
</li>
<li>
<a href="#portlet_tab2" data-toggle="tab">
Tab 2 </a>
</li>
<li class="active">
<a href="#portlet_tab1" data-toggle="tab">
Tab 1 </a>
</li>
</ul>
</div>
<div class="portlet-body">
<div class="tab-content">
<div class="tab-pane active" id="portlet_tab1">
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent.
</p>
<div class="alert alert-warning">
<p>
There is a known issue where the dropdown menu appears to be a clipping if it placed in tabbed content. By far there is no flaxible fix for this issue as per discussion here: <a target="_blank" href="https://github.com/twitter/bootstrap/issues/3661">
https://github.com/twitter/bootstrap/issues/3661 </a>
</p>
<p>
But you can check out the below dropdown menu. Don't worry it won't get chopped out by the tab content. Instead it will be opened as dropup menu
</p>
</div>
<div class="btn-group">
<a class="btn purple" href="#" data-toggle="dropdown">
<i class="fa fa-user"></i> Settings <i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu bottom-up">
<li>
<a href="#">
<i class="fa fa-plus"></i> Add </a>
</li>
<li>
<a href="#">
<i class="fa fa-trash-o"></i> Edit </a>
</li>
<li>
<a href="#">
<i class="fa fa-times"></i> Delete </a>
</li>
<li class="divider">
</li>
<li>
<a href="#">
<i class="i"></i> Full Settings </a>
</li>
</ul>
</div>
</div>
<div class="tab-pane" id="portlet_tab2">
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo.
</p>
<p>
<a class="btn red" href="ui_tabs_accordions_navs.html#portlet_tab2" target="_blank">
Activate this tab via URL </a>
</p>
</div>
<div class="tab-pane" id="portlet_tab3">
<p>
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
</p>
<p>
<a class="btn blue" href="ui_tabs_accordions_navs.html#portlet_tab3" target="_blank">
Activate this tab via URL </a>
</p>
</div>
</div>
</div>
</div>
<!-- END TAB PORTLET-->
<!-- BEGIN TAB PORTLET-->
<div class="portlet box green">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Portlet Tabs
</div>
<ul class="nav nav-tabs">
<li>
<a href="#portlet_tab2_3" data-toggle="tab">
Tab 3 </a>
</li>
<li>
<a href="#portlet_tab2_2" data-toggle="tab">
Tab 2 </a>
</li>
<li class="active">
<a href="#portlet_tab2_1" data-toggle="tab">
Tab 1 </a>
</li>
</ul>
</div>
<div class="portlet-body">
<div class="tab-content">
<div class="tab-pane active" id="portlet_tab2_1">
<div class="alert alert-success">
Check out the below dropdown menu. It will be opened as usual since there is enough space at the bottom.
</div>
<div class="btn-group margin-bottom-10">
<a class="btn red" href="#" data-toggle="dropdown">
<i class="fa fa-user"></i> Settings <i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu">
<li>
<a href="#">
<i class="fa fa-plus"></i> Add </a>
</li>
<li>
<a href="#">
<i class="fa fa-trash-o"></i> Edit </a>
</li>
<li>
<a href="#">
<i class="fa fa-times"></i> Delete </a>
</li>
<li class="divider">
</li>
<li>
<a href="#">
<i class="i"></i> Full Settings </a>
</li>
</ul>
</div>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait.
</p>
<p>
Deros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna. consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna.
</p>
</div>
<div class="tab-pane" id="portlet_tab2_2">
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo.
</p>
<p>
<a class="btn red" href="ui_tabs_accordions_navs.html#portlet_tab2_2" target="_blank">
Activate this tab via URL </a>
</p>
</div>
<div class="tab-pane" id="portlet_tab2_3">
<p>
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
</p>
<p>
<a class="btn purple" href="ui_tabs_accordions_navs.html#portlet_tab2_3" target="_blank">
Activate this tab via URL </a>
</p>
</div>
</div>
</div>
</div>
<!-- END TAB PORTLET-->
<!-- BEGIN ACCORDION PORTLET-->
<div class="portlet box green">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Accordions
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
<a href="javascript:;" class="reload">
</a>
<a href="javascript:;" class="remove">
</a>
</div>
</div>
<div class="portlet-body">
<div class="panel-group accordion" id="accordion1">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#collapse_1">
Collapsible Group Item #1 </a>
</h4>
</div>
<div id="collapse_1" class="panel-collapse in">
<div class="panel-body">
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod.
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#collapse_2">
Collapsible Group Item #2 </a>
</h4>
</div>
<div id="collapse_2" class="panel-collapse collapse">
<div class="panel-body" style="height:200px; overflow-y:auto;">
<p>
111111Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
<a class="btn blue" href="ui_tabs_accordions_navs.html#collapse_2" target="_blank">
Activate this section via URL </a>
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#collapse_3">
Collapsible Group Item #3 </a>
</h4>
</div>
<div id="collapse_3" class="panel-collapse collapse">
<div class="panel-body">
<p>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
<a class="btn green" href="ui_tabs_accordions_navs.html#collapse_3" target="_blank">
Activate this section via URL </a>
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#collapse_4">
Collapsible Group Item #4 </a>
</h4>
</div>
<div id="collapse_4" class="panel-collapse collapse">
<div class="panel-body">
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
<a class="btn red" href="ui_tabs_accordions_navs.html#collapse_4" target="_blank">
Activate this section via URL </a>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- END ACCORDION PORTLET-->
<!-- BEGIN ACCORDION PORTLET-->
<div class="portlet box yellow">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Accordions with Icons
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
<a href="javascript:;" class="reload">
</a>
<a href="javascript:;" class="remove">
</a>
</div>
</div>
<div class="portlet-body">
<div class="panel-group accordion" id="accordion3">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle accordion-toggle-styled" data-toggle="collapse" data-parent="#accordion3" href="#collapse_3_1">
Collapsible Group Item #1 </a>
</h4>
</div>
<div id="collapse_3_1" class="panel-collapse in">
<div class="panel-body">
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod.
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle accordion-toggle-styled collapsed" data-toggle="collapse" data-parent="#accordion3" href="#collapse_3_2">
Collapsible Group Item #2 </a>
</h4>
</div>
<div id="collapse_3_2" class="panel-collapse collapse">
<div class="panel-body" style="height:200px; overflow-y:auto;">
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
<a class="btn blue" href="ui_tabs_accordions_navs.html#collapse_3_2" target="_blank">
Activate this section via URL </a>
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle accordion-toggle-styled collapsed" data-toggle="collapse" data-parent="#accordion3" href="#collapse_3_3">
Collapsible Group Item #3 </a>
</h4>
</div>
<div id="collapse_3_3" class="panel-collapse collapse">
<div class="panel-body">
<p>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
<a class="btn green" href="ui_tabs_accordions_navs.html#collapse_3_3" target="_blank">
Activate this section via URL </a>
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle accordion-toggle-styled collapsed" data-toggle="collapse" data-parent="#accordion3" href="#collapse_3_4">
Collapsible Group Item #4 </a>
</h4>
</div>
<div id="collapse_3_4" class="panel-collapse collapse">
<div class="panel-body">
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
<a class="btn red" href="ui_tabs_accordions_navs.html#collapse_3_4" target="_blank">
Activate this section via URL </a>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- END ACCORDION PORTLET-->
<!-- BEGIN ACCORDION PORTLET-->
<div class="portlet box purple">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Scrollable Accordions
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
<a href="javascript:;" class="reload">
</a>
<a href="javascript:;" class="remove">
</a>
</div>
</div>
<div class="portlet-body">
<div class="panel-group accordion scrollable" id="accordion2">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse_2_1">
Collapsible Group Item #1 </a>
</h4>
</div>
<div id="collapse_2_1" class="panel-collapse in">
<div class="panel-body">
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod.
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse_2_2">
Collapsible Group Item #2 </a>
</h4>
</div>
<div id="collapse_2_2" class="panel-collapse collapse">
<div class="panel-body">
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
<a class="btn blue" href="ui_tabs_accordions_navs.html#collapse_2_2" target="_blank">
Activate this section via URL </a>
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse_2_3">
Collapsible Group Item #3 </a>
</h4>
</div>
<div id="collapse_2_3" class="panel-collapse collapse">
<div class="panel-body">
<p>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
<a class="btn green" href="ui_tabs_accordions_navs.html#collapse_2_3" target="_blank">
Activate this section via URL </a>
</p>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse_2_4">
Collapsible Group Item #4 </a>
</h4>
</div>
<div id="collapse_2_4" class="panel-collapse collapse">
<div class="panel-body">
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut.
</p>
<p>
<a class="btn red" href="ui_tabs_accordions_navs.html#collapse_2_4" target="_blank">
Activate this section via URL </a>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- END ACCORDION PORTLET-->
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Styled Tabs(justified)
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
</div>
</div>
<div class="portlet-body">
<div class="tabbable-custom nav-justified">
<ul class="nav nav-tabs nav-justified">
<li class="active">
<a href="#tab_1_1_1" data-toggle="tab">
Section 1 </a>
</li>
<li>
<a href="#tab_1_1_2" data-toggle="tab">
Section 2 </a>
</li>
<li>
<a href="#tab_1_1_3" data-toggle="tab">
Section 3 </a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tab_1_1_1">
<p>
I'm in Section 1.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.
</p>
</div>
<div class="tab-pane" id="tab_1_1_2">
<p>
Howdy, I'm in Section 2.
</p>
<p>
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat. Ut wisi enim ad minim veniam, quis nostrud exerci tation.
</p>
<p>
<a class="btn green" href="ui_tabs_accordions_navs.html#tab_1_1_2" target="_blank">
Activate this tab via URL </a>
</p>
</div>
<div class="tab-pane" id="tab_1_1_3">
<p>
Howdy, I'm in Section 3.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat
</p>
<p>
<a class="btn yellow" href="ui_tabs_accordions_navs.html#tab_1_1_3" target="_blank">
Activate this tab via URL </a>
</p>
</div>
</div>
</div>
<div class="tabbable-custom tabs-below nav-justified">
<div class="tab-content">
<div class="tab-pane active" id="tab_17_1">
<p>
I'm in Section 1.
</p>
<p>
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.
</p>
<p>
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat dolor in hendrerit in vulputate velit esse molestie consequat.
</p>
</div>
<div class="tab-pane" id="tab_17_2">
<p>
Howdy, I'm in Section 2.
</p>
<p>
Duis autem vel eum iriure dolor in hendrerit in vulputate. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat.
</p>
<p>
<a class="btn yellow" href="ui_tabs_accordions_navs.html#tab_17_2" target="_blank">
Activate this tab via URL </a>
</p>
</div>
<div class="tab-pane" id="tab_17_3">
<p>
Howdy, I'm in Section 3.
</p>
<p>
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate.
</p>
<p>
<a class="btn purple" href="ui_tabs_accordions_navs.html#tab_17_3" target="_blank">
Activate this tab via URL </a>
</p>
</div>
</div>
<ul class="nav nav-tabs nav-justified">
<li class="active">
<a href="#tab_17_1" data-toggle="tab">
Section 1 </a>
</li>
<li>
<a href="#tab_17_2" data-toggle="tab">
Section 2 </a>
</li>
<li>
<a href="#tab_17_3" data-toggle="tab">
Section 3 </a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="portlet box green">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Navbar
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
</div>
</div>
<div class="portlet-body">
<div class="navbar navbar-default" role="navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<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" href="#">
Brand </a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li class="active">
<a href="#">
Link </a>
</li>
<li>
<a href="#">
Link </a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Dropdown <i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu">
<li>
<a href="#">
Action </a>
</li>
<li>
<a href="#">
Another action </a>
</li>
<li>
<a href="#">
Something else here </a>
</li>
<li>
<a href="#">
Separated link </a>
</li>
<li>
<a href="#">
One more separated link </a>
</li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn blue">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#">
Link </a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Dropdown <i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu">
<li>
<a href="#">
Action </a>
</li>
<li>
<a href="#">
Another action </a>
</li>
<li>
<a href="#">
Something else here </a>
</li>
<li>
<a href="#">
Separated link </a>
</li>
</ul>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<h4>Home</h4>
<p>
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
</p>
</div>
</div>
<div class="portlet box yellow">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>ScrollSpy
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="#portlet-config" data-toggle="modal" class="config">
</a>
</div>
</div>
<div class="portlet-body">
<div id="navbar-example2" class="navbar navbar-default navbar-static" role="navigation">
<div class="navbar-header">
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".bs-js-navbar-scrollspy">
<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" href="#">
Section Name </a>
</div>
<div class="collapse navbar-collapse bs-js-navbar-scrollspy">
<ul class="nav navbar-nav">
<li class="active">
<a href="#home">
Home </a>
</li>
<li>
<a href="#profile">
Profile </a>
</li>
<li class="dropdown">
<a href="#" id="navbarDrop1" class="dropdown-toggle" data-toggle="dropdown">
Options <i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="navbarDrop1">
<li>
<a href="#section1" tabindex="-1">
section 1 </a>
</li>
<li>
<a href="#section2" tabindex="-1">
section 2 </a>
</li>
<li class="divider">
</li>
<li>
<a href="#section3" tabindex="-1">
section 1 </a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div data-spy="scroll" data-target="#navbar-example2" data-offset="0" class="scrollspy-example">
<h4 id="home">Home</h4>
<p>
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
</p>
<h4 id="profile">Profile</h4>
<p>
Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard. Freegan beard aliqua cupidatat mcsweeney's vero. Cupidatat four loko nisi, ea helvetica nulla carles. Tattooed cosby sweater food truck, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.
</p>
<h4 id="section1">Section 1</h4>
<p>
Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.
</p>
<h4 id="section2">Section 2</h4>
<p>
In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.
</p>
<h4 id="section3">Section 3</h4>
<p>
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
</p>
<p>
Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats you probably haven't heard of them consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat before they sold out, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.
</p>
</div>
</div>
</div>
</div>
<!-- END PAGE CONTENT-->
</div>
<!-- END PAGE CONTAINER-->
</div>
<!-- BEGIN CONTENT -->
</div>
<!-- END CONTENT -->
<!-- BEGIN QUICK SIDEBAR -->
<a href="javascript:;" class="page-quick-sidebar-toggler"><i class="icon-close"></i></a>
<div class="page-quick-sidebar-wrapper">
<div class="page-quick-sidebar">
<div class="nav-justified">
<ul class="nav nav-tabs nav-justified">
<li class="active">
<a href="#quick_sidebar_tab_1" data-toggle="tab">
Users <span class="badge badge-danger">2</span>
</a>
</li>
<li>
<a href="#quick_sidebar_tab_2" data-toggle="tab">
Alerts <span class="badge badge-success">7</span>
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
More<i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu pull-right" role="menu">
<li>
<a href="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-bell"></i> Alerts </a>
</li>
<li>
<a href="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-info"></i> Notifications </a>
</li>
<li>
<a href="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-speech"></i> Activities </a>
</li>
<li class="divider">
</li>
<li>
<a href="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-settings"></i> Settings </a>
</li>
</ul>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active page-quick-sidebar-chat" id="quick_sidebar_tab_1">
<div class="page-quick-sidebar-chat-users" data-rail-color="#ddd" data-wrapper-class="page-quick-sidebar-list">
<h3 class="list-heading">Staff</h3>
<ul class="media-list list-items">
<li class="media">
<div class="media-status">
<span class="badge badge-success">8</span>
</div>
<img class="media-object" src="../../assets/admin/layout/img/avatar3.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Bob Nilson</h4>
<div class="media-heading-sub">
Project Manager
</div>
</div>
</li>
<li class="media">
<img class="media-object" src="../../assets/admin/layout/img/avatar1.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Nick Larson</h4>
<div class="media-heading-sub">
Art Director
</div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="badge badge-danger">3</span>
</div>
<img class="media-object" src="../../assets/admin/layout/img/avatar4.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Deon Hubert</h4>
<div class="media-heading-sub">
CTO
</div>
</div>
</li>
<li class="media">
<img class="media-object" src="../../assets/admin/layout/img/avatar2.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Ella Wong</h4>
<div class="media-heading-sub">
CEO
</div>
</div>
</li>
</ul>
<h3 class="list-heading">Customers</h3>
<ul class="media-list list-items">
<li class="media">
<div class="media-status">
<span class="badge badge-warning">2</span>
</div>
<img class="media-object" src="../../assets/admin/layout/img/avatar6.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Lara Kunis</h4>
<div class="media-heading-sub">
CEO, Loop Inc
</div>
<div class="media-heading-small">
Last seen 03:10 AM
</div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="label label-sm label-success">new</span>
</div>
<img class="media-object" src="../../assets/admin/layout/img/avatar7.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Ernie Kyllonen</h4>
<div class="media-heading-sub">
Project Manager,<br>
SmartBizz PTL
</div>
</div>
</li>
<li class="media">
<img class="media-object" src="../../assets/admin/layout/img/avatar8.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Lisa Stone</h4>
<div class="media-heading-sub">
CTO, Keort Inc
</div>
<div class="media-heading-small">
Last seen 13:10 PM
</div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="badge badge-success">7</span>
</div>
<img class="media-object" src="../../assets/admin/layout/img/avatar9.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Deon Portalatin</h4>
<div class="media-heading-sub">
CFO, H&D LTD
</div>
</div>
</li>
<li class="media">
<img class="media-object" src="../../assets/admin/layout/img/avatar10.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Irina Savikova</h4>
<div class="media-heading-sub">
CEO, Tizda Motors Inc
</div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="badge badge-danger">4</span>
</div>
<img class="media-object" src="../../assets/admin/layout/img/avatar11.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Maria Gomez</h4>
<div class="media-heading-sub">
Manager, Infomatic Inc
</div>
<div class="media-heading-small">
Last seen 03:10 AM
</div>
</div>
</li>
</ul>
</div>
<div class="page-quick-sidebar-item">
<div class="page-quick-sidebar-chat-user">
<div class="page-quick-sidebar-nav">
<a href="javascript:;" class="page-quick-sidebar-back-to-list"><i class="icon-arrow-left"></i>Back</a>
</div>
<div class="page-quick-sidebar-chat-user-messages">
<div class="post out">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar3.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Bob Nilson</a>
<span class="datetime">20:15</span>
<span class="body">
When could you send me the report ? </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar2.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Ella Wong</a>
<span class="datetime">20:15</span>
<span class="body">
Its almost done. I will be sending it shortly </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar3.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Bob Nilson</a>
<span class="datetime">20:15</span>
<span class="body">
Alright. Thanks! :) </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar2.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Ella Wong</a>
<span class="datetime">20:16</span>
<span class="body">
You are most welcome. Sorry for the delay. </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar3.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Bob Nilson</a>
<span class="datetime">20:17</span>
<span class="body">
No probs. Just take your time :) </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar2.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Ella Wong</a>
<span class="datetime">20:40</span>
<span class="body">
Alright. I just emailed it to you. </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar3.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Bob Nilson</a>
<span class="datetime">20:17</span>
<span class="body">
Great! Thanks. Will check it right away. </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar2.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Ella Wong</a>
<span class="datetime">20:40</span>
<span class="body">
Please let me know if you have any comment. </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar3.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Bob Nilson</a>
<span class="datetime">20:17</span>
<span class="body">
Sure. I will check and buzz you if anything needs to be corrected. </span>
</div>
</div>
</div>
<div class="page-quick-sidebar-chat-user-form">
<div class="input-group">
<input type="text" class="form-control" placeholder="Type a message here...">
<div class="input-group-btn">
<button type="button" class="btn blue"><i class="icon-paper-clip"></i></button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane page-quick-sidebar-alerts" id="quick_sidebar_tab_2">
<div class="page-quick-sidebar-alerts-list">
<h3 class="list-heading">General</h3>
<ul class="feeds list-items">
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-check"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
You have 4 pending tasks. <span class="label label-sm label-warning ">
Take action <i class="fa fa-share"></i>
</span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
Just now
</div>
</div>
</li>
<li>
<a href="#">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-success">
<i class="fa fa-bar-chart-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
Finance Report for year 2013 has been released.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
20 mins
</div>
</div>
</a>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-danger">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
You have 5 pending membership that requires a quick review.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
24 mins
</div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-shopping-cart"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
New order received with <span class="label label-sm label-success">
Reference Number: DR23923 </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
30 mins
</div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-success">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
You have 5 pending membership that requires a quick review.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
24 mins
</div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-bell-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
Web server hardware needs to be upgraded. <span class="label label-sm label-warning">
Overdue </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
2 hours
</div>
</div>
</li>
<li>
<a href="#">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-default">
<i class="fa fa-briefcase"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
IPO Report for year 2013 has been released.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
20 mins
</div>
</div>
</a>
</li>
</ul>
<h3 class="list-heading">System</h3>
<ul class="feeds list-items">
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-check"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
You have 4 pending tasks. <span class="label label-sm label-warning ">
Take action <i class="fa fa-share"></i>
</span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
Just now
</div>
</div>
</li>
<li>
<a href="#">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-danger">
<i class="fa fa-bar-chart-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
Finance Report for year 2013 has been released.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
20 mins
</div>
</div>
</a>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-default">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
You have 5 pending membership that requires a quick review.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
24 mins
</div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-shopping-cart"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
New order received with <span class="label label-sm label-success">
Reference Number: DR23923 </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
30 mins
</div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-success">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
You have 5 pending membership that requires a quick review.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
24 mins
</div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-warning">
<i class="fa fa-bell-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
Web server hardware needs to be upgraded. <span class="label label-sm label-default ">
Overdue </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
2 hours
</div>
</div>
</li>
<li>
<a href="#">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-briefcase"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
IPO Report for year 2013 has been released.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
20 mins
</div>
</div>
</a>
</li>
</ul>
</div>
</div>
<div class="tab-pane page-quick-sidebar-settings" id="quick_sidebar_tab_3">
<div class="page-quick-sidebar-settings-list">
<h3 class="list-heading">General Settings</h3>
<ul class="list-items borderless">
<li>
Enable Notifications <input type="checkbox" class="make-switch" checked data-size="small" data-on-color="success" data-on-text="ON" data-off-color="default" data-off-text="OFF">
</li>
<li>
Allow Tracking <input type="checkbox" class="make-switch" data-size="small" data-on-color="info" data-on-text="ON" data-off-color="default" data-off-text="OFF">
</li>
<li>
Log Errors <input type="checkbox" class="make-switch" checked data-size="small" data-on-color="danger" data-on-text="ON" data-off-color="default" data-off-text="OFF">
</li>
<li>
Auto Sumbit Issues <input type="checkbox" class="make-switch" data-size="small" data-on-color="warning" data-on-text="ON" data-off-color="default" data-off-text="OFF">
</li>
<li>
Enable SMS Alerts <input type="checkbox" class="make-switch" checked data-size="small" data-on-color="success" data-on-text="ON" data-off-color="default" data-off-text="OFF">
</li>
</ul>
<h3 class="list-heading">System Settings</h3>
<ul class="list-items borderless">
<li>
Security Level
<select class="form-control input-inline input-sm input-small">
<option value="1">Normal</option>
<option value="2" selected>Medium</option>
<option value="e">High</option>
</select>
</li>
<li>
Failed Email Attempts <input class="form-control input-inline input-sm input-small" value="5"/>
</li>
<li>
Secondary SMTP Port <input class="form-control input-inline input-sm input-small" value="3560"/>
</li>
<li>
Notify On System Error <input type="checkbox" class="make-switch" checked data-size="small" data-on-color="danger" data-on-text="ON" data-off-color="default" data-off-text="OFF">
</li>
<li>
Notify On SMTP Error <input type="checkbox" class="make-switch" checked data-size="small" data-on-color="warning" data-on-text="ON" data-off-color="default" data-off-text="OFF">
</li>
</ul>
<div class="inner-content">
<button class="btn btn-success"><i class="icon-settings"></i> Save Changes</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- END QUICK SIDEBAR -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<div class="page-footer">
<div class="page-footer-inner">
2014 © Metronic by keenthemes.
</div>
<div class="scroll-to-top">
<i class="icon-arrow-up"></i>
</div>
</div>
<!-- END FOOTER -->
<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
<!-- BEGIN CORE PLUGINS -->
<!--[if lt IE 9]>
<script src="../../assets/global/plugins/respond.min.js"></script>
<script src="../../assets/global/plugins/excanvas.min.js"></script>
<![endif]-->
<script src="../../assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery-migrate.min.js" type="text/javascript"></script>
<!-- IMPORTANT! Load jquery-ui-1.10.3.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
<script src="../../assets/global/plugins/jquery-ui/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery.cokie.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="../../assets/global/scripts/metronic.js" type="text/javascript"></script>
<script src="../../assets/admin/layout/scripts/layout.js" type="text/javascript"></script>
<script src="../../assets/admin/layout/scripts/quick-sidebar.js" type="text/javascript"></script>
<script src="../../assets/admin/layout/scripts/demo.js" type="text/javascript"></script>
<!-- END PAGE LEVEL SCRIPTS -->
<script>
jQuery(document).ready(function() {
// initiate layout and plugins
Metronic.init(); // init metronic core components
Layout.init(); // init current layout
QuickSidebar.init(); // init quick sidebar
Demo.init(); // init demo features
});
</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html> | {'content_hash': 'f860ef3b8ef8caaad46dbd3feb9e6d2b', 'timestamp': '', 'source': 'github', 'line_count': 3618, 'max_line_length': 716, 'avg_line_length': 39.94637921503593, 'alnum_prop': 0.560584254736172, 'repo_name': 'zzsoszz/metronicv36', 'id': '02e14fe7977522c6b5cae7791b6688cbd61f4c12', 'size': '144526', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'theme_rtl/templates/admin/ui_tabs_accordions_navs.html', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'ASP', 'bytes': '580'}, {'name': 'ApacheConf', 'bytes': '932'}, {'name': 'CSS', 'bytes': '8633184'}, {'name': 'CoffeeScript', 'bytes': '167262'}, {'name': 'Go', 'bytes': '14152'}, {'name': 'HTML', 'bytes': '69593132'}, {'name': 'JavaScript', 'bytes': '11861529'}, {'name': 'PHP', 'bytes': '438910'}, {'name': 'Python', 'bytes': '11690'}, {'name': 'Shell', 'bytes': '888'}]} |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@id/lv_news"
android:listSelector="#00000000"
android:divider="@android:color/transparent"></ListView>
</LinearLayout> | {'content_hash': '7f18197348aeaf148d6f44dd725bb199', 'timestamp': '', 'source': 'github', 'line_count': 11, 'max_line_length': 72, 'avg_line_length': 41.63636363636363, 'alnum_prop': 0.7314410480349345, 'repo_name': 'karmalove/ZhiLiaoDaily', 'id': '1db8cd3b3f73bc5cbef2a32abd57176d93fd7861', 'size': '458', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/src/main/res/layout/news_layout.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '96484'}]} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
Rebutia canacruzensis Rausch
### Remarks
null | {'content_hash': '53ca57f8371267daf5b07efcdf42495b', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 31, 'avg_line_length': 11.538461538461538, 'alnum_prop': 0.74, 'repo_name': 'mdoering/backbone', 'id': '50775323f5a90aa333cd65bb86b0e322882058ba', 'size': '223', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Magnoliophyta/Magnoliopsida/Caryophyllales/Cactaceae/Lobivia/Lobivia haagei/Lobivia haagei canacruzensis/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
<?php
include_once __DIR__ . '/../../../config/Global.config.php';
include_once ROOT_PATH . SRU . 'ws/ws_sc03.php';
if ($_SERVER['REQUEST_METHOD'] !== 'PUT') {
http_response_code(405);
exit('Method not allowed');
}
if (!isset($httpRawData)) {
$httpRawData = file_get_contents('php://input');
}
$obj = new UpdateSubscriptionContainer;
$obj->setParam($httpRawData);
echo $obj->set();
| {'content_hash': '4630be5a41d535e3ad4e68dbe120a6b5', 'timestamp': '', 'source': 'github', 'line_count': 17, 'max_line_length': 60, 'avg_line_length': 23.41176470588235, 'alnum_prop': 0.6306532663316583, 'repo_name': 'whchi/TPElineService', 'id': '8b2cfc205e43f2ea0ad732d89e22d91f111c3b26', 'size': '398', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'restfulapi/v1/updateSubscriptionContainer/index.php', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '7451'}, {'name': 'JavaScript', 'bytes': '44292'}, {'name': 'PHP', 'bytes': '269366'}]} |
<?php
namespace Zend\Log\Formatter;
use DateTime;
use Traversable;
use Zend\Stdlib\ErrorHandler;
class Base implements FormatterInterface {
/**
* Format specifier for DateTime objects in event data (default: ISO 8601)
*
* @see http://php.net/manual/en/function.date.php
* @var string
*/
protected $dateTimeFormat = self::DEFAULT_DATETIME_FORMAT;
/**
* Class constructor
*
* @see http://php.net/manual/en/function.date.php
* @param null|string|array|Traversable $dateTimeFormat
* Format for DateTime objects
*/
public function __construct($dateTimeFormat = null) {
if ($dateTimeFormat instanceof Traversable) {
$dateTimeFormat = iterator_to_array ( $dateTimeFormat );
}
if (is_array ( $dateTimeFormat )) {
$dateTimeFormat = isset ( $dateTimeFormat ['dateTimeFormat'] ) ? $dateTimeFormat ['dateTimeFormat'] : null;
}
if (null !== $dateTimeFormat) {
$this->dateTimeFormat = $dateTimeFormat;
}
}
/**
* Formats data to be written by the writer.
*
* @param array $event
* event data
* @return array
*/
public function format($event) {
foreach ( $event as $key => $value ) {
// Keep extra as an array
if ('extra' === $key) {
$event [$key] = self::format ( $value );
} else {
$event [$key] = $this->normalize ( $value );
}
}
return $event;
}
/**
* Normalize all non-scalar data types (except null) in a string value
*
* @param mixed $value
* @return mixed
*/
protected function normalize($value) {
if (is_scalar ( $value ) || null === $value) {
return $value;
}
// better readable JSON
static $jsonFlags;
if ($jsonFlags === null) {
$jsonFlags = 0;
$jsonFlags |= defined ( 'JSON_UNESCAPED_SLASHES' ) ? JSON_UNESCAPED_SLASHES : 0;
$jsonFlags |= defined ( 'JSON_UNESCAPED_UNICODE' ) ? JSON_UNESCAPED_UNICODE : 0;
}
ErrorHandler::start ();
if ($value instanceof DateTime) {
$value = $value->format ( $this->getDateTimeFormat () );
} elseif ($value instanceof Traversable) {
$value = json_encode ( iterator_to_array ( $value ), $jsonFlags );
} elseif (is_array ( $value )) {
$value = json_encode ( $value, $jsonFlags );
} elseif (is_object ( $value ) && ! method_exists ( $value, '__toString' )) {
$value = sprintf ( 'object(%s) %s', get_class ( $value ), json_encode ( $value ) );
} elseif (is_resource ( $value )) {
$value = sprintf ( 'resource(%s)', get_resource_type ( $value ) );
} elseif (! is_object ( $value )) {
$value = gettype ( $value );
}
ErrorHandler::stop ();
return ( string ) $value;
}
/**
*
* {@inheritDoc}
*
*/
public function getDateTimeFormat() {
return $this->dateTimeFormat;
}
/**
*
* {@inheritDoc}
*
*/
public function setDateTimeFormat($dateTimeFormat) {
$this->dateTimeFormat = ( string ) $dateTimeFormat;
return $this;
}
}
| {'content_hash': '8f3e5f18dde312e82d9e359822d3dbf0', 'timestamp': '', 'source': 'github', 'line_count': 116, 'max_line_length': 110, 'avg_line_length': 25.870689655172413, 'alnum_prop': 0.5931356214595135, 'repo_name': 'ngmautri/nhungttk', 'id': '7656705781e4afcaf01087c753f7905325f871a4', 'size': '3309', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'vendor/ZF2/library/Zend/Log/Formatter/Base.php', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '363'}, {'name': 'CSS', 'bytes': '132055'}, {'name': 'HTML', 'bytes': '9152608'}, {'name': 'Hack', 'bytes': '15061'}, {'name': 'JavaScript', 'bytes': '1259151'}, {'name': 'Less', 'bytes': '78481'}, {'name': 'PHP', 'bytes': '18771001'}, {'name': 'SCSS', 'bytes': '79489'}]} |
package org.cinchapi.concourse.server.storage.temp;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import javax.annotation.Nullable;
import javax.annotation.concurrent.NotThreadSafe;
import org.cinchapi.concourse.util.MultimapViews;
import org.cinchapi.concourse.util.TMaps;
import org.cinchapi.concourse.util.TStrings;
import org.cinchapi.concourse.server.model.TObjectSorter;
import org.cinchapi.concourse.server.model.Value;
import org.cinchapi.concourse.server.storage.Action;
import org.cinchapi.concourse.server.storage.BaseStore;
import org.cinchapi.concourse.server.storage.PermanentStore;
import org.cinchapi.concourse.server.storage.db.Database;
import org.cinchapi.concourse.thrift.Operator;
import org.cinchapi.concourse.thrift.TObject;
import org.cinchapi.concourse.time.Time;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import static com.google.common.collect.Maps.newLinkedHashMap;
/**
* {@link Limbo} is a lightweight in-memory proxy store that is a suitable cache
* or fast, albeit temporary, store for data that will eventually be persisted
* to a {@link PermanentStore}.
* <p>
* The store is designed to write data very quickly <strong>
* <em>at the expense of much slower read time.</em></strong> {@code Limbo} does
* not index<sup>1</sup> any of the data it stores, so reads are not as
* efficient as they would normally be in the {@link Database}.
* </p>
* <p>
* This class provides naive read implementations for the methods specified in
* the {@link WritableStore} interface, but the subclass is free to override
* those methods to provide smarter implementations of introduce concurrency
* controls.
* </p>
* <sup>1</sup> - All reads are O(n) because {@code Limbo} uses an
* {@link #iterator()} to traverse the {@link Write} objects that it stores.
*
* @author Jeff Nelson
*/
@NotThreadSafe
public abstract class Limbo extends BaseStore implements Iterable<Write> {
/**
* Return {@code true} if {@code input} matches {@code operator} in relation
* to {@code values}.
*
* @param input
* @param operator
* @param values
* @return {@code true} if {@code input} matches
*/
protected static boolean matches(Value input, Operator operator,
TObject... values) {
Value v1 = Value.wrap(values[0]);
switch (operator) {
case EQUALS:
return v1.equals(input);
case NOT_EQUALS:
return !v1.equals(input);
case GREATER_THAN:
return v1.compareTo(input) < 0;
case GREATER_THAN_OR_EQUALS:
return v1.compareTo(input) <= 0;
case LESS_THAN:
return v1.compareTo(input) > 0;
case LESS_THAN_OR_EQUALS:
return v1.compareTo(input) >= 0;
case BETWEEN:
Preconditions.checkArgument(values.length > 1);
Value v2 = Value.wrap(values[1]);
return v1.compareTo(input) <= 0 && v2.compareTo(input) > 0;
case REGEX:
return input.getObject().toString()
.matches(v1.getObject().toString());
case NOT_REGEX:
return !input.getObject().toString()
.matches(v1.getObject().toString());
default:
throw new UnsupportedOperationException();
}
}
/**
* A Predicate that is used to filter out empty sets.
*/
protected static final Predicate<Set<? extends Object>> emptySetFilter = new Predicate<Set<? extends Object>>() {
@Override
public boolean apply(@Nullable Set<? extends Object> input) {
return !input.isEmpty();
}
};
@Override
public Map<Long, String> audit(long record) {
Map<Long, String> audit = Maps.newTreeMap();
for (Iterator<Write> it = iterator(); it.hasNext();) {
Write write = it.next();
if(write.getRecord().longValue() == record) {
audit.put(write.getVersion(), write.toString());
}
}
return audit;
}
@Override
public Map<Long, String> audit(String key, long record) {
Map<Long, String> audit = Maps.newTreeMap();
for (Iterator<Write> it = iterator(); it.hasNext();) {
Write write = it.next();
if(write.getKey().toString().equals(key)
&& write.getRecord().longValue() == record) {
audit.put(write.getVersion(), write.toString());
}
}
return audit;
}
@Override
public Map<TObject, Set<Long>> browse(String key) {
return browse(key, Time.NONE);
}
@Override
public Map<TObject, Set<Long>> browse(String key, long timestamp) {
Map<TObject, Set<Long>> context = Maps
.newTreeMap(TObjectSorter.INSTANCE);
return browse(key, timestamp, context);
}
/**
* Calculate the browsable view of {@code key} at {@code timestamp} using
* prior {@code context} as if it were also a part of the Buffer.
*
* @param key
* @param timestamp
* @param context
* @return a possibly empty Map of data
*/
public Map<TObject, Set<Long>> browse(String key, long timestamp,
Map<TObject, Set<Long>> context) {
if(timestamp >= getOldestWriteTimstamp()) {
for (Iterator<Write> it = iterator(); it.hasNext();) {
Write write = it.next();
if(write.getKey().toString().equals(key)
&& write.getVersion() <= timestamp) {
Set<Long> records = context.get(write.getValue()
.getTObject());
if(records == null) {
records = Sets.newLinkedHashSet();
context.put(write.getValue().getTObject(), records);
}
if(write.getType() == Action.ADD) {
records.add(write.getRecord().longValue());
}
else {
records.remove(write.getRecord().longValue());
}
}
else if(write.getVersion() > timestamp) {
break;
}
else {
continue;
}
}
}
return Maps.newTreeMap((SortedMap<TObject, Set<Long>>) Maps
.filterValues(context, emptySetFilter));
}
@Override
public boolean contains(long record) {
for (Iterator<Write> it = iterator(); it.hasNext();) {
Write write = it.next();
if(write.getRecord().longValue() == record) {
return true;
}
}
return false;
}
/**
* Calculate the description for {@code record} using prior {@code context}
* as if it were also a part of the Buffer.
*
* @param record
* @param timestamp
* @param context
* @return a possibly empty Set of keys
*/
public Set<String> describe(long record, long timestamp,
Map<String, Set<TObject>> context) {
if(timestamp >= getOldestWriteTimstamp()) {
for (Iterator<Write> it = iterator(); it.hasNext();) {
Write write = it.next();
if(write.getRecord().longValue() == record
&& write.getVersion() <= timestamp) {
Set<TObject> values;
values = context.get(write.getKey().toString());
if(values == null) {
values = Sets.newHashSet();
context.put(write.getKey().toString(), values);
}
if(write.getType() == Action.ADD) {
values.add(write.getValue().getTObject());
}
else {
values.remove(write.getValue().getTObject());
}
}
else if(write.getVersion() > timestamp) {
break;
}
else {
continue;
}
}
}
return newLinkedHashMap(Maps.filterValues(context, emptySetFilter))
.keySet();
}
/**
* This is an implementation of the {@code findAndBrowse} routine that takes
* in a prior {@code context}. Find and browse will return a mapping from
* records that match a criteria (expressed as {@code key} filtered by
* {@code operator} in relation to one or more {@code values}) to the set of
* values that cause that record to match the criteria.
*
* @param context
* @param timestamp
* @param key
* @param operator
* @param values
* @return the relevant data for the records that satisfy the find query
*/
public Map<Long, Set<TObject>> explore(Map<Long, Set<TObject>> context,
long timestamp, String key, Operator operator, TObject... values) {
if(timestamp >= getOldestWriteTimstamp()) {
for (Iterator<Write> it = iterator(); it.hasNext();) {
Write write = it.next();
long record = write.getRecord().longValue();
if(write.getVersion() <= timestamp) {
if(write.getKey().toString().equals(key)
&& matches(write.getValue(), operator, values)) {
if(write.getType() == Action.ADD) {
MultimapViews.put(context, record, write.getValue()
.getTObject());
}
else {
MultimapViews.remove(context, record, write
.getValue().getTObject());
}
}
}
else {
break;
}
}
}
return TMaps.asSortedMap(context);
}
/**
* Return the number of milliseconds that this store desires any back to
* back transport requests to pause in between.
*
* @return the pause time
*/
public int getDesiredTransportSleepTimeInMs() {
return 0;
}
/**
* Insert {@code write} into the store <strong>without performing any
* validity checks</strong>.
* <p>
* This method is <em>only</em> safe to call from a context that performs
* its own validity checks (i.e. a {@link BufferedStore}).
*
* @param write
* @return {@code true}
*/
public final boolean insert(Write write) {
return insert(write, true);
}
/**
* Insert {@code write} into the store <strong>without performing any
* validity checks</strong> and specify whether a {@code sync} should occur
* or not. By default, syncs are meaningless in {@link Limbo}, but some
* implementations may wish to provide guarantees that the write will be
* durably stored.
* <p>
* This method is <em>only</em> safe to call from a context that performs
* its own validity checks (i.e. a {@link BufferedStore}).
*
* @param write
* @return {@code true}
*/
public abstract boolean insert(Write write, boolean sync);
/**
* {@inheritDoc}
* <p>
* <strong>NOTE:</strong> The subclass <em>may</em> override this method to
* provide an iterator with granular locking functionality for increased
* throughput.
* </p>
*/
@Override
public abstract Iterator<Write> iterator();
@Override
public Set<Long> search(String key, String query) {
Map<Long, Set<Value>> rtv = Maps.newHashMap();
String[] needle = TStrings.stripStopWordsAndTokenize(query
.toLowerCase());
if(needle.length > 0) {
for (Iterator<Write> it = getSearchIterator(key); it.hasNext();) {
Write write = it.next();
Value value = write.getValue();
long record = write.getRecord().longValue();
if(isPossibleSearchMatch(key, write, value)) {
/*
* NOTE: It is not enough to merely check if the stored text
* contains the query because the Database does infix
* indexing/searching, which has some subtleties:
* 1. Stop words are removed from the both stored indices
* and the search query
* 2. A query and document are considered to match if the
* document contains a sequence of terms where each term or
* a substring of the term matches the term in the same
* relative position of the query.
*/
// CON-10: compare lowercase for case insensitive search
String stored = (String) (value.getObject());
String[] haystack = TStrings
.stripStopWordsAndTokenize(stored.toLowerCase());
if(haystack.length > 0
&& TStrings.isInfixSearchMatch(needle, haystack)) {
Set<Value> values = rtv.get(record);
if(values == null) {
values = Sets.newHashSet();
rtv.put(record, values);
}
if(write.getType() == Action.REMOVE) {
values.remove(value);
}
else {
values.add(value);
}
}
}
}
}
// FIXME sort search results based on frequency (see
// SearchRecord#search())
return newLinkedHashMap(Maps.filterValues(rtv, emptySetFilter))
.keySet();
}
@Override
public Map<String, Set<TObject>> select(long record) {
return select(record, Time.NONE);
}
@Override
public Map<String, Set<TObject>> select(long record, long timestamp) {
Map<String, Set<TObject>> context = Maps
.newTreeMap(new Comparator<String>() {
@Override
public int compare(String s1, String s2) {
return s1.compareToIgnoreCase(s2);
}
});
return select(record, timestamp, context);
}
/**
* Calculate the browsable view of {@code record} at {@code timestamp} using
* prior {@code context} as if it were also a part of the Buffer.
*
* @param key
* @param timestamp
* @param context
* @return a possibly empty Map of data
*/
public Map<String, Set<TObject>> select(long record, long timestamp,
Map<String, Set<TObject>> context) {
if(timestamp >= getOldestWriteTimstamp()) {
for (Iterator<Write> it = iterator(); it.hasNext();) {
Write write = it.next();
if(write.getRecord().longValue() == record
&& write.getVersion() <= timestamp) {
Set<TObject> values;
values = context.get(write.getKey().toString());
if(values == null) {
values = Sets.newHashSet();
context.put(write.getKey().toString(), values);
}
if(write.getType() == Action.ADD) {
values.add(write.getValue().getTObject());
}
else {
values.remove(write.getValue().getTObject());
}
}
else if(write.getVersion() > timestamp) {
break;
}
else {
continue;
}
}
}
return Maps.newTreeMap((SortedMap<String, Set<TObject>>) Maps
.filterValues(context, emptySetFilter));
}
@Override
public Set<TObject> select(String key, long record) {
return select(key, record, Time.NONE);
}
@Override
public Set<TObject> select(String key, long record, long timestamp) {
return select(key, record, timestamp, Sets.<TObject> newLinkedHashSet());
}
/**
* Fetch the values mapped from {@code key} in {@code record} at
* {@code timestamp} using prior {@code context} as if it were also a part
* of the Buffer.
*
* @param key
* @param record
* @param timestamp
* @param context
* @return the values
*/
public Set<TObject> select(String key, long record, long timestamp,
Set<TObject> context) {
if(timestamp >= getOldestWriteTimstamp()) {
for (Iterator<Write> it = iterator(); it.hasNext();) {
Write write = it.next();
if(write.getVersion() <= timestamp) {
if(key.equals(write.getKey().toString())
&& record == write.getRecord().longValue()) {
if(write.getType() == Action.ADD) {
context.add(write.getValue().getTObject());
}
else {
context.remove(write.getValue().getTObject());
}
}
}
else {
break;
}
}
}
return context;
}
/**
* If the implementation supports durable storage, this method guarantees
* that all the data contained here-within is durably persisted. Otherwise,
* this method is meaningless and returns immediately.
*/
public void sync() {/* noop */}
/**
* Transport the content of this store to {@code destination}.
*
* @param destination
*/
public final void transport(PermanentStore destination) {
transport(destination, true);
}
/**
* Transport the content of this store to {@code destination} with the
* directive to {@code sync} or not. A sync guarantees that the transported
* data is durably persisted within the {@link PermanentStore}.
*
* @param destination
* @param sync
*/
public void transport(PermanentStore destination, boolean sync) {
for (Iterator<Write> it = iterator(); it.hasNext();) {
destination.accept(it.next(), sync);
it.remove();
}
}
@Override
public boolean verify(String key, TObject value, long record) {
return verify(key, value, record, Time.NONE);
}
@Override
public boolean verify(String key, TObject value, long record, long timestamp) {
return verify(Write.notStorable(key, value, record), timestamp);
}
/**
* Return {@code true} if {@code write} represents a data mapping that
* currently exists using {@code exists} as prior context.
* <p>
* <strong>This method is called from
* {@link BufferedStore#verify(String, TObject, long)}.</strong>
* </p>
*
* @param write
* @return {@code true} if {@code write} currently appears an odd number of
* times
*/
public boolean verify(Write write, boolean exists) {
return verify(write, Time.NONE, exists);
}
/**
* Return {@code true} if {@code write} represents a data mapping that
* exists at {@code timestamp}.
* <p>
* <strong>This method is called from
* {@link BufferedStore#verify(String, TObject, long, long)}.</strong>
* </p>
*
* @param write
* @param timestamp
* @return {@code true} if {@code write} appears an odd number of times at
* {@code timestamp}
*/
public boolean verify(Write write, long timestamp) {
return verify(write, timestamp, false);
}
/**
* Return {@code true} if {@code write} represents a data mapping that
* exists at {@code timestamp}, using {@code exists} as prior context.
* <p>
* <strong>NOTE: ALL OTHER VERIFY METHODS DEFER TO THIS ONE.</strong>
* </p>
*
* @param write
* @param timestamp
* @param exists
* @return {@code true} if {@code write} appears an odd number of times at
* {@code timestamp}
*/
public boolean verify(Write write, long timestamp, boolean exists) {
if(timestamp >= getOldestWriteTimstamp()) {
for (Iterator<Write> it = iterator(); it.hasNext();) {
Write stored = it.next();
if(stored.getVersion() <= timestamp) {
if(stored.equals(write)) {
exists ^= true; // toggle boolean
}
}
else {
break;
}
}
}
return exists;
}
/**
* Wait (block) until the Buffer has enough data to complete a transport.
* This method should be called from the external service to avoid busy
* waiting if continuously transporting data in the background.
*/
public void waitUntilTransportable() {
return; // do nothing because Limbo is assumed to always be
// transportable. But the Buffer will override this method with
// the appropriate conditions.
}
@Override
protected Map<Long, Set<TObject>> doExplore(long timestamp, String key,
Operator operator, TObject... values) {
return explore(Maps.<Long, Set<TObject>> newLinkedHashMap(), timestamp,
key, operator, values);
}
@Override
protected Map<Long, Set<TObject>> doExplore(String key, Operator operator,
TObject... values) {
return explore(Time.NONE, key, operator, values);
}
/**
* Return the timestamp for the oldest write available.
*
* @return {@code timestamp}
*/
protected abstract long getOldestWriteTimstamp();
/**
* Return the iterator to use in the {@link #search(String, String)} method.
*
* @param key
* @return the appropriate iterator to use for searching
*/
protected abstract Iterator<Write> getSearchIterator(String key);
/**
* Allows the subclass to define some criteria for the search logic to
* determine if {@code write} with {@code value} is a possible search match
* for {@code key}.
* <p>
* The {@link Buffer} uses this method to optimize the check since the
* iterator it returns in {@link #getSearchIterator(String)} does some
* pre-processing to make the routine more efficient.
* </p>
*
* @param key
* @param write
* @param value
* @return {@code true} if the write is a basic search match
*/
protected abstract boolean isPossibleSearchMatch(String key, Write write,
Value value);
}
| {'content_hash': 'ef89b0d10c96409d42642bfc59177a67', 'timestamp': '', 'source': 'github', 'line_count': 648, 'max_line_length': 117, 'avg_line_length': 36.02932098765432, 'alnum_prop': 0.5471366770891335, 'repo_name': 'prateek135/concourse', 'id': '42ebbfafdf65fc0a3be4115db9d97dd51ffcfc4c', 'size': '23951', 'binary': False, 'copies': '7', 'ref': 'refs/heads/develop', 'path': 'concourse-server/src/main/java/org/cinchapi/concourse/server/storage/temp/Limbo.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '6985'}, {'name': 'Groff', 'bytes': '39953'}, {'name': 'Groovy', 'bytes': '84616'}, {'name': 'HTML', 'bytes': '36688'}, {'name': 'Java', 'bytes': '3363392'}, {'name': 'PHP', 'bytes': '2172481'}, {'name': 'Python', 'bytes': '205360'}, {'name': 'Ruby', 'bytes': '254445'}, {'name': 'Shell', 'bytes': '87413'}, {'name': 'Thrift', 'bytes': '55791'}]} |
"""Defines URL patterns for users"""
from django.conf.urls import url
from django.contrib.auth.views import login
from . import views
urlpatterns = [
# Login page
url(r'^login/$', login, {'template_name': 'users/login.html'},
name='login'),
# Logout page
url(r'^logout/$', views.logout_view, name='logout'),
# Registration page
url(r'^register/$', views.register, name='register'),
]
| {'content_hash': '78d5fbd019c4255c5351ce41f11e175c', 'timestamp': '', 'source': 'github', 'line_count': 18, 'max_line_length': 66, 'avg_line_length': 23.38888888888889, 'alnum_prop': 0.6460807600950119, 'repo_name': 'mccarrion/python-practice', 'id': '8d639d82866a77555167322601b56e699afa09c0', 'size': '421', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'crash_course/chapter19/learning_log/users/urls.py', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'HTML', 'bytes': '10589'}, {'name': 'Python', 'bytes': '159771'}]} |
require 'dpl/error'
require 'dpl/provider'
require 'rspec/its'
require 'coveralls'
Coveralls.wear!
class DummyContext
def shell(command)
end
def fold(message)
yield
end
def env
@env ||= {}
end
end
| {'content_hash': '86f8fcbb0a857511d6f7138c64440e29', 'timestamp': '', 'source': 'github', 'line_count': 19, 'max_line_length': 22, 'avg_line_length': 11.631578947368421, 'alnum_prop': 0.6742081447963801, 'repo_name': 'Misfit-SW-China/dpl', 'id': '1fdf189f948b1ed7cc43ee2ab10677b8a555101c', 'size': '221', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'spec/spec_helper.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Ruby', 'bytes': '253927'}]} |
package alluxio.cli.fs.command;
import alluxio.AlluxioURI;
import alluxio.client.file.FileSystem;
import alluxio.exception.AlluxioException;
import alluxio.exception.ExceptionMessage;
import alluxio.exception.status.InvalidArgumentException;
import org.apache.commons.cli.CommandLine;
import java.io.IOException;
import javax.annotation.concurrent.ThreadSafe;
/**
* Unpins the given file or folder (recursively unpinning all children if a folder). Pinned files
* are never evicted from memory, so this method will allow such files to be evicted.
*/
@ThreadSafe
public final class UnpinCommand extends WithWildCardPathCommand {
/**
* @param fs the filesystem of Alluxio
*/
public UnpinCommand(FileSystem fs) {
super(fs);
}
@Override
public String getCommandName() {
return "unpin";
}
@Override
protected void runCommand(AlluxioURI path, CommandLine cl) throws AlluxioException, IOException {
FileSystemCommandUtils.setPinned(mFileSystem, path, false);
System.out.println("File '" + path + "' was successfully unpinned.");
}
@Override
public String getUsage() {
return "unpin <path>";
}
@Override
public String getDescription() {
return "Unpins the given file or folder from memory (works recursively for a directory).";
}
@Override
public void validateArgs(String... args) throws InvalidArgumentException {
if (args.length < 1) {
throw new InvalidArgumentException(ExceptionMessage.INVALID_ARGS_NUM_INSUFFICIENT
.getMessage(getCommandName(), 1, args.length));
}
}
}
| {'content_hash': '3eeff58febf77feb24237366efc87c15', 'timestamp': '', 'source': 'github', 'line_count': 59, 'max_line_length': 99, 'avg_line_length': 26.627118644067796, 'alnum_prop': 0.7390197326543603, 'repo_name': 'ChangerYoung/alluxio', 'id': 'ae0df0e5ec05200e89e19ce0e126a8e837c4a6e2', 'size': '2083', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'shell/src/main/java/alluxio/cli/fs/command/UnpinCommand.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '599'}, {'name': 'Java', 'bytes': '6415066'}, {'name': 'JavaScript', 'bytes': '1079'}, {'name': 'Protocol Buffer', 'bytes': '15877'}, {'name': 'Python', 'bytes': '11471'}, {'name': 'Roff', 'bytes': '5796'}, {'name': 'Ruby', 'bytes': '23034'}, {'name': 'Shell', 'bytes': '114549'}, {'name': 'Thrift', 'bytes': '39810'}]} |
namespace Delaunay
{
namespace Utils
{
public interface IDisposable
{
void Dispose ();
}
}
} | {'content_hash': '91bc6cf559c3a8f2fe61ff283b702382', 'timestamp': '', 'source': 'github', 'line_count': 10, 'max_line_length': 30, 'avg_line_length': 10.4, 'alnum_prop': 0.6538461538461539, 'repo_name': 'doliveira87/ProceduralGenerationSample', 'id': '00fbe490219d25ec737593e829f3c5901e5f586f', 'size': '104', 'binary': False, 'copies': '11', 'ref': 'refs/heads/master', 'path': 'Assets/ProceduralDungeonGenerator/Scripts/Unity-delaunay/utils/IDisposable.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '126089'}]} |
.class public Lgov/nist/javax/sip/parser/extensions/ReplacesParser;
.super Lgov/nist/javax/sip/parser/ParametersParser;
.source "ReplacesParser.java"
# direct methods
.method protected constructor <init>(Lgov/nist/javax/sip/parser/Lexer;)V
.locals 0
.param p1, "lexer" # Lgov/nist/javax/sip/parser/Lexer;
.prologue
.line 36
invoke-direct {p0, p1}, Lgov/nist/javax/sip/parser/ParametersParser;-><init>(Lgov/nist/javax/sip/parser/Lexer;)V
.line 37
return-void
.end method
.method public constructor <init>(Ljava/lang/String;)V
.locals 0
.param p1, "callID" # Ljava/lang/String;
.prologue
.line 28
invoke-direct {p0, p1}, Lgov/nist/javax/sip/parser/ParametersParser;-><init>(Ljava/lang/String;)V
.line 29
return-void
.end method
.method public static main([Ljava/lang/String;)V
.locals 7
.param p0, "args" # [Ljava/lang/String;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/text/ParseException;
}
.end annotation
.prologue
.line 64
const/4 v4, 0x2
new-array v2, v4, [Ljava/lang/String;
const/4 v4, 0x0
const-string v5, "Replaces: 12345th5z8z\n"
aput-object v5, v2, v4
const/4 v4, 0x1
const-string v5, "Replaces: 12345th5z8z;to-tag=tozght6-45;from-tag=fromzght789-337-2\n"
aput-object v5, v2, v4
.line 69
.local v2, "to":[Ljava/lang/String;
const/4 v0, 0x0
.local v0, "i":I
:goto_0
array-length v4, v2
if-ge v0, v4, :cond_0
.line 70
new-instance v3, Lgov/nist/javax/sip/parser/extensions/ReplacesParser;
aget-object v4, v2, v0
invoke-direct {v3, v4}, Lgov/nist/javax/sip/parser/extensions/ReplacesParser;-><init>(Ljava/lang/String;)V
.line 71
.local v3, "tp":Lgov/nist/javax/sip/parser/extensions/ReplacesParser;
invoke-virtual {v3}, Lgov/nist/javax/sip/parser/extensions/ReplacesParser;->parse()Lgov/nist/javax/sip/header/SIPHeader;
move-result-object v1
check-cast v1, Lgov/nist/javax/sip/header/extensions/Replaces;
.line 72
.local v1, "t":Lgov/nist/javax/sip/header/extensions/Replaces;
sget-object v4, Ljava/lang/System;->out:Ljava/io/PrintStream;
new-instance v5, Ljava/lang/StringBuilder;
invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V
const-string v6, "Parsing => "
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
aget-object v6, v2, v0
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v5
invoke-virtual {v4, v5}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
.line 73
sget-object v4, Ljava/lang/System;->out:Ljava/io/PrintStream;
new-instance v5, Ljava/lang/StringBuilder;
invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V
const-string v6, "encoded = "
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
invoke-virtual {v1}, Lgov/nist/javax/sip/header/extensions/Replaces;->encode()Ljava/lang/String;
move-result-object v6
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
const-string v6, "==> "
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v5
invoke-virtual {v4, v5}, Ljava/io/PrintStream;->print(Ljava/lang/String;)V
.line 74
sget-object v4, Ljava/lang/System;->out:Ljava/io/PrintStream;
new-instance v5, Ljava/lang/StringBuilder;
invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V
const-string v6, "callId "
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
invoke-virtual {v1}, Lgov/nist/javax/sip/header/extensions/Replaces;->getCallId()Ljava/lang/String;
move-result-object v6
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
const-string v6, " from-tag="
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
invoke-virtual {v1}, Lgov/nist/javax/sip/header/extensions/Replaces;->getFromTag()Ljava/lang/String;
move-result-object v6
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
const-string v6, " to-tag="
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
invoke-virtual {v1}, Lgov/nist/javax/sip/header/extensions/Replaces;->getToTag()Ljava/lang/String;
move-result-object v6
invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v5
invoke-virtual {v4, v5}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
.line 69
add-int/lit8 v0, v0, 0x1
goto/16 :goto_0
.line 78
.end local v1 # "t":Lgov/nist/javax/sip/header/extensions/Replaces;
.end local v3 # "tp":Lgov/nist/javax/sip/parser/extensions/ReplacesParser;
:cond_0
return-void
.end method
# virtual methods
.method public parse()Lgov/nist/javax/sip/header/SIPHeader;
.locals 4
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/text/ParseException;
}
.end annotation
.prologue
.line 45
sget-boolean v2, Lgov/nist/javax/sip/parser/extensions/ReplacesParser;->debug:Z
if-eqz v2, :cond_0
.line 46
const-string v2, "parse"
invoke-virtual {p0, v2}, Lgov/nist/javax/sip/parser/extensions/ReplacesParser;->dbg_enter(Ljava/lang/String;)V
.line 48
:cond_0
const/16 v2, 0x857
:try_start_0
invoke-virtual {p0, v2}, Lgov/nist/javax/sip/parser/extensions/ReplacesParser;->headerName(I)V
.line 50
new-instance v1, Lgov/nist/javax/sip/header/extensions/Replaces;
invoke-direct {v1}, Lgov/nist/javax/sip/header/extensions/Replaces;-><init>()V
.line 51
.local v1, "replaces":Lgov/nist/javax/sip/header/extensions/Replaces;
iget-object v2, p0, Lgov/nist/javax/sip/parser/extensions/ReplacesParser;->lexer:Lgov/nist/core/LexerCore;
invoke-virtual {v2}, Lgov/nist/core/LexerCore;->SPorHT()V
.line 52
iget-object v2, p0, Lgov/nist/javax/sip/parser/extensions/ReplacesParser;->lexer:Lgov/nist/core/LexerCore;
invoke-virtual {v2}, Lgov/nist/core/LexerCore;->byteStringNoSemicolon()Ljava/lang/String;
move-result-object v0
.line 53
.local v0, "callId":Ljava/lang/String;
iget-object v2, p0, Lgov/nist/javax/sip/parser/extensions/ReplacesParser;->lexer:Lgov/nist/core/LexerCore;
invoke-virtual {v2}, Lgov/nist/core/LexerCore;->SPorHT()V
.line 54
invoke-super {p0, v1}, Lgov/nist/javax/sip/parser/ParametersParser;->parse(Lgov/nist/javax/sip/header/ParametersHeader;)V
.line 55
invoke-virtual {v1, v0}, Lgov/nist/javax/sip/header/extensions/Replaces;->setCallId(Ljava/lang/String;)V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 58
sget-boolean v2, Lgov/nist/javax/sip/parser/extensions/ReplacesParser;->debug:Z
if-eqz v2, :cond_1
.line 59
const-string v2, "parse"
invoke-virtual {p0, v2}, Lgov/nist/javax/sip/parser/extensions/ReplacesParser;->dbg_leave(Ljava/lang/String;)V
.line 56
:cond_1
return-object v1
.line 58
.end local v0 # "callId":Ljava/lang/String;
.end local v1 # "replaces":Lgov/nist/javax/sip/header/extensions/Replaces;
:catchall_0
move-exception v2
sget-boolean v3, Lgov/nist/javax/sip/parser/extensions/ReplacesParser;->debug:Z
if-eqz v3, :cond_2
.line 59
const-string v3, "parse"
invoke-virtual {p0, v3}, Lgov/nist/javax/sip/parser/extensions/ReplacesParser;->dbg_leave(Ljava/lang/String;)V
.line 58
:cond_2
throw v2
.end method
| {'content_hash': 'f20454f85da3a062646ff1737e7fec0d', 'timestamp': '', 'source': 'github', 'line_count': 301, 'max_line_length': 125, 'avg_line_length': 28.45514950166113, 'alnum_prop': 0.6904845300642148, 'repo_name': 'GaHoKwan/tos_device_meizu_mx4', 'id': 'b89fcd1f2f73111368afac0d0ddaa3bf04ca6389', 'size': '8565', 'binary': False, 'copies': '2', 'ref': 'refs/heads/TPS-YUNOS', 'path': 'patch/smali/pack/ext.jar/smali/gov/nist/javax/sip/parser/extensions/ReplacesParser.smali', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '2407'}, {'name': 'Groff', 'bytes': '8687'}, {'name': 'Makefile', 'bytes': '31774'}, {'name': 'Shell', 'bytes': '6226'}, {'name': 'Smali', 'bytes': '350951922'}]} |
import BaseHooks from './base';
export default class extends BaseHooks {
/**
* @Constructor
*/
constructor() {
// call parent
super();
this.itemAdd();
}
itemAdd() {
this.$body.on('submit', '[data-cart-item-add]', (event) => {
this.emit('cart-item-add', event, event.target);
});
}
}
| {'content_hash': 'b0990824891e4c1aa79e842bdedbb82b', 'timestamp': '', 'source': 'github', 'line_count': 20, 'max_line_length': 68, 'avg_line_length': 18.45, 'alnum_prop': 0.4959349593495935, 'repo_name': 'patttieo/Timber-Threads', 'id': 'ba96f5377a40afc3de67f56d817461d696531122', 'size': '369', 'binary': False, 'copies': '6', 'ref': 'refs/heads/master', 'path': 'assets/jspm_packages/github/bigcommerce/[email protected]/hooks/cart.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '432'}, {'name': 'CSS', 'bytes': '1703676'}, {'name': 'CoffeeScript', 'bytes': '36602'}, {'name': 'HTML', 'bytes': '1323707'}, {'name': 'JavaScript', 'bytes': '6439723'}, {'name': 'LiveScript', 'bytes': '5561'}, {'name': 'Makefile', 'bytes': '1424'}, {'name': 'PHP', 'bytes': '93714'}, {'name': 'Ruby', 'bytes': '1947'}, {'name': 'Shell', 'bytes': '3494'}]} |
module Bio
module Ucsc
module PriPac1
class ChainCe6Link
KLASS = "ChainCe6Link"
KLASS_S = KLASS[0..0].downcase + KLASS[1..-1]
Bio::Ucsc::PriPac1::CHROMS.each do |chr|
class_eval %!
class #{chr[0..0].upcase + chr[1..-1]}_#{KLASS} < DBConnection
self.table_name = "#{chr[0..0].downcase + chr[1..-1]}_#{KLASS_S}"
self.primary_key = nil
self.inheritance_column = nil
def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
find_first_or_all_by_interval(interval, :first, opt)
end
def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
find_first_or_all_by_interval(interval, :all, opt)
end
def self.find_first_or_all_by_interval(interval, first_all, opt); interval = Bio::Ucsc::Gi.wrap(interval)
zstart = interval.zero_start
zend = interval.zero_end
if opt[:partial] == true
where = <<-SQL
tName = :chrom
AND bin in (:bins)
AND ((tStart BETWEEN :zstart AND :zend)
OR (tEnd BETWEEN :zstart AND :zend)
OR (tStart <= :zstart AND tEnd >= :zend))
SQL
else
where = <<-SQL
tName = :chrom
AND bin in (:bins)
AND ((tStart BETWEEN :zstart AND :zend)
AND (tEnd BETWEEN :zstart AND :zend))
SQL
end
cond = {
:chrom => interval.chrom,
:bins => Bio::Ucsc::UcscBin.bin_all(zstart, zend),
:zstart => zstart,
:zend => zend,
}
self.find(first_all,
{ :select => "*",
:conditions => [where, cond], })
end
end
!
end # each chromosome
def self.find_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
chr_klass = self.const_get("#{chrom}_#{KLASS}")
chr_klass.__send__(:find_by_interval, interval, opt)
end
def self.find_all_by_interval(interval, opt = {:partial => true}); interval = Bio::Ucsc::Gi.wrap(interval)
chrom = interval.chrom[0..0].upcase + interval.chrom[1..-1]
chr_klass = self.const_get("#{chrom}_#{KLASS}")
chr_klass.__send__(:find_all_by_interval, interval, opt)
end
end # class
end # module Hg18
end # module Ucsc
end # module Bio
| {'content_hash': '22753d88d7df68cdc1c37811d4e5c865', 'timestamp': '', 'source': 'github', 'line_count': 72, 'max_line_length': 120, 'avg_line_length': 37.888888888888886, 'alnum_prop': 0.5069648093841642, 'repo_name': 'misshie/bioruby-ucsc-api', 'id': 'df630f401c80c5fae49d940a6a15375b96310451', 'size': '3107', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lib/bio-ucsc/pripac1/chaince6link.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Ruby', 'bytes': '4117804'}, {'name': 'sed', 'bytes': '320'}]} |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>basic_socket_streambuf::time_type</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="../basic_socket_streambuf.html" title="basic_socket_streambuf">
<link rel="prev" href="sync.html" title="basic_socket_streambuf::sync">
<link rel="next" href="timer_handler.html" title="basic_socket_streambuf::timer_handler">
</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="sync.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../basic_socket_streambuf.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="timer_handler.html"><img src="../../../next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="asio.reference.basic_socket_streambuf.time_type"></a><a class="link" href="time_type.html" title="basic_socket_streambuf::time_type">basic_socket_streambuf::time_type</a>
</h4></div></div></div>
<p>
<a class="indexterm" name="idp131627264"></a>
The time type.
</p>
<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">TimeTraits</span><span class="special">::</span><span class="identifier">time_type</span> <span class="identifier">time_type</span><span class="special">;</span>
</pre>
<h6>
<a name="asio.reference.basic_socket_streambuf.time_type.h0"></a>
<span><a name="asio.reference.basic_socket_streambuf.time_type.requirements"></a></span><a class="link" href="time_type.html#asio.reference.basic_socket_streambuf.time_type.requirements">Requirements</a>
</h6>
<p>
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/basic_socket_streambuf.hpp</code>
</p>
<p>
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 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="sync.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../basic_socket_streambuf.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="timer_handler.html"><img src="../../../next.png" alt="Next"></a>
</div>
</body>
</html>
| {'content_hash': 'fd557a568ab4d6ff748f5b6a1fba20a2', 'timestamp': '', 'source': 'github', 'line_count': 53, 'max_line_length': 348, 'avg_line_length': 61.9811320754717, 'alnum_prop': 0.6462709284627093, 'repo_name': 'akashin/HSE_AI_Labs', 'id': 'cd3596e6f3747ee83d73f35415e18c430f8b8f36', 'size': '3285', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'Lab_5/Source/ThirdParty/asio/doc/asio/reference/basic_socket_streambuf/time_type.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '1583'}, {'name': 'C#', 'bytes': '9510'}, {'name': 'C++', 'bytes': '4345310'}, {'name': 'CSS', 'bytes': '16051'}, {'name': 'HTML', 'bytes': '18242842'}, {'name': 'M4', 'bytes': '9302'}, {'name': 'Makefile', 'bytes': '411179'}, {'name': 'Perl', 'bytes': '6547'}, {'name': 'Python', 'bytes': '31734'}, {'name': 'Shell', 'bytes': '53330'}]} |
package main
import (
"crypto/tls"
"crypto/x509"
"errors"
"flag"
"fmt"
"io/ioutil"
"log"
"net"
"os"
"strconv"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/interop"
"google.golang.org/grpc/resolver"
testpb "google.golang.org/grpc/interop/grpc_testing"
)
type testFn func(tc testpb.TestServiceClient, args ...grpc.CallOption)
var defaultTestCases = map[string]testFn{
"cancel_after_begin": interop.DoCancelAfterBegin,
"cancel_after_first_response": interop.DoCancelAfterFirstResponse,
"client_streaming": interop.DoClientStreaming,
"custom_metadata": interop.DoCustomMetadata,
"empty_unary": interop.DoEmptyUnaryCall,
"large_unary": interop.DoLargeUnaryCall,
"ping_pong": interop.DoPingPong,
"server_streaming": interop.DoServerStreaming,
"special_status_message": interop.DoSpecialStatusMessage,
"status_code_and_message": interop.DoStatusCodeAndMessage,
"timeout_on_sleeping_server": interop.DoTimeoutOnSleepingServer,
"unimplemented_method": nil, // special case
"unimplemented_service": nil, // special case
}
var (
listTests = flag.Bool("list-tests", false, "List available test cases")
insecure = flag.Bool("insecure", false, "Skip certificate verification")
caFile = flag.String("ca-cert", "", "The file containing the CA root cert")
useTLS = flag.Bool("tls", false, "Connection uses TLS, if true")
host = flag.String("host", "localhost", "host address")
port = flag.Int("port", 443, "port number")
count = flag.Int("count", 1, "Run each test case N times")
)
type DialParams struct {
UseTLS bool
CertData []byte
Host string
Port int
Insecure bool
}
func Dial(cfg DialParams) (*grpc.ClientConn, error) {
var opts []grpc.DialOption
if cfg.UseTLS {
tlsConfig := &tls.Config{
InsecureSkipVerify: cfg.Insecure,
}
if len(cfg.CertData) > 0 {
rootCAs, err := x509.SystemCertPool()
if err != nil {
return nil, err
}
if rootCAs == nil {
rootCAs = x509.NewCertPool()
}
if ok := rootCAs.AppendCertsFromPEM(cfg.CertData); !ok {
return nil, errors.New("failed to append certs")
}
tlsConfig.RootCAs = rootCAs
}
opts = append(opts, grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)))
} else {
opts = append(opts, grpc.WithInsecure())
}
return grpc.Dial(net.JoinHostPort(cfg.Host, strconv.Itoa(cfg.Port)), append(opts, grpc.WithBlock())...)
}
func main() {
flag.Parse()
if *listTests {
for k := range defaultTestCases {
fmt.Println(k)
}
os.Exit(0)
}
dialParams := DialParams{
UseTLS: *useTLS,
Host: *host,
Port: *port,
Insecure: *insecure,
}
if *caFile != "" {
certs, err := ioutil.ReadFile(*caFile)
if err != nil {
log.Fatalf("Failed to read %q: %v", *caFile, err)
}
dialParams.CertData = certs
}
testCases := flag.Args()
if len(testCases) == 0 {
for k := range defaultTestCases {
testCases = append(testCases, k)
}
}
resolver.SetDefaultScheme("dns")
conn, err := Dial(dialParams)
if err != nil {
log.Fatalf("Dial failed: %v", err)
}
defer conn.Close()
for i := 0; i < *count; i++ {
for _, testCase := range testCases {
log.Printf("[%v/%v] running test case %q\n", i+1, *count, testCase)
if doRpcCall, ok := defaultTestCases[testCase]; ok && doRpcCall != nil {
doRpcCall(testpb.NewTestServiceClient(conn))
} else if ok && doRpcCall == nil {
switch testCase {
case "unimplemented_method":
interop.DoUnimplementedMethod(conn)
case "unimplemented_service":
interop.DoUnimplementedService(testpb.NewUnimplementedServiceClient(conn))
default:
log.Fatalf("Unsupported test case: %q", testCase)
}
} else {
log.Fatalf("Unsupported test case: %q", testCase)
}
}
}
}
| {'content_hash': '5d96fc7c5a3ca86eec87a6601e118650', 'timestamp': '', 'source': 'github', 'line_count': 145, 'max_line_length': 104, 'avg_line_length': 26.786206896551725, 'alnum_prop': 0.6593717816683831, 'repo_name': 'mkumatag/origin', 'id': '613c2964c1ce0b64d6b62c6b0b0857c243b65c13', 'size': '3884', 'binary': False, 'copies': '8', 'ref': 'refs/heads/master', 'path': 'test/extended/router/grpc-interop/cluster/client/client.go', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Awk', 'bytes': '921'}, {'name': 'Dockerfile', 'bytes': '2240'}, {'name': 'Go', 'bytes': '2298920'}, {'name': 'Makefile', 'bytes': '6395'}, {'name': 'Python', 'bytes': '14593'}, {'name': 'Shell', 'bytes': '310275'}]} |
package com.graphhopper.routing.weighting;
import com.graphhopper.storage.NodeAccess;
import com.graphhopper.util.DistanceCalc;
import com.graphhopper.util.Helper;
/**
* Approximates the distance to the goal node by weighting the beeline distance according to the
* distance weighting
* <p>
*
* @author jansoe
*/
public class BeelineWeightApproximator implements WeightApproximator {
private final NodeAccess nodeAccess;
private final Weighting weighting;
private DistanceCalc distanceCalc = Helper.DIST_EARTH;
private double toLat, toLon;
private double epsilon = 1;
public BeelineWeightApproximator(NodeAccess nodeAccess, Weighting weighting) {
this.nodeAccess = nodeAccess;
this.weighting = weighting;
}
@Override
public void setGoalNode(int toNode) {
toLat = nodeAccess.getLatitude(toNode);
toLon = nodeAccess.getLongitude(toNode);
}
public WeightApproximator setEpsilon(double epsilon) {
this.epsilon = epsilon;
return this;
}
@Override
public WeightApproximator duplicate() {
return new BeelineWeightApproximator(nodeAccess, weighting).setDistanceCalc(distanceCalc).setEpsilon(epsilon);
}
@Override
public double approximate(int fromNode) {
double fromLat = nodeAccess.getLatitude(fromNode);
double fromLon = nodeAccess.getLongitude(fromNode);
double dist2goal = distanceCalc.calcDist(toLat, toLon, fromLat, fromLon);
double weight2goal = weighting.getMinWeight(dist2goal);
return weight2goal * epsilon;
}
public BeelineWeightApproximator setDistanceCalc(DistanceCalc distanceCalc) {
this.distanceCalc = distanceCalc;
return this;
}
}
| {'content_hash': '05d2504661f5c3ee3d6d3f6266790071', 'timestamp': '', 'source': 'github', 'line_count': 56, 'max_line_length': 118, 'avg_line_length': 31.214285714285715, 'alnum_prop': 0.721395881006865, 'repo_name': 'tobias74/graphhopper', 'id': 'd0238466a18e60067f2baaf3014236b2cb478596', 'size': '2558', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'core/src/main/java/com/graphhopper/routing/weighting/BeelineWeightApproximator.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '22038'}, {'name': 'HTML', 'bytes': '5938'}, {'name': 'Java', 'bytes': '2527536'}, {'name': 'JavaScript', 'bytes': '135676'}, {'name': 'Shell', 'bytes': '12516'}]} |
package org.mycat.web.service;
import org.hx.rainbow.common.context.RainbowContext;
import org.hx.rainbow.common.core.service.BaseService;
import org.mycat.web.util.DataSourceUtils;
import org.mycat.web.util.DataSourceUtils.MycatPortType;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@Lazy
@Service
public class ExplainService extends BaseService{
private static final String NAMESPACE = "EXPLAINSQL";
public RainbowContext base(RainbowContext context,String cmd) {
String datasource = (String)context.getAttr("ds");
if(datasource == null || datasource.isEmpty()){
return context;
}
try {
if(!DataSourceUtils.getInstance().register(datasource, DataSourceUtils.MycatPortType.MYCAT_SERVER)){
context.setSuccess(false);
context.setMsg("数据源连接失败!");
logger.error(datasource + ":服务端口,数据源连接失败!");
return context;
}
} catch (Exception e) {
}
context.setDs(datasource + MycatPortType.MYCAT_SERVER);
super.query(context, NAMESPACE, cmd);
return context;
}
public RainbowContext explainMycat(RainbowContext context) {
return base(context,"explainMycat");
}
public RainbowContext explainMysql(RainbowContext context) {
return base(context,"explainMysql");
}
}
| {'content_hash': 'c5f43c3a26fec7e661882c847e434566', 'timestamp': '', 'source': 'github', 'line_count': 43, 'max_line_length': 103, 'avg_line_length': 29.58139534883721, 'alnum_prop': 0.7578616352201258, 'repo_name': 'MyCATApache/Mycat-Web', 'id': '4ba7fe9ade5a2dbc6ec1e4e56c6c78432dd8c87b', 'size': '1308', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'src/main/java/org/mycat/web/service/ExplainService.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '381'}, {'name': 'CSS', 'bytes': '670840'}, {'name': 'FreeMarker', 'bytes': '2102'}, {'name': 'HTML', 'bytes': '322470'}, {'name': 'Java', 'bytes': '226951'}, {'name': 'JavaScript', 'bytes': '1634856'}, {'name': 'Shell', 'bytes': '381'}]} |
<?php
/**
* This controller is called when a "resource" is requested.
* call verifyResourceRequest in order to determine if the request
* contains a valid token.
*
* ex:
* > if (!$resourceController->verifyResourceRequest(OAuth2_Request::createFromGlobals(), $response = new OAuth2_Response())) {
* > $response->send(); // authorization failed
* > die();
* > }
* > return json_encode($resource); // valid token! Send the stuff!
*
*/
interface OAuth2_Controller_ResourceControllerInterface
{
public function verifyResourceRequest(OAuth2_RequestInterface $request, OAuth2_ResponseInterface $response, $scope = null);
public function getAccessTokenData(OAuth2_RequestInterface $request, OAuth2_ResponseInterface $response);
}
| {'content_hash': '4c6fa1c8362295eb3ef3d19a4dcf8ae6', 'timestamp': '', 'source': 'github', 'line_count': 21, 'max_line_length': 128, 'avg_line_length': 36.333333333333336, 'alnum_prop': 0.7195281782437746, 'repo_name': 'rebot/oauth2-server-php', 'id': 'df87338981fb4df6080399b199bf48a8d70322cd', 'size': '763', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'src/OAuth2/Controller/ResourceControllerInterface.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'PHP', 'bytes': '261364'}]} |
[Newline](http://en.wikipedia.org/wiki/Newline) character converter for JavaScript. Available [on npm](https://www.npmjs.com/package/eol).
```
npm install eol --save
```
### `require` or `import`
```js
const eol = require('eol')
```
```js
import eol from 'eol'
```
## API
### `eol.auto(text)`
- Normalize line endings in <var>text</var> for the current operating system
- <b>@return</b> string with line endings normalized to `\r\n` or `\n`
### `eol.crlf(text)`
- Normalize line endings in <var>text</var> to <b>CRLF</b> (Windows, DOS)
- <b>@return</b> string with line endings normalized to `\r\n`
### `eol.lf(text)`
- Normalize line endings in <var>text</var> to <b>LF</b> (Unix, OS X)
- <b>@return</b> string with line endings normalized to `\n`
### `eol.cr(text)`
- Normalize line endings in <var>text</var> to <b>CR</b> (Mac OS)
- <b>@return</b> string with line endings normalized to `\r`
### `eol.before(text)`
- Add linebreak before <var>text</var>
- <b>@return</b> string with linebreak added before text
### `eol.after(text)`
- Add linebreak after <var>text</var>
- <b>@return</b> string with linebreak added after text
### `eol.split(text)`
- Split <var>text</var> by newline
- <b>@return</b> array of lines
### Joining
Coercing `eol.auto`|`eol.crlf`|`eol.lf`|`eol.cr` to string yields the appropriate character. This is useful for joining.
```js
String(eol.lf) // "\n"
eol.split(text).join(eol.auto) // same as eol.auto(text)
eol.split(text).filter(line => line).join(eol.auto) // text joined after removing empty lines
eol.split(text).slice(-3).join(eol.auto) // last 3 lines joined
```
## License
MIT
| {'content_hash': '5b652c48da1eb0163ced679f11ce4450', 'timestamp': '', 'source': 'github', 'line_count': 59, 'max_line_length': 138, 'avg_line_length': 27.64406779661017, 'alnum_prop': 0.6664622930717351, 'repo_name': 'BigBoss424/portfolio', 'id': 'a38678cf45ebe919e468e18a9450a95ea446721b', 'size': '1637', 'binary': False, 'copies': '6', 'ref': 'refs/heads/master', 'path': 'v7/development/node_modules/eol/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
package mk.ukim.finki.wp.service.impl.db;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import mk.ukim.finki.wp.model.db.City;
import mk.ukim.finki.wp.repository.db.CityRepository;
import mk.ukim.finki.wp.service.db.CityService;
import mk.ukim.finki.wp.service.impl.BaseEntityCrudServiceImpl;
@Service
public class CityServiceImpl extends
BaseEntityCrudServiceImpl<City, CityRepository> implements CityService {
@Autowired
private CityRepository repository;
@Override
protected CityRepository getRepository() {
return repository;
}
}
| {'content_hash': 'd0eb4805737e374e754eee02e724eaa3', 'timestamp': '', 'source': 'github', 'line_count': 23, 'max_line_length': 74, 'avg_line_length': 26.652173913043477, 'alnum_prop': 0.8189233278955954, 'repo_name': 'milandukovski/web-programming-starter', 'id': '7402c0c74a39bde3e7a6a615ebee08fcf618c4ab', 'size': '613', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'src/main/java/mk/ukim/finki/wp/service/impl/db/CityServiceImpl.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'ApacheConf', 'bytes': '24139'}, {'name': 'CSS', 'bytes': '8050'}, {'name': 'HTML', 'bytes': '1026335'}, {'name': 'Java', 'bytes': '211266'}, {'name': 'JavaScript', 'bytes': '460830'}]} |
// NOTE: This file was generated by the ServiceGenerator.
// ----------------------------------------------------------------------------
// API:
// BigQuery API (bigquery/v2)
// Description:
// A data platform for customers to create, manage, share and query data.
// Documentation:
// https://cloud.google.com/bigquery/
#if GTLR_BUILT_AS_FRAMEWORK
#import "GTLR/GTLRService.h"
#else
#import "GTLRService.h"
#endif
#if GTLR_RUNTIME_VERSION != 3000
#error This file was generated by a different version of ServiceGenerator which is incompatible with this GTLR library source.
#endif
NS_ASSUME_NONNULL_BEGIN
// ----------------------------------------------------------------------------
// Authorization scopes
/**
* Authorization scope: View and manage your data in Google BigQuery
*
* Value "https://www.googleapis.com/auth/bigquery"
*/
GTLR_EXTERN NSString * const kGTLRAuthScopeBigquery;
/**
* Authorization scope: View and manage your data across Google Cloud Platform
* services
*
* Value "https://www.googleapis.com/auth/cloud-platform"
*/
GTLR_EXTERN NSString * const kGTLRAuthScopeBigqueryCloudPlatform;
/**
* Authorization scope: View your data across Google Cloud Platform services
*
* Value "https://www.googleapis.com/auth/cloud-platform.read-only"
*/
GTLR_EXTERN NSString * const kGTLRAuthScopeBigqueryCloudPlatformReadOnly;
/**
* Authorization scope: Manage your data and permissions in Google Cloud
* Storage
*
* Value "https://www.googleapis.com/auth/devstorage.full_control"
*/
GTLR_EXTERN NSString * const kGTLRAuthScopeBigqueryDevstorageFullControl;
/**
* Authorization scope: View your data in Google Cloud Storage
*
* Value "https://www.googleapis.com/auth/devstorage.read_only"
*/
GTLR_EXTERN NSString * const kGTLRAuthScopeBigqueryDevstorageReadOnly;
/**
* Authorization scope: Manage your data in Google Cloud Storage
*
* Value "https://www.googleapis.com/auth/devstorage.read_write"
*/
GTLR_EXTERN NSString * const kGTLRAuthScopeBigqueryDevstorageReadWrite;
/**
* Authorization scope: Insert data into Google BigQuery
*
* Value "https://www.googleapis.com/auth/bigquery.insertdata"
*/
GTLR_EXTERN NSString * const kGTLRAuthScopeBigqueryInsertdata;
// ----------------------------------------------------------------------------
// GTLRBigqueryService
//
/**
* Service for executing BigQuery API queries.
*
* A data platform for customers to create, manage, share and query data.
*/
@interface GTLRBigqueryService : GTLRService
// No new methods
// Clients should create a standard query with any of the class methods in
// GTLRBigqueryQuery.h. The query can the be sent with GTLRService's execute
// methods,
//
// - (GTLRServiceTicket *)executeQuery:(GTLRQuery *)query
// completionHandler:(void (^)(GTLRServiceTicket *ticket,
// id object, NSError *error))handler;
// or
// - (GTLRServiceTicket *)executeQuery:(GTLRQuery *)query
// delegate:(id)delegate
// didFinishSelector:(SEL)finishedSelector;
//
// where finishedSelector has a signature of:
//
// - (void)serviceTicket:(GTLRServiceTicket *)ticket
// finishedWithObject:(id)object
// error:(NSError *)error;
//
// The object passed to the completion handler or delegate method
// is a subclass of GTLRObject, determined by the query method executed.
@end
NS_ASSUME_NONNULL_END
| {'content_hash': 'cf9846ffb418ff14d09ce84f64a4e3e3', 'timestamp': '', 'source': 'github', 'line_count': 107, 'max_line_length': 126, 'avg_line_length': 32.54205607476636, 'alnum_prop': 0.667145318782309, 'repo_name': 'googlecreativelab/Sprayscape', 'id': 'bcf3b49c5cb7a15a7d0c3aca7a632fd8b5ce5537', 'size': '3482', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'Sprayscape/Assets/Plugins/GoogleDrivePlugin/Plugins/iOS/google-api-objectivec-client-for-rest/Source/GeneratedServices/Bigquery/GTLRBigqueryService.h', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C#', 'bytes': '590239'}, {'name': 'HLSL', 'bytes': '4730'}, {'name': 'Java', 'bytes': '30392'}, {'name': 'JavaScript', 'bytes': '1554'}, {'name': 'Objective-C', 'bytes': '10576417'}, {'name': 'Objective-C++', 'bytes': '30880'}, {'name': 'Ruby', 'bytes': '16874'}, {'name': 'ShaderLab', 'bytes': '17021'}, {'name': 'Shell', 'bytes': '3452'}]} |
using UnityEngine;
using System.Collections;
public class ButterfyAnimatorController : MonoBehaviour {
Animator anim;
void Start () {
anim = GetComponent<Animator>();
StartCoroutine(StartStopFlying());
}
private IEnumerator StartStopFlying()
{
while (true)
{
if (Random.value > 0.5)
{
anim.SetBool("Flying", true);
}
else
{
anim.SetBool("Flying", false);
}
yield return new WaitForSeconds(5);
new WaitForEndOfFrame();
}
}
} | {'content_hash': '4716d0b738373da79578c6da5c7d274c', 'timestamp': '', 'source': 'github', 'line_count': 29, 'max_line_length': 57, 'avg_line_length': 21.379310344827587, 'alnum_prop': 0.5080645161290323, 'repo_name': 'SuperJura/RPGGame', 'id': 'aaa1ee2b7aaa6288d2793237378dca5e6072eeda', 'size': '622', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Assets/Models/Animals/Butterfly/Models/ButterfyAnimatorController.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '151707'}, {'name': 'GLSL', 'bytes': '30751'}]} |
define([
'./Cartesian3',
'./Cartesian4',
'./defaultValue',
'./defined',
'./defineProperties',
'./DeveloperError',
'./LinearSpline',
'./Matrix4',
'./Spline',
'./TridiagonalSystemSolver'
], function(
Cartesian3,
Cartesian4,
defaultValue,
defined,
defineProperties,
DeveloperError,
LinearSpline,
Matrix4,
Spline,
TridiagonalSystemSolver) {
'use strict';
var scratchLower = [];
var scratchDiagonal = [];
var scratchUpper = [];
var scratchRight = [];
function generateClamped(points, firstTangent, lastTangent) {
var l = scratchLower;
var u = scratchUpper;
var d = scratchDiagonal;
var r = scratchRight;
l.length = u.length = points.length - 1;
d.length = r.length = points.length;
var i;
l[0] = d[0] = 1.0;
u[0] = 0.0;
var right = r[0];
if (!defined(right)) {
right = r[0] = new Cartesian3();
}
Cartesian3.clone(firstTangent, right);
for (i = 1; i < l.length - 1; ++i) {
l[i] = u[i] = 1.0;
d[i] = 4.0;
right = r[i];
if (!defined(right)) {
right = r[i] = new Cartesian3();
}
Cartesian3.subtract(points[i + 1], points[i - 1], right);
Cartesian3.multiplyByScalar(right, 3.0, right);
}
l[i] = 0.0;
u[i] = 1.0;
d[i] = 4.0;
right = r[i];
if (!defined(right)) {
right = r[i] = new Cartesian3();
}
Cartesian3.subtract(points[i + 1], points[i - 1], right);
Cartesian3.multiplyByScalar(right, 3.0, right);
d[i + 1] = 1.0;
right = r[i + 1];
if (!defined(right)) {
right = r[i + 1] = new Cartesian3();
}
Cartesian3.clone(lastTangent, right);
return TridiagonalSystemSolver.solve(l, d, u, r);
}
function generateNatural(points){
var l = scratchLower;
var u = scratchUpper;
var d = scratchDiagonal;
var r = scratchRight;
l.length = u.length = points.length - 1;
d.length = r.length = points.length;
var i;
l[0] = u[0] = 1.0;
d[0] = 2.0;
var right = r[0];
if (!defined(right)) {
right = r[0] = new Cartesian3();
}
Cartesian3.subtract(points[1], points[0], right);
Cartesian3.multiplyByScalar(right, 3.0, right);
for (i = 1; i < l.length; ++i) {
l[i] = u[i] = 1.0;
d[i] = 4.0;
right = r[i];
if (!defined(right)) {
right = r[i] = new Cartesian3();
}
Cartesian3.subtract(points[i + 1], points[i - 1], right);
Cartesian3.multiplyByScalar(right, 3.0, right);
}
d[i] = 2.0;
right = r[i];
if (!defined(right)) {
right = r[i] = new Cartesian3();
}
Cartesian3.subtract(points[i], points[i - 1], right);
Cartesian3.multiplyByScalar(right, 3.0, right);
return TridiagonalSystemSolver.solve(l, d, u, r);
}
/**
* A Hermite spline is a cubic interpolating spline. Points, incoming tangents, outgoing tangents, and times
* must be defined for each control point. The outgoing tangents are defined for points [0, n - 2] and the incoming
* tangents are defined for points [1, n - 1]. For example, when interpolating a segment of the curve between <code>points[i]</code> and
* <code>points[i + 1]</code>, the tangents at the points will be <code>outTangents[i]</code> and <code>inTangents[i]</code>,
* respectively.
*
* @alias HermiteSpline
* @constructor
*
* @param {Object} options Object with the following properties:
* @param {Number[]} options.times An array of strictly increasing, unit-less, floating-point times at each point.
* The values are in no way connected to the clock time. They are the parameterization for the curve.
* @param {Cartesian3[]} options.points The array of {@link Cartesian3} control points.
* @param {Cartesian3[]} options.inTangents The array of {@link Cartesian3} incoming tangents at each control point.
* @param {Cartesian3[]} options.outTangents The array of {@link Cartesian3} outgoing tangents at each control point.
*
* @exception {DeveloperError} points.length must be greater than or equal to 2.
* @exception {DeveloperError} times.length must be equal to points.length.
* @exception {DeveloperError} inTangents and outTangents must have a length equal to points.length - 1.
*
*
* @example
* // Create a G<sup>1</sup> continuous Hermite spline
* var times = [ 0.0, 1.5, 3.0, 4.5, 6.0 ];
* var spline = new Cesium.HermiteSpline({
* times : times,
* points : [
* new Cesium.Cartesian3(1235398.0, -4810983.0, 4146266.0),
* new Cesium.Cartesian3(1372574.0, -5345182.0, 4606657.0),
* new Cesium.Cartesian3(-757983.0, -5542796.0, 4514323.0),
* new Cesium.Cartesian3(-2821260.0, -5248423.0, 4021290.0),
* new Cesium.Cartesian3(-2539788.0, -4724797.0, 3620093.0)
* ],
* outTangents : [
* new Cesium.Cartesian3(1125196, -161816, 270551),
* new Cesium.Cartesian3(-996690.5, -365906.5, 184028.5),
* new Cesium.Cartesian3(-2096917, 48379.5, -292683.5),
* new Cesium.Cartesian3(-890902.5, 408999.5, -447115)
* ],
* inTangents : [
* new Cesium.Cartesian3(-1993381, -731813, 368057),
* new Cesium.Cartesian3(-4193834, 96759, -585367),
* new Cesium.Cartesian3(-1781805, 817999, -894230),
* new Cesium.Cartesian3(1165345, 112641, 47281)
* ]
* });
*
* var p0 = spline.evaluate(times[0]);
*
* @see CatmullRomSpline
* @see LinearSpline
* @see QuaternionSpline
* @see WeightSpline
*/
function HermiteSpline(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var points = options.points;
var times = options.times;
var inTangents = options.inTangents;
var outTangents = options.outTangents;
//>>includeStart('debug', pragmas.debug);
if (!defined(points) || !defined(times) || !defined(inTangents) || !defined(outTangents)) {
throw new DeveloperError('times, points, inTangents, and outTangents are required.');
}
if (points.length < 2) {
throw new DeveloperError('points.length must be greater than or equal to 2.');
}
if (times.length !== points.length) {
throw new DeveloperError('times.length must be equal to points.length.');
}
if (inTangents.length !== outTangents.length || inTangents.length !== points.length - 1) {
throw new DeveloperError('inTangents and outTangents must have a length equal to points.length - 1.');
}
//>>includeEnd('debug');
this._times = times;
this._points = points;
this._inTangents = inTangents;
this._outTangents = outTangents;
this._lastTimeIndex = 0;
}
defineProperties(HermiteSpline.prototype, {
/**
* An array of times for the control points.
*
* @memberof HermiteSpline.prototype
*
* @type {Number[]}
* @readonly
*/
times : {
get : function() {
return this._times;
}
},
/**
* An array of {@link Cartesian3} control points.
*
* @memberof HermiteSpline.prototype
*
* @type {Cartesian3[]}
* @readonly
*/
points : {
get : function() {
return this._points;
}
},
/**
* An array of {@link Cartesian3} incoming tangents at each control point.
*
* @memberof HermiteSpline.prototype
*
* @type {Cartesian3[]}
* @readonly
*/
inTangents : {
get : function() {
return this._inTangents;
}
},
/**
* An array of {@link Cartesian3} outgoing tangents at each control point.
*
* @memberof HermiteSpline.prototype
*
* @type {Cartesian3[]}
* @readonly
*/
outTangents : {
get : function() {
return this._outTangents;
}
}
});
/**
* Creates a spline where the tangents at each control point are the same.
* The curves are guaranteed to be at least in the class C<sup>1</sup>.
*
* @param {Object} options Object with the following properties:
* @param {Number[]} options.times The array of control point times.
* @param {Cartesian3[]} options.points The array of control points.
* @param {Cartesian3[]} options.tangents The array of tangents at the control points.
* @returns {HermiteSpline} A hermite spline.
*
* @exception {DeveloperError} points, times and tangents are required.
* @exception {DeveloperError} points.length must be greater than or equal to 2.
* @exception {DeveloperError} times, points and tangents must have the same length.
*
* @example
* var points = [
* new Cesium.Cartesian3(1235398.0, -4810983.0, 4146266.0),
* new Cesium.Cartesian3(1372574.0, -5345182.0, 4606657.0),
* new Cesium.Cartesian3(-757983.0, -5542796.0, 4514323.0),
* new Cesium.Cartesian3(-2821260.0, -5248423.0, 4021290.0),
* new Cesium.Cartesian3(-2539788.0, -4724797.0, 3620093.0)
* ];
*
* // Add tangents
* var tangents = new Array(points.length);
* tangents[0] = new Cesium.Cartesian3(1125196, -161816, 270551);
* var temp = new Cesium.Cartesian3();
* for (var i = 1; i < tangents.length - 1; ++i) {
* tangents[i] = Cesium.Cartesian3.multiplyByScalar(Cesium.Cartesian3.subtract(points[i + 1], points[i - 1], temp), 0.5, new Cesium.Cartesian3());
* }
* tangents[tangents.length - 1] = new Cesium.Cartesian3(1165345, 112641, 47281);
*
* var spline = Cesium.HermiteSpline.createC1({
* times : times,
* points : points,
* tangents : tangents
* });
*/
HermiteSpline.createC1 = function(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var times = options.times;
var points = options.points;
var tangents = options.tangents;
//>>includeStart('debug', pragmas.debug);
if (!defined(points) || !defined(times) || !defined(tangents)) {
throw new DeveloperError('points, times and tangents are required.');
}
if (points.length < 2) {
throw new DeveloperError('points.length must be greater than or equal to 2.');
}
if (times.length !== points.length || times.length !== tangents.length) {
throw new DeveloperError('times, points and tangents must have the same length.');
}
//>>includeEnd('debug');
var outTangents = tangents.slice(0, tangents.length - 1);
var inTangents = tangents.slice(1, tangents.length);
return new HermiteSpline({
times : times,
points : points,
inTangents : inTangents,
outTangents : outTangents
});
};
/**
* Creates a natural cubic spline. The tangents at the control points are generated
* to create a curve in the class C<sup>2</sup>.
*
* @param {Object} options Object with the following properties:
* @param {Number[]} options.times The array of control point times.
* @param {Cartesian3[]} options.points The array of control points.
* @returns {HermiteSpline|LinearSpline} A hermite spline or a linear spline if less than 3 control points were given.
*
* @exception {DeveloperError} points and times are required.
* @exception {DeveloperError} points.length must be greater than or equal to 2.
* @exception {DeveloperError} times.length must be equal to points.length.
*
* @example
* // Create a natural cubic spline above the earth from Philadelphia to Los Angeles.
* var spline = Cesium.HermiteSpline.createNaturalCubic({
* times : [ 0.0, 1.5, 3.0, 4.5, 6.0 ],
* points : [
* new Cesium.Cartesian3(1235398.0, -4810983.0, 4146266.0),
* new Cesium.Cartesian3(1372574.0, -5345182.0, 4606657.0),
* new Cesium.Cartesian3(-757983.0, -5542796.0, 4514323.0),
* new Cesium.Cartesian3(-2821260.0, -5248423.0, 4021290.0),
* new Cesium.Cartesian3(-2539788.0, -4724797.0, 3620093.0)
* ]
* });
*/
HermiteSpline.createNaturalCubic = function(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var times = options.times;
var points = options.points;
//>>includeStart('debug', pragmas.debug);
if (!defined(points) || !defined(times)) {
throw new DeveloperError('points and times are required.');
}
if (points.length < 2) {
throw new DeveloperError('points.length must be greater than or equal to 2.');
}
if (times.length !== points.length) {
throw new DeveloperError('times.length must be equal to points.length.');
}
//>>includeEnd('debug');
if (points.length < 3) {
return new LinearSpline({
points : points,
times : times
});
}
var tangents = generateNatural(points);
var outTangents = tangents.slice(0, tangents.length - 1);
var inTangents = tangents.slice(1, tangents.length);
return new HermiteSpline({
times : times,
points : points,
inTangents : inTangents,
outTangents : outTangents
});
};
/**
* Creates a clamped cubic spline. The tangents at the interior control points are generated
* to create a curve in the class C<sup>2</sup>.
*
* @param {Object} options Object with the following properties:
* @param {Number[]} options.times The array of control point times.
* @param {Cartesian3[]} options.points The array of control points.
* @param {Cartesian3} options.firstTangent The outgoing tangent of the first control point.
* @param {Cartesian3} options.lastTangent The incoming tangent of the last control point.
* @returns {HermiteSpline|LinearSpline} A hermite spline or a linear spline if less than 3 control points were given.
*
* @exception {DeveloperError} points, times, firstTangent and lastTangent are required.
* @exception {DeveloperError} points.length must be greater than or equal to 2.
* @exception {DeveloperError} times.length must be equal to points.length.
*
* @example
* // Create a clamped cubic spline above the earth from Philadelphia to Los Angeles.
* var spline = Cesium.HermiteSpline.createClampedCubic({
* times : [ 0.0, 1.5, 3.0, 4.5, 6.0 ],
* points : [
* new Cesium.Cartesian3(1235398.0, -4810983.0, 4146266.0),
* new Cesium.Cartesian3(1372574.0, -5345182.0, 4606657.0),
* new Cesium.Cartesian3(-757983.0, -5542796.0, 4514323.0),
* new Cesium.Cartesian3(-2821260.0, -5248423.0, 4021290.0),
* new Cesium.Cartesian3(-2539788.0, -4724797.0, 3620093.0)
* ],
* firstTangent : new Cesium.Cartesian3(1125196, -161816, 270551),
* lastTangent : new Cesium.Cartesian3(1165345, 112641, 47281)
* });
*/
HermiteSpline.createClampedCubic = function(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var times = options.times;
var points = options.points;
var firstTangent = options.firstTangent;
var lastTangent = options.lastTangent;
//>>includeStart('debug', pragmas.debug);
if (!defined(points) || !defined(times) || !defined(firstTangent) || !defined(lastTangent)) {
throw new DeveloperError('points, times, firstTangent and lastTangent are required.');
}
if (points.length < 2) {
throw new DeveloperError('points.length must be greater than or equal to 2.');
}
if (times.length !== points.length) {
throw new DeveloperError('times.length must be equal to points.length.');
}
//>>includeEnd('debug');
if (points.length < 3) {
return new LinearSpline({
points : points,
times : times
});
}
var tangents = generateClamped(points, firstTangent, lastTangent);
var outTangents = tangents.slice(0, tangents.length - 1);
var inTangents = tangents.slice(1, tangents.length);
return new HermiteSpline({
times : times,
points : points,
inTangents : inTangents,
outTangents : outTangents
});
};
HermiteSpline.hermiteCoefficientMatrix = new Matrix4(
2.0, -3.0, 0.0, 1.0,
-2.0, 3.0, 0.0, 0.0,
1.0, -2.0, 1.0, 0.0,
1.0, -1.0, 0.0, 0.0);
/**
* Finds an index <code>i</code> in <code>times</code> such that the parameter
* <code>time</code> is in the interval <code>[times[i], times[i + 1]]</code>.
* @function
*
* @param {Number} time The time.
* @returns {Number} The index for the element at the start of the interval.
*
* @exception {DeveloperError} time must be in the range <code>[t<sub>0</sub>, t<sub>n</sub>]</code>, where <code>t<sub>0</sub></code>
* is the first element in the array <code>times</code> and <code>t<sub>n</sub></code> is the last element
* in the array <code>times</code>.
*/
HermiteSpline.prototype.findTimeInterval = Spline.prototype.findTimeInterval;
var scratchTimeVec = new Cartesian4();
var scratchTemp = new Cartesian3();
/**
* Wraps the given time to the period covered by the spline.
* @function
*
* @param {Number} time The time.
* @return {Number} The time, wrapped around to the updated animation.
*/
HermiteSpline.prototype.wrapTime = Spline.prototype.wrapTime;
/**
* Clamps the given time to the period covered by the spline.
* @function
*
* @param {Number} time The time.
* @return {Number} The time, clamped to the animation period.
*/
HermiteSpline.prototype.clampTime = Spline.prototype.clampTime;
/**
* Evaluates the curve at a given time.
*
* @param {Number} time The time at which to evaluate the curve.
* @param {Cartesian3} [result] The object onto which to store the result.
* @returns {Cartesian3} The modified result parameter or a new instance of the point on the curve at the given time.
*
* @exception {DeveloperError} time must be in the range <code>[t<sub>0</sub>, t<sub>n</sub>]</code>, where <code>t<sub>0</sub></code>
* is the first element in the array <code>times</code> and <code>t<sub>n</sub></code> is the last element
* in the array <code>times</code>.
*/
HermiteSpline.prototype.evaluate = function(time, result) {
if (!defined(result)) {
result = new Cartesian3();
}
var points = this.points;
var times = this.times;
var inTangents = this.inTangents;
var outTangents = this.outTangents;
var i = this._lastTimeIndex = this.findTimeInterval(time, this._lastTimeIndex);
var u = (time - times[i]) / (times[i + 1] - times[i]);
var timeVec = scratchTimeVec;
timeVec.z = u;
timeVec.y = u * u;
timeVec.x = timeVec.y * u;
timeVec.w = 1.0;
var coefs = Matrix4.multiplyByVector(HermiteSpline.hermiteCoefficientMatrix, timeVec, timeVec);
result = Cartesian3.multiplyByScalar(points[i], coefs.x, result);
Cartesian3.multiplyByScalar(points[i + 1], coefs.y, scratchTemp);
Cartesian3.add(result, scratchTemp, result);
Cartesian3.multiplyByScalar(outTangents[i], coefs.z, scratchTemp);
Cartesian3.add(result, scratchTemp, result);
Cartesian3.multiplyByScalar(inTangents[i], coefs.w, scratchTemp);
return Cartesian3.add(result, scratchTemp, result);
};
return HermiteSpline;
});
| {'content_hash': '54b9c89a202485423f1e54a7375cd52e', 'timestamp': '', 'source': 'github', 'line_count': 552, 'max_line_length': 154, 'avg_line_length': 38.07427536231884, 'alnum_prop': 0.5766284436408622, 'repo_name': 'oterral/cesium', 'id': '35eff8ad24d89268c03ffd91800b13f8271ab38c', 'size': '21017', 'binary': False, 'copies': '10', 'ref': 'refs/heads/master', 'path': 'Source/Core/HermiteSpline.js', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '659289'}, {'name': 'GLSL', 'bytes': '247456'}, {'name': 'HTML', 'bytes': '2008592'}, {'name': 'JavaScript', 'bytes': '23971138'}, {'name': 'Shell', 'bytes': '291'}]} |
mSync - a MySQL schema synchronization utility
### Description
mSync will create a schema file as JSON so that you can easily migrate schema to your production or any other work envirment easily. Currently mSync will support only table & views.
### Why we use mSync
Developers find very hard to synchronize mysql schema. The current conventional method is to export to sql & update it in production. The main demerit of this method is all the old values of the production will be loose & the process is bit hectic. In Order to solve this we developed a platform where you can update the schema in a file and by running msync it will update only those changes without losing any old structure or data.
### Prerequisites
To run mSync you need PHP.
### Configuration
First you need to update the database configuration in mSync config file (config.php). In confi.php you can add multiple hosts with a host name.
### Usage (CLI)
Create:
Creating schema (schema.json) file from localhost. Make sure that localhost configuration is updated in config.php
```sh
php msyc.php create
```
Creating schema (schema.json) file from some other host (Ex: yourdomain.com).
```sh
php msyc.php create yourdomain.com
```
Update :
Once the schema is created you can update/sync with other host or database by using update command.
```sh
//by the following query the schema.json will be update with your localhost
php msyc.php update
```
Updating remote mysql
```sh
php msyc.php update yourdomain.com
```
Note : If you are executing this query from localhost please make sure that your IP is accessible to update your production host. | {'content_hash': 'fda29e592af5ce8b2a72636d042d314d', 'timestamp': '', 'source': 'github', 'line_count': 37, 'max_line_length': 434, 'avg_line_length': 43.91891891891892, 'alnum_prop': 0.7747692307692308, 'repo_name': 'shabeer-ali-m/mSync', 'id': 'a303b2e943f17af8830bb099654fa4bbf96ef8ed', 'size': '1633', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'README.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'PHP', 'bytes': '14621'}]} |
# ===== Variables =====
PEGJS_VERSION = `cat $(VERSION_FILE)`
# ===== Modules =====
# Order matters -- dependencies must be listed before modules dependent on them.
MODULES = \
utils/arrays \
utils/objects \
utils/classes \
grammar-error \
parser \
compiler/visitor \
compiler/asts \
compiler/opcodes \
compiler/javascript \
statistics \
compiler/passes/generate-bytecode \
compiler/passes/generate-javascript \
compiler/passes/remove-proxy-rules \
compiler/passes/report-left-recursion \
compiler/passes/report-infinite-loops \
compiler/passes/report-missing-rules \
compiler/passes/report-unused-rules \
compiler/passes/report-duplicate-labels \
compiler/passes/report-duplicate-rules \
compiler/passes/report-redefined-rules \
compiler/passes/propagate-descriptions \
compiler/passes/patch-ast-graph \
compiler/passes/print-ruleset \
compiler/passes/auto-label \
compiler/passes/setup-memoization \
compiler/passes/calculate-consumption-info \
compiler \
peg
# ===== Directories =====
SRC_DIR = src
LIB_DIR = lib
BIN_DIR = bin
BROWSER_DIR = browser
SPEC_DIR = spec
BENCHMARK_DIR = benchmark
NODE_MODULES_DIR = node_modules
NODE_MODULES_BIN_DIR = $(NODE_MODULES_DIR)/.bin
# ===== Files =====
PARSER_SRC_FILE = $(SRC_DIR)/parser.pegjs
PARSER_OUT_FILE = $(LIB_DIR)/parser.js
BROWSER_FILE_DEV = $(BROWSER_DIR)/peg.js
BROWSER_FILE_MIN = $(BROWSER_DIR)/peg.min.js
VERSION_FILE = VERSION
# ===== Executables =====
JSHINT = $(NODE_MODULES_BIN_DIR)/jshint
UGLIFYJS = $(NODE_MODULES_BIN_DIR)/uglifyjs
JASMINE_NODE = $(NODE_MODULES_BIN_DIR)/jasmine-node
PEGJS = $(BIN_DIR)/pegjs
BENCHMARK_RUN = $(BENCHMARK_DIR)/run
# ===== Targets =====
# Default target
all: browser
# Generate the grammar parser
parser:
$(PEGJS) --verbose --elapsed-time --cache --statistics $(PARSER_SRC_FILE) $(PARSER_OUT_FILE)
# Build the browser version of the library
browser: parser
mkdir -p $(BROWSER_DIR)
rm -f $(BROWSER_FILE_DEV)
rm -f $(BROWSER_FILE_MIN)
# The following code is inspired by CoffeeScript's Cakefile.
echo '' >> $(BROWSER_FILE_DEV)
echo 'var PEG = (function(undefined) {' >> $(BROWSER_FILE_DEV)
echo ' "use strict";' >> $(BROWSER_FILE_DEV)
echo '' >> $(BROWSER_FILE_DEV)
echo ' var modules;' >> $(BROWSER_FILE_DEV)
echo '' >> $(BROWSER_FILE_DEV)
echo ' function __require__(path, dir) {' >> $(BROWSER_FILE_DEV)
echo ' var name = ((dir && path.indexOf("/") >= 0) ? dir : "") + path,' >> $(BROWSER_FILE_DEV)
echo ' regexp = /[^\/]+\/\.\.\/|\.\.\/|\.\/|\.js/;' >> $(BROWSER_FILE_DEV)
echo '' >> $(BROWSER_FILE_DEV)
echo " /* Can't use /.../g because we can move backwards in the string. */" >> $(BROWSER_FILE_DEV)
echo ' while (regexp.test(name)) {' >> $(BROWSER_FILE_DEV)
echo ' name = name.replace(regexp, "");' >> $(BROWSER_FILE_DEV)
echo ' }' >> $(BROWSER_FILE_DEV)
echo '' >> $(BROWSER_FILE_DEV)
echo ' return modules[name];' >> $(BROWSER_FILE_DEV)
echo ' }' >> $(BROWSER_FILE_DEV)
echo '' >> $(BROWSER_FILE_DEV)
echo ' modules = {' >> $(BROWSER_FILE_DEV)
echo ' define: function(name, factory) {' >> $(BROWSER_FILE_DEV)
echo ' var dir = name.replace(/(^|\/)[^\/]+$$/, "$$1"),' >> $(BROWSER_FILE_DEV)
echo ' module = { exports: {} };' >> $(BROWSER_FILE_DEV)
echo ' function require(path) {' >> $(BROWSER_FILE_DEV)
echo ' var rv = __require__(path, dir);' >> $(BROWSER_FILE_DEV)
echo ' if (!rv) {' >> $(BROWSER_FILE_DEV)
echo ' throw new Error("require-ing undefined module: " + path);' >> $(BROWSER_FILE_DEV)
echo ' }' >> $(BROWSER_FILE_DEV)
echo ' return rv;' >> $(BROWSER_FILE_DEV)
echo ' }' >> $(BROWSER_FILE_DEV)
echo '' >> $(BROWSER_FILE_DEV)
echo ' factory(module, require);' >> $(BROWSER_FILE_DEV)
echo ' this[name] = module.exports;' >> $(BROWSER_FILE_DEV)
echo ' }' >> $(BROWSER_FILE_DEV)
echo ' };' >> $(BROWSER_FILE_DEV)
echo '' >> $(BROWSER_FILE_DEV)
echo ' function assert(test) {' >> $(BROWSER_FILE_DEV)
echo ' if (!test) {' >> $(BROWSER_FILE_DEV)
echo ' throw new Error("assertion failed");' >> $(BROWSER_FILE_DEV)
echo ' }' >> $(BROWSER_FILE_DEV)
echo ' }' >> $(BROWSER_FILE_DEV)
echo '' >> $(BROWSER_FILE_DEV)
echo ' modules["assert"] = assert;' >> $(BROWSER_FILE_DEV)
echo '' >> $(BROWSER_FILE_DEV)
for module in $(MODULES); do \
echo " modules.define(\"$$module\", function(module, require) {" >> $(BROWSER_FILE_DEV); \
sed -e 's/^\(..*\)$$/ \1/' lib/$$module.js >> $(BROWSER_FILE_DEV); \
echo ' });' >> $(BROWSER_FILE_DEV); \
echo '' >> $(BROWSER_FILE_DEV); \
done
echo ' var PEG = modules["peg"];' >> $(BROWSER_FILE_DEV)
echo ' PEG.__require__ = __require__;' >> $(BROWSER_FILE_DEV)
echo ' PEG.__modules__ = modules;' >> $(BROWSER_FILE_DEV)
echo ' return PEG;' >> $(BROWSER_FILE_DEV)
echo '})();' >> $(BROWSER_FILE_DEV)
$(UGLIFYJS) \
--mangle \
--compress warnings=false \
--comments /Copyright/ \
-o $(BROWSER_FILE_MIN) \
$(BROWSER_FILE_DEV)
# Remove browser version of the library (created by "browser")
browserclean:
rm -rf $(BROWSER_DIR)
# Run the spec suite
spec: parser
$(JASMINE_NODE) --verbose $(SPEC_DIR)
# Run the benchmark suite
benchmark-all: \
benchmark \
benchmark-cache \
benchmark-locinfo \
benchmark-cache-locinfo \
benchmark-size \
benchmark-size-cache \
benchmark-size-locinfo \
benchmark-size-cache-locinfo
benchmark: parser
$(BENCHMARK_RUN)
benchmark-cache: parser
$(BENCHMARK_RUN) --cache
benchmark-locinfo: parser
$(BENCHMARK_RUN) --includeRegionInfo
benchmark-cache-locinfo: parser
$(BENCHMARK_RUN) --cache --includeRegionInfo
benchmark-size: parser
$(BENCHMARK_RUN) --optimize size
benchmark-size-cache: parser
$(BENCHMARK_RUN) --cache --optimize size
benchmark-size-locinfo: parser
$(BENCHMARK_RUN) --includeRegionInfo --optimize size
benchmark-size-cache-locinfo: parser
$(BENCHMARK_RUN) --cache --includeRegionInfo --optimize size
# Run JSHint on the source
hint: parser
$(JSHINT) \
`find $(LIB_DIR) -name '*.js'` \
`find $(SPEC_DIR) -name '*.js' -and -not -path '$(SPEC_DIR)/vendor/*'` \
$(BENCHMARK_DIR)/*.js \
$(BENCHMARK_RUN) \
$(PEGJS)
.PHONY: all parser browser browserclean spec benchmark hint
.SILENT: all parser browser browserclean spec benchmark hint
| {'content_hash': '6b7b6fd4658df96aa11fa587b3430ee0', 'timestamp': '', 'source': 'github', 'line_count': 202, 'max_line_length': 106, 'avg_line_length': 49.08910891089109, 'alnum_prop': 0.40500201694231547, 'repo_name': 'GerHobbelt/pegjs', 'id': '40930cb39f07614ddc4c3c93eaa5ee4b8781ad2b', 'size': '10668', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Makefile', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '55995'}, {'name': 'HTML', 'bytes': '4098'}, {'name': 'JavaScript', 'bytes': '412394'}, {'name': 'Makefile', 'bytes': '10668'}]} |
package com.it.zzb.niceweibo.bean;
import android.text.TextUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
/**
* 我喜欢的微博信息列表结构体。
*
* @author SINA
* @since 2013-11-24
*/
public class FavoriteList {
/** 微博列表 */
public ArrayList<Favorite> favoriteList;
public int total_number;
public static FavoriteList parse(String jsonString) {
if (TextUtils.isEmpty(jsonString)) {
return null;
}
FavoriteList favorites = new FavoriteList();
try {
JSONObject jsonObject = new JSONObject(jsonString);
favorites.total_number = jsonObject.optInt("total_number", 0);
JSONArray jsonArray = jsonObject.optJSONArray("favorites");
if (jsonArray != null && jsonArray.length() > 0) {
int length = jsonArray.length();
favorites.favoriteList = new ArrayList<Favorite>(length);
for (int ix = 0; ix < length; ix++) {
favorites.favoriteList.add(Favorite.parse(jsonArray.optJSONObject(ix)));
}
}
} catch (JSONException e) {
e.printStackTrace();
}
return favorites;
}
}
| {'content_hash': '5ab95ab3ef3e41853310815f46958e4d', 'timestamp': '', 'source': 'github', 'line_count': 51, 'max_line_length': 92, 'avg_line_length': 25.176470588235293, 'alnum_prop': 0.5919003115264797, 'repo_name': 'pugongyingbo/NiceWeibo', 'id': 'd2d4cbfade29052f0e7fe0285804eedaa3b8297c', 'size': '1947', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/src/main/java/com/it/zzb/niceweibo/bean/FavoriteList.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '828813'}]} |
package org.apache.carbondata.core.datastore.page;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.apache.carbondata.core.datastore.TableSpec;
import org.apache.carbondata.core.metadata.datatype.DataType;
public class SafeVarLengthColumnPage extends VarLengthColumnPageBase {
// for string and decimal data
private List<byte[]> byteArrayData;
SafeVarLengthColumnPage(TableSpec.ColumnSpec columnSpec, DataType dataType, int pageSize) {
super(columnSpec, dataType, pageSize);
byteArrayData = new ArrayList<>();
}
@Override
public void freeMemory() {
byteArrayData = null;
super.freeMemory();
}
@Override
public void putBytesAtRow(int rowId, byte[] bytes) {
byteArrayData.add(bytes);
}
@Override
public void putBytes(int rowId, byte[] bytes, int offset, int length) {
byteArrayData.add(bytes);
}
@Override public void putDecimal(int rowId, BigDecimal decimal) {
throw new UnsupportedOperationException("invalid data type: " + dataType);
}
@Override
public BigDecimal getDecimal(int rowId) {
throw new UnsupportedOperationException("invalid data type: " + dataType);
}
@Override
public byte[] getBytes(int rowId) {
return byteArrayData.get(rowId);
}
@Override
public void setByteArrayPage(byte[][] byteArray) {
for (byte[] data : byteArray) {
byteArrayData.add(data);
}
}
@Override
public byte[] getLVFlattenedBytePage() throws IOException {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(stream);
for (byte[] byteArrayDatum : byteArrayData) {
out.writeInt(byteArrayDatum.length);
out.write(byteArrayDatum);
}
return stream.toByteArray();
}
@Override
public byte[] getComplexChildrenLVFlattenedBytePage() throws IOException {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(stream);
for (byte[] byteArrayDatum : byteArrayData) {
out.writeShort((short)byteArrayDatum.length);
out.write(byteArrayDatum);
}
return stream.toByteArray();
}
@Override
public byte[] getComplexParentFlattenedBytePage() throws IOException {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(stream);
for (byte[] byteArrayDatum : byteArrayData) {
out.write(byteArrayDatum);
}
return stream.toByteArray();
}
@Override
public byte[][] getByteArrayPage() {
return byteArrayData.toArray(new byte[byteArrayData.size()][]);
}
@Override
void copyBytes(int rowId, byte[] dest, int destOffset, int length) {
System.arraycopy(byteArrayData.get(rowId), 0, dest, destOffset, length);
}
}
| {'content_hash': '4ae12f178bb962f0149fc8266e2b55c5', 'timestamp': '', 'source': 'github', 'line_count': 104, 'max_line_length': 93, 'avg_line_length': 27.89423076923077, 'alnum_prop': 0.7252671492588763, 'repo_name': 'jatin9896/incubator-carbondata', 'id': '274b8a7525c615ebbd982614cce73cc7cd819639', 'size': '3701', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'core/src/main/java/org/apache/carbondata/core/datastore/page/SafeVarLengthColumnPage.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '1639'}, {'name': 'Java', 'bytes': '6471103'}, {'name': 'Python', 'bytes': '19915'}, {'name': 'Scala', 'bytes': '10175489'}, {'name': 'Shell', 'bytes': '4349'}, {'name': 'Smalltalk', 'bytes': '86'}, {'name': 'Thrift', 'bytes': '25492'}]} |
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'app'))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'boot'
Bundler.require :default, ENV['RACK_ENV']
require 'web'
| {'content_hash': '9d1b203d604b2c4ab2d2f497ddc20a04', 'timestamp': '', 'source': 'github', 'line_count': 7, 'max_line_length': 66, 'avg_line_length': 35.57142857142857, 'alnum_prop': 0.6586345381526104, 'repo_name': 'ekosz/calhacks_demo', 'id': 'd7dea9d2766f2b0d8522d691040ff154160efd6a', 'size': '249', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'config/application.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Ruby', 'bytes': '5436'}, {'name': 'Shell', 'bytes': '97'}]} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>T801842841144041472</title>
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,600">
<link rel="stylesheet" href="/style.css">
<link rel="stylesheet" href="/custom.css">
<link rel="shortcut icon" href="https://micro.blog/curt/favicon.png" type="image/x-icon" />
<link rel="alternate" type="application/rss+xml" title="Curt Clifton" href="http://microblog.curtclifton.net/feed.xml" />
<link rel="alternate" type="application/json" title="Curt Clifton" href="http://microblog.curtclifton.net/feed.json" />
<link rel="EditURI" type="application/rsd+xml" href="/rsd.xml" />
<link rel="me" href="https://micro.blog/curt" />
<link rel="me" href="https://twitter.com/curtclifton" />
<link rel="authorization_endpoint" href="https://micro.blog/indieauth/auth" />
<link rel="token_endpoint" href="https://micro.blog/indieauth/token" />
<link rel="micropub" href="https://micro.blog/micropub" />
<link rel="webmention" href="https://micro.blog/webmention" />
<link rel="subscribe" href="https://micro.blog/users/follow" />
</head>
<body>
<div class="container">
<header class="masthead">
<h1 class="masthead-title--small">
<a href="/">Curt Clifton</a>
</h1>
</header>
<div class="content post h-entry">
<div class="post-date">
<time class="dt-published" datetime="2016-11-24 09:40:05 -0800">24 Nov 2016</time>
</div>
<div class="e-content">
<p>And can you start those proceedings before the inauguration? <a href="https://t.co/eC2wTZeAc7">https://t.co/eC2wTZeAc7</a></p>
</div>
</div>
</div>
</body>
</html>
| {'content_hash': '28f3f29d9795cce19024aa7e32aa4079', 'timestamp': '', 'source': 'github', 'line_count': 50, 'max_line_length': 131, 'avg_line_length': 35.24, 'alnum_prop': 0.6691259931895573, 'repo_name': 'curtclifton/curtclifton.github.io', 'id': 'bc5ff8f049714752f6f9b2a0acc1e5c7b6320130', 'size': '1762', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': '_site/2016/11/24/t801842841144041472.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '9029'}, {'name': 'HTML', 'bytes': '3523910'}]} |
PortListener::PortListener(const QString & portName)
{
qDebug() << "hi there";
this->port = new QextSerialPort(portName, QextSerialPort::EventDriven);
port->setBaudRate(BAUD56000);
port->setFlowControl(FLOW_OFF);
port->setParity(PAR_NONE);
port->setDataBits(DATA_8);
port->setStopBits(STOP_2);
if (port->open(QIODevice::ReadWrite) == true) {
connect(port, SIGNAL(readyRead()), this, SLOT(onReadyRead()));
connect(port, SIGNAL(dsrChanged(bool)), this, SLOT(onDsrChanged(bool)));
if (!(port->lineStatus() & LS_DSR))
qDebug() << "warning: device is not turned on";
qDebug() << "listening for data on" << port->portName();
}
else {
qDebug() << "device failed to open:" << port->errorString();
}
}
void PortListener::onReadyRead()
{
QByteArray bytes;
int a = port->bytesAvailable();
bytes.resize(a);
port->read(bytes.data(), bytes.size());
qDebug() << "bytes read:" << bytes.size();
qDebug() << "bytes:" << bytes;
}
void PortListener::onDsrChanged(bool status)
{
if (status)
qDebug() << "device was turned on";
else
qDebug() << "device was turned off";
}
| {'content_hash': '4a438a18423d3b126213c445f22614b6', 'timestamp': '', 'source': 'github', 'line_count': 39, 'max_line_length': 80, 'avg_line_length': 30.692307692307693, 'alnum_prop': 0.6073517126148705, 'repo_name': 'iti-luebeck/HANSE2012', 'id': 'ae6c5aecc9ce283ba6c4b551c5e065a053dda38f', 'size': '1244', 'binary': False, 'copies': '4', 'ref': 'refs/heads/release', 'path': 'hanse_ros/hanse_sonardriver/qextserialport/examples/event/PortListener.cpp', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C', 'bytes': '2838'}, {'name': 'C++', 'bytes': '1420994'}, {'name': 'CMake', 'bytes': '54594'}, {'name': 'CSS', 'bytes': '9813'}, {'name': 'HTML', 'bytes': '1407353'}, {'name': 'Makefile', 'bytes': '39710'}, {'name': 'Perl', 'bytes': '2600'}, {'name': 'Python', 'bytes': '402338'}, {'name': 'QMake', 'bytes': '2428'}, {'name': 'Shell', 'bytes': '2303'}]} |
package org.pkcs11.jacknji11;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import junit.framework.TestCase;
/**
* JUnit tests for jacknji11.
* Tests all the cryptoki functions that I have ever used and understand.
* The functions not tested are in commented lines.
* @author Joel Hockey ([email protected])
*/
public class CryptokiTest extends TestCase {
private byte[] SO_PIN = "sopin".getBytes();
private byte[] USER_PIN = "userpin".getBytes();
private long TESTSLOT = 0;
private long INITSLOT = 1;
public void setUp() {
String testSlotEnv = System.getenv("JACKNJI11_TEST_TESTSLOT");
if (testSlotEnv != null && testSlotEnv.length() > 0) {
TESTSLOT = Long.parseLong(testSlotEnv);
}
String initSlotEnv = System.getenv("JACKNJI11_TEST_INITSLOT");
if (initSlotEnv != null && initSlotEnv.length() > 0) {
INITSLOT = Long.parseLong(initSlotEnv);
}
String soPinEnv = System.getenv("JACKNJI11_TEST_SO_PIN");
if (soPinEnv != null && soPinEnv.length() > 0) {
SO_PIN = soPinEnv.getBytes();
}
String userPinEnv = System.getenv("JACKNJI11_TEST_USER_PIN");
if (userPinEnv != null && userPinEnv.length() > 0) {
USER_PIN = userPinEnv.getBytes();
}
// Library path can be set with JACKNJI11_PKCS11_LIB_PATH, or done in code such as:
// C.NATIVE = new org.pkcs11.jacknji11.jna.JNA("/usr/lib/softhsm/libsofthsm2.so");
// Or JFFI can be used rather than JNA:
// C.NATIVE = new org.pkcs11.jacknji11.jffi.JFFI();
CE.Initialize();
}
public void tearDown() {
CE.Finalize();
}
public void testGetInfo() {
CK_INFO info = new CK_INFO();
CE.GetInfo(info);
// System.out.println(info);
}
public void testGetSlotList() {
long[] slots = CE.GetSlotList(true);
// System.out.println("slots: " + Arrays.toString(slots));
}
public void testGetSlotInfo() {
CK_SLOT_INFO info = new CK_SLOT_INFO();
CE.GetSlotInfo(TESTSLOT, info);
// System.out.println(info);
}
public void testGetTokenInfo() {
CK_TOKEN_INFO info = new CK_TOKEN_INFO();
CE.GetTokenInfo(TESTSLOT, info);
// System.out.println(info);
}
public void testGetMechanismList() {
for (long mech : CE.GetMechanismList(TESTSLOT)) {
// System.out.println(String.format("0x%08x : %s", mech, CKM.L2S(mech)));
}
}
public void testGetMechanismInfo() {
CK_MECHANISM_INFO info = new CK_MECHANISM_INFO();
CE.GetMechanismInfo(TESTSLOT, CKM.AES_CBC, info);
// System.out.println(info);
}
public void testInitTokenInitPinSetPin() {
CE.InitToken(INITSLOT, SO_PIN, "TEST".getBytes());
long session = CE.OpenSession(INITSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
CE.Login(session, CKU.SO, SO_PIN);
CE.InitPIN(session, USER_PIN);
CE.Logout(session);
CE.Login(session, CKU.USER, USER_PIN);
byte[] somenewpin = "somenewpin".getBytes();
CE.SetPIN(session, USER_PIN, somenewpin);
CE.SetPIN(session, somenewpin, USER_PIN);
}
public void testGetSessionInfo() {
long session = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
CK_SESSION_INFO sessionInfo = new CK_SESSION_INFO();
CE.GetSessionInfo(session, sessionInfo);
// System.out.println(sessionInfo);
}
public void testGetSessionInfoCloseAllSessions() {
long s1 = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
long s2 = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
CK_SESSION_INFO info = new CK_SESSION_INFO();
CE.GetSessionInfo(s2, info );
// System.out.println(info);
long s3 = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
CE.CloseSession(s1);
CE.CloseAllSessions(TESTSLOT);
assertEquals(CKR.SESSION_HANDLE_INVALID, C.CloseSession(s3));
}
public void testGetSetOperationState() {
long session = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
byte[] state = CE.GetOperationState(session);
CE.SetOperationState(session, state, 0, 0);
}
public void testCreateCopyDestroyObject() {
long session = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
CE.Login(session, CKU.USER, USER_PIN);
CKA[] templ = {
new CKA(CKA.CLASS, CKO.DATA),
new CKA(CKA.VALUE, "datavalue"),
};
long o1 = CE.CreateObject(session, templ);
CKA[] newTempl = {
new CKA(CKA.TOKEN, true),
};
long o2 = CE.CopyObject(session, o1, newTempl);
CE.DestroyObject(session, o1);
CE.DestroyObject(session, o2);
}
public void testGetObjectSizeGetSetAtt() {
long session = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
CE.Login(session, CKU.USER, USER_PIN);
CKA[] templ = {
new CKA(CKA.CLASS, CKO.DATA),
new CKA(CKA.PRIVATE, false),
new CKA(CKA.VALUE, "datavalue"),
};
long o = CE.CreateObject(session, templ);
long size = CE.GetObjectSize(session, o);
assertNull(CE.GetAttributeValue(session, o, CKA.LABEL).getValueStr());
assertNull(CE.GetAttributeValue(session, o, CKA.ID).getValueStr());
assertEquals("datavalue", CE.GetAttributeValue(session, o, CKA.VALUE).getValueStr());
assertEquals(Long.valueOf(CKO.DATA), CE.GetAttributeValue(session, o, CKA.CLASS).getValueLong());
assertFalse(CE.GetAttributeValue(session, o, CKA.PRIVATE).getValueBool());
templ = new CKA[] {
// Different HSMs are pick in different ways which attributes can be modified,
// just modify label which seems to work on most
new CKA(CKA.LABEL, "datalabel"),
};
CE.SetAttributeValue(session, o, templ);
long newsize = CE.GetObjectSize(session, o);
if (size > -1) {
assertTrue("newsize: " + newsize + ", size " + size, newsize > size);
}
assertEquals("datalabel", CE.GetAttributeValue(session, o, CKA.LABEL).getValueStr());
assertNull(CE.GetAttributeValue(session, o, CKA.ID).getValueStr());
assertEquals("datavalue", CE.GetAttributeValue(session, o, CKA.VALUE).getValueStr());
assertEquals(Long.valueOf(CKO.DATA), CE.GetAttributeValue(session, o, CKA.CLASS).getValueLong());
assertFalse(CE.GetAttributeValue(session, o, CKA.PRIVATE).getValueBool());
templ = CE.GetAttributeValue(session, o, CKA.LABEL, CKA.ID, CKA.VALUE, CKA.CLASS, CKA.PRIVATE);
assertEquals("datalabel", templ[0].getValueStr());
assertNull(CE.GetAttributeValue(session, o, CKA.ID).getValueStr());
assertEquals("datavalue", templ[2].getValueStr());
assertEquals(CKO.DATA, templ[3].getValueLong().longValue());
assertFalse(templ[4].getValueBool());
templ = CE.GetAttributeValue(session, o, CKA.LABEL, CKA.ID, CKA.OBJECT_ID, CKA.TRUSTED);
assertEquals("datalabel", templ[0].getValueStr());
assertNull(CE.GetAttributeValue(session, o, CKA.ID).getValueStr());
assertNull(templ[2].getValue());
assertNull(templ[3].getValueBool());
}
public void testFindObjects() {
long session = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
CE.Login(session, CKU.USER, USER_PIN); // Needed depending on HSM policy
// create a few objects
CKA[] templ = {
new CKA(CKA.CLASS, CKO.DATA),
new CKA(CKA.LABEL, "label1"),
};
long o1 = CE.CreateObject(session, templ);
long o2 = CE.CreateObject(session, templ);
long o3 = CE.CreateObject(session, templ);
assertTrue(o1 != o2);
templ[1] = new CKA(CKA.LABEL, "label2");
long o4 = CE.CreateObject(session, templ);
templ = new CKA[] {new CKA(CKA.LABEL, "label1")};
CE.FindObjectsInit(session, templ);
assertEquals(2, CE.FindObjects(session, 2).length);
assertEquals(1, CE.FindObjects(session, 2).length);
assertEquals(0, CE.FindObjects(session, 2).length);
CE.FindObjectsFinal(session);
templ = new CKA[] {new CKA(CKA.LABEL, "label2")};
CE.FindObjectsInit(session, templ);
long[] found = CE.FindObjects(session, 2);
assertEquals(1, found.length);
assertEquals(o4, found[0]);
assertEquals(0, CE.FindObjects(session, 2).length);
CE.FindObjectsFinal(session);
}
public void testEncryptDecrypt() {
long session = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
CE.LoginUser(session, USER_PIN);
long aeskey = CE.GenerateKey(session, new CKM(CKM.AES_KEY_GEN),
new CKA(CKA.VALUE_LEN, 32),
new CKA(CKA.LABEL, "labelencaes"),
new CKA(CKA.ID, "labelencaes"),
new CKA(CKA.TOKEN, false),
new CKA(CKA.SENSITIVE, false),
new CKA(CKA.ENCRYPT, true),
new CKA(CKA.DECRYPT, true),
new CKA(CKA.DERIVE, true));
CE.EncryptInit(session, new CKM(CKM.AES_CBC_PAD), aeskey);
byte[] plaintext = new byte[10];
byte[] encrypted1 = CE.EncryptPad(session, plaintext);
CE.EncryptInit(session, new CKM(CKM.AES_CBC_PAD), aeskey);
byte[] encrypted2a = CE.EncryptUpdate(session, new byte[6]);
byte[] encrypted2b = CE.EncryptUpdate(session, new byte[4]);
byte[] encrypted2c = CE.EncryptFinal(session);
assertTrue(Arrays.equals(encrypted1, Buf.cat(encrypted2a, encrypted2b, encrypted2c)));
CE.DecryptInit(session, new CKM(CKM.AES_CBC_PAD), aeskey);
byte[] decrypted1 = CE.DecryptPad(session, encrypted1);
assertTrue(Arrays.equals(plaintext, decrypted1));
CE.DecryptInit(session, new CKM(CKM.AES_CBC_PAD), aeskey);
byte[] decrypted2a = CE.DecryptUpdate(session, Buf.substring(encrypted1, 0, 8));
byte[] decrypted2b = CE.DecryptUpdate(session, Buf.substring(encrypted1, 8, 8));
byte[] decrypted2c = CE.DecryptFinal(session);
assertTrue(Arrays.equals(plaintext, Buf.cat(decrypted2a, decrypted2b, decrypted2c)));
}
public void testDigest() {
long session = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
CE.Login(session, CKU.USER, USER_PIN); // Needed depending on HSM policy
CE.DigestInit(session, new CKM(CKM.SHA256));
byte[] digested1 = CE.Digest(session, new byte[100]);
assertEquals(32, digested1.length);
CE.DigestInit(session, new CKM(CKM.SHA256));
CE.DigestUpdate(session, new byte[50]);
CE.DigestUpdate(session, new byte[50]);
byte[] digested2 = CE.DigestFinal(session);
assertTrue(Arrays.equals(digested1, digested2));
long aeskey = CE.GenerateKey(session, new CKM(CKM.AES_KEY_GEN),
new CKA(CKA.VALUE_LEN, 24),
new CKA(CKA.LABEL, "labelaesdigest"),
new CKA(CKA.ID, "labelaesdigest"),
new CKA(CKA.TOKEN, false),
new CKA(CKA.SENSITIVE, false),
new CKA(CKA.DERIVE, true));
CE.DigestInit(session, new CKM(CKM.SHA256));
CE.DigestKey(session, aeskey);
byte[] digestedKey = CE.DigestFinal(session);
}
public void testSignVerifyRSAPKCS1() {
long session = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
CE.LoginUser(session, USER_PIN);
// Different HSMs have a little different requirements on templates, regardless of which are mandatory or not
// in the P11 spec. To work with as many HSMs as possible, use a good default, as complete as possible, template.
// On most HSMs you can set CKA_ID after key generations, but some requires adding CKA_ID at generation time
CKA[] pubTempl = new CKA[] {
new CKA(CKA.MODULUS_BITS, 1024),
new CKA(CKA.PUBLIC_EXPONENT, Hex.s2b("010001")),
new CKA(CKA.WRAP, false),
new CKA(CKA.ENCRYPT, false),
new CKA(CKA.VERIFY, true),
new CKA(CKA.TOKEN, true),
new CKA(CKA.LABEL, "labelrsa-public"),
new CKA(CKA.ID, "labelrsa"),
};
CKA[] privTempl = new CKA[] {
new CKA(CKA.TOKEN, true),
new CKA(CKA.PRIVATE, true),
new CKA(CKA.SENSITIVE, true),
new CKA(CKA.SIGN, true),
new CKA(CKA.DECRYPT, false),
new CKA(CKA.UNWRAP, false),
new CKA(CKA.EXTRACTABLE, false),
new CKA(CKA.LABEL, "labelrsa-private"),
new CKA(CKA.ID, "labelrsa"),
};
LongRef pubKey = new LongRef();
LongRef privKey = new LongRef();
CE.GenerateKeyPair(session, new CKM(CKM.RSA_PKCS_KEY_PAIR_GEN), pubTempl, privTempl, pubKey, privKey);
// Direct sign
byte[] data = new byte[100];
CE.SignInit(session, new CKM(CKM.SHA256_RSA_PKCS), privKey.value());
byte[] sig1 = CE.Sign(session, data);
assertEquals(128, sig1.length);
CE.VerifyInit(session, new CKM(CKM.SHA256_RSA_PKCS), pubKey.value());
CE.Verify(session, data, sig1);
// Using SignUpdate
CE.SignInit(session, new CKM(CKM.SHA256_RSA_PKCS), privKey.value());
CE.SignUpdate(session, new byte[50]);
CE.SignUpdate(session, new byte[50]);
byte[] sig2 = CE.SignFinal(session);
assertTrue(Arrays.equals(sig1, sig2));
CE.VerifyInit(session, new CKM(CKM.SHA256_RSA_PKCS), pubKey.value());
CE.VerifyUpdate(session, new byte[50]);
CE.VerifyUpdate(session, new byte[50]);
CE.VerifyFinal(session, sig2);
CE.VerifyInit(session, new CKM(CKM.SHA256_RSA_PKCS), pubKey.value());
try {
CE.Verify(session, data, new byte[128]);
fail("CE Verify with no real signature should throw exception");
} catch (CKRException e) {
assertEquals("Failure with invalid signature data should be CKR.SIGNATURE_INVALID", CKR.SIGNATURE_INVALID, e.getCKR());
}
}
public void testSignVerifyRSAPSS() {
long session = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
CE.LoginUser(session, USER_PIN);
CKA[] pubTempl = new CKA[] {
new CKA(CKA.MODULUS_BITS, 1024),
new CKA(CKA.PUBLIC_EXPONENT, Hex.s2b("010001")),
new CKA(CKA.WRAP, false),
new CKA(CKA.ENCRYPT, false),
new CKA(CKA.VERIFY, true),
new CKA(CKA.TOKEN, true),
new CKA(CKA.LABEL, "label-public"),
new CKA(CKA.ID, "label"),
};
CKA[] privTempl = new CKA[] {
new CKA(CKA.TOKEN, true),
new CKA(CKA.PRIVATE, true),
new CKA(CKA.SENSITIVE, true),
new CKA(CKA.SIGN, true),
new CKA(CKA.DECRYPT, false),
new CKA(CKA.UNWRAP, false),
new CKA(CKA.EXTRACTABLE, false),
new CKA(CKA.LABEL, "label-private"),
new CKA(CKA.ID, "label"),
};
LongRef pubKey = new LongRef();
LongRef privKey = new LongRef();
CE.GenerateKeyPair(session, new CKM(CKM.RSA_PKCS_KEY_PAIR_GEN), pubTempl, privTempl, pubKey, privKey);
// RSA-PSS needs parameters, which specifies the padding to be used, matching the hash algorithm
byte[] params = ULong.ulong2b(new long[]{CKM.SHA256, CKG.MGF1_SHA256, 32});
CKM ckm = new CKM(CKM.SHA256_RSA_PKCS_PSS, params);
// Direct sign
byte[] data = new byte[100];
CE.SignInit(session, ckm, privKey.value());
byte[] sig1 = CE.Sign(session, data);
assertEquals(128, sig1.length);
CE.VerifyInit(session, ckm, pubKey.value());
CE.Verify(session, data, sig1);
// Using SignUpdate
CE.SignInit(session, ckm, privKey.value());
CE.SignUpdate(session, new byte[50]);
CE.SignUpdate(session, new byte[50]);
byte[] sig2 = CE.SignFinal(session);
// RSA-PSS uses randomness, so two signatures can not be compared as with RSA PKCS#1
//assertTrue(Arrays.equals(sig1, sig2));
CE.VerifyInit(session, ckm, pubKey.value());
CE.VerifyUpdate(session, new byte[50]);
CE.VerifyUpdate(session, new byte[50]);
CE.VerifyFinal(session, sig2);
CE.VerifyInit(session, ckm, pubKey.value());
try {
CE.Verify(session, data, new byte[128]);
fail("CE Verify with no real signature should throw exception");
} catch (CKRException e) {
assertEquals("Failure with invalid signature data should be CKR.SIGNATURE_INVALID", CKR.SIGNATURE_INVALID, e.getCKR());
}
}
public void testSignVerifyECDSA() {
long session = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
CE.LoginUser(session, USER_PIN);
// Attributes from PKCS #11 Cryptographic Token Interface Current Mechanisms Specification
// Version 2.40 section 2.3.3 - ECDSA public key objects
// We use a P-256 key (also known as secp256r1 or prime256v1), the oid 1.2.840.10045.3.1.7
// has DER encoding in Hex 06082a8648ce3d030107
// DER-encoding of an ANSI X9.62 Parameters, also known as "EC domain parameters".
// See X9.62-1998 Public Key Cryptography For The Financial Services Industry:
// The Elliptic Curve Digital Signature Algorithm (ECDSA), page 27.
byte[] ecCurveParams = Hex.s2b("06082a8648ce3d030107");
CKA[] pubTempl = new CKA[] {
new CKA(CKA.EC_PARAMS, ecCurveParams),
new CKA(CKA.WRAP, false),
new CKA(CKA.ENCRYPT, false),
new CKA(CKA.VERIFY, true),
new CKA(CKA.VERIFY_RECOVER, false),
new CKA(CKA.TOKEN, true),
new CKA(CKA.LABEL, "labelec-public"),
new CKA(CKA.ID, "labelec"),
};
CKA[] privTempl = new CKA[] {
new CKA(CKA.TOKEN, true),
new CKA(CKA.PRIVATE, true),
new CKA(CKA.SENSITIVE, true),
new CKA(CKA.SIGN, true),
new CKA(CKA.SIGN_RECOVER, false),
new CKA(CKA.DECRYPT, false),
new CKA(CKA.UNWRAP, false),
new CKA(CKA.EXTRACTABLE, false),
new CKA(CKA.LABEL, "labelec-private"),
new CKA(CKA.ID, "labelec"),
};
LongRef pubKey = new LongRef();
LongRef privKey = new LongRef();
CE.GenerateKeyPair(session, new CKM(CKM.ECDSA_KEY_PAIR_GEN), pubTempl, privTempl, pubKey, privKey);
// Direct sign, PKCS#11 "2.3.6 ECDSA without hashing"
byte[] data = new byte[32]; // SHA256 hash is 32 bytes
CE.SignInit(session, new CKM(CKM.ECDSA), privKey.value());
byte[] sig1 = CE.Sign(session, data);
assertEquals(64, sig1.length);
CE.VerifyInit(session, new CKM(CKM.ECDSA), pubKey.value());
CE.Verify(session, data, sig1);
CE.VerifyInit(session, new CKM(CKM.ECDSA), pubKey.value());
try {
CE.Verify(session, data, new byte[64]);
fail("CE Verify with no real signature should throw exception");
} catch (CKRException e) {
assertEquals("Failure with invalid signature data should be CKR.SIGNATURE_INVALID", CKR.SIGNATURE_INVALID, e.getCKR());
}
}
/** https://docs.oasis-open.org/pkcs11/pkcs11-curr/v3.0/os/pkcs11-curr-v3.0-os.html#_Toc30061191
*/
public void testSignVerifyEdDSA() {
long session = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
CE.LoginUser(session, USER_PIN);
// CKM_EC_EDWARDS_KEY_PAIR_GEN
/*
The mechanism can only generate EC public/private key pairs over the curves edwards25519 and edwards448 as defined in RFC 8032 or the curves
id-Ed25519 and id-Ed448 as defined in RFC 8410. These curves can only be specified in the CKA_EC_PARAMS attribute of the template for the
public key using the curveName or the oID methods
*/
// CKM_EDDSA (signature mechanism)
/*
CK_EDDSA_PARAMS is a structure that provides the parameters for the CKM_EDDSA signature mechanism. The structure is defined as follows:
typedef struct CK_EDDSA_PARAMS {
CK_BBOOL phFlag;
CK_ULONG ulContextDataLen;
CK_BYTE_PTR pContextData;
} CK_EDDSA_PARAMS
*/
// CK_EDDSA_PARAMS (no params means Ed25519 in keygen?)
// CK_EDDSA_PARAMS_PTR is a pointer to a CK_EDDSA_PARAMS
// CKK_EC_EDWARDS (private and public key)
// Attributes from PKCS #11 Cryptographic Token Interface Current Mechanisms Specification Version 2.40 section 2.3.3 - ECDSA public key objects
/* DER-encoding of an ANSI X9.62 Parameters, also known as "EC domain parameters". */
// We use a Ed25519 key, the oid 1.3.101.112 has DER encoding in Hex 06032b6570
byte[] ecCurveParams = Hex.s2b("06032b6570");
CKA[] pubTempl = new CKA[] {
new CKA(CKA.EC_PARAMS, ecCurveParams),
new CKA(CKA.WRAP, false),
new CKA(CKA.ENCRYPT, false),
new CKA(CKA.VERIFY, true),
new CKA(CKA.VERIFY_RECOVER, false),
new CKA(CKA.TOKEN, true),
new CKA(CKA.LABEL, "label-public"),
new CKA(CKA.ID, "label"),
};
CKA[] privTempl = new CKA[] {
new CKA(CKA.TOKEN, true),
new CKA(CKA.PRIVATE, true),
new CKA(CKA.SENSITIVE, true),
new CKA(CKA.SIGN, true),
new CKA(CKA.SIGN_RECOVER, false),
new CKA(CKA.DECRYPT, false),
new CKA(CKA.UNWRAP, false),
new CKA(CKA.EXTRACTABLE, false),
new CKA(CKA.LABEL, "label-private"),
new CKA(CKA.ID, "label"),
};
LongRef pubKey = new LongRef();
LongRef privKey = new LongRef();
CE.GenerateKeyPair(session, new CKM(CKM.EC_EDWARDS_KEY_PAIR_GEN), pubTempl, privTempl, pubKey, privKey);
// Direct sign, PKCS#11 "2.3.14 EdDSA"
byte[] data = new byte[32]; // SHA256 hash is 32 bytes
CE.SignInit(session, new CKM(CKM.EDDSA), privKey.value());
byte[] sig1 = CE.Sign(session, data);
assertEquals(64, sig1.length);
CE.VerifyInit(session, new CKM(CKM.EDDSA), pubKey.value());
CE.Verify(session, data, sig1);
CE.VerifyInit(session, new CKM(CKM.EDDSA), pubKey.value());
try {
CE.Verify(session, data, new byte[64]);
fail("CE Verify with no real signature should throw exception");
} catch (CKRException e) {
assertEquals("Failure with invalid signature data should be CKR.SIGNATURE_INVALID", CKR.SIGNATURE_INVALID, e.getCKR());
}
}
/** SignRecoverInit and VerifyRecoverInit is not supported on all HSMs,
* so it has a separate test that may expect to fail with FUNCTION_NOT_SUPPORTED
*/
public void testSignVerifyRecoveryRSA() {
long session = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
CE.LoginUser(session, USER_PIN);
// See comments on the method testSignVerifyRSA
CKA[] pubTempl = new CKA[] {
new CKA(CKA.MODULUS_BITS, 1024),
new CKA(CKA.PUBLIC_EXPONENT, Hex.s2b("010001")),
new CKA(CKA.WRAP, false),
new CKA(CKA.ENCRYPT, false),
new CKA(CKA.VERIFY, true),
new CKA(CKA.VERIFY_RECOVER, true),
new CKA(CKA.TOKEN, true),
new CKA(CKA.LABEL, "labelrsa2-public"),
new CKA(CKA.ID, "labelrsa2"),
};
CKA[] privTempl = new CKA[] {
new CKA(CKA.TOKEN, true),
new CKA(CKA.PRIVATE, true),
new CKA(CKA.SENSITIVE, true),
new CKA(CKA.SIGN, true),
new CKA(CKA.SIGN_RECOVER, true),
new CKA(CKA.DECRYPT, false),
new CKA(CKA.UNWRAP, false),
new CKA(CKA.EXTRACTABLE, false),
new CKA(CKA.LABEL, "labelrsa2-private"),
new CKA(CKA.ID, "labelrsa2"),
};
LongRef pubKey = new LongRef();
LongRef privKey = new LongRef();
CE.GenerateKeyPair(session, new CKM(CKM.RSA_PKCS_KEY_PAIR_GEN), pubTempl, privTempl, pubKey, privKey);
byte[] data = new byte[100];
CE.SignInit(session, new CKM(CKM.SHA256_RSA_PKCS), privKey.value());
byte[] sig1 = CE.Sign(session, data);
assertEquals(128, sig1.length);
data = new byte[10];
CE.SignRecoverInit(session, new CKM(CKM.RSA_PKCS), privKey.value());
byte[] sigrec1 = CE.SignRecover(session, data);
assertEquals(64, sig1.length);
CE.VerifyRecoverInit(session, new CKM(CKM.RSA_PKCS), pubKey.value());
byte[] recdata = CE.VerifyRecover(session, sigrec1);
assertTrue(Arrays.equals(data, recdata));
}
// public static native long C_DigestEncryptUpdate(long session, byte[] part, long part_len, byte[] encrypted_part, LongRef encrypted_part_len);
// public static native long C_DecryptDigestUpdate(long session, byte[] encrypted_part, long encrypted_part_len, byte[] part, LongRef part_len);
// public static native long C_SignEncryptUpdate(long session, byte[] part, long part_len, byte[] encrypted_part, LongRef encrypted_part_len);
// public static native long C_DecryptVerifyUpdate(long session, byte[] encrypted_part, long encrypted_part_len, byte[] part, LongRef part_len);
public void testGenerateKeyWrapUnwrap() {
long session = CE.OpenSession(TESTSLOT);
CE.LoginUser(session, USER_PIN);
// CKA[] secTempl = new CKA[] {
// new CKA(CKA.VALUE_LEN, 32),
// new CKA(CKA.LABEL, "labelwrap"),
// new CKA(CKA.ID, "labelwrap"),
// new CKA(CKA.TOKEN, false),
// new CKA(CKA.SENSITIVE, false),
// new CKA(CKA.EXTRACTABLE, true),
// new CKA(CKA.ENCRYPT, true),
// new CKA(CKA.DECRYPT, true),
// new CKA(CKA.DERIVE, true),
// };
// long aeskey = CE.GenerateKey(session, new CKM(CKM.AES_KEY_GEN), secTempl);
long aeskey = CE.GenerateKey(session, new CKM(CKM.AES_KEY_GEN),
new CKA(CKA.VALUE_LEN, 32),
new CKA(CKA.LABEL, "labelwrap"),
new CKA(CKA.ID, "labelwrap"),
new CKA(CKA.TOKEN, false),
new CKA(CKA.SENSITIVE, false),
new CKA(CKA.EXTRACTABLE, true),
new CKA(CKA.DERIVE, true));
byte[] aeskeybuf = CE.GetAttributeValue(session, aeskey, CKA.VALUE).getValue();
// See comments on the method testSignVerifyRSA
CKA[] pubTempl = new CKA[] {
new CKA(CKA.MODULUS_BITS, 1024),
new CKA(CKA.PUBLIC_EXPONENT, Hex.s2b("010001")),
new CKA(CKA.WRAP, true),
new CKA(CKA.ENCRYPT, false),
new CKA(CKA.VERIFY, true),
new CKA(CKA.VERIFY_RECOVER, true),
new CKA(CKA.TOKEN, true),
new CKA(CKA.LABEL, "labelrsa3-public"),
new CKA(CKA.ID, "labelrsa3"),
};
CKA[] privTempl = new CKA[] {
new CKA(CKA.TOKEN, true),
new CKA(CKA.PRIVATE, true),
new CKA(CKA.SENSITIVE, true),
new CKA(CKA.SIGN, true),
new CKA(CKA.SIGN_RECOVER, true),
new CKA(CKA.DECRYPT, false),
new CKA(CKA.UNWRAP, true),
new CKA(CKA.EXTRACTABLE, false),
new CKA(CKA.LABEL, "labelrsa3-private"),
new CKA(CKA.ID, "labelrsa3"),
};
LongRef pubKey = new LongRef();
LongRef privKey = new LongRef();
CE.GenerateKeyPair(session, new CKM(CKM.RSA_PKCS_KEY_PAIR_GEN), pubTempl, privTempl, pubKey, privKey);
// Key wrapping, i.e. exporting a key from the HSM. Wrapping with RSA means you wrap (encrypt) the key
// with the RSA public key and you unwrap (decrypt) it with the RSA private key
// http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/csprd02/pkcs11-curr-v2.40-csprd02.html#_Toc387327730
byte[] wrapped = CE.WrapKey(session, new CKM(CKM.RSA_PKCS), pubKey.value(), aeskey);
// We need to provide a full set of attributes for the secret key in order to unwrap it inside the HSM
// Unwrapping is done with the RSA private key, i.e. the secret key is never exposed unencrypted outside
// of the HSM (if we had generated the secret key with CKA.EXTRACTABLE=false that is)
CKA[] secTemplUnwrap = new CKA[] {
new CKA(CKA.CLASS, CKO.SECRET_KEY),
new CKA(CKA.KEY_TYPE, CKK.AES),
new CKA(CKA.LABEL, "labelunwrap"),
new CKA(CKA.ID, "labelunwrap"),
new CKA(CKA.TOKEN, false),
new CKA(CKA.SENSITIVE, false),
new CKA(CKA.EXTRACTABLE, true),
new CKA(CKA.ENCRYPT, true),
new CKA(CKA.DECRYPT, true),
new CKA(CKA.DERIVE, true),
};
long aeskey2 = CE.UnwrapKey(session, new CKM(CKM.RSA_PKCS), privKey.value(), wrapped, secTemplUnwrap);
byte[] aeskey2buf = CE.GetAttributeValue(session, aeskey2, CKA.VALUE).getValue();
assertTrue(Arrays.equals(aeskey2buf, aeskeybuf));
}
public void testPTKDES3Derive() {
long session = CE.OpenSession(TESTSLOT);
CE.LoginUser(session, USER_PIN);
long des3key = CE.GenerateKey(session, new CKM(CKM.DES3_KEY_GEN),
new CKA(CKA.VALUE_LEN, 24),
new CKA(CKA.LABEL, "label"),
new CKA(CKA.SENSITIVE, false),
new CKA(CKA.DERIVE, true));
byte[] des3keybuf = CE.GetAttributeValue(session, des3key, CKA.VALUE).getValue();
CE.DeriveKey(session, new CKM(CKM.VENDOR_PTK_DES3_DERIVE_CBC, new byte[32]), des3key);
}
public void testRandom() {
long session = CE.OpenSession(TESTSLOT, CK_SESSION_INFO.CKF_RW_SESSION | CK_SESSION_INFO.CKF_SERIAL_SESSION, null, null);
byte[] buf = new byte[16];
CE.SeedRandom(session, buf);
CE.GenerateRandom(session, buf);
byte[] buf2 = CE.GenerateRandom(session, 16);
}
// public static native long C_GetFunctionStatus(long session);
// public static native long C_CancelFunction(long session);
// public static native long C_WaitForSlotEvent(long flags, LongRef slot, Pointer pReserved);
// public static native long C_SetOperationState(long session, byte[] operation_state, long operation_state_len, long encryption_key, long authentication_key);
}
| {'content_hash': '4e6cfe11eae8d454d40d5d03e1e95447', 'timestamp': '', 'source': 'github', 'line_count': 685, 'max_line_length': 162, 'avg_line_length': 46.472992700729925, 'alnum_prop': 0.6081862159954765, 'repo_name': 'joelhockey/jacknji11', 'id': '73c4f7a5e59c4d74590ec68731bf2dbc27de7516', 'size': '32993', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/test/java/org/pkcs11/jacknji11/CryptokiTest.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '190167'}, {'name': 'Java', 'bytes': '682266'}]} |
template <class StatSolver, class TimeOp, class Pot,
class Para, int dim>
class SimDef{
public:
SimDef(Params1D *p):da(p), s(p),t(p), psi0(p->getnx()){}
SimDef(Params2D<double> *p):da(p) {}
SimDef(Params3D *p):da(p) {}
void staticsolve() {
s.solve();
s.copystate(0, psi0);
t.setstate(psi0);
}
void timerev() {
std::chrono::high_resolution_clock::time_point t1 =
std::chrono::high_resolution_clock::now();
DEBUG2("Time Solve");
t.time_solve();
std::chrono::high_resolution_clock::time_point t2 =
std::chrono::high_resolution_clock::now();
auto duration =
std::chrono::duration_cast<std::chrono::minutes>( t2 - t1 ).count();
std::cout<<"It took "<< duration <<" minutes for the whole simulation!"<<std::endl;
}
private:
StatSolver s;
TimeOp t;
Pot p;
Para *da;
thrust::host_vector<cuDoubleComplex> psi0;
};
| {'content_hash': '7c886075fb1a2334e1e41abe9e0114c2', 'timestamp': '', 'source': 'github', 'line_count': 41, 'max_line_length': 91, 'avg_line_length': 24.463414634146343, 'alnum_prop': 0.555333998005982, 'repo_name': 's0vereign/SchroedingerSolver', 'id': 'f95b2cba93661d8b98a27840367607f2d5f39a91', 'size': '1119', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'src/QonGPU/include/SimDef.hpp', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C++', 'bytes': '32721'}, {'name': 'CMake', 'bytes': '5754'}, {'name': 'Cuda', 'bytes': '1050'}, {'name': 'Jupyter Notebook', 'bytes': '15946'}, {'name': 'Python', 'bytes': '4093'}, {'name': 'Shell', 'bytes': '643'}]} |
admin = User.create(
email: "[email protected]",
name: "Administrator",
username: 'root',
password: "5iveL!fe",
password_confirmation: "5iveL!fe"
)
admin.projects_limit = 10000
admin.admin = true
admin.save!
if admin.valid?
puts %q[
Administrator account created:
[email protected]
password......5iveL!fe
]
end
| {'content_hash': '795445a1d9a8f9182ce809c17735d803', 'timestamp': '', 'source': 'github', 'line_count': 20, 'max_line_length': 35, 'avg_line_length': 16.8, 'alnum_prop': 0.6904761904761905, 'repo_name': 'nuecho/gitlabhq', 'id': 'f119694d11d1025b17ee742e1024860efdc5b13f', 'size': '336', 'binary': False, 'copies': '8', 'ref': 'refs/heads/master', 'path': 'db/fixtures/production/001_admin.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CoffeeScript', 'bytes': '18129'}, {'name': 'JavaScript', 'bytes': '19063'}, {'name': 'Ruby', 'bytes': '773441'}, {'name': 'Shell', 'bytes': '79'}]} |
<a href='https://github.com/angular/angular.js/edit/v1.6.x/src/ngMock/angular-mocks.js?message=docs($controller)%3A%20describe%20your%20change...#L2205' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit"> </i>Improve this Doc</a>
<a href='https://github.com/angular/angular.js/tree/v1.6.4/src/ngMock/angular-mocks.js#L2205' class='view-source pull-right btn btn-primary'>
<i class="glyphicon glyphicon-zoom-in"> </i>View Source
</a>
<header class="api-profile-header">
<h1 class="api-profile-header-heading">$controller</h1>
<ol class="api-profile-header-structure naked-list step-list">
<li>
- service in module <a href="api/ngMock">ngMock</a>
</li>
</ol>
</header>
<div class="api-profile-description">
<p>A decorator for <a href="api/ng/service/$controller"><code>$controller</code></a> with additional <code>bindings</code> parameter, useful when testing
controllers of directives that use <a href="api/ng/service/$compile#-bindtocontroller-"><code>bindToController</code></a>.</p>
<p>Depending on the value of
<a href="api/ng/provider/$compileProvider#preAssignBindingsEnabled"><code>preAssignBindingsEnabled()</code></a>, the properties
will be bound before or after invoking the constructor.</p>
<h2 id="example">Example</h2>
<pre><code class="lang-js">// Directive definition ...
myMod.directive('myDirective', {
controller: 'MyDirectiveController',
bindToController: {
name: '@'
}
});
// Controller definition ...
myMod.controller('MyDirectiveController', ['$log', function($log) {
this.log = function() {
$log.info(this.name);
};
}]);
// In a test ...
describe('myDirectiveController', function() {
describe('log()', function() {
it('should write the bound name to the log', inject(function($controller, $log) {
var ctrl = $controller('MyDirectiveController', { /* no locals */ }, { name: 'Clark Kent' });
ctrl.log();
expect(ctrl.name).toEqual('Clark Kent');
expect($log.info.logs).toEqual(['Clark Kent']);
}));
});
});
</code></pre>
</div>
<div>
<h2 id="usage">Usage</h2>
<p><code>$controller(constructor, locals, [bindings]);</code></p>
<section class="api-section">
<h3>Arguments</h3>
<table class="variables-matrix input-arguments">
<thead>
<tr>
<th>Param</th>
<th>Type</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<tr>
<td>
constructor
</td>
<td>
<a href="" class="label type-hint type-hint-function">function()</a><a href="" class="label type-hint type-hint-string">string</a>
</td>
<td>
<p>If called with a function then it's considered to be the
controller constructor function. Otherwise it's considered to be a string which is used
to retrieve the controller constructor using the following steps:</p>
<ul>
<li>check if a controller with given name is registered via <code>$controllerProvider</code></li>
<li>check if evaluating the string on the current scope returns a constructor</li>
<li><p>if $controllerProvider#allowGlobals, check <code>window[constructor]</code> on the global
<code>window</code> object (deprecated, not recommended)</p>
<p>The string can use the <code>controller as property</code> syntax, where the controller instance is published
as the specified property on the <code>scope</code>; the <code>scope</code> must be injected into <code>locals</code> param for this
to work correctly.</p>
</li>
</ul>
</td>
</tr>
<tr>
<td>
locals
</td>
<td>
<a href="" class="label type-hint type-hint-object">Object</a>
</td>
<td>
<p>Injection locals for Controller.</p>
</td>
</tr>
<tr>
<td>
bindings
<div><em>(optional)</em></div>
</td>
<td>
<a href="" class="label type-hint type-hint-object">Object</a>
</td>
<td>
<p>Properties to add to the controller instance. This is used to simulate
the <code>bindToController</code> feature and simplify certain kinds of tests.</p>
</td>
</tr>
</tbody>
</table>
</section>
<h3>Returns</h3>
<table class="variables-matrix return-arguments">
<tr>
<td><a href="" class="label type-hint type-hint-object">Object</a></td>
<td><p>Instance of given controller.</p>
</td>
</tr>
</table>
</div>
| {'content_hash': '1bc89a9cb2e7894d0ece20f09ad2fbca', 'timestamp': '', 'source': 'github', 'line_count': 182, 'max_line_length': 256, 'avg_line_length': 25.576923076923077, 'alnum_prop': 0.6219119226638024, 'repo_name': 'keithbox/AngularJS-CRUD-PHP', 'id': '50463e9d1e22348bf978e8d80ce0b454e503b609', 'size': '4655', 'binary': False, 'copies': '9', 'ref': 'refs/heads/master', 'path': 'third-party/angularjs/angular-1.6.4/docs/partials/api/ngMock/service/$controller.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '10944'}, {'name': 'HTML', 'bytes': '35808'}, {'name': 'JavaScript', 'bytes': '538768'}, {'name': 'PHP', 'bytes': '195270'}, {'name': 'TSQL', 'bytes': '9643'}]} |
package com.google.common.collect;
import java.util.Collection;
import java.util.Set;
import androidcollections.annotations.Nullable;
import com.google.common.annotations.GwtCompatible;
/**
* An empty immutable set.
*
* @author Kevin Bourrillion
*/
@GwtCompatible(serializable = true, emulated = true)
final class EmptyImmutableSet extends ImmutableSet<Object> {
static final EmptyImmutableSet INSTANCE = new EmptyImmutableSet();
private EmptyImmutableSet() {}
public int size() {
return 0;
}
@Override public boolean isEmpty() {
return true;
}
@Override public boolean contains(Object target) {
return false;
}
@Override public UnmodifiableIterator<Object> iterator() {
return Iterators.emptyIterator();
}
private static final Object[] EMPTY_ARRAY = new Object[0];
@Override public Object[] toArray() {
return EMPTY_ARRAY;
}
@Override public <T> T[] toArray(T[] a) {
if (a.length > 0) {
a[0] = null;
}
return a;
}
@Override public boolean containsAll(Collection<?> targets) {
return targets.isEmpty();
}
@Override public boolean equals(@Nullable Object object) {
if (object instanceof Set) {
Set<?> that = (Set<?>) object;
return that.isEmpty();
}
return false;
}
@Override public final int hashCode() {
return 0;
}
@Override boolean isHashCodeFast() {
return true;
}
@Override public String toString() {
return "[]";
}
Object readResolve() {
return INSTANCE; // preserve singleton property
}
private static final long serialVersionUID = 0;
}
| {'content_hash': '47351a89275a4167b02ce87ccce9736b', 'timestamp': '', 'source': 'github', 'line_count': 81, 'max_line_length': 68, 'avg_line_length': 19.85185185185185, 'alnum_prop': 0.6710199004975125, 'repo_name': 'eugeneiiim/AndroidCollections', 'id': 'e08403e7048d7f456cb8885483fac25428ff05cc', 'size': '2202', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/com/google/common/collect/EmptyImmutableSet.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '1782489'}, {'name': 'Shell', 'bytes': '19684'}]} |
FROM meteorhacks/meteord:base
MAINTAINER MeteorHacks Pvt Ltd.
COPY scripts/install_binbuild_tools.sh $METEORD_DIR/install_binbuild_tools.sh
COPY scripts/rebuild_npm_modules.sh $METEORD_DIR/rebuild_npm_modules.sh
RUN bash $METEORD_DIR/install_binbuild_tools.sh
| {'content_hash': '0b177a1aa78fcd7e7cd60387001c5e8c', 'timestamp': '', 'source': 'github', 'line_count': 7, 'max_line_length': 77, 'avg_line_length': 37.42857142857143, 'alnum_prop': 0.8244274809160306, 'repo_name': 'cbioley/meteord', 'id': '3cd851541ee475f9bf03e00c7f72163f7ac04b4c', 'size': '262', 'binary': False, 'copies': '15', 'ref': 'refs/heads/master', 'path': 'binbuild/Dockerfile', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Shell', 'bytes': '8851'}]} |
import * as React from "react";
import { CarbonIconProps } from "../../";
declare const ClosedCaptionFilled32: React.ForwardRefExoticComponent<
CarbonIconProps & React.RefAttributes<SVGSVGElement>
>;
export default ClosedCaptionFilled32;
| {'content_hash': '37517219f2eb47d645ca89df23b00f7e', 'timestamp': '', 'source': 'github', 'line_count': 6, 'max_line_length': 69, 'avg_line_length': 40.0, 'alnum_prop': 0.7916666666666666, 'repo_name': 'mcliment/DefinitelyTyped', 'id': 'fb3a424eb29488505a06cfe5bd5cff34071686f4', 'size': '240', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'types/carbon__icons-react/es/closed-caption--filled/32.d.ts', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CoffeeScript', 'bytes': '15'}, {'name': 'Protocol Buffer', 'bytes': '678'}, {'name': 'TypeScript', 'bytes': '17214021'}]} |
from __future__ import absolute_import, print_function, unicode_literals
from distributed.ttypes import Edge, Node
def test(graphs):
from random import choice, sample
raw_input("Create?")
ids = sample(range(1, 26), 10)
for node_id in ids:
graphs.createNode( Node(node_id, 0, "", 0.0) )
for _ in range(50):
graphs.createEdge( Edge(choice(ids), choice(ids), 0.0, False, "") )
raw_input("Update?")
for node_id in sample(ids, 5):
graphs.updateNode(node_id, 1, "*", 1.0)
for _ in range(25):
graphs.updateEdge(choice(ids), choice(ids), 1.0, True, "*")
raw_input("Delete?")
for node_id in sample(ids, 5):
graphs.deleteNode(node_id)
for _ in range(10):
graphs.deleteEdge(choice(ids), choice(ids))
raw_input("Read?")
for node_id in sample(ids, 5):
node = graphs.readNode(node_id)
if node.id is not None: print(node)
for _ in range(25):
edge = graphs.readEdge(choice(ids), choice(ids))
if edge.node1 is not None: print(edge)
raw_input("List?")
for _ in range(50):
nodes = graphs.listNodesEdge(choice(ids), choice(ids))
if nodes != []: print(nodes)
for node_id in sample(ids, 5):
edges = graphs.listEdgesNode(node_id)
if edges != []: print(edges)
for node_id in sample(ids, 5):
neighbors = graphs.listNeighborNodes(node_id)
if neighbors != []: print(neighbors)
def example(graphs):
raw_input("Create?")
graphs.createNode( Node(0, 0, "A", 0.0) )
graphs.createNode( Node(1, 0, "B", 0.0) )
graphs.createNode( Node(2, 0, "C", 0.0) )
graphs.createNode( Node(3, 0, "D", 0.0) )
graphs.createNode( Node(4, 0, "E", 0.0) )
graphs.createNode( Node(5, 0, "F", 0.0) )
graphs.createEdge( Edge(0, 1, 0.0, False, "A-B") )
graphs.createEdge( Edge(0, 2, 0.0, False, "A-C") )
graphs.createEdge( Edge(1, 2, 0.0, False, "B-C") )
graphs.createEdge( Edge(2, 3, 0.0, False, "C-D") )
graphs.createEdge( Edge(3, 4, 0.0, False, "D-E") )
graphs.createEdge( Edge(3, 5, 0.0, False, "D-F") )
graphs.createEdge( Edge(4, 5, 0.0, False, "E-F") )
raw_input("Read?")
for i in range(6):
print( graphs.readNode(i) )
raw_input("List?")
for i in range(6):
print( graphs.listNeighborNodes(i) )
if __name__ == "__main__":
from thrift.transport.TSocket import TSocket
from thrift.transport.TTransport import TBufferedTransport
from thrift.protocol.TBinaryProtocol import TBinaryProtocol
from distributed.Graph import Client
transport = TSocket("localhost", 13579)
transport = TBufferedTransport(transport)
protocol = TBinaryProtocol(transport)
client = Client(protocol)
transport.open()
try: example(client)
finally: transport.close()
| {'content_hash': 'd1c834ca6f3fdaa1c2bc92d3bb9abf3f', 'timestamp': '', 'source': 'github', 'line_count': 100, 'max_line_length': 72, 'avg_line_length': 25.98, 'alnum_prop': 0.6647421093148576, 'repo_name': 'LG95/PraticaSD', 'id': '5f63a8f87d096cf0a060de2c09574756b87f5aa6', 'size': '2598', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'PROJETO/client.py', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '1766'}, {'name': 'Python', 'bytes': '8240'}, {'name': 'Thrift', 'bytes': '825'}]} |
layout: post
title: "Monday 07.09.18 - CrossFit"
teaser: "A. Alternating Sets: Front Squat, Push Press<br/> B. 20 minute EMOM of Bar Muscle-Ups, Hang Power Cleans, and Wall Ball Shots"
date: 2018-07-09 00:00:00
categories: wodup
tags: wods monday
header: no
---
<h3>A. Alternating Sets: Front Squat, Push Press</h3>
4 sets, starting a set every 2 minutes, of:<br/>A1. 3 Front Squats (13X1 tempo)90-100% of cleanA2. 3 Push Presses (13X1 tempo)Build in weight per set.
<h3>B. 20 minute EMOM of Bar Muscle-Ups, Hang Power Cleans, and Wall Ball Shots</h3>
Every 1 minute for 20 minutes (10 rounds):<br/><em>Minute 1</em><br/>– 3 Bar Muscle-Ups<br/>– 4 Hang Power Cleans @ 70/47.5 kg<br/>– 5 Wall Ball Shots @ 30/20 lbs<br/><em>Minute 2</em><br/>– Rest for 1 minute<br/>
<a href="https://www.wodup.com/gyms/asphodel/wods/7354" target="blank">View on WodUp</a>
#### Compare to other Mondays
{: .t60 }
{% include list-posts tag='monday' %} | {'content_hash': '3392b1e6ec550412377306cc225457c2', 'timestamp': '', 'source': 'github', 'line_count': 21, 'max_line_length': 213, 'avg_line_length': 44.80952380952381, 'alnum_prop': 0.696068012752391, 'repo_name': 'ohjho/asphodel2018', 'id': '65793d28ddacb0f59b678cfd8c5fd9c3507b7242', 'size': '953', 'binary': False, 'copies': '1', 'ref': 'refs/heads/gh-pages', 'path': '_posts/wodup/2018-07-09-wodup-monday-20180709.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '441011'}, {'name': 'HTML', 'bytes': '182377'}, {'name': 'JavaScript', 'bytes': '576748'}, {'name': 'Ruby', 'bytes': '4663'}, {'name': 'XSLT', 'bytes': '5064'}]} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {'content_hash': '18172bed952d8e66091c8133c953794f', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 31, 'avg_line_length': 9.692307692307692, 'alnum_prop': 0.7063492063492064, 'repo_name': 'mdoering/backbone', 'id': '7faa6e049ad9fedb93fab788d61aac3aa8b0086f', 'size': '180', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Helichrysum nimbicola/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
cd /vagrant
echo "Installing latest docker"
curl -sSL https://get.docker.com/ubuntu/ | sudo sh
sudo apt-get install -y unzip jq node
echo "Downloading serf"
wget https://dl.bintray.com/mitchellh/serf/0.6.4_linux_amd64.zip
unzip 0.6.4_linux_amd64.zip
rm 0.6.4_linux_amd64.zip
echo "Downloading consul"
sudo docker pull progrium/consul
echo "Installing meteor"
curl https://install.meteor.com/ | sh
echo "Installing mcli tools"
curl https://raw.githubusercontent.com/practicalmeteor/meteor-mcli/master/bin/install-mcli.sh | bash
sudo apt-get upgrade -y
echo "Configuring cli tools"
mkdir -p /vagrant/monk/.meteor/local
mkdir -p ~/monk/.meteor/local
sudo mount --bind /home/vagrant/monk/.meteor/local/ /vagrant/monk/.meteor/local/
echo "Starting web interface"
mkdir -p /vagrant/monk-opsweb/.meteor/local
mkdir -p ~/ops/.meteor/local
sudo mount --bind /home/vagrant/ops/.meteor/local/ /vagrant/monk-opsweb/.meteor/local/
cd /vagrant/monk-opsweb
meteor &
cd /vagrant
#todo: Set mongo host correctly
echo "Linking serf to web interface"
./serf agent -node listener -event-handler /vagrant/serf-handler.sh &
echo
echo
echo "Visit site at http://localhost:3000" | {'content_hash': 'cb1e2a42c02cf36f05b72a6e4d08e4c5', 'timestamp': '', 'source': 'github', 'line_count': 44, 'max_line_length': 100, 'avg_line_length': 26.5, 'alnum_prop': 0.7598627787307033, 'repo_name': 'WickedMonkeySoftware/monk-roshi', 'id': '88ce5b4f039a2a6dd274b4db04cc9af51866d04c', 'size': '1202', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'base/base.bash', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '31'}, {'name': 'CoffeeScript', 'bytes': '837'}, {'name': 'HTML', 'bytes': '224'}, {'name': 'JavaScript', 'bytes': '636'}, {'name': 'Shell', 'bytes': '1497'}]} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {'content_hash': '09ed3b51057a77f3a11d1fd4d317e23c', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 31, 'avg_line_length': 9.692307692307692, 'alnum_prop': 0.7063492063492064, 'repo_name': 'mdoering/backbone', 'id': 'e836a9215d372a4f980d64113657d86a0db43801', 'size': '185', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Pteridophyta/Polypodiopsida/Polypodiales/Dryopteridaceae/Dryopteris/Dryopteris vulcanica/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
package obvious.demo.transaction;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import obvious.ObviousException;
/**
* A login frame.
* @author Hemery
*
*/
@SuppressWarnings("serial")
public class LoginFrame extends JFrame implements ActionListener {
/**
* Labels.
*/
private JLabel userLabel, urlLabel, pswdLabel, tableLabel, tableKeyLabel,
driverLabel;
/**
* Fields.
*/
private JTextField userField, urlField, pswdField, tableField, tableKeyField,
driverField;
/**
* Button of the form.
*/
private JButton submit;
/**
* Params of the connexion.
*/
private String url, user, pswd, tableName, tableKey, driver;
/**
* JPanel.
*/
private JPanel panel;
/**
* Constructor.
*/
public LoginFrame() {
final int fieldSize = 15;
final int urfFielSize = 50;
userLabel = new JLabel();
userLabel.setText("User name");
userField = new JTextField(fieldSize);
pswdLabel = new JLabel();
pswdLabel.setText("User password");
pswdField = new JPasswordField(fieldSize);
tableLabel = new JLabel();
tableLabel.setText("Table name");
tableField = new JTextField(fieldSize);
tableField.setText("person");
tableKeyLabel = new JLabel();
tableKeyLabel.setText("Table primary key");
tableKeyField = new JTextField(fieldSize);
tableKeyField.setText("name");
urlLabel = new JLabel();
urlLabel.setText("Database url");
urlField = new JTextField(urfFielSize);
urlField.setText("jdbc:mysql://localhost/test");
driverLabel = new JLabel();
driverLabel.setText("Driver classpath");
driverField = new JTextField(urfFielSize);
driverField.setText("com.mysql.jdbc.Driver");
submit = new JButton("SUBMIT");
submit.addActionListener(this);
final int firstGridDim = 7;
final int secondGridDim = 1;
panel = new JPanel(new GridLayout(firstGridDim, secondGridDim));
panel.add(driverLabel);
panel.add(driverField);
panel.add(urlLabel);
panel.add(urlField);
panel.add(userLabel);
panel.add(userField);
panel.add(pswdLabel);
panel.add(pswdField);
panel.add(tableLabel);
panel.add(tableField);
panel.add(tableKeyLabel);
panel.add(tableKeyField);
panel.add(submit);
setContentPane(panel);
setTitle("Login Form");
}
/**
* Gets password.
* @return password
*/
private String getPswd() {
return pswd;
}
/**
* Sets password.
* @param inPswd password to set
*/
private void setPswd(String inPswd) {
this.pswd = inPswd;
}
/**
* Gets user.
* @return user
*/
private String getUser() {
return user;
}
/**
* Sets user.
* @param inUser user to set
*/
private void setUser(String inUser) {
this.user = inUser;
}
/**
* Gets url.
* @return url
*/
private String getUrl() {
return url;
}
/**
* Sets url.
* @param inUrl url to set
*/
private void setUrl(String inUrl) {
this.url = inUrl;
}
/**
* Gets driver.
* @return driver
*/
private String getDriver() {
return driver;
}
/**
* Sets driver.
* @param inDriver driver to set
*/
private void setDriver(String inDriver) {
this.driver = inDriver;
}
/**
* Gets table key.
* @return table primary key
*/
private String getTableKey() {
return tableKey;
}
/**
* Sets table key.
* @param inTableKey table key to set
*/
private void setTableKey(String inTableKey) {
this.tableKey = inTableKey;
}
/**
* Gets table name.
* @return table name
*/
private String getTableName() {
return tableName;
}
/**
* Sets table name.
* @param inTableName table name to set
*/
private void setTableName(String inTableName) {
this.tableName = inTableName;
}
/**
* Listener.
* @param e an event
*/
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(submit)) {
setUser(userField.getText());
setPswd(pswdField.getText());
setUrl(urlField.getText());
setDriver(driverField.getText());
setTableKey(tableKeyField.getText());
setTableName(tableField.getText());
this.setVisible(false);
this.dispose();
try {
TransactionDemo.fillTable(getUrl(), getUser(), getPswd(), getDriver(),
getTableName(), getTableKey());
} catch (ObviousException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
}
| {'content_hash': 'ce4bcf84515b48b3eda2d312e9a48e54', 'timestamp': '', 'source': 'github', 'line_count': 233, 'max_line_length': 79, 'avg_line_length': 21.394849785407725, 'alnum_prop': 0.6070210631895687, 'repo_name': 'jdfekete/obvious', 'id': '34637de01c128e621484daef8b9ba8cdad1fdb23', 'size': '6542', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'obvious-example/src/main/java/obvious/demo/transaction/LoginFrame.java', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C++', 'bytes': '36083'}, {'name': 'CMake', 'bytes': '2479'}, {'name': 'CSS', 'bytes': '15620'}, {'name': 'HTML', 'bytes': '9396961'}, {'name': 'Java', 'bytes': '1942859'}, {'name': 'Shell', 'bytes': '308'}]} |
import datetime
import logging
import os
import simplejson as json
from uuid import uuid4
from time import sleep
from nose.tools import nottest
from sqlalchemy.sql import desc
from onlinelinguisticdatabase.tests import TestController, url
import onlinelinguisticdatabase.model as model
from onlinelinguisticdatabase.model.meta import Session
import onlinelinguisticdatabase.lib.helpers as h
from onlinelinguisticdatabase.model import Corpus, CorpusBackup
log = logging.getLogger(__name__)
class TestCorporaController(TestController):
# Clear all models in the database except Language; recreate the corpora.
def tearDown(self):
TestController.tearDown(self, dirs_to_destroy=['user', 'corpus'])
@nottest
def test_index(self):
"""Tests that GET /corpora returns an array of all corpora and that order_by and pagination parameters work correctly."""
# Add 100 corpora.
def create_corpus_from_index(index):
corpus = model.Corpus()
corpus.name = u'Corpus %d' % index
corpus.description = u'A corpus with %d rules' % index
corpus.content = u'1'
return corpus
corpora = [create_corpus_from_index(i) for i in range(1, 101)]
Session.add_all(corpora)
Session.commit()
corpora = h.get_corpora(True)
corpora_count = len(corpora)
# Test that GET /corpora gives us all of the corpora.
response = self.app.get(url('corpora'), headers=self.json_headers,
extra_environ=self.extra_environ_view)
resp = json.loads(response.body)
assert len(resp) == corpora_count
assert resp[0]['name'] == u'Corpus 1'
assert resp[0]['id'] == corpora[0].id
assert response.content_type == 'application/json'
# Test the paginator GET params.
paginator = {'items_per_page': 23, 'page': 3}
response = self.app.get(url('corpora'), paginator, headers=self.json_headers,
extra_environ=self.extra_environ_view)
resp = json.loads(response.body)
assert len(resp['items']) == 23
assert resp['items'][0]['name'] == corpora[46].name
assert response.content_type == 'application/json'
# Test the order_by GET params.
order_by_params = {'order_by_model': 'Corpus', 'order_by_attribute': 'name',
'order_by_direction': 'desc'}
response = self.app.get(url('corpora'), order_by_params,
headers=self.json_headers, extra_environ=self.extra_environ_view)
resp = json.loads(response.body)
result_set = sorted(corpora, key=lambda c: c.name, reverse=True)
assert [c.id for c in result_set] == [c['id'] for c in resp]
assert response.content_type == 'application/json'
# Test the order_by *with* paginator.
params = {'order_by_model': 'Corpus', 'order_by_attribute': 'name',
'order_by_direction': 'desc', 'items_per_page': 23, 'page': 3}
response = self.app.get(url('corpora'), params,
headers=self.json_headers, extra_environ=self.extra_environ_view)
resp = json.loads(response.body)
assert result_set[46].name == resp['items'][0]['name']
# Expect a 400 error when the order_by_direction param is invalid
order_by_params = {'order_by_model': 'Corpus', 'order_by_attribute': 'name',
'order_by_direction': 'descending'}
response = self.app.get(url('corpora'), order_by_params, status=400,
headers=self.json_headers, extra_environ=self.extra_environ_view)
resp = json.loads(response.body)
assert resp['errors']['order_by_direction'] == u"Value must be one of: asc; desc (not u'descending')"
assert response.content_type == 'application/json'
# Expect the default BY id ASCENDING ordering when the order_by_model/Attribute
# param is invalid.
order_by_params = {'order_by_model': 'Corpusist', 'order_by_attribute': 'nominal',
'order_by_direction': 'desc'}
response = self.app.get(url('corpora'), order_by_params,
headers=self.json_headers, extra_environ=self.extra_environ_view)
resp = json.loads(response.body)
assert resp[0]['id'] == corpora[0].id
# Expect a 400 error when the paginator GET params are empty
# or are integers less than 1
paginator = {'items_per_page': u'a', 'page': u''}
response = self.app.get(url('corpora'), paginator, headers=self.json_headers,
extra_environ=self.extra_environ_view, status=400)
resp = json.loads(response.body)
assert resp['errors']['items_per_page'] == u'Please enter an integer value'
assert resp['errors']['page'] == u'Please enter a value'
assert response.content_type == 'application/json'
paginator = {'items_per_page': 0, 'page': -1}
response = self.app.get(url('corpora'), paginator, headers=self.json_headers,
extra_environ=self.extra_environ_view, status=400)
resp = json.loads(response.body)
assert resp['errors']['items_per_page'] == u'Please enter a number that is 1 or greater'
assert resp['errors']['page'] == u'Please enter a number that is 1 or greater'
assert response.content_type == 'application/json'
@nottest
def test_create(self):
"""Tests that POST /corpora creates a new corpus
or returns an appropriate error if the input is invalid.
"""
# Add 10 forms and use them to generate a valid value for ``test_corpus_content``
def create_form_from_index(index):
form = model.Form()
form.transcription = u'Form %d' % index
translation = model.Translation()
translation.transcription = u'Translation %d' % index
form.translation = translation
return form
forms = [create_form_from_index(i) for i in range(1, 10)]
Session.add_all(forms)
Session.commit()
forms = h.get_forms()
half_forms = forms[:5]
form_ids = [form.id for form in forms]
half_form_ids = [form.id for form in half_forms]
test_corpus_content = u','.join(map(str, half_form_ids))
# Create a form search model
query = {'filter': ['Form', 'transcription', 'regex', u'[a-zA-Z]{3,}']}
params = json.dumps({
'name': u'form search',
'description': u'This one\'s worth saving!',
'search': query
})
response = self.app.post(url('formsearches'), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
form_search_id = resp['id']
# Generate some valid corpus creation input parameters.
params = self.corpus_create_params.copy()
params.update({
'name': u'Corpus',
'description': u'Covers a lot of the data.',
'content': test_corpus_content,
'form_search': form_search_id
})
params = json.dumps(params)
# Attempt to create a corpus as a viewer and expect to fail
response = self.app.post(url('corpora'), params, self.json_headers,
self.extra_environ_view, status=403)
resp = json.loads(response.body)
assert resp['error'] == u'You are not authorized to access this resource.'
assert response.content_type == 'application/json'
# Successfully create a corpus as the admin
assert os.listdir(self.corpora_path) == []
original_corpus_count = Session.query(Corpus).count()
response = self.app.post(url('corpora'), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
corpus_id = resp['id']
new_corpus_count = Session.query(Corpus).count()
corpus = Session.query(Corpus).get(corpus_id)
corpus_form_ids = sorted([f.id for f in corpus.forms])
corpus_dir = os.path.join(self.corpora_path, 'corpus_%d' % corpus_id)
corpus_dir_contents = os.listdir(corpus_dir)
assert new_corpus_count == original_corpus_count + 1
assert resp['name'] == u'Corpus'
assert resp['description'] == u'Covers a lot of the data.'
assert corpus_dir_contents == []
assert response.content_type == 'application/json'
assert resp['content'] == test_corpus_content
assert corpus_form_ids == sorted(form_ids)
assert resp['form_search']['id'] == form_search_id
# Invalid because ``form_search`` refers to a non-existent form search.
params = self.corpus_create_params.copy()
params.update({
'name': u'Corpus Chi',
'description': u'Covers a lot of the data, padre.',
'content': test_corpus_content,
'form_search': 123456789
})
params = json.dumps(params)
response = self.app.post(url('corpora'), params, self.json_headers,
self.extra_environ_admin, status=400)
resp = json.loads(response.body)
corpus_count = new_corpus_count
new_corpus_count = Session.query(Corpus).count()
assert new_corpus_count == corpus_count
assert resp['errors']['form_search'] == u'There is no form search with id 123456789.'
assert response.content_type == 'application/json'
# Invalid because ``content`` refers to non-existent forms
params = self.corpus_create_params.copy()
params.update({
'name': u'Corpus Chi Squared',
'description': u'Covers a lot of the data, padre.',
'content': test_corpus_content + u',123456789'
})
params = json.dumps(params)
response = self.app.post(url('corpora'), params, self.json_headers,
self.extra_environ_admin, status=400)
resp = json.loads(response.body)
corpus_count = new_corpus_count
new_corpus_count = Session.query(Corpus).count()
assert new_corpus_count == corpus_count
#assert u'There is no form with id 123456789.' in resp['errors']['forms']
assert resp['errors'] == 'At least one form id in the content was invalid.'
assert response.content_type == 'application/json'
# Invalid because name is not unique
params = self.corpus_create_params.copy()
params.update({
'name': u'Corpus',
'description': u'Covers a lot of the data, dude.',
'content': test_corpus_content
})
params = json.dumps(params)
response = self.app.post(url('corpora'), params, self.json_headers,
self.extra_environ_admin, status=400)
resp = json.loads(response.body)
corpus_count = new_corpus_count
new_corpus_count = Session.query(Corpus).count()
assert new_corpus_count == corpus_count
assert resp['errors']['name'] == u'The submitted value for Corpus.name is not unique.'
assert response.content_type == 'application/json'
# Invalid because name must be a non-empty string
params = self.corpus_create_params.copy()
params.update({
'name': u'',
'description': u'Covers a lot of the data, sista.',
'content': test_corpus_content
})
params = json.dumps(params)
response = self.app.post(url('corpora'), params, self.json_headers,
self.extra_environ_admin, status=400)
resp = json.loads(response.body)
corpus_count = new_corpus_count
new_corpus_count = Session.query(Corpus).count()
assert new_corpus_count == corpus_count
assert resp['errors']['name'] == u'Please enter a value'
assert response.content_type == 'application/json'
# Invalid because name must be a non-empty string
params = self.corpus_create_params.copy()
params.update({
'name': None,
'description': u'Covers a lot of the data, young\'un.',
'content': test_corpus_content
})
params = json.dumps(params)
response = self.app.post(url('corpora'), params, self.json_headers,
self.extra_environ_admin, status=400)
resp = json.loads(response.body)
corpus_count = new_corpus_count
new_corpus_count = Session.query(Corpus).count()
assert new_corpus_count == corpus_count
assert resp['errors']['name'] == u'Please enter a value'
assert response.content_type == 'application/json'
# Invalid because name is too long.
params = self.corpus_create_params.copy()
params.update({
'name': 'Corpus' * 200,
'description': u'Covers a lot of the data, squirrel salad.',
'content': test_corpus_content
})
params = json.dumps(params)
response = self.app.post(url('corpora'), params, self.json_headers,
self.extra_environ_admin, status=400)
resp = json.loads(response.body)
corpus_count = new_corpus_count
new_corpus_count = Session.query(Corpus).count()
assert new_corpus_count == corpus_count
assert resp['errors']['name'] == u'Enter a value not more than 255 characters long'
assert response.content_type == 'application/json'
# Create a corpus whose forms are specified in the content value.
params = self.corpus_create_params.copy()
params.update({
'name': u'Corpus by contents',
'description': u'Covers a lot of the data.',
'content': test_corpus_content
})
params = json.dumps(params)
original_corpus_count = Session.query(Corpus).count()
response = self.app.post(url('corpora'), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
corpus_id = resp['id']
new_corpus_count = Session.query(Corpus).count()
corpus = Session.query(Corpus).get(corpus_id)
corpus_form_ids = sorted([f.id for f in corpus.forms])
corpus_dir = os.path.join(self.corpora_path, 'corpus_%d' % corpus_id)
corpus_dir_contents = os.listdir(corpus_dir)
assert new_corpus_count == original_corpus_count + 1
assert resp['name'] == u'Corpus by contents'
assert resp['description'] == u'Covers a lot of the data.'
assert corpus_dir_contents == []
assert response.content_type == 'application/json'
assert resp['content'] == test_corpus_content
assert corpus_form_ids == sorted(half_form_ids)
assert resp['form_search'] == None
@nottest
def test_new(self):
"""Tests that GET /corpora/new returns data needed to create a new corpus."""
# Create a tag
t = h.generate_restricted_tag()
Session.add(t)
Session.commit()
# Create a form search model
query = {'filter': ['Form', 'transcription', 'regex', u'[a-zA-Z]{3,}']}
params = json.dumps({
'name': u'form search',
'description': u'This one\'s worth saving!',
'search': query
})
response = self.app.post(url('formsearches'), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
# Get the data currently in the db (see websetup.py for the test data).
data = {
'tags': h.get_mini_dicts_getter('Tag')(),
'users': h.get_mini_dicts_getter('User')(),
'form_searches': h.get_mini_dicts_getter('FormSearch')(),
'corpus_formats': h.corpus_formats.keys()
}
# JSON.stringify and then re-Python-ify the data. This is what the data
# should look like in the response to a simulated GET request.
data = json.loads(json.dumps(data, cls=h.JSONOLDEncoder))
# Unauthorized user ('viewer') should return a 401 status code on the
# new action, which requires a 'contributor' or an 'administrator'.
response = self.app.get(url('new_corpus'), status=403,
extra_environ=self.extra_environ_view)
resp = json.loads(response.body)
assert response.content_type == 'application/json'
assert resp['error'] == u'You are not authorized to access this resource.'
# Get the data needed to create a new corpus; don't send any params.
response = self.app.get(url('new_corpus'), headers=self.json_headers,
extra_environ=self.extra_environ_contrib)
resp = json.loads(response.body)
assert resp['users'] == data['users']
assert resp['form_searches'] == data['form_searches']
assert resp['tags'] == data['tags']
assert resp['corpus_formats'] == data['corpus_formats']
assert response.content_type == 'application/json'
# GET /new_corpus with params. Param values are treated as strings, not
# JSON. If any params are specified, the default is to return a JSON
# array corresponding to store for the param. There are three cases
# that will result in an empty JSON array being returned:
# 1. the param is not specified
# 2. the value of the specified param is an empty string
# 3. the value of the specified param is an ISO 8601 UTC datetime
# string that matches the most recent datetime_modified value of the
# store in question.
params = {
# Value is any string: 'form_searches' will be in response.
'form_searches': 'anything can go here!',
# Value is ISO 8601 UTC datetime string that does not match the most
# recent Tag.datetime_modified value: 'tags' *will* be in
# response.
'tags': datetime.datetime.utcnow().isoformat(),
# Value is ISO 8601 UTC datetime string that does match the most
# recent SyntacticCategory.datetime_modified value:
# 'syntactic_categories' will *not* be in response.
'users': h.get_most_recent_modification_datetime(
'User').isoformat()
}
response = self.app.get(url('new_corpus'), params,
extra_environ=self.extra_environ_admin)
resp = json.loads(response.body)
assert resp['form_searches'] == data['form_searches']
assert resp['tags'] == data['tags']
assert resp['users'] == []
assert resp['corpus_formats'] == data['corpus_formats']
@nottest
def test_update(self):
"""Tests that PUT /corpora/id updates the corpus with id=id."""
# Add 10 forms and use them to generate a valid value for ``test_corpus_content``
def create_form_from_index(index):
form = model.Form()
form.transcription = u'Form %d' % index
translation = model.Translation()
translation.transcription = u'Translation %d' % index
form.translation = translation
return form
forms = [create_form_from_index(i) for i in range(1, 10)]
Session.add_all(forms)
Session.commit()
forms = h.get_forms()
form_ids = [form.id for form in forms]
test_corpus_content = u','.join(map(str, form_ids))
new_test_corpus_content = u','.join(map(str, form_ids[:5]))
# Create a form search model
query = {'filter': ['Form', 'transcription', 'regex', u'[a-zA-Z]{3,}']}
params = json.dumps({
'name': u'form search',
'description': u'This one\'s worth saving!',
'search': query
})
response = self.app.post(url('formsearches'), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
form_search_id = resp['id']
# Generate some valid corpus creation input parameters.
params = self.corpus_create_params.copy()
params.update({
'name': u'Corpus',
'description': u'Covers a lot of the data.',
'content': test_corpus_content,
'form_search': form_search_id
})
params = json.dumps(params)
# Successfully create a corpus as the admin
assert os.listdir(self.corpora_path) == []
original_corpus_count = Session.query(Corpus).count()
response = self.app.post(url('corpora'), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
corpus_id = resp['id']
new_corpus_count = Session.query(Corpus).count()
corpus = Session.query(Corpus).get(corpus_id)
corpus_form_ids = sorted([f.id for f in corpus.forms])
corpus_dir = os.path.join(self.corpora_path, 'corpus_%d' % corpus_id)
corpus_dir_contents = os.listdir(corpus_dir)
original_datetime_modified = resp['datetime_modified']
assert new_corpus_count == original_corpus_count + 1
assert resp['name'] == u'Corpus'
assert resp['description'] == u'Covers a lot of the data.'
assert corpus_dir_contents == []
assert response.content_type == 'application/json'
assert resp['content'] == test_corpus_content
assert corpus_form_ids == sorted(form_ids)
assert resp['form_search']['id'] == form_search_id
# Update the corpus
sleep(1) # sleep for a second to ensure that MySQL could register a different datetime_modified for the update
orig_backup_count = Session.query(CorpusBackup).count()
params = self.corpus_create_params.copy()
params.update({
'name': u'Corpus',
'description': u'Covers a lot of the data. Best yet!',
'content': new_test_corpus_content, # Here is the change
'form_search': form_search_id
})
params = json.dumps(params)
response = self.app.put(url('corpus', id=corpus_id), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
new_backup_count = Session.query(CorpusBackup).count()
datetime_modified = resp['datetime_modified']
corpus_count = new_corpus_count
new_corpus_count = Session.query(Corpus).count()
assert corpus_count == new_corpus_count
assert datetime_modified != original_datetime_modified
assert resp['description'] == u'Covers a lot of the data. Best yet!'
assert resp['content'] == new_test_corpus_content
assert response.content_type == 'application/json'
assert orig_backup_count + 1 == new_backup_count
assert response.content_type == 'application/json'
backup = Session.query(CorpusBackup).filter(
CorpusBackup.UUID==unicode(
resp['UUID'])).order_by(
desc(CorpusBackup.id)).first()
assert backup.datetime_modified.isoformat() == original_datetime_modified
assert backup.content == test_corpus_content
# Attempt an update with no new input and expect to fail
sleep(1) # sleep for a second to ensure that MySQL could register a different datetime_modified for the update
response = self.app.put(url('corpus', id=corpus_id), params, self.json_headers,
self.extra_environ_admin, status=400)
resp = json.loads(response.body)
corpus_count = new_corpus_count
new_corpus_count = Session.query(Corpus).count()
our_corpus_datetime_modified = Session.query(Corpus).get(corpus_id).datetime_modified
assert our_corpus_datetime_modified.isoformat() == datetime_modified
assert corpus_count == new_corpus_count
assert resp['error'] == u'The update request failed because the submitted data were not new.'
assert response.content_type == 'application/json'
@nottest
def test_delete(self):
"""Tests that DELETE /corpora/id deletes the corpus with id=id."""
# Count the original number of corpora and corpus_backups.
corpus_count = Session.query(Corpus).count()
corpus_backup_count = Session.query(CorpusBackup).count()
# Add 10 forms and use them to generate a valid value for ``test_corpus_content``
def create_form_from_index(index):
form = model.Form()
form.transcription = u'Form %d' % index
translation = model.Translation()
translation.transcription = u'Translation %d' % index
form.translation = translation
return form
forms = [create_form_from_index(i) for i in range(1, 10)]
Session.add_all(forms)
Session.commit()
forms = h.get_forms()
form_ids = [form.id for form in forms]
test_corpus_content = u','.join(map(str, form_ids))
# Create a form search model
query = {'filter': ['Form', 'transcription', 'regex', u'[a-zA-Z]{3,}']}
params = json.dumps({
'name': u'form search',
'description': u'This one\'s worth saving!',
'search': query
})
response = self.app.post(url('formsearches'), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
form_search_id = resp['id']
# Generate some valid corpus creation input parameters.
params = self.corpus_create_params.copy()
params.update({
'name': u'Corpus',
'description': u'Covers a lot of the data.',
'content': test_corpus_content,
'form_search': form_search_id
})
params = json.dumps(params)
# Successfully create a corpus as the admin
assert os.listdir(self.corpora_path) == []
response = self.app.post(url('corpora'), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
corpus_id = resp['id']
corpus = Session.query(Corpus).get(corpus_id)
corpus_form_ids = sorted([f.id for f in corpus.forms])
corpus_dir = os.path.join(self.corpora_path, 'corpus_%d' % corpus_id)
corpus_dir_contents = os.listdir(corpus_dir)
assert resp['name'] == u'Corpus'
assert resp['description'] == u'Covers a lot of the data.'
assert corpus_dir_contents == []
assert response.content_type == 'application/json'
assert resp['content'] == test_corpus_content
assert corpus_form_ids == sorted(form_ids)
assert resp['form_search']['id'] == form_search_id
# Now count the corpora and corpus_backups.
new_corpus_count = Session.query(Corpus).count()
new_corpus_backup_count = Session.query(CorpusBackup).count()
assert new_corpus_count == corpus_count + 1
assert new_corpus_backup_count == corpus_backup_count
# Now delete the corpus
response = self.app.delete(url('corpus', id=corpus_id), headers=self.json_headers,
extra_environ=self.extra_environ_admin)
resp = json.loads(response.body)
corpus_count = new_corpus_count
new_corpus_count = Session.query(Corpus).count()
corpus_backup_count = new_corpus_backup_count
new_corpus_backup_count = Session.query(CorpusBackup).count()
assert new_corpus_count == corpus_count - 1
assert new_corpus_backup_count == corpus_backup_count + 1
assert resp['id'] == corpus_id
assert response.content_type == 'application/json'
assert not os.path.exists(corpus_dir)
assert resp['content'] == test_corpus_content
# Trying to get the deleted corpus from the db should return None
deleted_corpus = Session.query(Corpus).get(corpus_id)
assert deleted_corpus == None
# The backed up corpus should have the deleted corpus's attributes
backed_up_corpus = Session.query(CorpusBackup).filter(
CorpusBackup.UUID==unicode(resp['UUID'])).first()
assert backed_up_corpus.name == resp['name']
modifier = json.loads(unicode(backed_up_corpus.modifier))
assert modifier['first_name'] == u'Admin'
assert backed_up_corpus.datetime_entered.isoformat() == resp['datetime_entered']
assert backed_up_corpus.UUID == resp['UUID']
# Delete with an invalid id
id = 9999999999999
response = self.app.delete(url('corpus', id=id),
headers=self.json_headers, extra_environ=self.extra_environ_admin,
status=404)
assert u'There is no corpus with id %s' % id in json.loads(response.body)['error']
assert response.content_type == 'application/json'
# Delete without an id
response = self.app.delete(url('corpus', id=''), status=404,
headers=self.json_headers, extra_environ=self.extra_environ_admin)
assert json.loads(response.body)['error'] == 'The resource could not be found.'
assert response.content_type == 'application/json'
@nottest
def test_show(self):
"""Tests that GET /corpora/id returns the corpus with id=id or an appropriate error."""
# Add 10 forms and use them to generate a valid value for ``test_corpus_content``
def create_form_from_index(index):
form = model.Form()
form.transcription = u'Form %d' % index
translation = model.Translation()
translation.transcription = u'Translation %d' % index
form.translation = translation
return form
forms = [create_form_from_index(i) for i in range(1, 10)]
Session.add_all(forms)
Session.commit()
forms = h.get_forms()
form_ids = [form.id for form in forms]
test_corpus_content = u','.join(map(str, form_ids))
# Create a form search model
query = {'filter': ['Form', 'transcription', 'regex', u'[a-zA-Z]{3,}']}
params = json.dumps({
'name': u'form search',
'description': u'This one\'s worth saving!',
'search': query
})
response = self.app.post(url('formsearches'), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
form_search_id = resp['id']
# Generate some valid corpus creation input parameters.
params = self.corpus_create_params.copy()
params.update({
'name': u'Corpus',
'description': u'Covers a lot of the data.',
'content': test_corpus_content,
'form_search': form_search_id
})
params = json.dumps(params)
# Successfully create a corpus as the admin
assert os.listdir(self.corpora_path) == []
original_corpus_count = Session.query(Corpus).count()
response = self.app.post(url('corpora'), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
corpus_count = Session.query(Corpus).count()
corpus_id = resp['id']
corpus = Session.query(Corpus).get(corpus_id)
corpus_form_ids = sorted([f.id for f in corpus.forms])
corpus_dir = os.path.join(self.corpora_path, 'corpus_%d' % corpus_id)
corpus_dir_contents = os.listdir(corpus_dir)
assert resp['name'] == u'Corpus'
assert resp['description'] == u'Covers a lot of the data.'
assert corpus_dir_contents == []
assert response.content_type == 'application/json'
assert resp['content'] == test_corpus_content
assert corpus_form_ids == sorted(form_ids)
assert resp['form_search']['id'] == form_search_id
assert corpus_count == original_corpus_count + 1
# Try to get a corpus using an invalid id
id = 100000000000
response = self.app.get(url('corpus', id=id),
headers=self.json_headers, extra_environ=self.extra_environ_admin,
status=404)
resp = json.loads(response.body)
assert u'There is no corpus with id %s' % id in json.loads(response.body)['error']
assert response.content_type == 'application/json'
# No id
response = self.app.get(url('corpus', id=''), status=404,
headers=self.json_headers, extra_environ=self.extra_environ_admin)
assert json.loads(response.body)['error'] == 'The resource could not be found.'
assert response.content_type == 'application/json'
# Valid id
response = self.app.get(url('corpus', id=corpus_id), headers=self.json_headers,
extra_environ=self.extra_environ_admin)
resp = json.loads(response.body)
assert resp['name'] == u'Corpus'
assert resp['description'] == u'Covers a lot of the data.'
assert resp['content'] == test_corpus_content
assert response.content_type == 'application/json'
@nottest
def test_edit(self):
"""Tests that GET /corpora/id/edit returns a JSON object of data necessary to edit the corpus with id=id.
The JSON object is of the form {'corpus': {...}, 'data': {...}} or
{'error': '...'} (with a 404 status code) depending on whether the id is
valid or invalid/unspecified, respectively.
"""
# Add 10 forms and use them to generate a valid value for ``test_corpus_content``
def create_form_from_index(index):
form = model.Form()
form.transcription = u'Form %d' % index
translation = model.Translation()
translation.transcription = u'Translation %d' % index
form.translation = translation
return form
forms = [create_form_from_index(i) for i in range(1, 10)]
Session.add_all(forms)
Session.commit()
forms = h.get_forms()
form_ids = [form.id for form in forms]
test_corpus_content = u','.join(map(str, form_ids))
# Create a form search model
query = {'filter': ['Form', 'transcription', 'regex', u'[a-zA-Z]{3,}']}
params = json.dumps({
'name': u'form search',
'description': u'This one\'s worth saving!',
'search': query
})
response = self.app.post(url('formsearches'), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
form_search_id = resp['id']
# Generate some valid corpus creation input parameters.
params = self.corpus_create_params.copy()
params.update({
'name': u'Corpus',
'description': u'Covers a lot of the data.',
'content': test_corpus_content,
'form_search': form_search_id
})
params = json.dumps(params)
# Successfully create a corpus as the admin
assert os.listdir(self.corpora_path) == []
original_corpus_count = Session.query(Corpus).count()
response = self.app.post(url('corpora'), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
corpus_count = Session.query(Corpus).count()
corpus_id = resp['id']
corpus = Session.query(Corpus).get(corpus_id)
corpus_form_ids = sorted([f.id for f in corpus.forms])
corpus_dir = os.path.join(self.corpora_path, 'corpus_%d' % corpus_id)
corpus_dir_contents = os.listdir(corpus_dir)
assert resp['name'] == u'Corpus'
assert resp['description'] == u'Covers a lot of the data.'
assert corpus_dir_contents == []
assert response.content_type == 'application/json'
assert resp['content'] == test_corpus_content
assert corpus_form_ids == sorted(form_ids)
assert resp['form_search']['id'] == form_search_id
assert corpus_count == original_corpus_count + 1
# Not logged in: expect 401 Unauthorized
response = self.app.get(url('edit_corpus', id=corpus_id), status=401)
resp = json.loads(response.body)
assert resp['error'] == u'Authentication is required to access this resource.'
assert response.content_type == 'application/json'
# Invalid id
id = 9876544
response = self.app.get(url('edit_corpus', id=id),
headers=self.json_headers, extra_environ=self.extra_environ_admin,
status=404)
assert u'There is no corpus with id %s' % id in json.loads(response.body)['error']
assert response.content_type == 'application/json'
# No id
response = self.app.get(url('edit_corpus', id=''), status=404,
headers=self.json_headers, extra_environ=self.extra_environ_admin)
assert json.loads(response.body)['error'] == 'The resource could not be found.'
assert response.content_type == 'application/json'
# Get the data currently in the db (see websetup.py for the test data).
data = {
'tags': h.get_mini_dicts_getter('Tag')(),
'users': h.get_mini_dicts_getter('User')(),
'form_searches': h.get_mini_dicts_getter('FormSearch')(),
'corpus_formats': h.corpus_formats.keys()
}
# JSON.stringify and then re-Python-ify the data. This is what the data
# should look like in the response to a simulated GET request.
data = json.loads(json.dumps(data, cls=h.JSONOLDEncoder))
# Valid id
response = self.app.get(url('edit_corpus', id=corpus_id),
headers=self.json_headers, extra_environ=self.extra_environ_admin)
resp = json.loads(response.body)
assert resp['corpus']['name'] == u'Corpus'
assert resp['data'] == data
assert response.content_type == 'application/json'
@nottest
def test_history(self):
"""Tests that GET /corpora/id/history returns the corpus with id=id and its previous incarnations.
The JSON object returned is of the form
{'corpus': corpus, 'previous_versions': [...]}.
"""
users = h.get_users()
contributor_id = [u for u in users if u.role==u'contributor'][0].id
administrator_id = [u for u in users if u.role==u'administrator'][0].id
# Add 10 forms and use them to generate a valid value for ``test_corpus_content``
def create_form_from_index(index):
form = model.Form()
form.transcription = u'Form %d' % index
translation = model.Translation()
translation.transcription = u'Translation %d' % index
form.translation = translation
return form
forms = [create_form_from_index(i) for i in range(1, 10)]
Session.add_all(forms)
Session.commit()
forms = h.get_forms()
form_ids = [form.id for form in forms]
test_corpus_content = u','.join(map(str, form_ids))
new_test_corpus_content = u','.join(map(str, form_ids[:5]))
newest_test_corpus_content = u','.join(map(str, form_ids[:4]))
# Create a form search model
query = {'filter': ['Form', 'transcription', 'regex', u'[a-zA-Z]{3,}']}
params = json.dumps({
'name': u'form search',
'description': u'This one\'s worth saving!',
'search': query
})
response = self.app.post(url('formsearches'), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
form_search_id = resp['id']
# Generate some valid corpus creation input parameters.
params = self.corpus_create_params.copy()
params.update({
'name': u'Corpus',
'description': u'Covers a lot of the data.',
'content': test_corpus_content,
'form_search': form_search_id
})
params = json.dumps(params)
# Successfully create a corpus as the admin
assert os.listdir(self.corpora_path) == []
original_corpus_count = Session.query(Corpus).count()
response = self.app.post(url('corpora'), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
corpus_count = Session.query(Corpus).count()
corpus_id = resp['id']
corpus = Session.query(Corpus).get(corpus_id)
corpus_form_ids = sorted([f.id for f in corpus.forms])
corpus_dir = os.path.join(self.corpora_path, 'corpus_%d' % corpus_id)
corpus_dir_contents = os.listdir(corpus_dir)
original_datetime_modified = resp['datetime_modified']
assert resp['name'] == u'Corpus'
assert resp['description'] == u'Covers a lot of the data.'
assert corpus_dir_contents == []
assert response.content_type == 'application/json'
assert resp['content'] == test_corpus_content
assert corpus_form_ids == sorted(form_ids)
assert resp['form_search']['id'] == form_search_id
assert corpus_count == original_corpus_count + 1
# Update the corpus as the admin.
sleep(1) # sleep for a second to ensure that MySQL could register a different datetime_modified for the update
orig_backup_count = Session.query(CorpusBackup).count()
params = self.corpus_create_params.copy()
params.update({
'name': u'Corpus',
'description': u'Covers a lot of the data. Best yet!',
'content': new_test_corpus_content,
'form_search': form_search_id
})
params = json.dumps(params)
response = self.app.put(url('corpus', id=corpus_id), params, self.json_headers,
self.extra_environ_admin)
resp = json.loads(response.body)
new_backup_count = Session.query(CorpusBackup).count()
first_update_datetime_modified = datetime_modified = resp['datetime_modified']
new_corpus_count = Session.query(Corpus).count()
assert corpus_count == new_corpus_count
assert datetime_modified != original_datetime_modified
assert resp['description'] == u'Covers a lot of the data. Best yet!'
assert resp['content'] == new_test_corpus_content
assert response.content_type == 'application/json'
assert orig_backup_count + 1 == new_backup_count
backup = Session.query(CorpusBackup).filter(
CorpusBackup.UUID==unicode(
resp['UUID'])).order_by(
desc(CorpusBackup.id)).first()
assert backup.datetime_modified.isoformat() == original_datetime_modified
assert backup.content == test_corpus_content
assert json.loads(backup.modifier)['first_name'] == u'Admin'
assert response.content_type == 'application/json'
# Update the corpus as the contributor.
sleep(1) # sleep for a second to ensure that MySQL could register a different datetime_modified for the update
orig_backup_count = Session.query(CorpusBackup).count()
params = self.corpus_create_params.copy()
params.update({
'name': u'Corpus',
'description': u'Covers even more data. Better than ever!',
'content': newest_test_corpus_content,
'form_search': form_search_id
})
params = json.dumps(params)
response = self.app.put(url('corpus', id=corpus_id), params, self.json_headers,
self.extra_environ_contrib)
resp = json.loads(response.body)
backup_count = new_backup_count
new_backup_count = Session.query(CorpusBackup).count()
datetime_modified = resp['datetime_modified']
new_corpus_count = Session.query(Corpus).count()
assert corpus_count == new_corpus_count == 1
assert datetime_modified != original_datetime_modified
assert resp['description'] == u'Covers even more data. Better than ever!'
assert resp['content'] == newest_test_corpus_content
assert resp['modifier']['id'] == contributor_id
assert response.content_type == 'application/json'
assert backup_count + 1 == new_backup_count
backup = Session.query(CorpusBackup).filter(
CorpusBackup.UUID==unicode(
resp['UUID'])).order_by(
desc(CorpusBackup.id)).first()
assert backup.datetime_modified.isoformat() == first_update_datetime_modified
assert backup.content == new_test_corpus_content
assert json.loads(backup.modifier)['first_name'] == u'Admin'
assert response.content_type == 'application/json'
# Now get the history of this corpus.
extra_environ = {'test.authentication.role': u'contributor',
'test.application_settings': True}
response = self.app.get(
url(controller='corpora', action='history', id=corpus_id),
headers=self.json_headers, extra_environ=extra_environ)
resp = json.loads(response.body)
assert response.content_type == 'application/json'
assert 'corpus' in resp
assert 'previous_versions' in resp
first_version = resp['previous_versions'][1]
second_version = resp['previous_versions'][0]
current_version = resp['corpus']
assert first_version['name'] == u'Corpus'
assert first_version['description'] == u'Covers a lot of the data.'
assert first_version['enterer']['id'] == administrator_id
assert first_version['modifier']['id'] == administrator_id
# Should be <; however, MySQL<5.6.4 does not support microseconds in datetimes
# so the test will fail/be inconsistent with <
assert first_version['datetime_modified'] <= second_version['datetime_modified']
assert second_version['name'] == u'Corpus'
assert second_version['description'] == u'Covers a lot of the data. Best yet!'
assert second_version['content'] == new_test_corpus_content
assert second_version['enterer']['id'] == administrator_id
assert second_version['modifier']['id'] == administrator_id
assert second_version['datetime_modified'] <= current_version['datetime_modified']
assert current_version['name'] == u'Corpus'
assert current_version['description'] == u'Covers even more data. Better than ever!'
assert current_version['content'] == newest_test_corpus_content
assert current_version['enterer']['id'] == administrator_id
assert current_version['modifier']['id'] == contributor_id
# Get the history using the corpus's UUID and expect it to be the same
# as the one retrieved above
corpus_UUID = resp['corpus']['UUID']
response = self.app.get(
url(controller='corpora', action='history', id=corpus_UUID),
headers=self.json_headers, extra_environ=extra_environ)
resp_UUID = json.loads(response.body)
assert resp == resp_UUID
# Attempt to call history with an invalid id and an invalid UUID and
# expect 404 errors in both cases.
bad_id = 103
bad_UUID = str(uuid4())
response = self.app.get(
url(controller='corpora', action='history', id=bad_id),
headers=self.json_headers, extra_environ=extra_environ,
status=404)
resp = json.loads(response.body)
assert resp['error'] == u'No corpora or corpus backups match %d' % bad_id
response = self.app.get(
url(controller='corpora', action='history', id=bad_UUID),
headers=self.json_headers, extra_environ=extra_environ,
status=404)
resp = json.loads(response.body)
assert resp['error'] == u'No corpora or corpus backups match %s' % bad_UUID
# Now delete the corpus ...
response = self.app.delete(url('corpus', id=corpus_id),
headers=self.json_headers, extra_environ=extra_environ)
# ... and get its history again, this time using the corpus's UUID
response = self.app.get(
url(controller='corpora', action='history', id=corpus_UUID),
headers=self.json_headers, extra_environ=extra_environ)
by_UUID_resp = json.loads(response.body)
assert by_UUID_resp['corpus'] == None
assert len(by_UUID_resp['previous_versions']) == 3
first_version = by_UUID_resp['previous_versions'][2]
second_version = by_UUID_resp['previous_versions'][1]
third_version = by_UUID_resp['previous_versions'][0]
assert first_version['name'] == u'Corpus'
assert first_version['description'] == u'Covers a lot of the data.'
assert first_version['enterer']['id'] == administrator_id
assert first_version['modifier']['id'] == administrator_id
# Should be <; however, MySQL<5.6.4 does not support microseconds in datetimes
# so the test will fail/be inconsistent with <
assert first_version['datetime_modified'] <= second_version['datetime_modified']
assert second_version['name'] == u'Corpus'
assert second_version['description'] == u'Covers a lot of the data. Best yet!'
assert second_version['content'] == new_test_corpus_content
assert second_version['enterer']['id'] == administrator_id
assert second_version['modifier']['id'] == administrator_id
assert second_version['datetime_modified'] <= third_version['datetime_modified']
assert third_version['name'] == u'Corpus'
assert third_version['description'] == u'Covers even more data. Better than ever!'
assert third_version['content'] == newest_test_corpus_content
assert third_version['enterer']['id'] == administrator_id
assert third_version['modifier']['id'] == contributor_id
# Get the deleted corpus's history again, this time using its id. The
# response should be the same as the response received using the UUID.
response = self.app.get(
url(controller='corpora', action='history', id=corpus_id),
headers=self.json_headers, extra_environ=extra_environ)
by_corpus_id_resp = json.loads(response.body)
assert by_corpus_id_resp == by_UUID_resp
| {'content_hash': 'c2a41d7a332f5f4cb8656da1b03b9edb', 'timestamp': '', 'source': 'github', 'line_count': 1050, 'max_line_length': 129, 'avg_line_length': 48.434285714285714, 'alnum_prop': 0.6036259241780714, 'repo_name': 'jrwdunham/old', 'id': '6ecae74b393fd3237e4385bdee16cf9aba95a220', 'size': '51440', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'onlinelinguisticdatabase/tests/functional/test_corpora.py', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '66'}, {'name': 'Python', 'bytes': '2840936'}, {'name': 'Shell', 'bytes': '778'}]} |
"""Data structures in Foam-Files that can't be directly represented by Python-Structures"""
from __future__ import division
import re
import six
import math
import copy
if six.PY3:
def cmp(a,b):
if a<b:
return -1
elif a==b:
return 0
else:
return 1
class FoamDataType(object):
def __repr__(self):
return "'"+str(self)+"'"
def __eq__(self,other):
"""Implementation to make __cmp__ work again in Python3
Implementing this method means that these objects are not hashable.
But that is OK
"""
return self.__cmp__(other)==0
def __lt__(self,other):
"Implementation to make __cmp__ work again in Python3"
return self.__cmp__(other)<0
def __ne__(self,other):
return self.__cmp__(other)!=0
def __gt__(self,other):
return self.__cmp__(other)>0
def __ge__(self,other):
return self.__cmp__(other)>=0
def __le__(self,other):
return self.__cmp__(other)<=0
class Field(FoamDataType):
def __init__(self,val,name=None):
self.val=val
self.name=name
if type(val) in[list,UnparsedList,BinaryList]:
self.uniform=False
elif self.name==None:
self.uniform=True
else:
raise TypeError("Type",type(val),"of value",val,"can not be used to determine uniformity")
def __str__(self):
result=""
if self.uniform:
result+="uniform "
else:
result+="nonuniform "
if self.name:
result+=self.name+" "
import PyFoam.Basics.FoamFileGenerator
result+=str(
PyFoam.Basics.FoamFileGenerator.FoamFileGenerator(
self.val,
longListThreshold=-1,
useFixedType=False
))
return result
def __cmp__(self,other):
if other==None or type(other)!=Field:
return 1
if self.uniform!=other.uniform:
return cmp(self.uniform,other.uniform)
elif self.name!=other.name:
return cmp(self.name,other.name)
else:
return cmp(self.val,other.val)
def __getitem__(self,key):
assert(not self.uniform)
return self.val[key]
def __setitem__(self,key,value):
assert(not self.uniform)
self.val[key]=value
def isUniform(self):
return self.uniform
def isBinary(self):
return type(self.val)==BinaryList
def binaryString(self):
return "nonuniform "+self.name+" <BINARY DATA>"
def value(self):
return self.val
def setUniform(self,data):
self.val=data
self.uniform=True
self.name=None
class Dimension(FoamDataType):
def __init__(self,*dims):
assert(len(dims)==7)
self.dims=list(dims)
def __str__(self):
result="[ "
for v in self.dims:
result+=str(v)+" "
result+="]"
return result
def __cmp__(self,other):
if other==None:
return 1
return cmp(self.dims,other.dims)
def __getitem__(self,key):
return self.dims[key]
def __setitem__(self,key,value):
self.dims[key]=value
class FixedLength(FoamDataType):
def __init__(self,vals):
self.vals=vals[:]
def __str__(self):
return "("+" ".join(["%g"%v for v in self.vals])+")"
def __cmp__(self,other):
if other==None or not issubclass(type(other),FixedLength):
return 1
return cmp(self.vals,other.vals)
def __getitem__(self,key):
return self.vals[key]
def __setitem__(self,key,value):
self.vals[key]=value
def __len__(self):
return len(self.vals)
class Vector(FixedLength):
def __init__(self,x,y,z):
FixedLength.__init__(self,[x,y,z])
def __add__(self,y):
x=self
if type(y)==Vector:
return Vector(x[0]+y[0],x[1]+y[1],x[2]+y[2])
elif type(y) in six.integer_types+(float,):
return Vector(x[0]+y,x[1]+y,x[2]+y)
else:
return NotImplemented
def __radd__(self,y):
x=self
if type(y) in six.integer_types+(float,):
return Vector(x[0]+y,x[1]+y,x[2]+y)
else:
return NotImplemented
def __sub__(self,y):
x=self
if type(y)==Vector:
return Vector(x[0]-y[0],x[1]-y[1],x[2]-y[2])
elif type(y) in six.integer_types+(float,):
return Vector(x[0]-y,x[1]-y,x[2]-y)
else:
return NotImplemented
def __rsub__(self,y):
x=self
if type(y) in six.integer_types+(float,):
return Vector(y-x[0],y-x[1],y-x[2])
else:
return NotImplemented
def __mul__(self,y):
x=self
if type(y)==Vector:
return Vector(x[0]*y[0],x[1]*y[1],x[2]*y[2])
elif type(y) in six.integer_types+(float,):
return Vector(x[0]*y,x[1]*y,x[2]*y)
else:
return NotImplemented
def __rmul__(self,y):
x=self
if type(y) in six.integer_types+(float,):
return Vector(y*x[0],y*x[1],y*x[2])
else:
return NotImplemented
def __div__(self,y):
x=self
if type(y)==Vector:
return Vector(x[0]/y[0],x[1]/y[1],x[2]/y[2])
elif type(y) in six.integer_types+(float,):
return Vector(x[0]/y,x[1]/y,x[2]/y)
else:
return NotImplemented
def __truediv__(self,y):
return self.__div__(y)
def __xor__(self,y):
x=self
if type(y)==Vector:
return Vector(x[1]*y[2]-x[2]*y[1],
x[2]*y[0]-x[0]*y[2],
x[0]*y[1]-x[1]*y[0])
else:
return NotImplemented
def __abs__(self):
x=self
return math.sqrt(x[0]*x[0]+x[1]*x[1]+x[2]*x[2])
def __neg__(self):
x=self
return Vector(-x[0],-x[1],-x[2])
def __pos__(self):
x=self
return Vector( x[0], x[1], x[2])
class Tensor(FixedLength):
def __init__(self,v1,v2,v3,v4,v5,v6,v7,v8,v9):
FixedLength.__init__(self,[v1,v2,v3,v4,v5,v6,v7,v8,v9])
class SymmTensor(FixedLength):
def __init__(self,v1,v2,v3,v4,v5,v6):
FixedLength.__init__(self,[v1,v2,v3,v4,v5,v6])
class BoolProxy(object):
"""Wraps a boolean parsed from a file. Optionally stores a textual
representation
"""
TrueStrings=["on",
"yes",
"true",
# "y" # this breaks parsing certain files
]
FalseStrings=[
"off",
"no",
"false",
# "n", # this breaks parsing certain files
"none",
"invalid"
]
def __init__(self,val=None,textual=None):
if val==None and textual==None:
raise TypeError("'BoolProxy' initialized without values")
elif val==None:
if textual in BoolProxy.TrueStrings:
self.val=True
elif textual in BoolProxy.FalseStrings:
self.val=False
else:
raise TypeError(str(textual)+" not in "+str(BoolProxy.TrueStrings)
+" or "+str(BoolProxy.TrueStrings))
else:
if val not in [True,False]:
raise TypeError(str(val)+" is not a boolean")
self.val=val
self.textual=textual
if self.textual:
if self.val:
if self.textual not in BoolProxy.TrueStrings:
raise TypeError(self.textual+" not in "
+str(BoolProxy.TrueStrings))
else:
if self.textual not in BoolProxy.FalseStrings:
raise TypeError(self.textual+" not in "
+str(BoolProxy.FalseStrings))
def __nonzero__(self):
return self.val
# for Python 3
def __bool__(self):
return self.val
def __str__(self):
if self.textual==None:
if self.val:
return "yes"
else:
return "no"
else:
return self.textual
def __eq__(self,o):
if type(o) in [bool,BoolProxy]:
return self.val==o
elif isinstance(o,six.string_types):
if self.textual==o:
return True
else:
try:
return self.val==BoolProxy(textual=o)
except TypeError:
return False
else:
raise TypeError("Can't compare BoolProxy with "+str(type(o)))
class DictRedirection(object):
"""This class is in charge of handling redirections to other directories"""
def __init__(self,fullCopy,reference,name):
self._fullCopy=fullCopy
self._reference=reference
self._name=name
def useAsRedirect(self):
self._fullCopy=None
def getContent(self):
result=self._fullCopy
self._fullCopy=None
return result
def __call__(self):
return self._reference
def __str__(self):
return "$"+self._name
def __float__(self):
return float(self._reference)
class DictProxy(dict):
"""A class that acts like a dictionary, but preserves the order
of the entries. Used to beautify the output"""
def __init__(self):
dict.__init__(self)
self._order=[]
self._decoration={}
self._regex=[]
self._redirects=[]
def __setitem__(self,key,value):
dict.__setitem__(self,key,value)
if key not in self._order:
self._order.append(key)
def __getitem__(self,key):
try:
return dict.__getitem__(self,key)
except KeyError:
for k,e,v in self._regex:
if e.match(key):
return v
for r in self._redirects:
try:
return r()[key]
except KeyError:
pass
raise KeyError(key)
def __delitem__(self,key):
dict.__delitem__(self,key)
self._order.remove(key)
if key in self._decoration:
del self._decoration[key]
def __deepcopy__(self,memo):
new=DictProxy()
for k in self._order:
if type(k)==DictRedirection:
new.addRedirection(k)
else:
try:
new[k]=copy.deepcopy(self[k],memo)
except KeyError:
new[k]=copy.deepcopy(self.getRegexpValue(k),memo)
return new
def __contains__(self,key):
if dict.__contains__(self,key):
return True
else:
for k,e,v in self._regex:
if e.match(key):
return True
for r in self._redirects:
if key in r():
return True
return False
def __enforceString(self,v,toString):
if not isinstance(v,six.string_types) and toString:
return str(v)
else:
return v
def update(self,other=None,toString=False,**kwargs):
"""Emulate the regular update of dict"""
if other:
if hasattr(other,"keys"):
for k in other.keys():
self[k]=self.__enforceString(other[k],toString)
else:
for k,v in other:
self[k]=self.__enforceString(v,toString)
for k in kwargs:
self[k]=self.__enforceString(kwargs[k],toString)
def keys(self):
return [x for x in self._order if type(x)!=DictRedirection]
def __str__(self):
first=True
result="{"
for k in self.keys():
v=self[k]
if first:
first=False
else:
result+=", "
result+="%s: %s" % (repr(k),repr(v))
result+="}"
return result
def addDecoration(self,key,text):
if key in self:
if key not in self._decoration:
self._decoration[key]=""
self._decoration[key]+=text
def getDecoration(self,key):
if key in self._decoration:
return " \t"+self._decoration[key]
else:
return ""
def getRegexpValue(self,key):
for k,e,v in self._regex:
if k==key:
return v
raise KeyError(key)
def addRedirection(self,redir):
self._order.append(redir)
redir.useAsRedirect()
self._redirects.append(redir)
class TupleProxy(list):
"""Enables Tuples to be manipulated"""
def __init__(self,tup=()):
list.__init__(self,tup)
class Unparsed(object):
"""A class that encapsulates an unparsed string"""
def __init__(self,data):
self.data=data
def __str__(self):
return self.data
def __hash__(self):
return hash(self.data)
def __lt__(self,other):
return self.data<other.data
class BinaryBlob(Unparsed):
"""Represents a part of the file with binary data in it"""
def __init__(self,data):
Unparsed.__init__(self,data)
class Codestream(str):
"""A class that encapsulates an codestream string"""
def __str__(self):
return "#{" + str.__str__(self) + "#}"
class UnparsedList(object):
"""A class that encapsulates a list that was not parsed for
performance reasons"""
def __init__(self,lngth,data):
self.data=data
self.length=lngth
def __len__(self):
return self.length
def __cmp__(self,other):
return cmp(self.data,other.data)
def __eq__(self,other):
return self.data==other.data
def __lt__(self,other):
return self.data<other.data
class BinaryList(UnparsedList):
"""A class that represents a list that is saved as binary data"""
def __init__(self,lngth,data):
UnparsedList.__init__(self,lngth,data)
def makePrimitiveString(val):
"""Make strings of types that might get written to a directory"""
if isinstance(val,(Dimension,FixedLength,BoolProxy)):
return str(val)
else:
return val
# Should work with Python3 and Python2
| {'content_hash': 'e6cffda9d6acf6757896ef44df354e4c', 'timestamp': '', 'source': 'github', 'line_count': 532, 'max_line_length': 102, 'avg_line_length': 26.979323308270676, 'alnum_prop': 0.5200306556120672, 'repo_name': 'mortbauer/foamserver', 'id': '25941a1c2443e5ee441010f18b8479b245d8149e', 'size': '14353', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'foamserver/foamparser/data_structures.py', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C++', 'bytes': '40201'}, {'name': 'Python', 'bytes': '72373'}]} |
import { getNodeAtPath, walk } from "react-sortable-tree";
const calcPackageVolume = (treeData, selectedRow) => {
"use strict";
var productMassNodes, productCountNodes, parentPath, pathValue,
mass, counts, volume;
// Get all the nodes that have keys of "UNIT_MASS" or "PRODUCT_UNITS".
productMassNodes = [];
productCountNodes = [];
const walkCallback = (n) => {
if (n.node.key=="UNIT_MASS") {
productMassNodes.push(n);
} else if (n.node.key=="PRODUCT_UNITS") {
productCountNodes.push(n);
}
};
walk({
treeData: treeData,
getNodeKey: ({ treeIndex }) => treeIndex,
callback: walkCallback,
ignoreCollapsed: false
});
// The node sought have the same path upto the last two values.
parentPath = selectedRow.path.slice(0, -2);
// Only the last value of path needs to be equal.
pathValue = parentPath.pop();
mass = productMassNodes.filter((elem, indx, arry) => {return elem.path.slice(0, -2).pop() === pathValue;})[0].node.value;
counts = productCountNodes.filter((elem, indx, arry) => {return elem.path.slice(0, -2).pop() === pathValue;})[0].node.value;
volume = mass*1.0e-3 * counts / 1.0;
return volume;
};
const calcPackageArea = (treeData, selectedRow) => {
"use strict";
var packageVolumeNodes, parentPath, pathValue, volume, area;
// Get all the nodes that have keys "VOLUME".
packageVolumeNodes = [];
const walkCallback = (n) => {
if (n.node.key=="VOLUME") {
packageVolumeNodes.push(n);
}
};
walk({
treeData: treeData,
getNodeKey: ({ treeIndex }) => treeIndex,
callback: walkCallback,
ignoreCollapsed: false
});
// The node sought have the same path upto the last value.
parentPath = selectedRow.path.slice(0, -1);
pathValue = parentPath.pop();
volume = packageVolumeNodes.filter((elem, indx, arry) => {return elem.path.slice(0, -1).pop() === pathValue;})[0].node.value;
area = Math.pow(4*3.14*(3*volume/(4*3.14)),(2.0/3.0));
return area;
};
const demoCalculation = () => {
"use strict";
let data = {
time: [],
water: []
};
let tau = Math.random();
let start = 10*Math.random();
let end = 10*Math.random();
let y = (x) => {
return 60+start-(50+end)*Math.exp(-1*x/30.0*tau);
};
for (let x=0; x<200; x++) {
data.time.push(x);
data.water.push(y(x));
}
return data;
};
export { calcPackageVolume, calcPackageArea, demoCalculation };
| {'content_hash': '23360a1b27e1cd05d929f25e61ee59cb', 'timestamp': '', 'source': 'github', 'line_count': 93, 'max_line_length': 129, 'avg_line_length': 28.27956989247312, 'alnum_prop': 0.5836501901140685, 'repo_name': 'brentjm/Impurity-Predictions', 'id': '279ed6bc17d3f5b78de8ad095cd3231b65ea6232', 'size': '2630', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'client/src/app/packageapp/lib/calculations.js', 'mode': '33188', 'license': 'bsd-2-clause', 'language': [{'name': 'CSS', 'bytes': '12736'}, {'name': 'HTML', 'bytes': '848'}, {'name': 'JavaScript', 'bytes': '370652'}, {'name': 'Jupyter Notebook', 'bytes': '984271'}, {'name': 'Python', 'bytes': '330982'}, {'name': 'Shell', 'bytes': '1012'}]} |
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package android.support.transition;
public final class R {
public static final class id {
public static int transition_current_scene = 0x7f0b0009;
public static int transition_scene_layoutid_cache = 0x7f0b000a;
}
}
| {'content_hash': '7b101e9d0eedcdb5656d94454311fdcd', 'timestamp': '', 'source': 'github', 'line_count': 14, 'max_line_length': 65, 'avg_line_length': 28.785714285714285, 'alnum_prop': 0.7444168734491315, 'repo_name': 'kd345312/RoboApp', 'id': '67ba6c1be0c8c4018454b7cb9cde85ca2462c441', 'size': '403', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'RoboApp/appFaceTracker/build/generated/source/r/release/android/support/transition/R.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C++', 'bytes': '4992'}, {'name': 'Java', 'bytes': '4672574'}, {'name': 'Matlab', 'bytes': '19403'}, {'name': 'Python', 'bytes': '105'}, {'name': 'Shell', 'bytes': '947'}]} |
published: true
title: Fantasy Fudge (Microwave)
layout: post
categories: [desserts]
rating: 0
---
### Servings
### Ingredients
- 3/4 cup (1-1/2 sticks) butter or margarine, softened
- 3 cups sugar
- 1 can (5 ounce) evaporated milk (2/3 cups)
- 1 pkg (8 squares) BAKER'S semi-sweet baking chocolate
- 1 jar (7 ouces) JET-PUFFED marshmallow crème
- 1 teaspoon vanilla
- 1 cup chopped walnuts
### Directions
1. Microwave: Place butter in a 4 quart microwavable bowl on HIGH 1 minute or until melted. Add sugar and milk; mix well. Microwave 5 minutes or until mixture begins to boil, stirring after 3 minutes. Stir well scraping down sides of bowl. Microwave 5 1/2 minutes, stirring after 3 minutes. Let stand 2 minutes.
2. Add chocolate, stir until melted. Add marshmallow and vanilla, mix well. Stir in nuts. Pour into greased 13x9 inch pan.
3. Cool at room temperature, cut into squares.
### Source
| {'content_hash': '245bc599122409162b838de571fe6657', 'timestamp': '', 'source': 'github', 'line_count': 25, 'max_line_length': 317, 'avg_line_length': 36.52, 'alnum_prop': 0.7393209200438116, 'repo_name': 'jrolstad/rolstad-recipes', 'id': 'eea72aaa3a0ab3292bfa7fc0904bbe61248cc4d3', 'size': '918', 'binary': False, 'copies': '2', 'ref': 'refs/heads/gh-pages', 'path': '_posts/2015-12-14-fantasy-fudge-(microwave).md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '21122'}, {'name': 'HTML', 'bytes': '11978'}, {'name': 'JavaScript', 'bytes': '1872'}]} |
<?php
// Добавление поддержки миниатюр для записей
add_theme_support('post-thumbnails', array('post'));
// Очистка вывода хука wp_head от ненужного дефолтного мусора.
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'rsd_link');
// Отключаем jQuery (он уже подключен в конце)
function modify_jquery() {
wp_deregister_script('jquery');
}
add_action('init', 'modify_jquery');
?> | {'content_hash': '774ecfbbbb03a51dd7219d446edb36ed', 'timestamp': '', 'source': 'github', 'line_count': 14, 'max_line_length': 66, 'avg_line_length': 34.92857142857143, 'alnum_prop': 0.6523517382413088, 'repo_name': 'tomin-vlad/tomin', 'id': 'cb57db07990577ee16fb6e6b0b49f53c6497fde3', 'size': '599', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'functions.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '4922'}, {'name': 'JavaScript', 'bytes': '450'}, {'name': 'PHP', 'bytes': '20277'}]} |
'''
'''
# 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.
import os
Test.Summary = '''
'''
Test.SkipUnless(Condition.PluginExists('cookie_remap.so'))
Test.ContinueOnFail = True
Test.testName = "cookie_remap: cookie in bucket or not"
# Define default ATS
ts = Test.MakeATSProcess("ts")
# First server is run during first test and
# second server is run during second test
server = Test.MakeOriginServer("server", ip='127.0.0.10')
request_header = {"headers": "GET /cookiematches HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
"timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
# add response to the server dictionary
server.addResponse("sessionfile.log", request_header, response_header)
server2 = Test.MakeOriginServer("server2", ip='127.0.0.11')
request_header2 = {"headers": "GET /cookiedoesntmatch HTTP/1.1\r\nHost: www.example.com\r\n\r\n",
"timestamp": "1469733493.993", "body": ""}
# expected response from the origin server
response_header2 = {"headers": "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n", "timestamp": "1469733493.993", "body": ""}
# add response to the server dictionary
server2.addResponse("sessionfile.log", request_header2, response_header2)
# Setup the remap configuration
config_path = os.path.join(Test.TestDirectory, "configs/bucketconfig.txt")
with open(config_path, 'r') as config_file:
config1 = config_file.read()
ts.Disk.records_config.update({
'proxy.config.diags.debug.enabled': 1,
'proxy.config.diags.debug.tags': 'cookie_remap.*|http.*|dns.*',
})
config1 = config1.replace("$PORT", str(server.Variables.Port))
config1 = config1.replace("$ALTPORT", str(server2.Variables.Port))
ts.Disk.File(ts.Variables.CONFIGDIR + "/bucketconfig.txt", exists=False, id="config1")
ts.Disk.config1.WriteOn(config1)
ts.Disk.remap_config.AddLine(
'map http://www.example.com/magic http://shouldnothit.com @plugin=cookie_remap.so @pparam=config/bucketconfig.txt'
)
# Cookie value in bucket
tr = Test.AddTestRun("cookie value in bucket")
tr.Processes.Default.Command = '''
curl \
--proxy 127.0.0.1:{0} \
"http://www.example.com/magic" \
-H"Cookie: fpbeta=333" \
-H "Proxy-Connection: keep-alive" \
--verbose \
'''.format(ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(server, ready=When.PortOpen(server.Variables.Port))
tr.Processes.Default.StartBefore(Test.Processes.ts)
tr.StillRunningAfter = ts
server.Streams.All = "gold/matchcookie.gold"
# cookie value not in bucket
tr = Test.AddTestRun("cooke value not in bucket")
tr.Processes.Default.Command = '''
curl \
--proxy 127.0.0.1:{0} \
"http://www.example.com/magic" \
-H"Cookie: fpbeta=etc" \
-H "Proxy-Connection: keep-alive" \
--verbose \
'''.format(ts.Variables.port)
tr.Processes.Default.ReturnCode = 0
tr.Processes.Default.StartBefore(server2, ready=When.PortOpen(server2.Variables.Port))
tr.StillRunningAfter = ts
server2.Streams.All = "gold/wontmatchcookie.gold"
| {'content_hash': 'c3e82288d192a832fdd9ceec37dd132f', 'timestamp': '', 'source': 'github', 'line_count': 102, 'max_line_length': 121, 'avg_line_length': 37.745098039215684, 'alnum_prop': 0.7283116883116884, 'repo_name': 'pbchou/trafficserver', 'id': 'f75035847e09dbec6fee86087ca60d60939fce7c', 'size': '3850', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'tests/gold_tests/pluginTest/cookie_remap/bucketcookie.test.py', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '1478100'}, {'name': 'C++', 'bytes': '16547456'}, {'name': 'CMake', 'bytes': '13151'}, {'name': 'Dockerfile', 'bytes': '6693'}, {'name': 'Java', 'bytes': '9881'}, {'name': 'Lua', 'bytes': '64412'}, {'name': 'M4', 'bytes': '216500'}, {'name': 'Makefile', 'bytes': '250518'}, {'name': 'Objective-C', 'bytes': '12972'}, {'name': 'Perl', 'bytes': '128436'}, {'name': 'Python', 'bytes': '1509938'}, {'name': 'SWIG', 'bytes': '25777'}, {'name': 'Shell', 'bytes': '175893'}, {'name': 'Starlark', 'bytes': '987'}, {'name': 'Vim script', 'bytes': '192'}]} |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- From: file:/D:/git_workspace/react-native/ReactAndroid/src/main/res/devsupport/values-ja/strings.xml -->
<eat-comment/>
<string name="catalyst_debugjs">Debug JS</string>
<string name="catalyst_inspect_element">要素を確認</string>
<string name="catalyst_jsload_error">Unable to download JS bundle</string>
<string name="catalyst_jsload_message">Fetching JS bundle</string>
<string name="catalyst_jsload_title">しばらくお待ちください</string>
<string name="catalyst_reloadjs">Reload JS</string>
<string name="catalyst_settings">Dev Settings</string>
<string name="catalyst_settings_title">Catalyst Dev Settings</string>
</resources> | {'content_hash': '353202f47c729ded4fe3ee621e4a1620', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 113, 'avg_line_length': 54.61538461538461, 'alnum_prop': 0.7211267605633803, 'repo_name': 'zhaoxingyu/rn-for-eclipse', 'id': '00aa5b5c58c48394b010bd4faad1438773efca65', 'size': '742', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'demo-for-eclipse/react_native_lib/res/values-ja/values-ja.xml', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Assembly', 'bytes': '14166'}, {'name': 'Awk', 'bytes': '121'}, {'name': 'Batchfile', 'bytes': '354'}, {'name': 'C', 'bytes': '83783'}, {'name': 'C++', 'bytes': '897747'}, {'name': 'CSS', 'bytes': '18211'}, {'name': 'HTML', 'bytes': '28846'}, {'name': 'IDL', 'bytes': '1851'}, {'name': 'Java', 'bytes': '3068750'}, {'name': 'JavaScript', 'bytes': '1339868'}, {'name': 'Makefile', 'bytes': '11843'}, {'name': 'Objective-C', 'bytes': '1051917'}, {'name': 'Objective-C++', 'bytes': '8138'}, {'name': 'Prolog', 'bytes': '933'}, {'name': 'Python', 'bytes': '33001'}, {'name': 'Ruby', 'bytes': '4310'}, {'name': 'Shell', 'bytes': '21468'}]} |
;(function(){
'use strict';
window.Application.register('generators');
}).call(this); | {'content_hash': '20c11a68cdf15df1d1cd2276d2913604', 'timestamp': '', 'source': 'github', 'line_count': 6, 'max_line_length': 44, 'avg_line_length': 14.833333333333334, 'alnum_prop': 0.6741573033707865, 'repo_name': 'lijanele/slush-y', 'id': '8044bdff8b5621a7fe2abd629ef9e705ac2debd6', 'size': '89', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'generators/application/templates/client/base/modules/generators/generators.module.js', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '274954'}, {'name': 'HTML', 'bytes': '39418'}, {'name': 'JavaScript', 'bytes': '386651'}]} |
<?php
namespace WPMailSMTP\Providers\Mail;
use WPMailSMTP\Providers\MailerAbstract;
/**
* Class Mailer inherits everything from parent abstract class.
* This file is required for a proper work of Loader and \ReflectionClass.
*
* @package WPMailSMTP\Providers\Mail
*/
class Mailer extends MailerAbstract {
/**
* @inheritdoc
*/
public function get_debug_info() {
$mail_text = array();
$mail_text[] = '<br><strong>Server:</strong>';
$disabled_functions = ini_get( 'disable_functions' );
$disabled = (array) explode( ',', trim( $disabled_functions ) );
$mail_text[] = '<strong>PHP.mail():</strong> ' . ( in_array( 'mail', $disabled, true ) || ! function_exists( 'mail' ) ? 'No' : 'Yes' );
if ( function_exists( 'apache_get_modules' ) ) {
$modules = apache_get_modules();
$mail_text[] = '<strong>Apache.mod_security:</strong> ' . ( in_array( 'mod_security', $modules, true ) || in_array( 'mod_security2', $modules, true ) ? 'Yes' : 'No' );
}
if ( function_exists( 'selinux_is_enabled' ) ) {
$mail_text[] = '<strong>OS.SELinux:</strong> ' . ( selinux_is_enabled() ? 'Yes' : 'No' );
}
if ( function_exists( 'grsecurity_is_enabled' ) ) {
$mail_text[] = '<strong>OS.grsecurity:</strong> ' . ( grsecurity_is_enabled() ? 'Yes' : 'No' );
}
return implode( '<br>', $mail_text );
}
}
| {'content_hash': '76b94a05bf6a2e418baa2fe00d2d2e68', 'timestamp': '', 'source': 'github', 'line_count': 41, 'max_line_length': 170, 'avg_line_length': 32.707317073170735, 'alnum_prop': 0.6152125279642058, 'repo_name': 'mandino/nu', 'id': '2b59a6c9afde12f9f0ee9e3e8261e38928e847c0', 'size': '1341', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'wp-content/plugins/wp-mail-smtp/src/Providers/Mail/Mailer.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '2534865'}, {'name': 'HTML', 'bytes': '131438'}, {'name': 'JavaScript', 'bytes': '3766596'}, {'name': 'Modelica', 'bytes': '10338'}, {'name': 'PHP', 'bytes': '19289064'}, {'name': 'Perl', 'bytes': '2554'}, {'name': 'Shell', 'bytes': '1145'}]} |
// Copyright (C) 2009 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.server.query;
import org.eclipse.jgit.lib.AbbreviatedObjectId;
import org.eclipse.jgit.lib.ObjectId;
/** Predicate for a field of {@link ObjectId}. */
public abstract class ObjectIdPredicate<T> extends OperatorPredicate<T> {
private final AbbreviatedObjectId id;
public ObjectIdPredicate(final String name, final AbbreviatedObjectId id) {
super(name, id.name());
this.id = id;
}
public boolean isComplete() {
return id.isComplete();
}
public AbbreviatedObjectId abbreviated() {
return id;
}
public ObjectId full() {
return id.toObjectId();
}
@Override
public int hashCode() {
return getOperator().hashCode() * 31 + id.hashCode();
}
@Override
public boolean equals(Object other) {
if (other instanceof ObjectIdPredicate) {
final ObjectIdPredicate<?> p = (ObjectIdPredicate<?>) other;
return getOperator().equals(p.getOperator()) && id.equals(p.id);
}
return false;
}
@Override
public String toString() {
return getOperator() + ":" + id.name();
}
}
| {'content_hash': '40decbf7d257319adbde7ca1a4442944', 'timestamp': '', 'source': 'github', 'line_count': 60, 'max_line_length': 77, 'avg_line_length': 28.0, 'alnum_prop': 0.7053571428571429, 'repo_name': 'm1kah/gerrit-contributions', 'id': 'bea4da123273780a176ac4910309b8074d983dca', 'size': '1680', 'binary': False, 'copies': '11', 'ref': 'refs/heads/master', 'path': 'gerrit-server/src/main/java/com/google/gerrit/server/query/ObjectIdPredicate.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '4448911'}, {'name': 'JavaScript', 'bytes': '811'}, {'name': 'Prolog', 'bytes': '15950'}, {'name': 'Python', 'bytes': '12214'}, {'name': 'Shell', 'bytes': '35710'}]} |
package com.u8.server.sdk.lehaihai;
/**
* Created by ant on 2016/1/19.
*/
public class LehaihaiPayResult {
private String orderid;
private String gameid;
private String serverid;
private String uid;
private String amount;
private String time;
private String sign;
private String extendsInfo;
public String getOrderid() {
return orderid;
}
public void setOrderid(String orderid) {
this.orderid = orderid;
}
public String getGameid() {
return gameid;
}
public void setGameid(String gameid) {
this.gameid = gameid;
}
public String getServerid() {
return serverid;
}
public void setServerid(String serverid) {
this.serverid = serverid;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
public String getExtendsInfo() {
return extendsInfo;
}
public void setExtendsInfo(String extendsInfo) {
this.extendsInfo = extendsInfo;
}
}
| {'content_hash': '76d7d6f58cdf4fe480b001a213af1a54', 'timestamp': '', 'source': 'github', 'line_count': 80, 'max_line_length': 52, 'avg_line_length': 19.4, 'alnum_prop': 0.5650773195876289, 'repo_name': 'uustory/U8Server', 'id': '97e8402b9a2e749f9db770e9c3bc2883334dfa56', 'size': '1552', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/com/u8/server/sdk/lehaihai/LehaihaiPayResult.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '466466'}, {'name': 'Java', 'bytes': '1186914'}, {'name': 'JavaScript', 'bytes': '627204'}]} |
package com.sksamuel.elastic4s.jackson
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.sksamuel.elastic4s.source.DocumentSource
/** @author Stephen Samuel */
@deprecated("Prefer Indexable[T] typeclass", "1.5.12")
class ObjectSource(any: Any) extends DocumentSource {
def json: String = ObjectSource.mapper.writeValueAsString(any)
}
object ObjectSource {
val mapper = new ObjectMapper
mapper.registerModule(DefaultScalaModule)
@deprecated("Prefer Indexable[T] typeclass", "1.5.12")
def apply(any: Any) = new ObjectSource(any)
}
| {'content_hash': 'f9b77c7c71147dad88e406e11e9b3602', 'timestamp': '', 'source': 'github', 'line_count': 18, 'max_line_length': 64, 'avg_line_length': 34.166666666666664, 'alnum_prop': 0.7869918699186992, 'repo_name': 'rauanmaemirov/elastic4s', 'id': '3181f754fd5c85ccee1fb3b9bd0851083ebf9fc3', 'size': '615', 'binary': False, 'copies': '15', 'ref': 'refs/heads/master', 'path': 'elastic4s-jackson/src/main/scala/com/sksamuel/elastic4s/jackson/ObjectSource.scala', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Scala', 'bytes': '585947'}]} |
#include <stdio.h>
#include "py/runtime.h"
#include "py/mphal.h"
#include "extint.h"
#include "pin.h"
#include "genhdr/pins.h"
#include "usrsw.h"
#if MICROPY_HW_HAS_SWITCH
/// \moduleref pyb
/// \class Switch - switch object
///
/// A Switch object is used to control a push-button switch.
///
/// Usage:
///
/// sw = pyb.Switch() # create a switch object
/// sw() # get state (True if pressed, False otherwise)
/// sw.callback(f) # register a callback to be called when the
/// # switch is pressed down
/// sw.callback(None) # remove the callback
///
/// Example:
///
/// pyb.Switch().callback(lambda: pyb.LED(1).toggle())
// this function inits the switch GPIO so that it can be used
void switch_init0(void) {
mp_hal_pin_config(&MICROPY_HW_USRSW_PIN, MP_HAL_PIN_MODE_INPUT, MICROPY_HW_USRSW_PULL, 0);
}
int switch_get(void) {
int val = ((MICROPY_HW_USRSW_PIN.gpio->IDR & MICROPY_HW_USRSW_PIN.pin_mask) != 0);
return val == MICROPY_HW_USRSW_PRESSED;
}
/******************************************************************************/
// MicroPython bindings
typedef struct _pyb_switch_obj_t {
mp_obj_base_t base;
} pyb_switch_obj_t;
STATIC const pyb_switch_obj_t pyb_switch_obj = {{&pyb_switch_type}};
void pyb_switch_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
mp_print_str(print, "Switch()");
}
/// \classmethod \constructor()
/// Create and return a switch object.
STATIC mp_obj_t pyb_switch_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// check arguments
mp_arg_check_num(n_args, n_kw, 0, 0, false);
// No need to clear the callback member: if it's already been set and registered
// with extint then we don't want to reset that behaviour. If it hasn't been set,
// then no extint will be called until it is set via the callback method.
// return static switch object
return (mp_obj_t)&pyb_switch_obj;
}
/// \method \call()
/// Return the switch state: `True` if pressed down, `False` otherwise.
mp_obj_t pyb_switch_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
// get switch state
mp_arg_check_num(n_args, n_kw, 0, 0, false);
return switch_get() ? mp_const_true : mp_const_false;
}
mp_obj_t pyb_switch_value(mp_obj_t self_in) {
(void)self_in;
return mp_obj_new_bool(switch_get());
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_switch_value_obj, pyb_switch_value);
STATIC mp_obj_t switch_callback(mp_obj_t line) {
if (MP_STATE_PORT(pyb_switch_callback) != mp_const_none) {
mp_call_function_0(MP_STATE_PORT(pyb_switch_callback));
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(switch_callback_obj, switch_callback);
/// \method callback(fun)
/// Register the given function to be called when the switch is pressed down.
/// If `fun` is `None`, then it disables the callback.
mp_obj_t pyb_switch_callback(mp_obj_t self_in, mp_obj_t callback) {
MP_STATE_PORT(pyb_switch_callback) = callback;
// Init the EXTI each time this function is called, since the EXTI
// may have been disabled by an exception in the interrupt, or the
// user disabling the line explicitly.
extint_register((mp_obj_t)&MICROPY_HW_USRSW_PIN,
MICROPY_HW_USRSW_EXTI_MODE,
MICROPY_HW_USRSW_PULL,
callback == mp_const_none ? mp_const_none : (mp_obj_t)&switch_callback_obj,
true);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_switch_callback_obj, pyb_switch_callback);
STATIC const mp_rom_map_elem_t pyb_switch_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&pyb_switch_value_obj) },
{ MP_ROM_QSTR(MP_QSTR_callback), MP_ROM_PTR(&pyb_switch_callback_obj) },
};
STATIC MP_DEFINE_CONST_DICT(pyb_switch_locals_dict, pyb_switch_locals_dict_table);
const mp_obj_type_t pyb_switch_type = {
{ &mp_type_type },
.name = MP_QSTR_Switch,
.print = pyb_switch_print,
.make_new = pyb_switch_make_new,
.call = pyb_switch_call,
.locals_dict = (mp_obj_dict_t*)&pyb_switch_locals_dict,
};
#endif // MICROPY_HW_HAS_SWITCH
| {'content_hash': '97eadc6bad5f074f2c6fa4d5ce617700', 'timestamp': '', 'source': 'github', 'line_count': 123, 'max_line_length': 114, 'avg_line_length': 34.577235772357724, 'alnum_prop': 0.6355513754996474, 'repo_name': 'TDAbboud/micropython', 'id': 'a7721ad779a1098a5b52244e05a18fce82d8f5cd', 'size': '5483', 'binary': False, 'copies': '15', 'ref': 'refs/heads/master', 'path': 'stmhal/usrsw.c', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Assembly', 'bytes': '34880'}, {'name': 'C', 'bytes': '34538866'}, {'name': 'C++', 'bytes': '1022145'}, {'name': 'HTML', 'bytes': '84456'}, {'name': 'Makefile', 'bytes': '77969'}, {'name': 'Objective-C', 'bytes': '391996'}, {'name': 'Python', 'bytes': '658151'}, {'name': 'Shell', 'bytes': '4829'}]} |
/**
* Adapted from https://github.com/nylen/wait-until since it suits our use case but is not maintained.
*/
class WaitUntil {
/**
* The interval frequency to check
* @param {int} interval in milliseconds
*/
interval(interval) {
this._interval = interval;
return this;
}
/**
* Number of times to check before expiring and calling done
* @param {int} times
*/
times(times) {
this._times = times;
return this;
}
/**
* The condition to be checked for
* @param {function} condition callback function
*/
condition(condition) {
this._condition = condition;
return this;
}
/**
* Work to be done after waiting or expiring
* @param {function} cb callback function
*/
done(cb) {
if (!this._times) {
throw new Error('waitUntil.times() not called yet');
}
if (!this._interval) {
throw new Error('waitUntil.interval() not called yet');
}
if (!this._condition) {
throw new Error('waitUntil.condition() not called yet');
}
const runCheck = (i, prevResult) => {
if (i === this._times) {
cb(prevResult);
} else {
setTimeout(() => {
const gotConditionResult = result => {
if (result) {
cb(result);
} else {
runCheck(i + 1, result);
}
};
if (this._condition.length) {
this._condition(gotConditionResult);
} else {
process.nextTick(() => {
gotConditionResult(this._condition());
});
}
}, this._interval);
}
};
runCheck(0);
return this;
}
}
module.exports = exports = () => new WaitUntil();
| {'content_hash': '6032a314fa4213760f5aa64f03d9ec32', 'timestamp': '', 'source': 'github', 'line_count': 76, 'max_line_length': 102, 'avg_line_length': 27.144736842105264, 'alnum_prop': 0.4517692680562288, 'repo_name': 'rifatdover/generator-jhipster', 'id': 'b980f2cdc8094ec4ea3fb2a4ea080b9eca7e96f6', 'size': '2063', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'cli/wait-until.js', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '5006'}, {'name': 'HTML', 'bytes': '3655456'}, {'name': 'JavaScript', 'bytes': '1045790'}, {'name': 'Shell', 'bytes': '32937'}]} |
/* $NetBSD: int.h,v 1.1.1.2.4.1 2014/12/24 00:05:19 riz Exp $ */
/*
* Copyright (C) 2004, 2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2001 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* Id: int.h,v 1.13 2007/06/19 23:47:20 tbox Exp */
#ifndef ISC_INT_H
#define ISC_INT_H 1
#define _INTEGRAL_MAX_BITS 64
#include <limits.h>
typedef __int8 isc_int8_t;
typedef unsigned __int8 isc_uint8_t;
typedef __int16 isc_int16_t;
typedef unsigned __int16 isc_uint16_t;
typedef __int32 isc_int32_t;
typedef unsigned __int32 isc_uint32_t;
typedef __int64 isc_int64_t;
typedef unsigned __int64 isc_uint64_t;
#define ISC_INT8_MIN -128
#define ISC_INT8_MAX 127
#define ISC_UINT8_MAX 255
#define ISC_INT16_MIN -32768
#define ISC_INT16_MAX 32767
#define ISC_UINT16_MAX 65535
/*
* Note that "int" is 32 bits on all currently supported Unix-like operating
* systems, but "long" can be either 32 bits or 64 bits, thus the 32 bit
* constants are not qualified with "L".
*/
#define ISC_INT32_MIN _I32_MIN
#define ISC_INT32_MAX _I32_MAX
#define ISC_UINT32_MAX _UI32_MAX
#define ISC_INT64_MIN _I64_MIN
#define ISC_INT64_MAX _I64_MAX
#define ISC_UINT64_MAX _UI64_MAX
#endif /* ISC_INT_H */
| {'content_hash': 'fe8867bd50bb383978129e3357e3e9ea', 'timestamp': '', 'source': 'github', 'line_count': 58, 'max_line_length': 78, 'avg_line_length': 33.275862068965516, 'alnum_prop': 0.7248704663212435, 'repo_name': 'execunix/vinos', 'id': '13c1026d4bf95c250d478e061d145f4ca377a679', 'size': '1930', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'external/bsd/ntp/dist/lib/isc/win32/include/isc/int.h', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - FBX loader</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
font-family: Monospace;
background-color: #000;
color: #fff;
margin: 0px;
overflow: hidden;
}
#info {
color: #fff;
position: absolute;
top: 10px;
width: 100%;
text-align: center;
z-index: 100;
display:block;
}
#info a, .button { color: #f00; font-weight: bold; text-decoration: underline; cursor: pointer }
</style>
</head>
<body>
<div id="info">
<a href="http://threejs.org" target="_blank">three.js</a> - FBXLoader test
</div>
<script src="../build/three.js"></script>
<script src="js/controls/OrbitControls.js"></script>
<script src="js/curves/NURBSCurve.js"></script>
<script src="js/curves/NURBSUtils.js"></script>
<script src="js/loaders/FBXLoader2.js"></script>
<script src="js/Detector.js"></script>
<script src="js/libs/stats.min.js"></script>
<script>
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
var container, stats, controls;
var camera, scene, renderer, light;
var clock = new THREE.Clock();
var mixers = [];
init();
function init() {
container = document.createElement( 'div' );
document.body.appendChild( container );
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
scene = new THREE.Scene();
// grid
var gridHelper = new THREE.GridHelper( 28, 28, 0x303030, 0x303030 );
gridHelper.position.set( 0, - 0.04, 0 );
scene.add( gridHelper );
// stats
stats = new Stats();
container.appendChild( stats.dom );
// model
var manager = new THREE.LoadingManager();
manager.onProgress = function( item, loaded, total ) {
console.log( item, loaded, total );
};
var onProgress = function( xhr ) {
if ( xhr.lengthComputable ) {
var percentComplete = xhr.loaded / xhr.total * 100;
console.log( Math.round( percentComplete, 2 ) + '% downloaded' );
}
};
var onError = function( xhr ) {
};
var loader = new THREE.FBXLoader( manager );
loader.load( 'models/fbx/xsi_man_skinning.fbx', function( object ) {
object.mixer = new THREE.AnimationMixer( object );
mixers.push( object.mixer );
var action = object.mixer.clipAction( object.animations[ 0 ] );
action.play();
scene.add( object );
}, onProgress, onError );
loader.load( 'models/fbx/nurbs.fbx', function( object ) {
scene.add( object );
}, onProgress, onError );
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
renderer.setClearColor( 0x000000 );
container.appendChild( renderer.domElement );
// controls, camera
controls = new THREE.OrbitControls( camera, renderer.domElement );
controls.target.set( 0, 12, 0 );
camera.position.set( 2, 18, 28 );
controls.update();
window.addEventListener( 'resize', onWindowResize, false );
light = new THREE.HemisphereLight(0xffffff, 0x444444, 1.0);
light.position.set(0, 1, 0);
scene.add(light);
light = new THREE.DirectionalLight(0xffffff, 1.0);
light.position.set(0, 1, 0);
scene.add(light);
animate();
}
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
}
//
function animate() {
requestAnimationFrame( animate );
if ( mixers.length > 0 ) {
for ( var i = 0; i < mixers.length; i ++ ) {
mixers[ i ].update( clock.getDelta() );
}
}
stats.update();
render();
}
function render() {
renderer.render( scene, camera );
}
</script>
</body>
</html>
| {'content_hash': 'ad1205679f9f42ea12b5f557667d688d', 'timestamp': '', 'source': 'github', 'line_count': 183, 'max_line_length': 109, 'avg_line_length': 21.983606557377048, 'alnum_prop': 0.6251553566989808, 'repo_name': 'godlzr/Three.js', 'id': '82e81efda8052487c2f8911d0ac113fe97e59de3', 'size': '4023', 'binary': False, 'copies': '9', 'ref': 'refs/heads/master', 'path': 'examples/webgl_loader_fbx.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '1131'}, {'name': 'C', 'bytes': '80088'}, {'name': 'C++', 'bytes': '116715'}, {'name': 'CSS', 'bytes': '20541'}, {'name': 'GLSL', 'bytes': '31133'}, {'name': 'Groff', 'bytes': '75209'}, {'name': 'HTML', 'bytes': '22711'}, {'name': 'JavaScript', 'bytes': '3209356'}, {'name': 'Python', 'bytes': '448635'}, {'name': 'Shell', 'bytes': '10178'}]} |
/*
Convert a portable pixmap to an AutoCAD slide or DXB file
Author:
John Walker
Autodesk SA
Avenue des Champs-Montants 14b
CH-2074 MARIN
Switzerland
Usenet: [email protected]
Fax: 038/33 88 15
Voice: 038/33 76 33
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, without any conditions or restrictions. This software is
provided "as is" without express or implied warranty.
*/
#include <stdio.h>
#include "ppm.h"
#define TRUE 1
#define FALSE 0
#define EOS '\0'
#define MAXHIST 32767 /* Color histogram maximum size */
static pixel **pixels; /* Input pixel map */
static colorhash_table cht; /* Color hash table */
static int curcol = -1; /* Current slide output color */
static int polymode = FALSE; /* Output filled polygons ? */
static int dxbmode = FALSE; /* Output .dxb format ? */
static int bgcol = -1; /* Screen background color */
static double aspect = 1.0; /* Pixel aspect ratio correction */
static int gamut = 256; /* Output color gamut */
#include "autocad.h" /* AutoCAD standard color assignments */
/* prototypes */
static void outrun ARGS((int color, int ysize, int y, int xstart, int xend));
static void slideout ARGS((int xdots, int ydots, int ncolors,
unsigned char *red, unsigned char *green, unsigned char *blue));
/* OUTRUN -- Output a run of pixels. */
static void outrun(color, ysize, y, xstart, xend)
int color, ysize, y, xstart, xend;
{
if (color == 0) {
return; /* Let screen background handle this */
}
if (curcol != color) {
if (dxbmode) {
putchar((char)136);
(void) pm_writelittleshort(stdout, color);
} else {
(void) pm_writelittleshort(stdout, (short) 0xFF00 | color);
}
curcol = color;
}
if (polymode) {
int v, yb = (ysize - y) + 1, yspan = 1;
/* Since we're emitting filled polygons, let's scan downward
in the pixmap and see if we can extend the run on this line
vertically as well. If so, emit a polygon that handles
both the horizontal and vertical run and clear the pixels
in the subsequent lines to the background color. */
for (v = y + 1; v <= ysize; v++) {
int j, mismatch = FALSE;
for (j = xstart; j <= xend; j++) {
if (PPM_GETR(pixels[y][j]) != PPM_GETR(pixels[v][j])) {
mismatch = TRUE;
break;
}
}
if (mismatch) {
break;
}
for (j = xstart; j <= xend; j++) {
PPM_ASSIGN(pixels[v][j], 0, 0, 0);
}
}
yspan = v - y;
if (dxbmode) {
putchar(11); /* Solid */
(void) pm_writelittleshort(
stdout, (int) (xstart * aspect + 0.4999));
(void) pm_writelittleshort(stdout, yb);
(void) pm_writelittleshort(
stdout, (int) ((xend + 1) * aspect + 0.4999));
(void) pm_writelittleshort(stdout, yb);
(void) pm_writelittleshort(
stdout, (int) (xstart * aspect + 0.4999));
(void) pm_writelittleshort(stdout, yb - yspan);
(void) pm_writelittleshort(
stdout, (int) ((xend + 1) * aspect + 0.4999));
(void) pm_writelittleshort(stdout, yb - yspan);
} else {
(void) pm_writelittleshort(stdout, (short) 0xFD00);
/* Solid fill header */
(void) pm_writelittleshort(stdout, 4);
/* Vertices to follow */
(void) pm_writelittleshort(stdout, -2); /* Fill type */
(void) pm_writelittleshort(stdout, (short)0xFD00);
/* Solid fill vertex */
(void) pm_writelittleshort(stdout, xstart);
(void) pm_writelittleshort(stdout, yb);
(void) pm_writelittleshort(stdout, (short) 0xFD00);
/* Solid fill vertex */
(void) pm_writelittleshort(stdout, xend + 1);
(void) pm_writelittleshort(stdout, yb);
(void) pm_writelittleshort(stdout, (short) 0xFD00);
/* Solid fill vertex */
(void) pm_writelittleshort(stdout, xend + 1);
(void) pm_writelittleshort(stdout, yb - yspan);
(void) pm_writelittleshort(stdout, (short) 0xFD00);
/* Solid fill vertex */
(void) pm_writelittleshort(stdout, xstart);
(void) pm_writelittleshort(stdout, yb - yspan);
(void) pm_writelittleshort(stdout, (short) 0xFD00);
/* Solid fill trailer */
(void) pm_writelittleshort(stdout, 4); /* Vertices that precede */
(void) pm_writelittleshort(stdout, -2); /* Fill type */
}
} else {
(void) pm_writelittleshort(stdout, xstart); /* Vector: From X */
(void) pm_writelittleshort(stdout, ysize - y); /* From Y */
(void) pm_writelittleshort(stdout, xend); /* To X */
(void) pm_writelittleshort(stdout, ysize - y); /* To Y */
}
}
/* SLIDEOUT -- Write an AutoCAD slide. */
static void slideout(xdots, ydots, ncolors, red, green, blue)
int xdots, ydots, ncolors;
unsigned char *red, *green, *blue;
{
static char sldhead[18] = "AutoCAD Slide\r\n\32";
static char dxbhead[20] = "AutoCAD DXB 1.0\r\n\32";
unsigned char *acadmap;
int i, xsize, ysize;
/* If the user has specified a non-black screen background color,
swap the screen background color into color index zero and
move black into the slot previously occupied by the background
color. */
if (bgcol > 0) {
acadcol[0][0] = acadcol[bgcol][0];
acadcol[0][1] = acadcol[bgcol][1];
acadcol[0][2] = acadcol[bgcol][2];
acadcol[bgcol][0] = acadcol[bgcol][1] = acadcol[bgcol][2] = 0;
}
acadmap = (unsigned char *) pm_allocrow(ncolors, sizeof(unsigned char));
xsize = polymode ? xdots : (xdots - 1);
ysize = polymode ? ydots : (ydots - 1);
if (dxbmode) {
fwrite(dxbhead, 19, 1, stdout); /* DXB file header */
putchar((char)135); /* Number mode */
(void) pm_writelittleshort(stdout, 0); /* ...short integers */
} else {
fwrite(sldhead, 17, 1, stdout); /* Slide file header */
putchar(86); /* Number format indicator */
putchar(2); /* File level number */
(void) pm_writelittleshort(stdout, xsize); /* Max X co-ordinate value */
(void) pm_writelittleshort(stdout, ysize); /* Max Y co-ordinate value */
/* Aspect ratio indicator */
(void) pm_writelittlelong(
stdout, (long) ((((double) xsize) / ysize) * aspect * 1E7));
(void) pm_writelittleshort(stdout, 2); /* Polygon fill type */
(void) pm_writelittleshort(stdout, 0x1234); /* Byte order indicator */
}
/* Now build a mapping from the image's computed color map
indices to the closest representation of each color within
AutoCAD's color repertoire. */
for (i = 0; i < ncolors; i++) {
int best, j;
long dist = 3 * 256 * 256;
for (j = 0; j < gamut; j++) {
long dr = red[i] - acadcol[j][0],
dg = green[i] - acadcol[j][1],
db = blue[i] - acadcol[j][2];
long tdist = dr * dr + dg * dg + db * db;
if (tdist < dist) {
dist = tdist;
best = j;
}
}
acadmap[i] = best;
}
/* Swoop over the entire map and replace each RGB pixel with its
closest AutoCAD color representation. We do this in a
separate pass since it avoids repetitive mapping of pixels as
we examine them for compression. */
for (i = 0; i < ydots; i++) {
int x;
for (x = 0; x < xdots; x++) {
PPM_ASSIGN(pixels[i][x],
acadmap[ppm_lookupcolor(cht, &pixels[i][x])], 0 ,0);
}
}
/* Output a run-length encoded expression of the pixmap as AutoCAD
vectors. */
for (i = 0; i < ydots; i++) {
int x, rx, rpix = -1, nrun = 0;
for (x = 0; x < xdots; x++) {
int pix = PPM_GETR(pixels[i][x]);
if (pix != rpix) {
if (nrun > 0) {
if (rpix > 0) {
outrun(rpix, ydots - 1, i, rx, x - 1);
}
}
rpix = pix;
rx = x;
nrun = 1;
}
}
if ((nrun > 0) && (rpix > 0)) {
outrun(rpix, ydots - 1, i, rx, xdots - 1);
}
}
if (dxbmode) {
putchar(0); /* DXB end sentinel */
} else {
(void) pm_writelittleshort(stdout, (short) 0xFC00);
/* End of file marker */
}
pm_freerow((char *) acadmap);
}
/* Main program. */
int main(argc, argv)
int argc;
char* argv[];
{
FILE *ifp;
int argn, rows, cols, ncolors, i;
int aspectspec = FALSE;
pixval maxval;
colorhist_vector chv;
unsigned char *Red, *Green, *Blue;
const char * const usage =
"[-poly] [-dxb] [-white] [-background <col>]\n\
[-aspect <f>] [-8] [ppmfile]";
ppm_init(&argc, argv);
argn = 1;
while (argn < argc && argv[argn][0] == '-' && argv[argn][1] != EOS) {
if (pm_keymatch(argv[argn], "-dxb", 2)) {
dxbmode = polymode = TRUE;
} else if (pm_keymatch(argv[argn], "-poly", 2)) {
polymode = TRUE;
} else if (pm_keymatch(argv[argn], "-white", 2)) {
if (bgcol >= 0) {
pm_error("already specified a background color");
}
bgcol = 7;
} else if (pm_keymatch(argv[argn], "-background", 2)) {
if (bgcol >= 0) {
pm_error("already specified a background color");
}
argn++;
if ((argn == argc) || (sscanf(argv[argn], "%d", &bgcol) != 1))
pm_usage(usage);
if (bgcol < 0) {
pm_error("background color must be >= 0 and <= 255");
}
} else if (pm_keymatch(argv[argn], "-aspect", 2)) {
if (aspectspec) {
pm_error("already specified an aspect ratio");
}
argn++;
if ((argn == argc) || (sscanf(argv[argn], "%lf", &aspect) != 1))
pm_usage(usage);
if (aspect <= 0.0) {
pm_error("aspect ratio must be greater than 0");
}
aspectspec = TRUE;
} else if (pm_keymatch(argv[argn], "-8", 2)) {
gamut = 8;
} else {
pm_usage(usage);
}
argn++;
}
if (argn < argc) {
ifp = pm_openr(argv[argn]);
argn++;
} else {
ifp = stdin;
}
if (argn != argc) {
pm_usage(usage);
}
pixels = ppm_readppm(ifp, &cols, &rows, &maxval);
pm_close(ifp);
/* Figure out the colormap. Logic for squeezing depth to limit the
number of colors in the image was swiped from ppmquant.c. */
while (TRUE) {
int row, col;
pixval newmaxval;
pixel *pP;
pm_message("computing colormap...");
chv = ppm_computecolorhist(pixels, cols, rows, MAXHIST, &ncolors);
if (chv != (colorhist_vector) 0)
break;
newmaxval = maxval / 2;
pm_message(
"scaling colors from maxval=%d to maxval=%d to improve clustering...",
maxval, newmaxval );
for (row = 0; row < rows; ++row) {
for (col = 0, pP = pixels[row]; col < cols; ++col, ++pP) {
PPM_DEPTH(*pP, *pP, maxval, newmaxval);
}
}
maxval = newmaxval;
}
pm_message("%d colors found", ncolors);
/* Scale the color map derived for the PPM file into one compatible
with AutoCAD's convention of 8 bit intensities. */
if (maxval != 255) {
pm_message("maxval is not 255 - automatically rescaling colors");
}
Red = (unsigned char *) pm_allocrow(ncolors, sizeof(unsigned char));
Green = (unsigned char *) pm_allocrow(ncolors, sizeof(unsigned char));
Blue = (unsigned char *) pm_allocrow(ncolors, sizeof(unsigned char));
for (i = 0; i < ncolors; ++i) {
if ( maxval == 255 ) {
Red[i] = PPM_GETR(chv[i].color);
Green[i] = PPM_GETG(chv[i].color);
Blue[i] = PPM_GETB( chv[i].color );
} else {
Red[i] = ((int) PPM_GETR(chv[i].color) * 255) / maxval;
Green[i] = ((int) PPM_GETG(chv[i].color) * 255) / maxval;
Blue[i] = ((int) PPM_GETB(chv[i].color) * 255) / maxval;
}
}
/* And make a hash table for fast lookup. */
cht = ppm_colorhisttocolorhash(chv, ncolors);
ppm_freecolorhist(chv);
slideout(cols, rows, ncolors, Red, Green, Blue);
pm_freerow((char *) Red);
pm_freerow((char *) Green);
pm_freerow((char *) Blue);
exit(0);
}
| {'content_hash': '58b87a817dee9963d2345e2aeb671e84', 'timestamp': '', 'source': 'github', 'line_count': 394, 'max_line_length': 80, 'avg_line_length': 34.494923857868024, 'alnum_prop': 0.5077624898830109, 'repo_name': 'ownclo/jpeg-on-steroids', 'id': '4f927f028deb924482654aaa00d9d144ee6e6868', 'size': '13591', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'vendor/C/netpbm/converter/ppm/ppmtoacad.c', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Haskell', 'bytes': '18684'}]} |
// T4 code generation is enabled for model 'E:\WebProjects\tds-socio\BeyondThemes.BeyondAdmin\azure_sociodataEntities.edmx'.
// To enable legacy code generation, change the value of the 'Code Generation Strategy' designer
// property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model
// is open in the designer.
// If no context and entity classes have been generated, it may be because you created an empty model but
// have not yet chosen which version of Entity Framework to use. To generate a context class and entity
// classes for your model, open the model in the designer, right-click on the designer surface, and
// select 'Update Model from Database...', 'Generate Database from Model...', or 'Add Code Generation
// Item...'. | {'content_hash': '91772aaa476b8e69df463fe4c166197c', 'timestamp': '', 'source': 'github', 'line_count': 10, 'max_line_length': 126, 'avg_line_length': 78.3, 'alnum_prop': 0.768837803320562, 'repo_name': 'lakshmanpilaka/tds-socio', 'id': '158ed47047ec40b0a7580da8bac2d6e85411231f', 'size': '785', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'BeyondThemes.BeyondAdmin/azure_sociodataEntities.Designer.cs', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'ASP', 'bytes': '100'}, {'name': 'C#', 'bytes': '299697'}, {'name': 'CSS', 'bytes': '50356'}, {'name': 'JavaScript', 'bytes': '1657676'}, {'name': 'PHP', 'bytes': '1443'}]} |
<?xml version="1.0" encoding="UTF-8"?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:08:04">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:pdf="http://ns.adobe.com/pdf/1.3/">
<pdf:Producer>intarsys PDF/A Live! 6.0.1</pdf:Producer>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xmp="http://ns.adobe.com/xap/1.0/">
<xmp:ModifyDate>2013-06-10T15:10:31+02:00</xmp:ModifyDate>
<xmp:CreateDate>2013-06-05T11:05:41+02:00</xmp:CreateDate>
<xmp:CreatorTool>intarsys PDF/A Live! 6.0.1 FeRD Extension</xmp:CreatorTool>
<xmp:MetadataDate>2013-06-10T15:10:31+02:00</xmp:MetadataDate>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#">
<xmpMM:DocumentID>uuid:a5437ca7-05db-11ee-0000-3ab0dc3f3f2a</xmpMM:DocumentID>
<xmpMM:VersionID>0</xmpMM:VersionID>
<xmpMM:InstanceID>uuid:c97f9264-aa8d-47e1-acc2-3e2b727a7215</xmpMM:InstanceID>
<xmpMM:History>
<rdf:Seq>
<rdf:li rdf:parseType="Resource">
<rdf:value rdf:parseType="Resource">
<stEvt:action>edited</stEvt:action>
<stEvt:softwareAgent>CABAReT Stage</stEvt:softwareAgent>
<stEvt:parameters>XMP by CABAReT Stage</stEvt:parameters>
<stEvt:when>2013-06-05T11:05:41+02:00</stEvt:when>
</rdf:value>
<rdf:type>http://ns.adobe.com/xap/1.0/sType/Version#:event</rdf:type>
</rdf:li>
</rdf:Seq>
</xmpMM:History>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:format>application/pdf</dc:format>
<dc:title>
<rdf:Alt>
<rdf:li xml:lang="x-default">(Beispielrechnung_ZUGFeRD_RC_COMFORT.xlsx)</rdf:li>
</rdf:Alt>
</dc:title>
<dc:creator>
<rdf:Seq>
<rdf:li>(Dr. Bernd Wild)</rdf:li>
</rdf:Seq>
</dc:creator>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/">
<pdfaid:conformance>B</pdfaid:conformance>
<pdfaid:part>3</pdfaid:part>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:zf="urn:ferd:pdfa:invoice:rc">
<zf:ConformanceLevel>COMFORT</zf:ConformanceLevel>
<zf:DocumentFileName>ZUGFeRD-invoice.xml</zf:DocumentFileName>
<zf:DocumentType>INVOICE</zf:DocumentType>
<zf:Version>RC</zf:Version>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/"
xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#"
xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#">
<pdfaExtension:schemas>
<rdf:Bag>
<rdf:li rdf:parseType="Resource">
<pdfaSchema:schema>ZUGFeRD PDFA Extension Schema</pdfaSchema:schema>
<pdfaSchema:namespaceURI>urn:ferd:pdfa:invoice:rc</pdfaSchema:namespaceURI>
<pdfaSchema:prefix>zf</pdfaSchema:prefix>
<pdfaSchema:property>
<rdf:Seq>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>DocumentFileName</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
<pdfaProperty:category>external</pdfaProperty:category>
<pdfaProperty:description>name of the embedded XML invoice file</pdfaProperty:description>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>DocumentType</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
<pdfaProperty:category>external</pdfaProperty:category>
<pdfaProperty:description>INVOICE</pdfaProperty:description>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>Version</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
<pdfaProperty:category>external</pdfaProperty:category>
<pdfaProperty:description>The actual version of the ZUGFeRD data</pdfaProperty:description>
</rdf:li>
<rdf:li rdf:parseType="Resource">
<pdfaProperty:name>ConformanceLevel</pdfaProperty:name>
<pdfaProperty:valueType>Text</pdfaProperty:valueType>
<pdfaProperty:category>external</pdfaProperty:category>
<pdfaProperty:description>The conformance level of the ZUGFeRD data</pdfaProperty:description>
</rdf:li>
</rdf:Seq>
</pdfaSchema:property>
</rdf:li>
</rdf:Bag>
</pdfaExtension:schemas>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
| {'content_hash': 'fb899c1b1fed744ff6fd2415adcacd2c', 'timestamp': '', 'source': 'github', 'line_count': 104, 'max_line_length': 121, 'avg_line_length': 53.25, 'alnum_prop': 0.5597688696280245, 'repo_name': 'opendatalab-de/zugferd', 'id': '2044fc825f88266a455fd7b20d12e2d7994572b2', 'size': '5538', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/test/resources/metadata.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '8653'}]} |
const IsThere = require("../lib");
// Sync
console.log(IsThere(`${__dirname}/contents/file`))
// => true
console.log(IsThere.directory(`${__dirname}/contents/dir`))
// Callback
IsThere.file(`${__dirname}/contents/not_found`, exists => {
console.log(exists)
// => false
})
// Promises
IsThere.promises.directory(`${__dirname}/contents/dir`).then(exists => {
console.log(exists)
// => true
}).catch(console.error)
| {'content_hash': 'ed93649ef4ffdaf34cf406617895d1de', 'timestamp': '', 'source': 'github', 'line_count': 18, 'max_line_length': 72, 'avg_line_length': 23.944444444444443, 'alnum_prop': 0.6403712296983759, 'repo_name': 'IonicaBizau/node-is-there', 'id': '63fd22c3a199f408ea9adedc43bff28a6e1a340b', 'size': '431', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'example/index.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '7263'}]} |
FROM balenalib/generic-armv7ahf-debian:buster-build
# remove several traces of debian python
RUN apt-get purge -y python.*
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# key 63C7CC90: public key "Simon McVittie <[email protected]>" imported
# key 3372DCFA: public key "Donald Stufft (dstufft) <[email protected]>" imported
RUN gpg --batch --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \
&& gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059
ENV PYTHON_VERSION 3.9.10
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 21.3.1
ENV SETUPTOOLS_VERSION 60.5.4
RUN set -x \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-armv7hf-libffi3.2.tar.gz" \
&& echo "41a01b86463a3585c8f098685e80eaefb8e2027a333f48419f81e83d1e6db8b4 Python-$PYTHON_VERSION.linux-armv7hf-libffi3.2.tar.gz" | sha256sum -c - \
&& tar -xzf "Python-$PYTHON_VERSION.linux-armv7hf-libffi3.2.tar.gz" --strip-components=1 \
&& rm -rf "Python-$PYTHON_VERSION.linux-armv7hf-libffi3.2.tar.gz" \
&& ldconfig \
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \
&& echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \
&& python3 get-pip.py \
&& rm get-pip.py \
; fi \
&& pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& cd / \
&& rm -rf /usr/src/python ~/.cache
# install "virtualenv", since the vast majority of users of this image will want it
RUN pip3 install --no-cache-dir virtualenv
ENV PYTHON_DBUS_VERSION 1.2.18
# install dbus-python dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libdbus-1-dev \
libdbus-glib-1-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get -y autoremove
# install dbus-python
RUN set -x \
&& mkdir -p /usr/src/dbus-python \
&& curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz" -o dbus-python.tar.gz \
&& curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz.asc" -o dbus-python.tar.gz.asc \
&& gpg --verify dbus-python.tar.gz.asc \
&& tar -xzC /usr/src/dbus-python --strip-components=1 -f dbus-python.tar.gz \
&& rm dbus-python.tar.gz* \
&& cd /usr/src/dbus-python \
&& PYTHON_VERSION=$(expr match "$PYTHON_VERSION" '\([0-9]*\.[0-9]*\)') ./configure \
&& make -j$(nproc) \
&& make install -j$(nproc) \
&& cd / \
&& rm -rf /usr/src/dbus-python
# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -sf pip3 pip \
&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
&& ln -sf idle3 idle \
&& ln -sf pydoc3 pydoc \
&& ln -sf python3 python \
&& ln -sf python3-config python-config
# set PYTHONPATH to point to dist-packages
ENV PYTHONPATH /usr/lib/python3/dist-packages:$PYTHONPATH
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/[email protected]" \
&& echo "Running test-stack@python" \
&& chmod +x [email protected] \
&& bash [email protected] \
&& rm -rf [email protected]
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Debian Buster \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.9.10, Pip v21.3.1, Setuptools v60.5.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | {'content_hash': 'cac65912567ab72235e5061bf7357b10', 'timestamp': '', 'source': 'github', 'line_count': 95, 'max_line_length': 711, 'avg_line_length': 50.93684210526316, 'alnum_prop': 0.7038644348005786, 'repo_name': 'resin-io-library/base-images', 'id': 'a46088852c9310915beb8336c92376eb5fc69a49', 'size': '4860', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'balena-base-images/python/generic-armv7ahf/debian/buster/3.9.10/build/Dockerfile', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Dockerfile', 'bytes': '71234697'}, {'name': 'JavaScript', 'bytes': '13096'}, {'name': 'Shell', 'bytes': '12051936'}, {'name': 'Smarty', 'bytes': '59789'}]} |
function [spike] = ft_read_spike(filename, varargin);
% FT_READ_SPIKE reads spike timestamps and waveforms from various data
% formats.
%
% Use as
% [spike] = ft_read_spike(filename, ...)
%
% Additional options should be specified in key-value pairs and can be
% 'spikeformat'
%
% The output spike structure contains
% spike.label = 1xNchans cell-array, with channel labels
% spike.waveform = 1xNchans cell-array, each element contains a matrix (Nsamples X Nspikes)
% spike.timestamp = 1xNchans cell-array, each element contains a vector (1 X Nspikes)
% spike.unit = 1xNchans cell-array, each element contains a vector (1 X Nspikes)
%
% See also FT_READ_HEADER, FT_READ_DATA, FT_READ_EVENT
% Copyright (C) 2007-2010 Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.ru.nl/neuroimaging/fieldtrip
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% FieldTrip is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id: ft_read_spike.m 1981 2010-10-27 10:47:32Z jansch $
% get the options
spikeformat = keyval('spikeformat', varargin);
% determine the filetype
if isempty(spikeformat)
spikeformat = ft_filetype(filename);
end
switch spikeformat
case {'neuralynx_ncs' 'plexon_ddt'}
% these files only contain continuous data
error('file does not contain spike timestamps or waveforms');
case 'matlab'
% plain matlab file with a single variable in it
load(filename, 'spike');
case 'mclust_t'
fp = fopen(filename, 'rb', 'ieee-le');
H = ReadHeader(fp);
fclose(fp);
% read only from one file
S = LoadSpikes({filename});
spike.hdr = H(:);
spike.timestamp = S;
[p, f, x] = fileparts(filename);
spike.label = {f}; % use the filename as label for the spike channel
spike.waveform = {}; % this is unknown
spike.unit = {}; % this is unknown
case 'neuralynx_nse'
% single channel file, read all records
nse = read_neuralynx_nse(filename);
if isfield(nse.hdr, 'NLX_Base_Class_Name')
spike.label = {nse.hdr.NLX_Base_Class_Name};
else
spike.label = {nse.hdr.AcqEntName};
end
spike.timestamp = {nse.TimeStamp};
spike.waveform = {nse.dat};
spike.unit = {nse.CellNumber};
spike.hdr = nse.hdr;
case 'neuralynx_nst'
% single channel stereotrode file, read all records
nst = read_neuralynx_nst(filename, 1, inf);
if isfield(nst.hdr, 'NLX_Base_Class_Name')
spike.label = {nst.hdr.NLX_Base_Class_Name};
else
spike.label = {nst.hdr.AcqEntName};
end
spike.timestamp = {nst.TimeStamp};
spike.waveform = {nst.dat};
spike.unit = {nst.CellNumber};
spike.hdr = nst.hdr;
case 'neuralynx_ntt'
% single channel stereotrode file, read all records
ntt = read_neuralynx_ntt(filename);
if isfield(ntt.hdr, 'NLX_Base_Class_Name')
spike.label = {ntt.hdr.NLX_Base_Class_Name};
else
spike.label = {ntt.hdr.AcqEntName};
end
spike.timestamp = {ntt.TimeStamp};
spike.waveform = {ntt.dat};
spike.unit = {ntt.CellNumber};
spike.hdr = ntt.hdr;
case 'neuralynx_nts'
% single channel file, read all records
nts = read_neuralynx_nts(filename);
if isfield(nte.hdr, 'NLX_Base_Class_Name')
spike.label = {nts.hdr.NLX_Base_Class_Name};
else
spike.label = {nts.hdr.AcqEntName};
end
spike.timestamp = {nts.TimeStamp(:)'};
spike.waveform = {zeros(0,length(nts.TimeStamp))}; % does not contain waveforms
spike.unit = {zeros(0,length(nts.TimeStamp))}; % does not contain units
spike.hdr = nts.hdr;
case 'plexon_nex'
% a single file can contain multiple channels of different types
hdr = read_plexon_nex(filename);
typ = [hdr.VarHeader.Type];
chan = 0;
spike.label = {};
spike.waveform = {};
spike.unit = {};
spike.timestamp = {};
for i=1:length(typ)
if typ(i)==0
% neurons, only timestamps
nex = read_plexon_nex(filename, 'channel', i);
nspike = length(nex.ts);
chan = chan + 1;
spike.label{chan} = deblank(hdr.VarHeader(i).Name);
spike.waveform{chan} = zeros(0, nspike);
spike.unit{chan} = nan*ones(1,nspike);
spike.timestamp{chan} = nex.ts;
elseif typ(i)==3
% neurons, timestamps and waveforms
nex = read_plexon_nex(filename, 'channel', i);
chan = chan + 1;
nspike = length(nex.ts);
spike.label{chan} = deblank(hdr.VarHeader(i).Name);
spike.waveform{chan} = nex.dat;
spike.unit{chan} = nan*ones(1,nspike);
spike.timestamp{chan} = nex.ts;
end
end
spike.hdr = hdr;
case 'plexon_plx'
% read the header information
hdr = read_plexon_plx(filename);
nchan = length(hdr.ChannelHeader);
typ = [hdr.DataBlockHeader.Type];
unit = [hdr.DataBlockHeader.Unit];
chan = [hdr.DataBlockHeader.Channel];
for i=1:nchan
% select the data blocks that contain spike waveforms and that belong to this channel
sel = (typ==1 & chan==hdr.ChannelHeader(i).Channel);
if any(sel)
% get the timestamps that correspond with this spike channel
tsl = [hdr.DataBlockHeader(sel).TimeStamp];
tsh = [hdr.DataBlockHeader(sel).UpperByteOf5ByteTimestamp];
% convert the 16 bit high timestamp into a 32 bit integer
ts = timestamp_plexon(tsl, tsh);
spike.timestamp{i} = ts;
spike.unit{i} = unit(sel);
else
% this spike channel is empty
spike.timestamp{i} = [];
spike.unit{i} = [];
end
end
for i=1:nchan
spike.label{i} = deblank(hdr.ChannelHeader(i).Name);
spike.waveform{i} = read_plexon_plx(filename, 'ChannelIndex', i, 'header', hdr);
end
spike.hdr = hdr;
case 'neuroshare' % NOTE: still under development
% check that the required neuroshare toolbox is available
ft_hastoolbox('neuroshare', 1);
tmp = read_neuroshare(filename, 'readspike', 'yes');
spike.label = {tmp.hdr.entityinfo(tmp.list.segment).EntityLabel};
for i=1:length(spike.label)
spike.waveform{i} = tmp.spikew.data(:,:,i);
spike.timestamp{i} = tmp.spikew.timestamp(:,i)';
spike.unit{i} = tmp.spikew.unitID(:,i)';
end
otherwise
error('unsupported data format');
end
| {'content_hash': 'a93d15f08da949f3581be0c08b5c6987', 'timestamp': '', 'source': 'github', 'line_count': 203, 'max_line_length': 94, 'avg_line_length': 34.45320197044335, 'alnum_prop': 0.63768944809837, 'repo_name': 'jimmyshen007/NeMo', 'id': '02487ab79a02eb6d8c3d188e7bea05e81a332d77', 'size': '6994', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'mymfiles/spm8/external/fieldtrip/fileio/ft_read_spike.m', 'mode': '33261', 'license': 'bsd-2-clause', 'language': [{'name': 'C', 'bytes': '1151672'}, {'name': 'C++', 'bytes': '3310'}, {'name': 'M', 'bytes': '995814'}, {'name': 'Mathematica', 'bytes': '122494'}, {'name': 'Matlab', 'bytes': '5692710'}, {'name': 'Mercury', 'bytes': '2633349'}, {'name': 'Objective-C', 'bytes': '245514'}, {'name': 'Perl', 'bytes': '7850'}, {'name': 'R', 'bytes': '12651'}, {'name': 'Ruby', 'bytes': '15824'}, {'name': 'TeX', 'bytes': '1035980'}]} |
package local
import (
"fmt"
"os"
"path"
"syscall"
"testing"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
utiltesting "k8s.io/client-go/util/testing"
"k8s.io/kubernetes/pkg/volume"
volumetest "k8s.io/kubernetes/pkg/volume/testing"
)
const (
testPVName = "pvA"
testMountPath = "pods/poduid/volumes/kubernetes.io~local-volume/pvA"
testNodeName = "fakeNodeName"
)
func getPlugin(t *testing.T) (string, volume.VolumePlugin) {
tmpDir, err := utiltesting.MkTmpdir("localVolumeTest")
if err != nil {
t.Fatalf("can't make a temp dir: %v", err)
}
plugMgr := volume.VolumePluginMgr{}
plugMgr.InitPlugins(ProbeVolumePlugins(), nil /* prober */, volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
plug, err := plugMgr.FindPluginByName(localVolumePluginName)
if err != nil {
os.RemoveAll(tmpDir)
t.Fatalf("Can't find the plugin by name")
}
if plug.GetPluginName() != localVolumePluginName {
t.Errorf("Wrong name: %s", plug.GetPluginName())
}
return tmpDir, plug
}
func getPersistentPlugin(t *testing.T) (string, volume.PersistentVolumePlugin) {
tmpDir, err := utiltesting.MkTmpdir("localVolumeTest")
if err != nil {
t.Fatalf("can't make a temp dir: %v", err)
}
plugMgr := volume.VolumePluginMgr{}
plugMgr.InitPlugins(ProbeVolumePlugins(), nil /* prober */, volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
plug, err := plugMgr.FindPersistentPluginByName(localVolumePluginName)
if err != nil {
os.RemoveAll(tmpDir)
t.Fatalf("Can't find the plugin by name")
}
if plug.GetPluginName() != localVolumePluginName {
t.Errorf("Wrong name: %s", plug.GetPluginName())
}
return tmpDir, plug
}
func getTestVolume(readOnly bool, path string) *volume.Spec {
pv := &v1.PersistentVolume{
ObjectMeta: metav1.ObjectMeta{
Name: testPVName,
},
Spec: v1.PersistentVolumeSpec{
PersistentVolumeSource: v1.PersistentVolumeSource{
Local: &v1.LocalVolumeSource{
Path: path,
},
},
},
}
return volume.NewSpecFromPersistentVolume(pv, readOnly)
}
func TestCanSupport(t *testing.T) {
tmpDir, plug := getPlugin(t)
defer os.RemoveAll(tmpDir)
if !plug.CanSupport(getTestVolume(false, tmpDir)) {
t.Errorf("Expected true")
}
}
func TestGetAccessModes(t *testing.T) {
tmpDir, plug := getPersistentPlugin(t)
defer os.RemoveAll(tmpDir)
modes := plug.GetAccessModes()
if !volumetest.ContainsAccessMode(modes, v1.ReadWriteOnce) {
t.Errorf("Expected AccessModeType %q", v1.ReadWriteOnce)
}
if volumetest.ContainsAccessMode(modes, v1.ReadWriteMany) {
t.Errorf("Found AccessModeType %q, expected not", v1.ReadWriteMany)
}
if volumetest.ContainsAccessMode(modes, v1.ReadOnlyMany) {
t.Errorf("Found AccessModeType %q, expected not", v1.ReadOnlyMany)
}
}
func TestGetVolumeName(t *testing.T) {
tmpDir, plug := getPersistentPlugin(t)
defer os.RemoveAll(tmpDir)
volName, err := plug.GetVolumeName(getTestVolume(false, tmpDir))
if err != nil {
t.Errorf("Failed to get volume name: %v", err)
}
if volName != testPVName {
t.Errorf("Expected volume name %q, got %q", testPVName, volName)
}
}
func TestInvalidLocalPath(t *testing.T) {
tmpDir, plug := getPlugin(t)
defer os.RemoveAll(tmpDir)
pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}}
mounter, err := plug.NewMounter(getTestVolume(false, "/no/backsteps/allowed/.."), pod, volume.VolumeOptions{})
if err != nil {
t.Fatal(err)
}
err = mounter.SetUp(nil)
expectedMsg := "invalid path: /no/backsteps/allowed/.. must not contain '..'"
if err.Error() != expectedMsg {
t.Fatalf("expected error `%s` but got `%s`", expectedMsg, err)
}
}
func TestMountUnmount(t *testing.T) {
tmpDir, plug := getPlugin(t)
defer os.RemoveAll(tmpDir)
pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}}
mounter, err := plug.NewMounter(getTestVolume(false, tmpDir), pod, volume.VolumeOptions{})
if err != nil {
t.Errorf("Failed to make a new Mounter: %v", err)
}
if mounter == nil {
t.Fatalf("Got a nil Mounter")
}
volPath := path.Join(tmpDir, testMountPath)
path := mounter.GetPath()
if path != volPath {
t.Errorf("Got unexpected path: %s", path)
}
if err := mounter.SetUp(nil); err != nil {
t.Errorf("Expected success, got: %v", err)
}
if _, err := os.Stat(path); err != nil {
if os.IsNotExist(err) {
t.Errorf("SetUp() failed, volume path not created: %s", path)
} else {
t.Errorf("SetUp() failed: %v", err)
}
}
unmounter, err := plug.NewUnmounter(testPVName, pod.UID)
if err != nil {
t.Errorf("Failed to make a new Unmounter: %v", err)
}
if unmounter == nil {
t.Fatalf("Got a nil Unmounter")
}
if err := unmounter.TearDown(); err != nil {
t.Errorf("Expected success, got: %v", err)
}
if _, err := os.Stat(path); err == nil {
t.Errorf("TearDown() failed, volume path still exists: %s", path)
} else if !os.IsNotExist(err) {
t.Errorf("SetUp() failed: %v", err)
}
}
func testFSGroupMount(plug volume.VolumePlugin, pod *v1.Pod, tmpDir string, fsGroup int64) error {
mounter, err := plug.NewMounter(getTestVolume(false, tmpDir), pod, volume.VolumeOptions{})
if err != nil {
return err
}
if mounter == nil {
return fmt.Errorf("Got a nil Mounter")
}
volPath := path.Join(tmpDir, testMountPath)
path := mounter.GetPath()
if path != volPath {
return fmt.Errorf("Got unexpected path: %s", path)
}
if err := mounter.SetUp(&fsGroup); err != nil {
return err
}
return nil
}
func TestFSGroupMount(t *testing.T) {
tmpDir, plug := getPlugin(t)
defer os.RemoveAll(tmpDir)
info, err := os.Stat(tmpDir)
if err != nil {
t.Errorf("Error getting stats for %s (%v)", tmpDir, err)
}
s := info.Sys().(*syscall.Stat_t)
if s == nil {
t.Errorf("Error getting stats for %s (%v)", tmpDir, err)
}
fsGroup1 := int64(s.Gid)
fsGroup2 := fsGroup1 + 1
pod1 := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}}
pod1.Spec.SecurityContext = &v1.PodSecurityContext{
FSGroup: &fsGroup1,
}
pod2 := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}}
pod2.Spec.SecurityContext = &v1.PodSecurityContext{
FSGroup: &fsGroup2,
}
err = testFSGroupMount(plug, pod1, tmpDir, fsGroup1)
if err != nil {
t.Errorf("Failed to make a new Mounter: %v", err)
}
err = testFSGroupMount(plug, pod2, tmpDir, fsGroup2)
if err != nil {
t.Errorf("Failed to make a new Mounter: %v", err)
}
//Checking if GID of tmpDir has not been changed by mounting it by second pod
s = info.Sys().(*syscall.Stat_t)
if s == nil {
t.Errorf("Error getting stats for %s (%v)", tmpDir, err)
}
if fsGroup1 != int64(s.Gid) {
t.Errorf("Old Gid %d for volume %s got overwritten by new Gid %d", fsGroup1, tmpDir, int64(s.Gid))
}
}
func TestConstructVolumeSpec(t *testing.T) {
tmpDir, plug := getPlugin(t)
defer os.RemoveAll(tmpDir)
volPath := path.Join(tmpDir, testMountPath)
spec, err := plug.ConstructVolumeSpec(testPVName, volPath)
if err != nil {
t.Errorf("ConstructVolumeSpec() failed: %v", err)
}
if spec == nil {
t.Fatalf("ConstructVolumeSpec() returned nil")
}
volName := spec.Name()
if volName != testPVName {
t.Errorf("Expected volume name %q, got %q", testPVName, volName)
}
if spec.Volume != nil {
t.Errorf("Volume object returned, expected nil")
}
pv := spec.PersistentVolume
if pv == nil {
t.Fatalf("PersistentVolume object nil")
}
ls := pv.Spec.PersistentVolumeSource.Local
if ls == nil {
t.Fatalf("LocalVolumeSource object nil")
}
}
func TestPersistentClaimReadOnlyFlag(t *testing.T) {
tmpDir, plug := getPlugin(t)
defer os.RemoveAll(tmpDir)
// Read only == true
pod := &v1.Pod{ObjectMeta: metav1.ObjectMeta{UID: types.UID("poduid")}}
mounter, err := plug.NewMounter(getTestVolume(true, tmpDir), pod, volume.VolumeOptions{})
if err != nil {
t.Errorf("Failed to make a new Mounter: %v", err)
}
if mounter == nil {
t.Fatalf("Got a nil Mounter")
}
if !mounter.GetAttributes().ReadOnly {
t.Errorf("Expected true for mounter.IsReadOnly")
}
// Read only == false
mounter, err = plug.NewMounter(getTestVolume(false, tmpDir), pod, volume.VolumeOptions{})
if err != nil {
t.Errorf("Failed to make a new Mounter: %v", err)
}
if mounter == nil {
t.Fatalf("Got a nil Mounter")
}
if mounter.GetAttributes().ReadOnly {
t.Errorf("Expected false for mounter.IsReadOnly")
}
}
func TestUnsupportedPlugins(t *testing.T) {
tmpDir, err := utiltesting.MkTmpdir("localVolumeTest")
if err != nil {
t.Fatalf("can't make a temp dir: %v", err)
}
defer os.RemoveAll(tmpDir)
plugMgr := volume.VolumePluginMgr{}
plugMgr.InitPlugins(ProbeVolumePlugins(), nil /* prober */, volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
spec := getTestVolume(false, tmpDir)
recyclePlug, err := plugMgr.FindRecyclablePluginBySpec(spec)
if err == nil && recyclePlug != nil {
t.Errorf("Recyclable plugin found, expected none")
}
deletePlug, err := plugMgr.FindDeletablePluginByName(localVolumePluginName)
if err == nil && deletePlug != nil {
t.Errorf("Deletable plugin found, expected none")
}
attachPlug, err := plugMgr.FindAttachablePluginByName(localVolumePluginName)
if err == nil && attachPlug != nil {
t.Errorf("Attachable plugin found, expected none")
}
createPlug, err := plugMgr.FindCreatablePluginBySpec(spec)
if err == nil && createPlug != nil {
t.Errorf("Creatable plugin found, expected none")
}
provisionPlug, err := plugMgr.FindProvisionablePluginByName(localVolumePluginName)
if err == nil && provisionPlug != nil {
t.Errorf("Provisionable plugin found, expected none")
}
}
| {'content_hash': '705fd3320d3cedfe5b0f136dccab2f6a', 'timestamp': '', 'source': 'github', 'line_count': 344, 'max_line_length': 111, 'avg_line_length': 27.75581395348837, 'alnum_prop': 0.6921868454126519, 'repo_name': 'rajatchopra/kubernetes', 'id': 'd4ddd12020d53bb993cbfedee9fc165eb9eb3cac', 'size': '10117', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'pkg/volume/local/local_test.go', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '2525'}, {'name': 'Go', 'bytes': '42387281'}, {'name': 'HTML', 'bytes': '1193990'}, {'name': 'Makefile', 'bytes': '72489'}, {'name': 'PowerShell', 'bytes': '4261'}, {'name': 'Python', 'bytes': '2455049'}, {'name': 'Ruby', 'bytes': '1591'}, {'name': 'SaltStack', 'bytes': '51788'}, {'name': 'Shell', 'bytes': '1624872'}]} |
/**
* This class is generated by jOOQ
*/
package io.cattle.platform.core.model.tables;
/**
* This class is generated by jOOQ.
*/
@javax.annotation.Generated(value = { "http://www.jooq.org", "3.3.0" },
comments = "This class is generated by jOOQ")
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class GlobalLoadBalancerTable extends org.jooq.impl.TableImpl<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord> {
private static final long serialVersionUID = 538767251;
/**
* The singleton instance of <code>cattle.global_load_balancer</code>
*/
public static final io.cattle.platform.core.model.tables.GlobalLoadBalancerTable GLOBAL_LOAD_BALANCER = new io.cattle.platform.core.model.tables.GlobalLoadBalancerTable();
/**
* The class holding records for this type
*/
@Override
public java.lang.Class<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord> getRecordType() {
return io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord.class;
}
/**
* The column <code>cattle.global_load_balancer.id</code>.
*/
public final org.jooq.TableField<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord, java.lang.Long> ID = createField("id", org.jooq.impl.SQLDataType.BIGINT.nullable(false), this, "");
/**
* The column <code>cattle.global_load_balancer.name</code>.
*/
public final org.jooq.TableField<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord, java.lang.String> NAME = createField("name", org.jooq.impl.SQLDataType.VARCHAR.length(255), this, "");
/**
* The column <code>cattle.global_load_balancer.account_id</code>.
*/
public final org.jooq.TableField<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord, java.lang.Long> ACCOUNT_ID = createField("account_id", org.jooq.impl.SQLDataType.BIGINT, this, "");
/**
* The column <code>cattle.global_load_balancer.kind</code>.
*/
public final org.jooq.TableField<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord, java.lang.String> KIND = createField("kind", org.jooq.impl.SQLDataType.VARCHAR.length(255).nullable(false), this, "");
/**
* The column <code>cattle.global_load_balancer.uuid</code>.
*/
public final org.jooq.TableField<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord, java.lang.String> UUID = createField("uuid", org.jooq.impl.SQLDataType.VARCHAR.length(128).nullable(false), this, "");
/**
* The column <code>cattle.global_load_balancer.description</code>.
*/
public final org.jooq.TableField<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord, java.lang.String> DESCRIPTION = createField("description", org.jooq.impl.SQLDataType.VARCHAR.length(1024), this, "");
/**
* The column <code>cattle.global_load_balancer.state</code>.
*/
public final org.jooq.TableField<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord, java.lang.String> STATE = createField("state", org.jooq.impl.SQLDataType.VARCHAR.length(128).nullable(false), this, "");
/**
* The column <code>cattle.global_load_balancer.created</code>.
*/
public final org.jooq.TableField<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord, java.util.Date> CREATED = createField("created", org.jooq.impl.SQLDataType.TIMESTAMP.asConvertedDataType(new io.cattle.platform.db.jooq.converter.DateConverter()), this, "");
/**
* The column <code>cattle.global_load_balancer.removed</code>.
*/
public final org.jooq.TableField<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord, java.util.Date> REMOVED = createField("removed", org.jooq.impl.SQLDataType.TIMESTAMP.asConvertedDataType(new io.cattle.platform.db.jooq.converter.DateConverter()), this, "");
/**
* The column <code>cattle.global_load_balancer.remove_time</code>.
*/
public final org.jooq.TableField<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord, java.util.Date> REMOVE_TIME = createField("remove_time", org.jooq.impl.SQLDataType.TIMESTAMP.asConvertedDataType(new io.cattle.platform.db.jooq.converter.DateConverter()), this, "");
/**
* The column <code>cattle.global_load_balancer.data</code>.
*/
public final org.jooq.TableField<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord, java.util.Map<String,Object>> DATA = createField("data", org.jooq.impl.SQLDataType.CLOB.length(65535).asConvertedDataType(new io.cattle.platform.db.jooq.converter.DataConverter()), this, "");
/**
* Create a <code>cattle.global_load_balancer</code> table reference
*/
public GlobalLoadBalancerTable() {
this("global_load_balancer", null);
}
/**
* Create an aliased <code>cattle.global_load_balancer</code> table reference
*/
public GlobalLoadBalancerTable(java.lang.String alias) {
this(alias, io.cattle.platform.core.model.tables.GlobalLoadBalancerTable.GLOBAL_LOAD_BALANCER);
}
private GlobalLoadBalancerTable(java.lang.String alias, org.jooq.Table<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord> aliased) {
this(alias, aliased, null);
}
private GlobalLoadBalancerTable(java.lang.String alias, org.jooq.Table<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord> aliased, org.jooq.Field<?>[] parameters) {
super(alias, io.cattle.platform.core.model.CattleTable.CATTLE, aliased, parameters, "");
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.Identity<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord, java.lang.Long> getIdentity() {
return io.cattle.platform.core.model.Keys.IDENTITY_GLOBAL_LOAD_BALANCER;
}
/**
* {@inheritDoc}
*/
@Override
public org.jooq.UniqueKey<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord> getPrimaryKey() {
return io.cattle.platform.core.model.Keys.KEY_GLOBAL_LOAD_BALANCER_PRIMARY;
}
/**
* {@inheritDoc}
*/
@Override
public java.util.List<org.jooq.UniqueKey<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord>> getKeys() {
return java.util.Arrays.<org.jooq.UniqueKey<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord>>asList(io.cattle.platform.core.model.Keys.KEY_GLOBAL_LOAD_BALANCER_PRIMARY, io.cattle.platform.core.model.Keys.KEY_GLOBAL_LOAD_BALANCER_IDX_GLOBAL_LOAD_BALANCER_UUID);
}
/**
* {@inheritDoc}
*/
@Override
public java.util.List<org.jooq.ForeignKey<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord, ?>> getReferences() {
return java.util.Arrays.<org.jooq.ForeignKey<io.cattle.platform.core.model.tables.records.GlobalLoadBalancerRecord, ?>>asList(io.cattle.platform.core.model.Keys.FK_GLOBAL_LOAD_BALANCER__ACCOUNT_ID);
}
/**
* {@inheritDoc}
*/
@Override
public io.cattle.platform.core.model.tables.GlobalLoadBalancerTable as(java.lang.String alias) {
return new io.cattle.platform.core.model.tables.GlobalLoadBalancerTable(alias, this);
}
/**
* Rename this table
*/
public io.cattle.platform.core.model.tables.GlobalLoadBalancerTable rename(java.lang.String name) {
return new io.cattle.platform.core.model.tables.GlobalLoadBalancerTable(name, null);
}
}
| {'content_hash': '43c2d57da549a712a44937abcf4987b1', 'timestamp': '', 'source': 'github', 'line_count': 152, 'max_line_length': 296, 'avg_line_length': 47.41447368421053, 'alnum_prop': 0.7584293048425143, 'repo_name': 'hibooboo2/cattle', 'id': 'c75994422589cb5ac463cd887209113dd32ed06f', 'size': '7207', 'binary': False, 'copies': '3', 'ref': 'refs/heads/drone-slack', 'path': 'code/iaas/model/src/main/java/io/cattle/platform/core/model/tables/GlobalLoadBalancerTable.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '4343099'}, {'name': 'Python', 'bytes': '403939'}, {'name': 'Shell', 'bytes': '35775'}]} |
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "clientusers".
*
* @property integer $id
* @property integer $client
* @property string $firstName
* @property string $lastName
* @property string $NIPT
* @property string $branch
* @property string $tel
* @property string $cel
* @property string $fax
* @property string $email
* @property string $city
* @property string $address
* @property integer $created_by
* @property integer $updated_by
* @property string $updated_at
*
* @property Client $client0
* @property User $createdBy
* @property User $updatedBy
* @property Reservation[] $reservations
*/
class ClientUser extends \yii\db\ActiveRecord
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'clientusers';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['client', 'firstName', 'lastName'], 'required'],
[['client', 'created_by', 'updated_by'], 'integer'],
[['updated_at'], 'safe'],
[['firstName', 'lastName'], 'string', 'max' => 225],
[['NIPT'], 'string', 'max' => 10],
[['branch', 'tel', 'cel', 'fax', 'email', 'city', 'address'], 'string', 'max' => 45]
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => Yii::t('app', 'ID'),
'client' => Yii::t('app', 'Client'),
'firstName' => Yii::t('app', 'First Name'),
'lastName' => Yii::t('app', 'Last Name'),
'NIPT' => Yii::t('app', 'Nipt'),
'branch' => Yii::t('app', 'Branch'),
'tel' => Yii::t('app', 'Tel'),
'cel' => Yii::t('app', 'Cel'),
'fax' => Yii::t('app', 'Fax'),
'email' => Yii::t('app', 'Email'),
'city' => Yii::t('app', 'City'),
'address' => Yii::t('app', 'Address'),
'created_by' => Yii::t('app', 'Created By'),
'updated_by' => Yii::t('app', 'Updated By'),
'updated_at' => Yii::t('app', 'Updated At'),
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getClient0()
{
return $this->hasOne(Client::className(), ['id' => 'client']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getCreatedBy()
{
return $this->hasOne(User::className(), ['id' => 'created_by']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getUpdatedBy()
{
return $this->hasOne(User::className(), ['id' => 'updated_by']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getReservations()
{
return $this->hasMany(Reservation::className(), ['client' => 'id']);
}
}
| {'content_hash': '23c76ed521646ea3e59ba8306d176be1', 'timestamp': '', 'source': 'github', 'line_count': 111, 'max_line_length': 96, 'avg_line_length': 25.63063063063063, 'alnum_prop': 0.5033391915641476, 'repo_name': 'banyx101/new-Kalemi', 'id': 'ffe5643db60fa93f81206e516d1f28e8052342de', 'size': '2845', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': '_protected/models/ClientUser.php', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'ApacheConf', 'bytes': '358'}, {'name': 'CSS', 'bytes': '11440'}, {'name': 'PHP', 'bytes': '321483'}, {'name': 'Shell', 'bytes': '1041'}]} |
"""The MIT License
Copyright (c) 2009 Rodolfo da Silva Carvalho <[email protected]>
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.
"""
from webalbum.models import Album, Picture
from django import template
from django.core.urlresolvers import reverse
from django.conf import settings
from webalbum import settings as album_settings
register = template.Library()
@register.simple_tag
def album_thumbnail(id):
album = Album.objects.get(pk=id)
img_str = "<img src='%s' width='150' height='150' alt='%s' title='%s'/>"
#img_url = reverse("crop-photo", kwargs=dict(id=album.image.id, width=80,
# height=80))
img_url = album.image.url
return img_str % (img_url, album.name, album.name)
@register.simple_tag
def pic_thumbnail(picture, width=225, height=150):
return picture.thumbnail
class PicturePaginatorNode(template.Node):
def render(self, context):
if context.has_key("picture_error"):
return ""
page = context['picture_page']
paginator = context['picture_paginator']
album = context['album']
if paginator.num_pages == 1:
return ""
html = "<div class='paginator span-19 last'><ul>\n"
if page.has_previous():
html += "<li><a href='?album=%d&picture_page=%d'>%s</a></li>\n" % \
(album.id, page.next_page_number(),
album_settings.PICT_PAGE_PREV)
for page_number in paginator.page_range:
if page.number == page_number:
html += "<li class='current'>"
page_content = u"%(page)d"
else:
html += "<li>"
page_content = u"<a href='?album=%(album)d&picture_page=%(page)d'>%(page)d</a>"
html += page_content % {'album': album.id, 'page': page_number}
html += "</li>\n"
if page.has_next():
html += "<li><a href='?album=%d&picture_page=%d'>%s</a></li>\n" % \
(album.id, page.next_page_number(),
album_settings.PICT_PAGE_NEXT)
html += "</ul></div>"
return html
@register.tag
def picture_paginator(parser, token):
return PicturePaginatorNode()
class AlbumsPaginatorNode(template.Node):
def render(self, context):
if context.has_key("album_error"):
return ""
page = context['album_page']
paginator = context['album_paginator']
if paginator.num_pages == 1:
return ""
html = "<div class='paginator span-14'><ul>\n"
if page.has_previous():
html += "<li><a href='?album_page=%d'>%s</a></li>\n" % \
(page.previous_page_number(),
album_settings.ALBUM_PAGE_PREV)
else:
html += "<li>" + album_settings.ALBUM_PAGE_NO_PREV + "</li>"
for page_number in paginator.page_range:
html += "<li>"
if page.number == page_number:
page_content = "%(page)d"
else:
page_content = "<a href='?album_page=%(page)d'>%(page)d</a>"
html += page_content % {'page': page_number}
html += "</li>\n"
if page.has_next():
html += "<li><a href='?album_page=%d'>%s</a></li>\n" % \
(page.next_page_number(),
album_settings.ALBUM_PAGE_NEXT)
else:
html += "<li>" + album_settings.ALBUM_PAGE_NO_NEXT + "</li>"
html += "</ul></div>"
return html
@register.tag
def album_paginator(parser, token):
return AlbumsPaginatorNode()
| {'content_hash': 'ffe188b3f9cf3381fc8c9a68db0ddad9', 'timestamp': '', 'source': 'github', 'line_count': 126, 'max_line_length': 95, 'avg_line_length': 39.5, 'alnum_prop': 0.5559574040586699, 'repo_name': 'rscarvalho/django-webalbum', 'id': '89d5a1d3c4bb4c4a8259b1435db28dde7efaa94e', 'size': '4977', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'webalbum/templatetags/album_tags.py', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Python', 'bytes': '24542'}]} |
package javax.validation;
import static java.lang.annotation.ElementType.TYPE;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
/**
* @version $Rev$ $Date$
*/
@Target({ TYPE })
@Retention(RUNTIME)
public @interface GroupSequence {
Class<?>[] value();
}
| {'content_hash': 'daaa726e99630e5e465a79d8178b2601', 'timestamp': '', 'source': 'github', 'line_count': 17, 'max_line_length': 59, 'avg_line_length': 20.529411764705884, 'alnum_prop': 0.7449856733524355, 'repo_name': 'salyh/javamailspec', 'id': '32f8e4241fea7ef1c8a48c6515198fc9060fb21f', 'size': '1146', 'binary': False, 'copies': '4', 'ref': 'refs/heads/trunk', 'path': 'geronimo-validation_1.0_spec/src/main/java/javax/validation/GroupSequence.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '8627604'}]} |
class coType;
class coArchiveWriter
{
public:
void Clear();
void WriteRoot(const void* object, const coType& type);
template <class T>
void WriteRoot(const T& object);
private:
void Write(const void* buffer, coUint32 size);
template <class T>
void Write(const T& buffer) { WriteBuffer(&buffer, sizeof(buffer)); }
void PushBytes(coUint size);
coReverseDynamicArray<coByte> data;
};
template<class T>
inline void coArchiveWriter::WriteRoot(const T& object)
{
WriteRoot(&object, *T::GetStaticType());
}
| {'content_hash': '2cab17b6d5f3f2387f4627fa965370ae', 'timestamp': '', 'source': 'github', 'line_count': 24, 'max_line_length': 70, 'avg_line_length': 21.416666666666668, 'alnum_prop': 0.7354085603112841, 'repo_name': 'smogpill/core', 'id': '2137a3b7c41715f423ee8f5ab17631b1979ccd6b', 'size': '749', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/io/archive/writer/coArchiveWriter.h', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '1950195'}, {'name': 'C++', 'bytes': '3500164'}, {'name': 'GLSL', 'bytes': '1451'}, {'name': 'Lua', 'bytes': '9569'}]} |
<?xml version="1.0" encoding="UTF-8" ?>
<!--
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.
-->
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.apache.aurora.scheduler.storage.db.TaskMapper">
<cache type="org.apache.aurora.scheduler.storage.db.MyBatisCacheImpl">
<property name="size" value="10000"/>
</cache>
<insert id="insertScheduledTask" useGeneratedKeys="true" keyColumn="id" keyProperty="result.id">
INSERT INTO tasks (
task_id,
slave_row_id,
instance_id,
status,
failure_count,
ancestor_task_id,
task_config_row_id,
) VALUES (
#{task.assignedTask.taskId},
(
SELECT ID
FROM host_attributes
WHERE slave_id = #{task.assignedTask.slaveId}
AND host = #{task.assignedTask.slaveHost}
),
#{task.assignedTask.instanceId},
#{task.status, typeHandler=org.apache.aurora.scheduler.storage.db.typehandlers.ScheduleStatusTypeHandler},
#{task.failureCount},
#{task.ancestorId},
#{configId}
)
</insert>
<resultMap id="taskEventMap" type="org.apache.aurora.gen.TaskEvent">
<id column="id"/>
<result property="status"
column="status"
typeHandler="org.apache.aurora.scheduler.storage.db.typehandlers.ScheduleStatusTypeHandler" />
<result column="timestamp_ms" property="timestamp" />
<result column="message" property="message" />
<result column="scheduler_host" property="scheduler" />
</resultMap>
<resultMap id="scheduledTaskMap" type="org.apache.aurora.scheduler.storage.db.views.DbScheduledTask">
<id column="row_id"/>
<result property="status"
column="status"
typeHandler="org.apache.aurora.scheduler.storage.db.typehandlers.ScheduleStatusTypeHandler" />
<result column="task_id" property="assignedTask.taskId"/>
<result column="slave_id" property="assignedTask.slaveId"/>
<result column="slave_host" property="assignedTask.slaveHost"/>
<result column="instance_id" property="assignedTask.instanceId"/>
<association
property="assignedTask.task"
select="org.apache.aurora.scheduler.storage.db.TaskConfigMapper.selectConfig"
column="task_config_row_id"
foreignColumn="row_id"/>
<collection
property="assignedTask.assignedPorts"
resultMap="portMap"
columnPrefix="tp_"/>
<collection
property="taskEvents"
resultMap="taskEventMap"
columnPrefix="te_"
notNullColumn="status"/>
</resultMap>
<sql id="unscopedSelect">
<!--
N.B. For any one-to-many relationship, results from the joined table *must* include the id
otherwise mybatis will not be able to disambiguate identical rows leading to an explosion
of related rows on each save.
-->
SELECT
t.id AS row_id,
t.task_config_row_id AS task_config_row_id,
t.task_id AS task_id,
t.instance_id AS instance_id,
t.status AS status,
t.failure_count AS failure_count,
t.ancestor_task_id AS ancestor_id,
j.role AS c_j_role,
j.environment AS c_j_environment,
j.name AS c_j_name,
h.slave_id AS slave_id,
h.host AS slave_host,
tp.id as tp_id,
tp.name as tp_name,
tp.port as tp_port,
te.id as te_id,
te.timestamp_ms as te_timestamp,
te.status as te_status,
te.message as te_message,
te.scheduler_host as te_scheduler
FROM tasks AS t
INNER JOIN task_configs as c ON c.id = t.task_config_row_id
INNER JOIN job_keys AS j ON j.id = c.job_key_id
LEFT OUTER JOIN task_ports as tp ON tp.task_row_id = t.id
LEFT OUTER JOIN task_events as te ON te.task_row_id = t.id
LEFT OUTER JOIN host_attributes AS h ON h.id = t.slave_row_id
</sql>
<select id="selectById" resultMap="scheduledTaskMap">
<include refid="unscopedSelect"/>
WHERE
t.task_id = #{taskId}
</select>
<select id="select" resultMap="scheduledTaskMap">
<include refid="unscopedSelect"/>
<where>
<if test="role != null">
j.role = #{role}
</if>
<if test="environment != null">
AND j.environment = #{environment}
</if>
<if test="jobName != null">
AND j.name = #{jobName}
</if>
<if test="!taskIds.isEmpty()">
AND t.task_id IN (
<foreach item="task_id" collection="taskIds" separator=",">
#{task_id}
</foreach>
)
</if>
<if test="!statuses.isEmpty()">
AND t.status IN (
<foreach item="element" collection="statuses" separator=",">
#{element, typeHandler=org.apache.aurora.scheduler.storage.db.typehandlers.ScheduleStatusTypeHandler}
</foreach>
)
</if>
<if test="!instanceIds.isEmpty()">
AND t.instance_id IN (
<foreach item="instance_id" collection="instanceIds" separator=",">
#{instance_id}
</foreach>
)
</if>
<if test="!slaveHosts.isEmpty()">
AND h.host IN (
<foreach item="host" collection="slaveHosts" separator=",">
#{host}
</foreach>
)
</if>
<if test="!jobKeys.isEmpty()">
AND (
<foreach item="jobKey" collection="jobKeys" open="(" separator=") OR (" close=")">
j.role = #{jobKey.role}
AND j.name = #{jobKey.name}
AND j.environment = #{jobKey.environment}
</foreach>
)
</if>
</where>
</select>
<select id="selectJobKeys" resultMap="org.apache.aurora.scheduler.storage.db.JobKeyMapper.jobKeyMap">
SELECT DISTINCT
j.role AS role,
j.environment AS environment,
j.name AS name
FROM tasks AS t
INNER JOIN task_configs as c ON c.id = t.task_config_row_id
INNER JOIN job_keys AS j ON j.id = c.job_key_id
</select>
<insert id="insertTaskEvents">
INSERT INTO task_events(
task_row_id,
timestamp_ms,
status,
message,
scheduler_host
) VALUES (
<foreach item="event" collection="events" separator="),(">
#{taskRowId},
#{event.timestamp},
#{event.status, typeHandler=org.apache.aurora.scheduler.storage.db.typehandlers.ScheduleStatusTypeHandler},
#{event.message},
#{event.scheduler}
</foreach>
)
</insert>
<insert id="insertPorts">
INSERT INTO task_ports(
task_row_id,
name,
port
) VALUES (
<foreach index="name" item="port" collection="ports" separator="),(">
#{taskRowId},
#{name},
#{port}
</foreach>
)
</insert>
<resultMap id="portMap" type="org.apache.aurora.scheduler.storage.db.views.DbAssginedPort">
<id column="id"/>
<result column="name" property="name" />
<result column="port" property="port" />
</resultMap>
<delete id="truncate">
<!--
This assumes cascading deletes will clean up all references. Also, once the job store is
migrated, there will be a clash between deletes on the two that needs to be resolved. At that
point it probably makes sense to remove all of the store-specific truncate verbs and use a
single control.
-->
DELETE FROM tasks
</delete>
<delete id="deleteTasks">
DELETE FROM tasks WHERE task_id IN (
<foreach item="task_id" collection="taskIds" separator=",">
#{task_id}
</foreach>
)
</delete>
</mapper>
| {'content_hash': 'a0b8993a745090f7d446f615a558f7a4', 'timestamp': '', 'source': 'github', 'line_count': 241, 'max_line_length': 113, 'avg_line_length': 33.0, 'alnum_prop': 0.6304539167609707, 'repo_name': 'crashlytics/aurora', 'id': '0ecffab8757701d58a33d0fb0ec4357c93c7a337', 'size': '7953', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'src/main/resources/org/apache/aurora/scheduler/storage/db/TaskMapper.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '24108'}, {'name': 'Groovy', 'bytes': '7856'}, {'name': 'HTML', 'bytes': '13576'}, {'name': 'Java', 'bytes': '3537654'}, {'name': 'JavaScript', 'bytes': '202454'}, {'name': 'Makefile', 'bytes': '2292'}, {'name': 'Python', 'bytes': '1560260'}, {'name': 'Ruby', 'bytes': '4315'}, {'name': 'Shell', 'bytes': '86531'}, {'name': 'Smalltalk', 'bytes': '79'}, {'name': 'Smarty', 'bytes': '25233'}, {'name': 'Thrift', 'bytes': '54490'}]} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.