text
stringlengths 2
1.04M
| meta
dict |
|---|---|
namespace arrow {
class TestDefaultMemoryPool : public ::arrow::test::TestMemoryPoolBase {
public:
::arrow::MemoryPool* memory_pool() override { return ::arrow::default_memory_pool(); }
};
TEST_F(TestDefaultMemoryPool, MemoryTracking) {
this->TestMemoryTracking();
}
TEST_F(TestDefaultMemoryPool, OOM) {
#ifndef ADDRESS_SANITIZER
this->TestOOM();
#endif
}
TEST_F(TestDefaultMemoryPool, Reallocate) {
this->TestReallocate();
}
// Death tests and valgrind are known to not play well 100% of the time. See
// googletest documentation
#if !(defined(ARROW_VALGRIND) || defined(ADDRESS_SANITIZER))
TEST(DefaultMemoryPoolDeathTest, FreeLargeMemory) {
MemoryPool* pool = default_memory_pool();
uint8_t* data;
ASSERT_OK(pool->Allocate(100, &data));
#ifndef NDEBUG
EXPECT_EXIT(pool->Free(data, 120), ::testing::ExitedWithCode(1),
".*Check failed: \\(bytes_allocated_\\) >= \\(size\\)");
#endif
pool->Free(data, 100);
}
TEST(DefaultMemoryPoolDeathTest, MaxMemory) {
DefaultMemoryPool pool;
ASSERT_EQ(0, pool.max_memory());
uint8_t* data;
ASSERT_OK(pool.Allocate(100, &data));
uint8_t* data2;
ASSERT_OK(pool.Allocate(100, &data2));
pool.Free(data, 100);
pool.Free(data2, 100);
ASSERT_EQ(200, pool.max_memory());
}
#endif // ARROW_VALGRIND
TEST(LoggingMemoryPool, Logging) {
DefaultMemoryPool pool;
LoggingMemoryPool lp(&pool);
ASSERT_EQ(0, lp.max_memory());
uint8_t* data;
ASSERT_OK(pool.Allocate(100, &data));
uint8_t* data2;
ASSERT_OK(pool.Allocate(100, &data2));
pool.Free(data, 100);
pool.Free(data2, 100);
ASSERT_EQ(200, pool.max_memory());
}
} // namespace arrow
|
{
"content_hash": "4ab99d14f92323cc0b482f00c49ccba9",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 88,
"avg_line_length": 21.63157894736842,
"alnum_prop": 0.6916058394160584,
"repo_name": "StevenMPhillips/arrow",
"id": "8a185abca71cc16de9a1f1fdb82877402bf8fa80",
"size": "2521",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "cpp/src/arrow/memory_pool-test.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "205455"
},
{
"name": "C++",
"bytes": "1214948"
},
{
"name": "CMake",
"bytes": "133494"
},
{
"name": "FreeMarker",
"bytes": "2404"
},
{
"name": "HTML",
"bytes": "2207"
},
{
"name": "Java",
"bytes": "985393"
},
{
"name": "JavaScript",
"bytes": "3373"
},
{
"name": "M4",
"bytes": "3399"
},
{
"name": "Makefile",
"bytes": "25130"
},
{
"name": "Perl",
"bytes": "3799"
},
{
"name": "Python",
"bytes": "371857"
},
{
"name": "Ruby",
"bytes": "61839"
},
{
"name": "Shell",
"bytes": "35027"
},
{
"name": "TypeScript",
"bytes": "22056"
}
],
"symlink_target": ""
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_38) on Thu Oct 10 15:31:46 MDT 2013 -->
<TITLE>
MesgIndexTest
</TITLE>
<META NAME="date" CONTENT="2013-10-10">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="MesgIndexTest";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../com/garmin/fit/test/FileIdTest.html" title="class in com.garmin.fit.test"><B>PREV CLASS</B></A>
<A HREF="../../../../com/garmin/fit/test/Test.html" title="interface in com.garmin.fit.test"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?com/garmin/fit/test/MesgIndexTest.html" target="_top"><B>FRAMES</B></A>
<A HREF="MesgIndexTest.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.garmin.fit.test</FONT>
<BR>
Class MesgIndexTest</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.garmin.fit.test.MesgIndexTest</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../com/garmin/fit/MesgListener.html" title="interface in com.garmin.fit">MesgListener</A>, <A HREF="../../../../com/garmin/fit/test/Test.html" title="interface in com.garmin.fit.test">Test</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <B>MesgIndexTest</B><DT>extends java.lang.Object<DT>implements <A HREF="../../../../com/garmin/fit/test/Test.html" title="interface in com.garmin.fit.test">Test</A>, <A HREF="../../../../com/garmin/fit/MesgListener.html" title="interface in com.garmin.fit">MesgListener</A></DL>
</PRE>
<P>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../com/garmin/fit/test/MesgIndexTest.html#MesgIndexTest()">MesgIndexTest</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/garmin/fit/test/MesgIndexTest.html#getError()">getError</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/garmin/fit/test/MesgIndexTest.html#onMesg(com.garmin.fit.Mesg)">onMesg</A></B>(<A HREF="../../../../com/garmin/fit/Mesg.html" title="class in com.garmin.fit">Mesg</A> mesg)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="MesgIndexTest()"><!-- --></A><H3>
MesgIndexTest</H3>
<PRE>
public <B>MesgIndexTest</B>()</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="onMesg(com.garmin.fit.Mesg)"><!-- --></A><H3>
onMesg</H3>
<PRE>
public void <B>onMesg</B>(<A HREF="../../../../com/garmin/fit/Mesg.html" title="class in com.garmin.fit">Mesg</A> mesg)</PRE>
<DL>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../com/garmin/fit/MesgListener.html#onMesg(com.garmin.fit.Mesg)">onMesg</A></CODE> in interface <CODE><A HREF="../../../../com/garmin/fit/MesgListener.html" title="interface in com.garmin.fit">MesgListener</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getError()"><!-- --></A><H3>
getError</H3>
<PRE>
public java.lang.String <B>getError</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../com/garmin/fit/test/Test.html#getError()">getError</A></CODE> in interface <CODE><A HREF="../../../../com/garmin/fit/test/Test.html" title="interface in com.garmin.fit.test">Test</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../com/garmin/fit/test/FileIdTest.html" title="class in com.garmin.fit.test"><B>PREV CLASS</B></A>
<A HREF="../../../../com/garmin/fit/test/Test.html" title="interface in com.garmin.fit.test"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?com/garmin/fit/test/MesgIndexTest.html" target="_top"><B>FRAMES</B></A>
<A HREF="MesgIndexTest.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
|
{
"content_hash": "cd2dfc9f70dff632350f91b7bc55c837",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 300,
"avg_line_length": 41.02517985611511,
"alnum_prop": 0.6029811486190267,
"repo_name": "manuelhartl/opensaft",
"id": "572aef44619e4b379e3b58f9035f7bce127e829f",
"size": "11405",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "opensaft-input/doc/fit/java/doc/com/garmin/fit/test/MesgIndexTest.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1420"
},
{
"name": "Java",
"bytes": "764382"
},
{
"name": "Shell",
"bytes": "1090"
}
],
"symlink_target": ""
}
|
package language.parser.nodes;
import language.parser.Symbols;
import language.parser.Visitor;
import language.parser.framework.Symbol;
import language.parser.framework.Token;
/**
* This class was generated by the LRPaGe parser generator v1.0 using the com.sun.codemodel library.
*
* <P>LRPaGe is available from https://github.com/tbepler/LRPaGe.
* <P>CodeModel is available from https://codemodel.java.net/.
*
*/
public class _Punctuation11Token
extends Token<Visitor>
{
public _Punctuation11Token(String text, int line, int pos) {
super(text, line, pos);
}
public _Punctuation11Token() {
super();
}
@Override
public void accept(Visitor visitor) {
//do nothing
}
@Override
public Symbol symbol() {
return Symbols._PUNCTUATION11;
}
@Override
public String toString() {
return symbol().toString();
}
}
|
{
"content_hash": "7c4071a596590b418fe7975b4644a370",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 100,
"avg_line_length": 20.355555555555554,
"alnum_prop": 0.6670305676855895,
"repo_name": "tbepler/programming-language",
"id": "d4831a2932cca9191b40c1c1de3ad4a61e157e3e",
"size": "916",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/language/parser/nodes/_Punctuation11Token.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "670005"
}
],
"symlink_target": ""
}
|
<!DOCTYPE html>
<html>
<head>
<meta charset='utf8'>
<title>Justified Grid</title>
<style>
html, body {
margin: 0;
padding: 0;
}
#gallery {
top: 100px;
position: relative;
}
#gallery.working img {
display: none;
}
#gallery img {
box-sizing: border-box;
padding: 4px;
}
#gallery img::before {
content: attr(data-priority);
}
form {
position: fixed;
z-index: 1;
background: white;
padding: 10px;
width: 100%;
height: 100px;
}
label {
box-sizing: border-box;
display: inline-block;
width: 49%;
}
label > * {
width: 100%;
display: block;
}
</style>
</head>
<body>
<form>
<label>
<span>Width (<span id='w'></span>px)</span>
<input name='width' value='550' min='100' max='2000' step='10' type='range' onmousemove='redraw()'>
</label>
<label>
<span>Height (<span id='h'></span>px)</span>
<input name='height' value='150' min='10' max='400' step='1' type='range' onmousemove='redraw()'>
</label>
<label title='How much of the last row can be whitespace before it is justified. 100% means always justify the last row. 0% means never justify the last row.'>
<span>Orphan Threshold (<span id='o'></span>%)</span>
<input name='hthreshold' value='0.25' min='0' max='1' step='0.01' type='range' onmousemove='redraw()'>
</label>
<label title='How flexible each row height is in % of the target row height.'>
<span>Height Threshold (<span id='t'></span>%)</span>
<input name='vthreshold' value='0.25' min='0' max='1' step='0.01' type='range' onmousemove='redraw()'>
</label>
</form>
<div id='gallery' class='working'>
<img data-priority='5' src='http://placehold.it/600x500' width='600' height='500'>
<img data-priority='2' src='http://placehold.it/600x600' width='600' height='600'>
<img data-priority='2' src='http://placehold.it/600x800' width='600' height='800'>
<img data-priority='2' src='http://placehold.it/600x400' width='600' height='400'>
<img data-priority='2' src='http://placehold.it/600x430' width='600' height='430'>
<img data-priority='3' src='http://placehold.it/600x200' width='600' height='200'>
<img data-priority='3' src='http://placehold.it/600x800' width='600' height='800'>
<img data-priority='3' src='http://placehold.it/600x400' width='600' height='400'>
<img data-priority='3' src='http://placehold.it/600x430' width='600' height='430'>
<img data-priority='3' src='http://placehold.it/600x200' width='600' height='200'>
<img data-priority='3' src='http://placehold.it/600x500' width='600' height='500'>
<img data-priority='4' src='http://placehold.it/600x600' width='600' height='600'>
<img data-priority='4' src='http://placehold.it/600x200' width='600' height='200'>
<img data-priority='4' src='http://placehold.it/600x800' width='600' height='800'>
<img data-priority='3' src='http://placehold.it/600x400' width='600' height='400'>
<img data-priority='3' src='http://placehold.it/600x430' width='600' height='430'>
<img data-priority='3' src='http://placehold.it/600x200' width='600' height='200'>
<img data-priority='3' src='http://placehold.it/600x500' width='600' height='500'>
<img data-priority='3' src='http://placehold.it/600x600' width='600' height='600'>
<img data-priority='3' src='http://placehold.it/600x800' width='600' height='800'>
<img data-priority='3' src='http://placehold.it/600x400' width='600' height='400'>
<img data-priority='2' src='http://placehold.it/600x430' width='600' height='430'>
<img data-priority='2' src='http://placehold.it/600x200' width='600' height='200'>
<img data-priority='2' src='http://placehold.it/600x800' width='600' height='800'>
<img data-priority='4' src='http://placehold.it/600x400' width='600' height='400'>
<img data-priority='4' src='http://placehold.it/600x430' width='600' height='430'>
<img data-priority='4' src='http://placehold.it/600x200' width='600' height='200'>
<img data-priority='4' src='http://placehold.it/600x500' width='600' height='500'>
<img data-priority='4' src='http://placehold.it/600x600' width='600' height='600'>
<img data-priority='2' src='http://placehold.it/600x430' width='600' height='430'>
<img data-priority='2' src='http://placehold.it/600x200' width='600' height='200'>
<img data-priority='2' src='http://placehold.it/600x600' width='600' height='600'>
<img data-priority='2' src='http://placehold.it/600x800' width='600' height='800'>
<img data-priority='2' src='http://placehold.it/600x400' width='600' height='400'>
<img data-priority='2' src='http://placehold.it/600x430' width='600' height='430'>
<img data-priority='2' src='http://placehold.it/600x500' width='600' height='500'>
<img data-priority='2' src='http://placehold.it/600x600' width='600' height='600'>
<img data-priority='2' src='http://placehold.it/600x800' width='600' height='800'>
<img data-priority='2' src='http://placehold.it/600x400' width='600' height='400'>
<img data-priority='2' src='http://placehold.it/600x430' width='600' height='430'>
</div>
<script src='./justified-grid.js'></script>
<script>
var form = document.forms[0];
var gallery = document.querySelector('#gallery');
var groups = buildGroups(gallery.children);
redraw();
// a dumb trick avoid the flash of unpositioned elements
// before the initial positioning
gallery.classList.remove('working');
function buildGroups(elements) {
var groups = [];
var group;
for(var i=0; i<elements.length; i++) {
var el = elements[i];
var prio = parseInt(el.dataset.priority, 10);
if (!group || group.priority !== prio) {
group = {
priority: prio,
elements: []
};
groups.push(group);
}
group.elements.push(el);
}
return groups;
}
function redraw() {
updateForm();
console.time('justify');
var prevTop = 0;
groups.forEach(function(group) {
var grid = justifyGrid(group.elements, { //debug: true,
rowHeight: Math.exp(group.priority) * form.height.valueAsNumber,
rowWidth: Math.min(form.width.valueAsNumber, gallery.clientWidth),
orphanThreshold: form.hthreshold.valueAsNumber,
heightThreshold: form.vthreshold.valueAsNumber
});
// move them down a bit...
grid.elements.forEach(function(entry) {
entry.element.style.left = entry.x + 'px';
entry.element.style.top = (prevTop + entry.y) + 'px';
entry.element.style.width = entry.w + 'px';
entry.element.style.height = entry.h + 'px';
entry.element.style.position = 'absolute';
});
console.log('rendered group with %s elements (%spx height)', group.elements.length, grid.height);
prevTop += grid.height;
});
console.timeEnd('justify');
}
function updateForm() {
w.innerHTML = Math.min(form.width.valueAsNumber, gallery.clientWidth);
h.innerHTML = form.height.valueAsNumber;
o.innerHTML = form.hthreshold.valueAsNumber * 100 | 0;
t.innerHTML = form.vthreshold.valueAsNumber * 100 | 0;
}
window.addEventListener('resize', redraw);
</script>
</body>
</html>
|
{
"content_hash": "6d66d60fdda56386e678c8e8c4eb54c8",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 163,
"avg_line_length": 43.72189349112426,
"alnum_prop": 0.6285018270401949,
"repo_name": "publicclass/justified-grid",
"id": "3dd2b6bfcd6a10324ad5c1495b02f738e8ad5403",
"size": "7389",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/groups.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "22317"
},
{
"name": "JavaScript",
"bytes": "7186"
},
{
"name": "Makefile",
"bytes": "363"
}
],
"symlink_target": ""
}
|
@interface UIView (utitlities)
+ (instancetype) loadFromXibNamed:(NSString *) xibName;
+ (instancetype) loadFromXib;
- (void) forEachButtonDoBlock:(void (^)(UIButton *button))block;
- (void) forEachSubviewOfClass:(Class)viewClass doBlock:(void (^)(UIView *view))block;
@end
|
{
"content_hash": "678225b51e53223ad84fe75d613b4144",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 86,
"avg_line_length": 30.77777777777778,
"alnum_prop": 0.7436823104693141,
"repo_name": "PitchLabsAsh/PLTableViewController",
"id": "fd68547017494aa8284c1fe4b66b25c74802c83d",
"size": "485",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Pod/Classes/UIView+utitlities.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "40960"
},
{
"name": "Ruby",
"bytes": "3525"
}
],
"symlink_target": ""
}
|
module DelayedPaperclip
module Jobs
autoload :DelayedJob, 'delayed_paperclip/jobs/delayed_job'
autoload :Resque, 'delayed_paperclip/jobs/resque'
end
end
|
{
"content_hash": "7c22e40a464996242557a83e78c1ba7c",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 62,
"avg_line_length": 27.5,
"alnum_prop": 0.7636363636363637,
"repo_name": "jonathanleone/delayed_paperclip",
"id": "df2501916be923edc7516acf63751552ca798e7e",
"size": "165",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/delayed_paperclip/jobs.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "20300"
}
],
"symlink_target": ""
}
|
package org.kuali.mobility.security.authn.util;
public class AuthenticationConstants {
public static final String KME_USER_KEY = "kme.user";
public static final String PUBLIC_USER = "public_";
public static final String AUTH_PATH_PREFIX = "authPath";
public static final String DEVICE_ID = "DEVICE_ID";
public static final String PUSH_OPT_IN = "PUSH_OPT_IN";
}
|
{
"content_hash": "12816295c05607616d819611faef7e9e",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 58,
"avg_line_length": 30.833333333333332,
"alnum_prop": 0.7513513513513513,
"repo_name": "tamerman/mobile-starting-framework",
"id": "06402a48b18a14e9d9b3707710d929580838c7be",
"size": "1513",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "security.authentication/src/main/java/org/kuali/mobility/security/authn/util/AuthenticationConstants.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "182546"
},
{
"name": "HTML",
"bytes": "1176"
},
{
"name": "Java",
"bytes": "4428458"
},
{
"name": "JavaScript",
"bytes": "1634723"
}
],
"symlink_target": ""
}
|
drop database if exists `policies`;
create database `policies`;
use `policies`;
grant usage on policies.* to policies@localhost identified by '@policies#';
grant select, insert, update, delete, drop, alter, create temporary tables on policies.* to policies@localhost;
flush privileges;
drop table if exists `policies`;
create table `policies`(
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) unsigned NOT NULL,
`group_id` int(11) unsigned NOT NULL,
`empresa_id` int(11) unsigned NOT NULL,
`policies_path` varchar(255) not null,
`name` varchar(150) null,
`description` text null,
`create` timestamp DEFAULT current_timestamp,
`modified` DATETIME,
`status` enum('Active','Inactive') NOT NULL default 'Active',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
drop table if exists `policies_filters`;
create table `policies_filters`(
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`policies_id` int(11) unsigned NOT NULL,
`group_id` int(11) unsigned NOT NULL,
`view` boolean not null default false,
`create` timestamp DEFAULT current_timestamp,
`modified` DATETIME,
`status` enum('Active','Inactive') NOT NULL default 'Active',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
drop table if exists `policies_anexos`;
create table `policies_anexos`(
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`policies_id` int(11) unsigned NOT NULL,
`anexo_path` varchar(100) not null,
`name` varchar(200) not null,
`description` text null,
`create` timestamp DEFAULT current_timestamp,
`modified` DATETIME,
`status` enum('Active','Inactive') NOT NULL default 'Active',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
drop table if exists `policies_type`;
create table `policies_type`(
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
-- `user_id` int(11) unsigned NOT NULL,
-- `group_id` int(11) unsigned NOT NULL,
`name` varchar(150) null,
`description` text null,
`create` timestamp not null DEFAULT current_timestamp,
`modified` DATETIME,
`status` enum('Active','Inactive') NOT NULL default 'Active',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
drop table if exists `company`;
create table `company`(
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) unsigned NOT NULL,
`group_id` int(11) unsigned NOT NULL,
`name` varchar(150) null,
`description` text null,
`create` timestamp DEFAULT current_timestamp,
`modified` DATETIME,
`status` enum('Active','Inactive') NOT NULL default 'Active',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
{
"content_hash": "809a8216b82ec83be303b21db1e5c39d",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 111,
"avg_line_length": 36.78082191780822,
"alnum_prop": 0.7217877094972067,
"repo_name": "ambagasdowa/kml",
"id": "6ad6a1694a45448db727e241a1e5c60e1e4310aa",
"size": "2685",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "db/policies.sql",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1013"
},
{
"name": "CSS",
"bytes": "1062962"
},
{
"name": "HTML",
"bytes": "1804393"
},
{
"name": "Java",
"bytes": "1894749"
},
{
"name": "JavaScript",
"bytes": "35452359"
},
{
"name": "Makefile",
"bytes": "3040"
},
{
"name": "PHP",
"bytes": "12930100"
},
{
"name": "Pug",
"bytes": "4882"
},
{
"name": "Python",
"bytes": "3979"
},
{
"name": "SCSS",
"bytes": "167114"
},
{
"name": "Shell",
"bytes": "7585"
},
{
"name": "Stylus",
"bytes": "45043"
}
],
"symlink_target": ""
}
|
layout: post
title: "How to configure Postman API tests in Azure DevOps"
subtitle: "This post is configuring Postman API tests in Azure DevOps. Postman makes API development easy. Postman platform offers the tools to simplify each step of the API building process and streamlines collaboration so you can create better APIs faster."
date: 2020-12-19 00:00:00
categories: [Azure,Postman,API Testing]
tags: [Azure,Postman,API Testing]
author: "Anuraj"
image: /assets/images/2020/12/testplans_runs.png
---
This post is configuring Postman API tests in Azure DevOps. Postman makes API development easy. Postman platform offers the tools to simplify each step of the API building process and streamlines collaboration so you can create better APIs faster. In this post I am discussing about configuring Postman API testing in Azure DevOps and GitHub actions.
First I created a collection in Postman, then I am using some API endpoint for this post. Along with that, I am adding few test cases. Here is one request with test.

Once it is executed and working as expected, click on the collection and export it.

From the Export collection dialog, choose the `Collection v2.1 (recommended)`, and save the JSON file. For demo purposes I am not using any environment variables. If you're using any tokens or variables, you can using Postman environments, and you need to export that as well.
To run the Postman collection in DevOps pipelines you need to use `newman` CLI tool - which is from postman helps you to run the Postman collection files, this can be installed using npm command - `npm install -g newman`. And you can run the tests using the command - `newman run TestAPICollection.json` - this command will execute the test cases and print the output in the console.

Next I committed the JSON file to source control, I am using GitHub. Once you commit the JSON file we can start creating the Azure DevOps pipeline. I am creating a Azure DevOps Build pipeline, I am using Class Editor option, not YAML option. Next I am adding few build steps - first build step in a `npm task` will be installing the `newman`. Next step is a command line script - which will be running the newman with the file. And final step is `Publish Test Results` - this step will publish the test results from the previous step. We may need to provide one more parameter which will export the results in JUnit XML.
Here is the YAML file.
{% highlight Javascript %}
resources:
repositories:
- repository: self
type: git
ref: master
jobs:
- job: Job_1
displayName: Agent job 1
pool:
vmImage: vs2017-win2016
steps:
- checkout: self
- task: Npm@1
displayName: npm custom
inputs:
command: custom
verbose: false
customCommand: install -g newman
- task: CmdLine@2
displayName: Command Line Script
inputs:
script: newman run $(Build.SourcesDirectory)\Testing.postman_collection.json -x -r junit --reporter-junit-export $(build.artifactstagingdirectory)\Results\JunitResults.xml
- task: PublishTestResults@2
displayName: Publish Test Results
inputs:
testResultsFiles: '**\*.xml'
searchFolder: $(build.artifactstagingdirectory)
{% endhighlight %}
And here is the Build pipeline.

If you notice the `newman run` command comes with few more parameters which helps to publish the results as JUnit XML file. The `-x` flag will ignore the exit code and continue the build steps, if you want to stop the build execution if any of the tests fails, you need to remove it. In this post I build a pipeline only specific for monitoring purposes, that is why I added an ignore exit code parameter. Here is the results after running the pipeline.

You can find more details about the test run in the Test Plans > Runs. You can find more details like Test Runs and details about Tests.

You can configure the it to be run it with scheduled trigger or as a continuous delivery option, so that this API tests can validate your app and show the results. You can use similar script and execute the same test cases in GitHub actions as well.
Happy Programming :)
|
{
"content_hash": "79b96b24faafc518f1fa108161651ec5",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 620,
"avg_line_length": 60.85526315789474,
"alnum_prop": 0.764972972972973,
"repo_name": "dotnetthoughts/dotnetthoughts.github.io",
"id": "cf0f771f0d52dde77d430fe2833a422023061543",
"size": "4629",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2020-12-19-how-to-configure-postman-api-tests-in-azure-devops.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "30785"
},
{
"name": "Ruby",
"bytes": "164"
}
],
"symlink_target": ""
}
|
package com.wq.android.lightannotation.annotations;
/**
* Created by qwang on 2016/7/13.
*/
import android.view.KeyEvent;
import android.view.View;
import android.widget.TextView;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* <pre>
*
* See: {@link android.widget.TextView.OnEditorActionListener#onEditorAction(TextView v, int actionId, KeyEvent event)}
*
* Usage Example:
*
* @OnEditorAction({R.id.viewId, R.id.viewId})
* private boolean onEditorAction(TextView v, int actionId, KeyEvent event)
* {
* }
*
* </pre>
*/
@Documented
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface OnEditorAction {
int[] value() default View.NO_ID;
}
|
{
"content_hash": "73e0bc606cd2ae01bfebd5936b382946",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 119,
"avg_line_length": 23.08108108108108,
"alnum_prop": 0.7482435597189696,
"repo_name": "kim-wang-bj/LightAndroidAnnotation",
"id": "6660fb1d9ab43c3a7d52212f27ca2a699fc3b4d1",
"size": "854",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "light-android-annotation/src/main/java/com/wq/android/lightannotation/annotations/OnEditorAction.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "90158"
}
],
"symlink_target": ""
}
|
"""
User assisted updating redirect links on disambiguation pages.
Usage:
python pwb.py disambredir [start]
If no starting name is provided, the bot starts at '!'.
"""
#
# (C) André Engels, 2006-2009
# (C) Pywikibot team, 2006-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
__version__ = '$Id$'
#
import pywikibot
from pywikibot import textlib, pagegenerators
from pywikibot.bot import (MultipleSitesBot, InteractiveReplace,
AutomaticTWSummaryBot)
class DisambiguationRedirectBot(MultipleSitesBot, AutomaticTWSummaryBot):
"""Change redirects from disambiguation pages."""
summary_key = 'disambredir-msg'
def _create_callback(self, old, new):
replace_callback = InteractiveReplace(
old, new, default='n', automatic_quit=False)
replace_callback.allow_replace_label = True
replace_callback.allow_replace_section = True
replace_callback.allow_replace_all = True
return replace_callback
def treat_page(self):
"""Iterate over the linked pages and replace redirects conditionally."""
text = self.current_page.text
for linked_page in self.current_page.linkedPages():
try:
target = linked_page.getRedirectTarget()
except (pywikibot.Error, pywikibot.SectionError):
continue
# TODO: Work on all links at the same time (would mean that the user
# doesn't get them ordered like in links but how they appear in the page)
text = textlib.replace_links(
text, self._create_callback(linked_page, target),
self.current_page.site)
if text != self.current_page.get():
self.put_current(text)
def main(*args):
"""
Process command line arguments and invoke bot.
If args is an empty list, sys.argv is used.
@param args: command line arguments
@type args: list of unicode
"""
local_args = pywikibot.handle_args(args)
start = local_args[0] if local_args else '!'
mysite = pywikibot.Site()
try:
mysite.disambcategory()
except pywikibot.Error as e:
pywikibot.bot.suggest_help(exception=e)
return False
generator = pagegenerators.CategorizedPageGenerator(
mysite.disambcategory(), start=start, content=True, namespaces=[0])
bot = DisambiguationRedirectBot(generator=generator)
bot.run()
if __name__ == "__main__":
main()
|
{
"content_hash": "b7b9d100fbff9656fd230d44c256578b",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 85,
"avg_line_length": 28.886363636363637,
"alnum_prop": 0.6538158929976396,
"repo_name": "jayvdb/pywikibot-core",
"id": "246055194ac536d95d4d574bb37c414c456da7f9",
"size": "2585",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "scripts/disambredir.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "97"
},
{
"name": "HTML",
"bytes": "1365"
},
{
"name": "Python",
"bytes": "4435849"
}
],
"symlink_target": ""
}
|
from allennlp.common import Params
from allennlp.common.testing import AllenNlpTestCase
class TestParams(AllenNlpTestCase):
def test_load_from_file(self):
filename = 'tests/fixtures/bidaf/experiment.json'
params = Params.from_file(filename)
assert "dataset_reader" in params
assert "trainer" in params
model_params = params.pop("model")
assert model_params.pop("type") == "bidaf"
def test_overrides(self):
filename = 'tests/fixtures/bidaf/experiment.json'
overrides = '{ "train_data_path": "FOO", "model": { "type": "BAR" },'\
'model.text_field_embedder.tokens.type: "BAZ" }'
params = Params.from_file(filename, overrides)
assert "dataset_reader" in params
assert "trainer" in params
assert params["train_data_path"] == "FOO"
model_params = params.pop("model")
assert model_params.pop("type") == "BAR"
assert model_params["text_field_embedder.tokens.type"] == "BAZ"
def test_add_file_to_archive(self):
# Some nested classes just to exercise the ``from_params``
# and ``add_file_to_archive`` methods.
class A:
def __init__(self, b: 'B') -> None:
self.b = b
@classmethod
def from_params(cls, params: Params) -> 'A':
b_params = params.pop("b")
return cls(B.from_params(b_params))
class B:
def __init__(self, filename: str, c: 'C') -> None:
self.filename = filename
self.c_dict = {"here": c}
@classmethod
def from_params(cls, params: Params) -> 'B':
params.add_file_to_archive("filename")
filename = params.pop("filename")
c_params = params.pop("c")
c = C.from_params(c_params)
return cls(filename, c)
class C:
def __init__(self, c_file: str) -> None:
self.c_file = c_file
@classmethod
def from_params(cls, params: Params) -> 'C':
params.add_file_to_archive("c_file")
c_file = params.pop("c_file")
return cls(c_file)
params = Params({
"a": {
"b": {
"filename": "my-file",
"c": {
"c_file": "my-other-file"
}
}
}
})
# Construct ``A`` from params but then just throw it away.
A.from_params(params.pop("a"))
assert params.files_to_archive == {
"a.b.filename": "my-file",
"a.b.c.c_file": "my-other-file"
}
|
{
"content_hash": "57609401781a76f7e34a668120ef8d65",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 78,
"avg_line_length": 32.26136363636363,
"alnum_prop": 0.4874955970412117,
"repo_name": "nafitzgerald/allennlp",
"id": "69458e46bebfcea9a5147d0c3852948dfd74af66",
"size": "2882",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/common/params_test.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "5564"
},
{
"name": "Cuda",
"bytes": "18610"
},
{
"name": "Jupyter Notebook",
"bytes": "36610"
},
{
"name": "Makefile",
"bytes": "1478"
},
{
"name": "Perl",
"bytes": "43067"
},
{
"name": "Python",
"bytes": "1247761"
},
{
"name": "Shell",
"bytes": "13919"
}
],
"symlink_target": ""
}
|
#ifndef SINGA_CORE_SCHEDULER_H_
#define SINGA_CORE_SCHEDULER_H_
#include <condition_variable>
#include <functional>
#include <mutex>
#include <thread>
#include <unordered_map>
#include <vector>
#include "singa/core/common.h"
#include "singa/utils/safe_queue.h"
using std::function;
using std::unordered_map;
using std::vector;
namespace singa {
class Node;
class Edge;
class Graph;
class Device;
class BlkInfo;
typedef std::vector<Node *> NodeVec;
typedef std::vector<Edge *> EdgeVec;
typedef std::vector<Block *> BlockVec;
typedef std::function<void(Context *)> OpFunc;
typedef std::unordered_map<Block *, BlkInfo *> Blk2InfoMap;
enum BlockType { kUnknow, kInput, kParam, kInter, kEnd };
class Node {
public:
Node(int id, OpFunc &&op) : id_(id), op_(std::move(op)) {}
void AddInEdge(Edge *in_edge);
void AddOutEdge(Edge *out_edge);
// getters of Node
int id() const { return id_; }
const EdgeVec &in_edges() const { return in_edges_; }
const EdgeVec &out_edges() const { return out_edges_; }
private:
friend Graph;
int id_;
OpFunc op_;
EdgeVec in_edges_;
EdgeVec out_edges_;
};
class Edge {
public:
Edge(int id, Block *blk, Node *src_node, Node *dst_node)
: id_(id), blk_(blk), src_node_(src_node), dst_node_(dst_node) {}
void SetBlock(Block *blk);
void SetSrcNode(Node *src_node);
void SetDstNode(Node *dst_node);
// getters of Edge
int id() const { return id_; }
Block *block() const { return blk_; }
Node *src_node() const { return src_node_; }
Node *dst_node() const { return dst_node_; }
private:
friend Graph;
int id_;
Block *blk_;
Node *src_node_;
Node *dst_node_;
};
class BlkInfo {
public:
BlkInfo(int id, Block *blk, BlockType type = BlockType::kUnknow)
: id_(id),
blk_(blk),
type_(type),
graph_ref_(0),
write_node_(nullptr),
last_node_(nullptr) {}
// getters of BlkInfo
int id() const { return id_; }
Block *block() const { return blk_; }
BlockType type() const { return type_; }
int graph_ref() const { return graph_ref_; }
Node *write_node() const { return write_node_; }
Node *last_node() const { return last_node_; }
private:
friend Graph;
int id_;
Block *blk_;
BlockType type_;
int graph_ref_;
Node *write_node_; // last node that writes the block
Node *last_node_; // last node that uses the block
};
class Graph {
public:
struct CBData {
Graph *graph_;
Node *node_;
CBData(Graph *graph, Node *node) : graph_(graph), node_(node) {}
};
~Graph();
Graph(Device *device);
void Reset();
void Debug();
void RunGraph();
void RunInSerial();
void AddOperation(OpFunc &&op, const BlockVec &read_blocks,
const BlockVec &write_blocks);
// getters of Graph
const NodeVec &nodes() const { return nodes_; }
const EdgeVec &edges() const { return edges_; }
const Blk2InfoMap &blocks() const { return blocks_; }
const BlockVec &write_blocks() const { return write_blocks_; }
bool dirty() const { return dirty_; }
const NodeVec &begin_nodes() const { return begin_nodes_; }
const std::vector<NodeVec> &next_nodes() const { return next_nodes_; }
const std::vector<BlockVec> &free_blocks() const { return free_blocks_; }
Node *node(const size_t idx) const;
Edge *edge(const size_t idx) const;
BlkInfo *block(Block *blk) const;
Block *write_block(const size_t idx) const;
Node *begin_node(const size_t idx) const;
const NodeVec &next_nodes(const size_t idx) const;
const BlockVec &free_blocks(const size_t idx) const;
private:
void Analysis();
void FreeLoop();
void AddSyncOp(function<void(Context *)> &&op);
// static void CUDART_CB Callback(cudaStream_t stream, cudaError_t status,
// void *data);
private:
Device *device_;
// nodes, edges and blocks included in the calculation graph
NodeVec nodes_;
EdgeVec edges_;
Blk2InfoMap blocks_;
// Blocks written by the last operation, used for sync op
BlockVec write_blocks_;
// Calculation graph analysis
bool dirty_ = false;
NodeVec begin_nodes_;
std::vector<NodeVec> next_nodes_;
std::vector<BlockVec> free_blocks_;
SafeQueue<int> free_queue_;
};
/// Scheduling Tensor operations with dependency detection.
class Scheduler {};
} // namespace singa
#endif // SINGA_CORE_SCHEDULER_H_
|
{
"content_hash": "ee4dd473daec141a31fab81b90ebb755",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 76,
"avg_line_length": 23.85792349726776,
"alnum_prop": 0.6546037562986715,
"repo_name": "nudles/incubator-singa",
"id": "8055f7b22d48aeff60634986cc272bc44fffd2ca",
"size": "5172",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "include/singa/core/scheduler.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "179197"
},
{
"name": "C++",
"bytes": "2256779"
},
{
"name": "CMake",
"bytes": "34223"
},
{
"name": "Cuda",
"bytes": "23056"
},
{
"name": "Dockerfile",
"bytes": "19274"
},
{
"name": "Java",
"bytes": "2578"
},
{
"name": "Python",
"bytes": "338437"
},
{
"name": "Shell",
"bytes": "11565"
}
],
"symlink_target": ""
}
|
'use strict';
/**
const exampleReport = {
'Properties1 (Raw)': '<Buffer a1>',
Properties1: {
'Scale bit 2': true,
'Meter Type': 'Electric meter',
'Rate Type': 'Import',
'Meter Type (Parsed)': { value: 'Electric meter' },
'Rate Type (Parsed)': { value: 'Import' },
},
'Properties2 (Raw)': '<Buffer 34>',
Properties2: {
Size: 4,
'Scale bits 10': 2,
Precision: 1,
},
'Meter Value': '<Buffer 00 00 27 10>',
'Delta Time (Raw)': '<Buffer 00 00>',
'Delta Time': 0,
'Previous Meter Value': '<Buffer 00 00 00>',
'Scale 2 (Raw)': '<Buffer 00>',
'Scale 2': 0,
'Meter Value (Parsed)': 1000,
};
*/
module.exports = {
get: 'METER_GET',
getOpts: {
getOnStart: true,
},
getParserV3: () => ({
Properties1: {
Scale: 6,
},
}),
getParserV4: () => ({
Properties1: {
'Rate Type': 'Import',
Scale: 6,
},
'Scale 2': 0,
}),
report: 'METER_REPORT',
reportParserV3: report => {
if (report &&
report.hasOwnProperty('Properties1') &&
report.Properties1.hasOwnProperty('Meter Type') &&
(report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) &&
report.Properties1.hasOwnProperty('Scale bit 2') &&
report.Properties1['Scale bit 2'] === true &&
report.hasOwnProperty('Properties2') &&
report.Properties2.hasOwnProperty('Scale bits 10') &&
report.Properties2['Scale bits 10'] === 2) {
return report['Meter Value (Parsed)'];
}
return null;
},
reportParserV4: report => {
if (report &&
report.hasOwnProperty('Properties1') &&
report.Properties1.hasOwnProperty('Meter Type') &&
(report.Properties1['Meter Type'] === 'Electric meter' || report.Properties1['Meter Type'] === 1) &&
report.Properties1.hasOwnProperty('Scale bit 2') &&
report.Properties1['Scale bit 2'] === true &&
report.hasOwnProperty('Properties2') &&
report.Properties2.hasOwnProperty('Scale bits 10') &&
report.Properties2['Scale bits 10'] === 2 &&
report.hasOwnProperty('Scale 2') === false ||
report.hasOwnProperty('Scale 2')
&& report['Scale 2'] === 0) {
return report['Meter Value (Parsed)'];
}
return null;
},
};
|
{
"content_hash": "f2de0ef92fc35ecb2bba6c6f725e82fe",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 103,
"avg_line_length": 27.346153846153847,
"alnum_prop": 0.6169714017815283,
"repo_name": "timkouters/nl.timkouters.domitech",
"id": "2cc4cfd32b39fec62bd1ff50db06a425096bc73c",
"size": "2133",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "node_modules/homey-meshdriver/lib/zwave/system/capabilities/powerFactor/METER.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "2854"
}
],
"symlink_target": ""
}
|
set(CTEST_CMAKE_GENERATOR "Visual Studio 16 2019")
set(CTEST_CMAKE_GENERATOR_PLATFORM x64)
set(CTEST_CMAKE_GENERATOR_TOOLSET ClangCL)
list(APPEND CTEST_UPDATE_NOTES_FILES "${CMAKE_CURRENT_LIST_FILE}")
include(${CMAKE_CURRENT_LIST_DIR}/windows-common.cmake)
|
{
"content_hash": "2a99705a4c690b02e40682ad4e357dc5",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 66,
"avg_line_length": 43,
"alnum_prop": 0.7906976744186046,
"repo_name": "ornladios/ADIOS2",
"id": "f562eccdfa0628016d72f1c3612c7e70c611d010",
"size": "305",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "thirdparty/ffs/ffs/scripts/ci/cmake/windows2019-vs2019-clang.cmake",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "854523"
},
{
"name": "C++",
"bytes": "6522951"
},
{
"name": "CMake",
"bytes": "758150"
},
{
"name": "Cuda",
"bytes": "2207"
},
{
"name": "Dockerfile",
"bytes": "40776"
},
{
"name": "Fortran",
"bytes": "631183"
},
{
"name": "MATLAB",
"bytes": "26685"
},
{
"name": "Makefile",
"bytes": "8099"
},
{
"name": "PowerShell",
"bytes": "8948"
},
{
"name": "Python",
"bytes": "224209"
},
{
"name": "Roff",
"bytes": "1214"
},
{
"name": "Shell",
"bytes": "92677"
},
{
"name": "Tcl",
"bytes": "423"
}
],
"symlink_target": ""
}
|
package com.lianyu.tech.backoffice.web.request;
import com.lianyu.tech.core.platform.web.form.Form;
import com.lianyu.tech.core.platform.web.form.FormParam;
import javax.validation.constraints.NotNull;
/**
* @author bowen
*/
@Form
public class DescriptionItemRequest {
@FormParam("id")
private Integer id;
@NotNull(message = "descriptionId不能为空")
@FormParam("descriptionId")
private Integer descriptionId;
@FormParam("imageId")
private Integer imageId;
@FormParam("content")
private String content;
@FormParam("displayOrder")
private int displayOrder;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getDescriptionId() {
return descriptionId;
}
public void setDescriptionId(Integer descriptionId) {
this.descriptionId = descriptionId;
}
public Integer getImageId() {
return imageId;
}
public void setImageId(Integer imageId) {
this.imageId = imageId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public int getDisplayOrder() {
return displayOrder;
}
public void setDisplayOrder(int displayOrder) {
this.displayOrder = displayOrder;
}
}
|
{
"content_hash": "41104a6f0cc22798f11494519711efcc",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 57,
"avg_line_length": 20.323529411764707,
"alnum_prop": 0.6548480463096961,
"repo_name": "howbigbobo/com.lianyu.tech",
"id": "52c7f6b24680d20d2bc15889e5496e9f22655dce",
"size": "1390",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "back-office/src/main/java/com/lianyu/tech/backoffice/web/request/DescriptionItemRequest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "384739"
},
{
"name": "FreeMarker",
"bytes": "186817"
},
{
"name": "Java",
"bytes": "237500"
},
{
"name": "JavaScript",
"bytes": "385754"
},
{
"name": "Shell",
"bytes": "23"
}
],
"symlink_target": ""
}
|
/**
* @file base_session.h
*
* Base class for MQTT sessions. This class add facilities for persistence and resumption of session state. The MQTT
* standard requires that the client and server both maintain session state while connected. The server is also
* required to resume the state when a client re-connects with the same client id.
*/
#pragma once
#include "packet.h"
#include "packet_manager.h"
#include <event2/bufferevent.h>
#include <string>
/**
* Base session class
*
* Maintains session attributes and provides default handler methods for received control packets. Classes derived
* from BaseSession will override control packet handlers as required.
*
* Each BaseSession composes a PacketManager instance that can be moved between BaseSession instances.
*/
class BaseSession {
public:
/**
* Constructor
*
* Accepts a pointer to a libevent bufferevent as the only argument. The bufferevent is forwarded to a
* newly instantiated PacketManager that use it to handle all network related functions.
*
* This BaseSession instance can persist in memory after the network connection is closed. If a connection is
* received and the Connect control packet contains the same client id as an existing session. Any currently
* active connection in the original session is closed and this PacketManager will be moved to the original
* session. This session will then be deleted.
*
* @param bev Pointer to a bufferevent.
*/
BaseSession(struct bufferevent *bev) : packet_manager(new PacketManager(bev)) {
packet_manager->set_packet_received_handler(
std::bind(&BaseSession::packet_received, this, std::placeholders::_1));
packet_manager->set_event_handler(std::bind(&BaseSession::packet_manager_event, this, std::placeholders::_1));
}
/**
* Desctructor
*
* Virtual so the desctructor for derived classes will be called.
*/
virtual ~BaseSession() {}
/** Client id. */
std::string client_id;
/** Clean session flag. */
bool clean_session;
/**
* PacketManager callback.
*
* Invoked by the installed PacketManager instance when it receives a complete control packet. The default handler
* methods will be passed a reference to the received packet. Packet memory is heap allocated on creation and
* will be freed according to standard C++ std::unique_ptr rules. It is the responsibility of subclasses to
* manage the std::unique_ptr<Packet>.
*
* @param packet Pointer to a packet.
*/
virtual void packet_received(std::unique_ptr<Packet> packet);
/**
* PacketManager callback.
*
* Invoked by the installed PacketManager instance when it detects a low level protocol or network error. The
* default action is to close the network connection.
*
* @param event The type of event detected.
*/
virtual void packet_manager_event(PacketManager::EventType event);
/**
* Handle a received ConnectPacket.
*
* The default action is to throw an exception. Subclasses should override this method.
*
* @param connect_packet A reference to the packet.
*/
virtual void handle_connect(const ConnectPacket & connect_packet);
/**
* Handle a received ConnackPacket.
*
* The default action is to throw an exception. Subclasses should override this method.
*
* @param connack_packet A reference to the packet.
*/
virtual void handle_connack(const ConnackPacket & connack_packet);
/**
* Handle a received PublishPacket.
*
* The default action is to throw an exception. Subclasses should override this method.
*
* @param publish_packet A reference to the packet.
*/
virtual void handle_publish(const PublishPacket & publish_packet);
/**
* Handle a received PubackPacket.
*
* The default action is to throw an exception. Subclasses should override this method.
*
* @param puback_packet A reference to the packet.
*/
virtual void handle_puback(const PubackPacket & puback_packet);
/**
* Handle a received PubrecPacket.
*
* The default action is to throw an exception. Subclasses should override this method.
*
* @param pubrec_packet A reference to the packet.
*/
virtual void handle_pubrec(const PubrecPacket & pubrec_packet);
/**
* Handle a received PubrelPacket.
*
* The default action is to throw an exception. Subclasses should override this method.
*
* @param pubrel_packet A reference to the packet.
*/
virtual void handle_pubrel(const PubrelPacket & pubrel_packet);
/**
* Handle a received PubcompPacket.
*
* The default action is to throw an exception. Subclasses should override this method.
*
* @param pubcomp_packet A reference to the packet.
*/
virtual void handle_pubcomp(const PubcompPacket & pubcomp_packet);
/**
* Handle a received SubscribePacket.
*
* The default action is to throw an exception. Subclasses should override this method.
*
* @param subscribe_packet A reference to the packet.
*/
virtual void handle_subscribe(const SubscribePacket & subscribe_packet);
/**
* Handle a received SubackPacket.
*
* The default action is to throw an exception. Subclasses should override this method.
*
* @param suback_packet A reference to the packet.
*/
virtual void handle_suback(const SubackPacket & suback_packet);
/**
* Handle a received UnsubscribePacket.
*
* The default action is to throw an exception. Subclasses should override this method.
*
* @param unsubscribe_packet A reference to the packet.
*/
virtual void handle_unsubscribe(const UnsubscribePacket & unsubscribe_packet);
/**
* Handle a received UnsubackPacket.
*
* The default action is to throw an exception. Subclasses should override this method.
*
* @param unsuback_packet A reference to the packet.
*/
virtual void handle_unsuback(const UnsubackPacket & unsuback_packet);
/**
* Handle a received PingreqPacket.
*
* The default action is to send a Pingresp packet. Subclasses can override this method.
*
* @param pingreq_packet A reference to the packet.
*/
virtual void handle_pingreq(const PingreqPacket & pingreq_packet);
/**
* Handle a received PingrespPacket.
*
* The default action is to do nothing. Subclasses can override this method.
*
* @param pingresp_packet A reference to the packet.
*/
virtual void handle_pingresp(const PingrespPacket & pingresp_packet);
/**
* Handle a received DisconnectPacket.
*
* The default action is to throw an exception. Subclasses should override this method.
*
* @param disconnect_packet A reference to the packet.
*/
virtual void handle_disconnect(const DisconnectPacket & disconnect_packet);
/** Pointer to the installed PacketManager instance. */
std::unique_ptr<PacketManager> packet_manager;
};
|
{
"content_hash": "52d0d17899f0c36b6bea67788cd29690",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 119,
"avg_line_length": 33.943661971830984,
"alnum_prop": 0.680359612724758,
"repo_name": "inyotech/mqtt_broker",
"id": "fa17d4ae69fb7f591fca5103077af671cc34e2c1",
"size": "7230",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/base_session.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "150393"
},
{
"name": "CMake",
"bytes": "2495"
}
],
"symlink_target": ""
}
|
/**
* AdGroupBidModifierService.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter.
*/
package com.google.api.ads.adwords.axis.v201402.cm;
public interface AdGroupBidModifierService extends javax.xml.rpc.Service {
public java.lang.String getAdGroupBidModifierServiceInterfacePortAddress();
public com.google.api.ads.adwords.axis.v201402.cm.AdGroupBidModifierServiceInterface getAdGroupBidModifierServiceInterfacePort() throws javax.xml.rpc.ServiceException;
public com.google.api.ads.adwords.axis.v201402.cm.AdGroupBidModifierServiceInterface getAdGroupBidModifierServiceInterfacePort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
}
|
{
"content_hash": "e7763c66c47a1d98bf5c1544d81f1d2d",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 195,
"avg_line_length": 46.3125,
"alnum_prop": 0.8178137651821862,
"repo_name": "nafae/developer",
"id": "c472ef730a1dbd86019e59478c41ecb1945fbe66",
"size": "741",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/adwords_axis/src/main/java/com/google/api/ads/adwords/axis/v201402/cm/AdGroupBidModifierService.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "127846798"
},
{
"name": "Perl",
"bytes": "28418"
}
],
"symlink_target": ""
}
|
/*
* login.jsp页面请勿调用这个JS文件
*/
function setMainBodyHeight(){
function f(){
var h = $(window).height() - $('#header').outerHeight();
if($('#main_body').outerHeight() < h){
$('#main_body').css({'min-height': h});
}
}
$(window).on('resize', f);
f();
}
function bindSideMenu(){
$('#side_menu dl dt').on('click', function(){
if(!$(this).parent().hasClass(('active'))){
$('#side_menu dl dd').filter(':animated').stop(true, true);
$('#side_menu dl').filter('.active').find('dd').css('display', 'block').slideUp(300).parent().removeClass('active');
$(this).next('dd').slideDown(300).parent().addClass('active');
}else{
$(this).next('dd').css('display', 'block').slideUp(300).parent().removeClass('active');
}
$('.m_xxx_ul').animate({"height":0},300);
});
//三级菜单8.31添加 #
$('.m_xxx').each(function(i){
$(this).on('click', function(){
$(this).addClass('on3').siblings().removeClass('on3')
if($(this).next('ul').height()==0){
var $ul_li_length= $(this).next('ul').find('li').length
$(this).parent().find('ul').eq(i).animate({"height":$ul_li_length*30},300).siblings('ul').animate({"height":0},300)
$(this).find('.m_xxx_span3').addClass('on5').parent().siblings('.m_xxx').find('.m_xxx_span3').removeClass('on5')
$(this).find('.m_xxx_span1').addClass('on6').parent().siblings('.m_xxx').find('.m_xxx_span1').removeClass('on6')
}else{
$(this).next('ul').animate({"height":0},300);
$(this).removeClass('on3')
$(this).find('.m_xxx_span3').removeClass('on5')
$(this).find('.m_xxx_span1').removeClass('on6')
}
});
$(this).on('mouseenter',function(){
$(this).addClass('on2')
$(this).find('.m_xxx_span1').addClass('on4')
$(this).find('.m_xxx_span3').addClass('on4')
})
$(this).on('mouseleave',function(){
$(this).removeClass('on2')
$(this).find('.m_xxx_span1').removeClass('on4')
$(this).find('.m_xxx_span3').removeClass('on4')
})
})
}
function setSideMenu(menuID, subMenuID){
$(menuID).find('dt').trigger('click');
$(subMenuID).addClass('active');
}
function setThirdSideMenu(menuID, subMenuID,thirdMenuID){
$(menuID).find('dt').trigger('click');
$(subMenuID).trigger('click');
$(thirdMenuID).addClass('active');
}
function getFileInfo(file){
var fileInfo = {};
fileInfo.path = $(file).val();
if(fileInfo.path.lastIndexOf('\\') != -1){
fileInfo.name = fileInfo.path.substr(fileInfo.path.lastIndexOf('\\') + 1, fileInfo.path.length - 1);
}else{
fileInfo.name = fileInfo.path;
}
fileInfo.extName = fileInfo.name.substr(fileInfo.name.lastIndexOf('.') + 1 , fileInfo.name.length - 1).toLowerCase();
return fileInfo;
}
function showFileName(file, showObj){
var fileInfo = getFileInfo(file);
$(showObj).html(fileInfo.name);
}
$(function(){
setMainBodyHeight();
bindSideMenu();
//bindEditPasswordEvent();//绑定修改头部密码框事件
//selectedAuto();
});
function selectedAuto(){
/*
* 如果级联下拉,有权限的时候,对应的第一个值可能不是全部。这个时候要加载next下拉是数据
* 张威
*/
var insitutesSelect = $('#instituteslist');
var majorslistSelect = $('#majorslist');
var isAuto = false;//是否加载
if(insitutesSelect!=null && typeof(insitutesSelect.val())!="undefined"){
isAuto = true;
}
if(majorslistSelect!=null && typeof(majorslistSelect.val())!="undefined"){
isAuto = true;
}
if(isAuto){
$('#instituteslist').trigger('change');
//专业下拉的数据加载
var classtypelistSelect = $('#classtypelist');
//比如查询的时候。做一些自动选中操作
var selected_institutes = $("#selected_institutes").val();
var selected_majors = $("#selected_majors").val();
var selected_enrolYear = $("#selected_enrolYear").val();
var selected_class = $("#selected_class").val();
if(selected_institutes!=""){
insitutesSelect.find("option[value="+selected_institutes+"]").prop("selected", "selected");
}
if(selected_majors!=""){
majorslistSelect.find("option[value="+selected_majors+"]").prop("selected", "selected");
}
if(majorslistSelect!=null && majorslistSelect.val()!=null && majorslistSelect.val()!="" ){
$('#majorslist').trigger('change');
if(selected_enrolYear!=""){
classtypelistSelect.find("option[value="+selected_enrolYear+"]").prop("selected", "selected");
}
//入学年份的数据加载
if(classtypelistSelect!=null && classtypelistSelect.val()!=rblanguage.oldpage.new36 && classtypelistSelect.val()!="" ){
$('#classtypelist').trigger('change');
if(selected_class!=""){
$("#classlist option[value='"+selected_class+"']").prop("selected", "selected");//$('#classlist option[value="+selected_class+"]")
}
}else{
$('#classlist').hide();
}
}else{
$('#classtypelist').hide();
$('#classlist').hide();
}
if($('#classtypelist option').size()==0){
$('#classtypelist').hide();
}
}
}
//UEditor自定义配置项
var myUEditorOptions = {
//关闭字数统计
wordCount: false,
//关闭elementPath
elementPathEnabled: false,
//关闭自动长高
autoHeightEnabled: false,
//自定义工具栏
toolbars: [[
'fullscreen', 'source', '|', 'undo', 'redo', '|',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
'fontsize', '|',
'indent', '|',
'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
'link', 'unlink', '|',
'simpleupload', '|',
'preview', '|', 'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deletecol', 'insertcol', 'mergecells'
]]
};
//JS命名空间
educationPay = {};
educationPay.desktop = {};
educationPay.desktop.public = {};
educationPay.desktop.public.zIndex = 10000;
//信息提示插件(自动关闭)
educationPay.desktop.autoMsg = function(options){
if(educationPay.desktop.autoMsg.isOpen) return;
educationPay.desktop.autoMsg.isOpen = true;
this.options = {
'type': 'success', //支持三种类型:success成功信息、error失败信息、warning警告信息
'msg': rblanguage.oldpage.new37,
'fade': true,
'fadeSpeed': 300,
'delay': 3000,
'callBack': function(){},
'bgColor': {
'success': '#00a65a',
'error': '#dd4b39',
'warning': '#dd4b39'
//'warning': '#f39c12'
}
};
if(typeof(options) == 'object')
for(var x in options)
this.options[x] = options[x];
this.obj = $('<div>');
this.obj.css({
'display': 'none',
'position': 'fixed',
'bottom': '0',
'left': '0',
'zIndex': ++ educationPay.desktop.public.zIndex,
'boxSizing': 'border-box',
'width': '100%',
'height': '50px',
'backgroundColor': this.options.bgColor[this.options.type],
'boxShadow': '0 0 10px #666',
'fontSize': '24px',
'fontWeight': 'bold',
'color': '#fff',
'lineHeight': '50px',
'textAlign': 'center'
}).html(this.options.msg).appendTo($('body').first());
if(this.options.fade)
this.obj.fadeIn(this.options.fadeSpeed);
else
this.obj.show();
var oThis = this;
function close(){
if(oThis.obj){
function closeFun(){
oThis.obj.remove();
oThis.obj = null;
educationPay.desktop.autoMsg.isOpen = false;
oThis.options.callBack();
}
if(oThis.options.fade)
oThis.obj.fadeOut(oThis.options.fadeSpeed, function(){closeFun();});
else
closeFun();
}
}
setTimeout(function(){close();}, this.options.delay);
}
educationPay.desktop.autoMsg.isOpen = false;
autoMsg = educationPay.desktop.autoMsg;
//格式化日期
Date.prototype.format = function(){
var _year = this.getFullYear(),
_month = this.getMonth()+1<10?'0'+(this.getMonth()+1):this.getMonth()+1,
_date = this.getDate()<10?'0'+this.getDate():this.getDate();
return _year+'/'+_month+'/'+_date;
};
//查询四级联动
function searchChangeLink(server,obj){
// $("#paytopersonname").val("");
// $("#paymentCode").val("");
var tag = obj.attr('tag');
if(tag == '0'){
var majorValue=$("#majorslist").val();
for(var i=1; i<4; i++){
$('select[tag="'+i+'"]').hide();
$('select[tag="'+i+'"]').find('option').remove();
}
//如果是查询缴费码人群
if(obj.val() == "paymentCode_value"){
$("#paytopersonname").hide();
$("#paymentCode").show();
return;
}else{
$("#paymentCode").hide();
$("#paytopersonname").hide();
}
//如果是自定义收费对象
if(obj.val() == "zdypayitem"){
$("#paymentCode").hide();
$("#paytopersonname").show();
return;
}else{
$("#paymentCode").hide();
$("#paytopersonname").hide();
}
if(obj.val() == ''||obj.val()=="zdypayitem"||obj.val()=="zsjepayitem"){
$("#only_query_new_student").show();//这个为了控制学生列表页面中搜索是否显示“仅显示新生”
return;
}else{
$("#only_query_new_student").hide();
$("#only_query_new").attr("checked",false);
}
$.ajax({
type:"post",
dataType : "json",
url:server+"ed/schpayItem/getschmajors",
async:false,
data:{"institutesid" : obj.val()},
success:function(json){
var majorsList = json.majors,
enrolYearList = json.enyears,
opt_year = '',
opt_major = '';
if(majorsList.length != 0){
for(var i=0; i<majorsList.length; i++){
if(majorValue==majorsList[i].majorUid)
{
opt_major+='<option value="'+majorsList[i].majorUid+'" selected="selected">'+majorsList[i].majorName+'</option>';
}
else
{
opt_major+='<option value="'+majorsList[i].majorUid+'">'+majorsList[i].majorName+'</option>';
}
}
$('#majorslist').find('option').remove();
$('#majorslist').show().append($(opt_major));
if(majorsList.length == 1){
$('#majorslist').trigger('change');
}
}else{
for(var i=0; i<enrolYearList.length; i++){
if(enrolYearList[i].enrolYear=='全部入学年份'){
opt_year+='<option value="">'+enrolYearList[i].enrolYear+'</option>';
}else{
opt_year+='<option value="'+enrolYearList[i].enrolYear+'">'+enrolYearList[i].enrolYear+'</option>';
}
}
$('#majorslist').hide();
$('#classtypelist').find('option').not('option[value=""]').remove();
$('#classtypelist').show().append($(opt_year));
}
},
error:function(){
new autoMsg({'type': 'error', 'msg': rblanguage.oldpage.new07});
setTimeout(function(){
location.href = server + 'login.jsp';
}, 2000);
}
});
}else if(tag == '1'){
var enrolYearValue=$("#classtypelist").val();
for(var i=2; i<4; i++){
$('select[tag="'+i+'"]').hide();
$('select[tag="'+i+'"]').find('option').remove();
}
if(obj.val() == ''){return;};
$.ajax({
type:"post",
dataType : "json",
url:server+"ed/schpayItem/getschclasstypelist",
async:false,
data:{"institutesid" : $('#instituteslist').val(),"majorid":obj.val()},
success:function(json){
opt_year = '';
for(var i=0; i<json.length; i++){
if(enrolYearValue==json[i].enrolYear)
{
opt_year+='<option value="'+json[i].classUid+'" selected="selected">'+json[i].enrolYear+'</option>';
}
else
{
opt_year+='<option value="'+json[i].classUid+'">'+json[i].enrolYear+'</option>';
}
}
$('#classtypelist').find('option').not('option[value=""]').remove();
$('#classtypelist').show().append($(opt_year));
if(json.length == 1){
$('#classtypelist').trigger('change');
}else if(json.length == 0){
$('#classtypelist').hide();
}
},
error:function(){
new autoMsg({'type': 'error', 'msg': rblanguage.oldpage.new07});
setTimeout(function(){
location.href = server + 'login.jsp';
}, 2000);
}
});
}else if(tag == '2'){
var classValue=$('#classlist').val();
for(var i=3; i<4; i++){
$('select[tag="'+i+'"]').hide();
$('select[tag="'+i+'"]').find('option').remove();
}
if(obj.val() == ''){return;};
$.ajax({
type:"post",
dataType : "json",
url:server+"ed/schpayItem/getschclasstypelist",
async:false,
data:{"institutesid" : $('#instituteslist').val(),"majorid":$('#majorslist').val(),"enrolYear":obj.val()},
success:function(json){
opt_classes = '';
for(var i=0; i<json.length; i++){
if(classValue==json[i].classUid)
{
opt_classes+='<option value="'+json[i].classUid+'" selected="selected">'+json[i].className+'</option>';
}
else
{
opt_classes+='<option value="'+json[i].classUid+'">'+json[i].className+'</option>';
}
}
if(json.length == 0){
$('#classlist').hide();
}else{
$('#classlist').find('option').remove();
$('#classlist').show().append($(opt_classes));
}
},
error:function(){
new autoMsg({'type': 'error', 'msg': rblanguage.oldpage.new07});
setTimeout(function(){
location.href = server + 'login.jsp';
}, 2000); }
});
}
};
//全选
$.fn.checkAll = function(options){
var me = this;
var Len = options.length;
this.on('click',function(){
options.prop('checked',$(this).prop('checked'));
});
options.on('click',function(){
me.prop('checked',options.filter(':checked').length == Len?true:false);
});
return this;
};
|
{
"content_hash": "45448b90b28b3f62db274722806016f3",
"timestamp": "",
"source": "github",
"line_count": 466,
"max_line_length": 261,
"avg_line_length": 32.68025751072961,
"alnum_prop": 0.5079125352945039,
"repo_name": "ChristYoung/Home2Work",
"id": "ce7291c6466fd067edd9c57b4924f053f69ff1ab",
"size": "15701",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "管理后台模板/js/common/common.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "263865"
},
{
"name": "HTML",
"bytes": "824698"
},
{
"name": "JavaScript",
"bytes": "821691"
},
{
"name": "TypeScript",
"bytes": "77540"
}
],
"symlink_target": ""
}
|
package org.txt2xml.cli;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.net.URL;
import java.nio.CharBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import org.txt2xml.config.ProcessorFactory;
import org.txt2xml.core.Processor;
import org.txt2xml.driver.StreamDriver;
/**
* A simple command line utility to apply a txt2xml
* conversion with a specified configuration to a set
* of files.
*
* Usage:
* <pre>
* java org.txt2xml.cli.Batch <config_xml> <source_file>*
* </pre>
* Applies txt2xml to all source files as configured by the config_xml,
* saving result xml by appending .xml to the source filename.
*
* @author <A HREF="mailto:smeyfroi@users.sourceforge.net">Steve Meyfroidt</A>
*/
public class Batch {
public static void main(String[] args) throws Exception {
if (args.length < 2) {
System.out.println("Usage: java org.txt2xml.cli.Batch <config_xml> <source_file>*");
System.out.println("Applies txt2xml to all source files as configured by the config_xml,\n" +
"saving result xml by appending .xml to the source filename.");
System.exit(1);
}
String config = args[0];
String[] sources = new String[args.length - 1];
System.arraycopy(args, 1, sources, 0, sources.length);
URL configUrl = new File(config).toURI().toURL();
Processor processor = ProcessorFactory.getInstance().createProcessor(configUrl);
StreamDriver driver = new StreamDriver(processor);
driver.useDebugOutputProperties();
for (int i = 0; i < sources.length; i++) {
String sourceName = sources[i];
processFile(driver, sourceName);
}
}
private static void processFile(StreamDriver driver, String sourceName) throws Exception {
// Make dest file
String destName = sourceName + ".xml";
File dest = new File(destName);
if (dest.exists()) {
throw new IllegalArgumentException("File '" + destName + "' already exists!");
}
// Load source, converting bytes to unicode chars
FileInputStream fis = new FileInputStream(sourceName);
FileChannel sourceChannel = fis.getChannel();
try {
MappedByteBuffer sourceByteBuffer = sourceChannel.map(FileChannel.MapMode.READ_ONLY, 0, sourceChannel.size());
CharsetDecoder decoder = Charset.forName("ISO-8859-15").newDecoder();
CharBuffer sourceBuffer = decoder.decode(sourceByteBuffer);
// Do txt2xml
driver.generateXmlDocument(sourceBuffer, new FileOutputStream(dest));
} finally {
// Close source
sourceChannel.close();
fis.close();
}
}
}
|
{
"content_hash": "4c0e29264bb54e91db8fb4f5cbcdf2d1",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 122,
"avg_line_length": 38.31645569620253,
"alnum_prop": 0.6336306574165841,
"repo_name": "JOverseer/joverseer",
"id": "99a784102e0d782f12d7f96a82598d7d508984fe",
"size": "4708",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "txt2xmljar/src/org/txt2xml/cli/Batch.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "997"
},
{
"name": "HTML",
"bytes": "2597"
},
{
"name": "Inno Setup",
"bytes": "3220"
},
{
"name": "Java",
"bytes": "3007047"
},
{
"name": "Shell",
"bytes": "36145"
},
{
"name": "VBA",
"bytes": "986"
},
{
"name": "XSLT",
"bytes": "619"
}
],
"symlink_target": ""
}
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>V8 API Reference Guide for node.js v4.4.6: v8::ResourceConstraints Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for node.js v4.4.6
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="inherits.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacev8.html">v8</a></li><li class="navelem"><a class="el" href="classv8_1_1ResourceConstraints.html">ResourceConstraints</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="classv8_1_1ResourceConstraints-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">v8::ResourceConstraints Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include <<a class="el" href="v8_8h_source.html">v8.h</a>></code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:aeeaaee4017e8d5f8f0439af2af2ed3a5"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classv8_1_1ResourceConstraints.html#aeeaaee4017e8d5f8f0439af2af2ed3a5">ConfigureDefaults</a> (uint64_t physical_memory, uint64_t virtual_memory_limit)</td></tr>
<tr class="separator:aeeaaee4017e8d5f8f0439af2af2ed3a5"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a9cdff07ac0633cd33eddd4e58cbfa3a9"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9cdff07ac0633cd33eddd4e58cbfa3a9"></a>
 </td><td class="memItemRight" valign="bottom"><b>V8_DEPRECATED</b> ("Use two-args version instead", void <a class="el" href="classv8_1_1ResourceConstraints.html#aeeaaee4017e8d5f8f0439af2af2ed3a5">ConfigureDefaults</a>(uint64_t physical_memory, uint64_t virtual_memory_limit, uint32_t number_of_processors))</td></tr>
<tr class="separator:a9cdff07ac0633cd33eddd4e58cbfa3a9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aeeecbbdb2c7880bf74d5d7fb9bbc52b3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aeeecbbdb2c7880bf74d5d7fb9bbc52b3"></a>
int </td><td class="memItemRight" valign="bottom"><b>max_semi_space_size</b> () const </td></tr>
<tr class="separator:aeeecbbdb2c7880bf74d5d7fb9bbc52b3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac83efbf72458c872009f66019352409e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac83efbf72458c872009f66019352409e"></a>
void </td><td class="memItemRight" valign="bottom"><b>set_max_semi_space_size</b> (int value)</td></tr>
<tr class="separator:ac83efbf72458c872009f66019352409e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a72840efdbcfc7bb287c6aea38d0b07b9"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a72840efdbcfc7bb287c6aea38d0b07b9"></a>
int </td><td class="memItemRight" valign="bottom"><b>max_old_space_size</b> () const </td></tr>
<tr class="separator:a72840efdbcfc7bb287c6aea38d0b07b9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa764be7c76b4baa3fce7a54c3777b5e9"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa764be7c76b4baa3fce7a54c3777b5e9"></a>
void </td><td class="memItemRight" valign="bottom"><b>set_max_old_space_size</b> (int value)</td></tr>
<tr class="separator:aa764be7c76b4baa3fce7a54c3777b5e9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a037777e608ed1c22fe294ecef5722036"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a037777e608ed1c22fe294ecef5722036"></a>
int </td><td class="memItemRight" valign="bottom"><b>max_executable_size</b> () const </td></tr>
<tr class="separator:a037777e608ed1c22fe294ecef5722036"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a37d1b38672e9844c567823a119dcd557"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a37d1b38672e9844c567823a119dcd557"></a>
void </td><td class="memItemRight" valign="bottom"><b>set_max_executable_size</b> (int value)</td></tr>
<tr class="separator:a37d1b38672e9844c567823a119dcd557"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aafc4a94f2eeb0684e7a50f355eb4d06d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aafc4a94f2eeb0684e7a50f355eb4d06d"></a>
uint32_t * </td><td class="memItemRight" valign="bottom"><b>stack_limit</b> () const </td></tr>
<tr class="separator:aafc4a94f2eeb0684e7a50f355eb4d06d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a26ed3e89985a4afe34e84509fb093cf1"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a26ed3e89985a4afe34e84509fb093cf1"></a>
void </td><td class="memItemRight" valign="bottom"><b>set_stack_limit</b> (uint32_t *value)</td></tr>
<tr class="separator:a26ed3e89985a4afe34e84509fb093cf1"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac9f4b9010ed635944cffee59f4f22795"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac9f4b9010ed635944cffee59f4f22795"></a>
 </td><td class="memItemRight" valign="bottom"><b>V8_DEPRECATED</b> ("Unused, will be removed", int max_available_threads() const)</td></tr>
<tr class="separator:ac9f4b9010ed635944cffee59f4f22795"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5a5c9962c1376dd99511fea06659abdb"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5a5c9962c1376dd99511fea06659abdb"></a>
 </td><td class="memItemRight" valign="bottom"><b>V8_DEPRECATED</b> ("Unused, will be removed", void set_max_available_threads(int value))</td></tr>
<tr class="separator:a5a5c9962c1376dd99511fea06659abdb"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8dd511917ad17bf2185d574b0c7e4186"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8dd511917ad17bf2185d574b0c7e4186"></a>
size_t </td><td class="memItemRight" valign="bottom"><b>code_range_size</b> () const </td></tr>
<tr class="separator:a8dd511917ad17bf2185d574b0c7e4186"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af887bf453b41b79eb174e5eeee0f1db2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af887bf453b41b79eb174e5eeee0f1db2"></a>
void </td><td class="memItemRight" valign="bottom"><b>set_code_range_size</b> (size_t value)</td></tr>
<tr class="separator:af887bf453b41b79eb174e5eeee0f1db2"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A set of constraints that specifies the limits of the runtime's memory use. You must set the heap size before initializing the VM - the size cannot be adjusted after the VM is initialized.</p>
<p>If you are using threads then you should hold the V8::Locker lock while setting the stack limit and you must set a non-default stack limit separately for each thread. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="aeeaaee4017e8d5f8f0439af2af2ed3a5"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void v8::ResourceConstraints::ConfigureDefaults </td>
<td>(</td>
<td class="paramtype">uint64_t </td>
<td class="paramname"><em>physical_memory</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t </td>
<td class="paramname"><em>virtual_memory_limit</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Configures the constraints with reasonable default values based on the capabilities of the current device the VM is running on.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">physical_memory</td><td>The total amount of physical memory on the current device, in bytes. </td></tr>
<tr><td class="paramname">virtual_memory_limit</td><td>The amount of virtual memory on the current device, in bytes, or zero, if there is no limit. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>deps/v8/include/<a class="el" href="v8_8h_source.html">v8.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
|
{
"content_hash": "1cf2c4f537d0a5a9a8676c07477f36b9",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 341,
"avg_line_length": 63.891752577319586,
"alnum_prop": 0.6939088342073416,
"repo_name": "v8-dox/v8-dox.github.io",
"id": "c43b8a32c8bfc7037143a3aea62b35007ad9f767",
"size": "12395",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "134c3b3/html/classv8_1_1ResourceConstraints.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
}
|
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for All files</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="prettify.css" />
<link rel="stylesheet" href="base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
All files
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">80% </span>
<span class="quiet">Statements</span>
<span class='fraction'>8/10</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>2/2</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">80% </span>
<span class="quiet">Lines</span>
<span class='fraction'>8/10</span>
</div>
</div>
</div>
<div class='status-line high'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
<tr>
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
</tr>
</thead>
<tbody><tr>
<td class="file high" data-value="Search.js"><a href="Search.js.html">Search.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="6" class="abs high">6/6</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="2" class="abs high">2/2</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="6" class="abs high">6/6</td>
</tr>
<tr>
<td class="file medium" data-value="ShowCard.js"><a href="ShowCard.js.html">ShowCard.js</a></td>
<td data-value="50" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 50%;"></div><div class="cover-empty" style="width:50%;"></div></div></td>
<td data-value="50" class="pct medium">50%</td>
<td data-value="4" class="abs medium">2/4</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="50" class="pct medium">50%</td>
<td data-value="4" class="abs medium">2/4</td>
</tr>
</tbody>
</table>
</div><div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Fri Mar 31 2017 22:17:05 GMT-0400 (EDT)
</div>
</div>
<script src="prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="sorter.js"></script>
</body>
</html>
|
{
"content_hash": "f40120948fe74c970fb4285ab2222dd9",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 180,
"avg_line_length": 39.15094339622642,
"alnum_prop": 0.6139759036144579,
"repo_name": "PansFortress/complete-intro-to-react",
"id": "42eca537301d1572116b0687b79406976172648b",
"size": "4150",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "coverage/lcov-report/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "9423"
},
{
"name": "HTML",
"bytes": "13872"
},
{
"name": "JavaScript",
"bytes": "14410"
}
],
"symlink_target": ""
}
|
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
DOCUMENTATION = '''
---
module: nxos_snmp_community
extends_documentation_fragment: nxos
version_added: "2.2"
short_description: Manages SNMP community configs.
description:
- Manages SNMP community configuration.
author:
- Jason Edelman (@jedelman8)
- Gabriele Gerbino (@GGabriele)
notes:
- Tested against NXOSv 7.3.(0)D1(1) on VIRL
options:
community:
description:
- Case-sensitive community string.
required: true
access:
description:
- Access type for community.
required: false
default: null
choices: ['ro','rw']
group:
description:
- Group to which the community belongs.
required: false
default: null
acl:
description:
- ACL name to filter snmp requests.
required: false
default: 1
state:
description:
- Manage the state of the resource.
required: true
default: present
choices: ['present','absent']
'''
EXAMPLES = '''
# ensure snmp community is configured
- nxos_snmp_community:
community: TESTING7
group: network-operator
state: present
'''
RETURN = '''
commands:
description: commands sent to the device
returned: always
type: list
sample: ["snmp-server community TESTING7 group network-operator"]
'''
import re
from ansible.module_utils.nxos import load_config, run_commands
from ansible.module_utils.nxos import nxos_argument_spec, check_args
from ansible.module_utils.basic import AnsibleModule
def execute_show_command(command, module):
if 'show run' not in command:
output = 'json'
else:
output = 'text'
cmds = [{
'command': command,
'output': output,
}]
body = run_commands(module, cmds)
return body
def flatten_list(command_lists):
flat_command_list = []
for command in command_lists:
if isinstance(command, list):
flat_command_list.extend(command)
else:
flat_command_list.append(command)
return flat_command_list
def get_snmp_groups(module):
data = execute_show_command('show snmp group', module)[0]
group_list = []
try:
group_table = data['TABLE_role']['ROW_role']
for group in group_table:
group_list.append(group['role_name'])
except (KeyError, AttributeError):
pass
return group_list
def get_snmp_community(module, name):
command = 'show run snmp all | grep {0}'.format(name)
data = execute_show_command(command, module)[0]
community_dict = {}
if not data:
return community_dict
community_re = r'snmp-server community (\S+)'
mo = re.search(community_re, data)
if mo:
community_name = mo.group(1)
else:
return community_dict
community_dict['group'] = None
group_re = r'snmp-server community {0} group (\S+)'.format(community_name)
mo = re.search(group_re, data)
if mo:
community_dict['group'] = mo.group(1)
community_dict['acl'] = None
acl_re = r'snmp-server community {0} use-acl (\S+)'.format(community_name)
mo = re.search(acl_re, data)
if mo:
community_dict['acl'] = mo.group(1)
return community_dict
def config_snmp_community(delta, community):
CMDS = {
'group': 'snmp-server community {0} group {group}',
'acl': 'snmp-server community {0} use-acl {acl}'
}
commands = []
for k, v in delta.items():
cmd = CMDS.get(k).format(community, **delta)
if cmd:
commands.append(cmd)
cmd = None
return commands
def main():
argument_spec = dict(
community=dict(required=True, type='str'),
access=dict(choices=['ro', 'rw']),
group=dict(type='str'),
acl=dict(type='str'),
state=dict(choices=['absent', 'present'], default='present'),
)
argument_spec.update(nxos_argument_spec)
module = AnsibleModule(argument_spec=argument_spec,
required_one_of=[['access', 'group']],
mutually_exclusive=[['access', 'group']],
supports_check_mode=True)
warnings = list()
check_args(module, warnings)
results = {'changed': False, 'commands': [], 'warnings': warnings}
access = module.params['access']
group = module.params['group']
community = module.params['community']
acl = module.params['acl']
state = module.params['state']
if access:
if access == 'ro':
group = 'network-operator'
elif access == 'rw':
group = 'network-admin'
# group check - ensure group being configured exists on the device
configured_groups = get_snmp_groups(module)
if group not in configured_groups:
module.fail_json(msg="Group not on switch. Please add before moving forward")
existing = get_snmp_community(module, community)
args = dict(group=group, acl=acl)
proposed = dict((k, v) for k, v in args.items() if v is not None)
delta = dict(set(proposed.items()).difference(existing.items()))
commands = []
if state == 'absent':
if existing:
command = "no snmp-server community {0}".format(community)
commands.append(command)
elif state == 'present':
if delta:
command = config_snmp_community(dict(delta), community)
commands.append(command)
cmds = flatten_list(commands)
if cmds:
results['changed'] = True
if not module.check_mode:
load_config(module, cmds)
if 'configure' in cmds:
cmds.pop(0)
results['commands'] = cmds
module.exit_json(**results)
if __name__ == '__main__':
main()
|
{
"content_hash": "21ebc661a823c3723501fadabbbf0da4",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 85,
"avg_line_length": 26.94090909090909,
"alnum_prop": 0.5979416230808166,
"repo_name": "e-gob/plataforma-kioscos-autoatencion",
"id": "341fb8aa34b4151445dcf21bd7e13fac383c63f8",
"size": "6602",
"binary": false,
"copies": "18",
"ref": "refs/heads/master",
"path": "scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_snmp_community.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "41110"
},
{
"name": "C++",
"bytes": "3804"
},
{
"name": "CSS",
"bytes": "34823"
},
{
"name": "CoffeeScript",
"bytes": "8521"
},
{
"name": "HTML",
"bytes": "61168"
},
{
"name": "JavaScript",
"bytes": "7206"
},
{
"name": "Makefile",
"bytes": "1347"
},
{
"name": "PowerShell",
"bytes": "584344"
},
{
"name": "Python",
"bytes": "25506593"
},
{
"name": "Ruby",
"bytes": "245726"
},
{
"name": "Shell",
"bytes": "5075"
}
],
"symlink_target": ""
}
|
<include file="Common:header"/>
<include file="Common:nav"/>
<div class="main">
<div style="padding-top: 20px;width: 900px;height: 300px;">
<div class="list-group">
<a href="#" class="list-group-item active">
资料下载
</a>
<foreach name="file" item="v">
<a href="{:U('Index/Download/file_download',array('id'=>$v['file_id']))}" class="list-group-item">
{$v.file_name}</a>
</foreach>
</div>
</div>
<include file="Common:bottom"/>
|
{
"content_hash": "17a3818fef98590ad6338f803eddf3aa",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 114,
"avg_line_length": 32.588235294117645,
"alnum_prop": 0.5018050541516246,
"repo_name": "CodeBall/SDUTXSH",
"id": "bcc993b58f60917d9178d83ce52ab9aedbf361c2",
"size": "562",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "APP/Modules/Index/Tpl/List/File.html",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "109"
},
{
"name": "CSS",
"bytes": "173756"
},
{
"name": "HTML",
"bytes": "263749"
},
{
"name": "JavaScript",
"bytes": "1616656"
},
{
"name": "PHP",
"bytes": "1546382"
},
{
"name": "Smarty",
"bytes": "8885"
}
],
"symlink_target": ""
}
|
package org.shipwheel.service.user;
import org.shipwheel.vo.user.User;
import java.util.Collection;
import java.util.Map;
/**
* Created by wx on 2017/4/29.
*/
public interface IUserService {
Collection<User> getUsers();
User getUserByName(String name);
Map<String, Object> modUser(String name, String oldPwd, String newPwd) throws Exception;
User createUser(User user);
User login(String name, String password);
}
|
{
"content_hash": "cb9b7839e77bbdbe975e278f92edf366",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 92,
"avg_line_length": 25.823529411764707,
"alnum_prop": 0.7312072892938497,
"repo_name": "kuun/dataship",
"id": "9316ef48c3dac35d8655fafc778ab9d50b9af15b",
"size": "439",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "shipwheel/src/main/java/org/shipwheel/service/user/IUserService.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "60388"
},
{
"name": "Makefile",
"bytes": "64"
}
],
"symlink_target": ""
}
|
This app demonstrates how to use the mobilehtml5app framework to generate
a rich HTML5 based user interface on mobile for a Go Language webapp backend.
It also demonstrates how to use the private app storage space on Android
to persist data and how to link up all the build all components using Gradle.
<img src="https://github.com/srinathh/mobilehtml5app/raw/master/example/todoapp/screenshot.jpg" width="300">
# Web Frameworks Used
The app uses [React](https://facebook.github.io/react/) and [Bootstrap](http://getbootstrap.com/)
to build the user interface and interacts using AJAX calls with the Go Language
backend. It uses [BoltDB](https://github.com/boltdb/bolt) to persist the data
in the app's private persistant data folder which is obtained using
Activity.getFilesDir() and provided to the Start() function of the Go app.
## Requirements to Build
- [Node.js](https://nodejs.org/) and [Babel](https://babeljs.io/) installed
to compile JSX to Javascript
- [Go-Bindata](https://github.com/jteeuwen/go-bindata) installed to compile assets into bindata.go
## How to Build
- In the Android Studio's opening dialog, select "Import Project"
- Import the androidapp folder
## Photo Credits
Markus Spiske, www.markusspiske.com
|
{
"content_hash": "307a80f82b4e36e67f6812959bcf0941",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 108,
"avg_line_length": 47.53846153846154,
"alnum_prop": 0.7775080906148867,
"repo_name": "srinathh/mobilehtml5app",
"id": "a48a7c66988fa37fc1cfb7e7f0bafdb062630ff2",
"size": "1255",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "example/todoapp/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "526"
},
{
"name": "Go",
"bytes": "40172"
},
{
"name": "HTML",
"bytes": "1154"
},
{
"name": "Java",
"bytes": "5224"
},
{
"name": "JavaScript",
"bytes": "10507"
}
],
"symlink_target": ""
}
|
import React, { PropTypes } from 'react';
import CSSModules from 'react-css-modules';
// Components
import Tooltip from '../../utils/Tooltip';
// Styles
import styles from './index.scss';
const propTypes = {
toggleMarkerVisibility: PropTypes.func.isRequired,
archiveCurrentCrisis: PropTypes.func.isRequired,
controlMap: PropTypes.object.isRequired,
disableArchiving: PropTypes.bool.isRequired,
};
const Toolbar = ({
toggleMarkerVisibility, archiveCurrentCrisis, controlMap,
disableArchiving,
}) => {
const weatherTooltipContent = controlMap.visibility.weather ?
'Hide weather markers' :
'Show weather markers';
const archiveTooltipContent = disableArchiving ?
'You cannot archive crisis while there is still active incidents' :
'New crisis will be initialized when you archive crisis';
return (
<div styleName='Toolbar'>
<Tooltip content={weatherTooltipContent}>
<button onClick={() => toggleMarkerVisibility('weather')}>
<i className='ion-ios-toggle-outline' />
</button>
</Tooltip>
<Tooltip content={archiveTooltipContent}>
<button
onClick={archiveCurrentCrisis}
disabled={disableArchiving}
>
<i className='ion-ios-box-outline' />
Archive current crisis
</button>
</Tooltip>
</div>
);
};
Toolbar.propTypes = propTypes;
// Toolbar.defaultProps = {};
export default CSSModules(Toolbar, styles); // { allowMultiple: true }
|
{
"content_hash": "62f3a2dcaf77e06f210f1f117e76a84e",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 71,
"avg_line_length": 28.20754716981132,
"alnum_prop": 0.6822742474916388,
"repo_name": "Temzasse/ntu-crysis",
"id": "f8b94fc5733ebb9013ac5071fc0192e3b49c40d4",
"size": "1495",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/components/map/Toolbar/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "28727"
},
{
"name": "HTML",
"bytes": "76570"
},
{
"name": "JavaScript",
"bytes": "132229"
},
{
"name": "Python",
"bytes": "73442"
}
],
"symlink_target": ""
}
|
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "b1cc41b501a17f1994df10df56089b64",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "afc7e786e727b0b63f78b79b1256998bbe981240",
"size": "177",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Ericales/Primulaceae/Lysimachia/Lysimachia trientalis/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
}
|
import Format from "./Format";
export { Format };
|
{
"content_hash": "4d267dbbf49102b474d88fc7a5232dc8",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 30,
"avg_line_length": 17,
"alnum_prop": 0.6666666666666666,
"repo_name": "laurentChin/movie-manager-pwa",
"id": "e2f88386f935fb9624df1539b1f1aaca16b5178b",
"size": "51",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Format/Item/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "8997"
},
{
"name": "HTML",
"bytes": "2161"
},
{
"name": "JavaScript",
"bytes": "60993"
},
{
"name": "Shell",
"bytes": "58"
}
],
"symlink_target": ""
}
|
package com.medal.framework.mybatis.config;
import lombok.Data;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.ExecutorType;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@ConfigurationProperties(prefix = "medal.mybatis")
public class MedalMybatisProperties {
/**
* config-location: MyBatis xml config file (optional)
*/
private String configLocation;
/**
* mapper-locations: Mapper xml config files (optional)
*/
private String[] mapperLocations;
/**
* type-aliases-package: Package to search for type aliases (optional)
*/
private String typeAliasesPackage;
/**
* type-handlers-package: Package to search for type aliases (optional)
*/
private String typeHandlersPackage;
private boolean checkConfigLocation = false;
/**
* executor-type: Executor type: SIMPLE, REUSE, BATCH (optional)
*/
private ExecutorType executorType;
/**
* configuration A MyBatis Configuration bean. About available properties see the MyBatis reference page. NOTE This property cannot use at the same time with the config-location.
*/
private Configuration configuration;
public Resource[] resolveMapperLocations() {
ArrayList resources = new ArrayList();
if(this.mapperLocations != null) {
String[] mapperLocations = this.mapperLocations;
int var3 = mapperLocations.length;
for(int var4 = 0; var4 < var3; ++var4) {
String mapperLocation = mapperLocations[var4];
try {
Resource[] mappers = (new PathMatchingResourcePatternResolver()).getResources(mapperLocation);
resources.addAll(Arrays.asList(mappers));
} catch (IOException var8) {
;
}
}
}
Resource[] var9 = new Resource[resources.size()];
var9 = (Resource[])resources.toArray(var9);
return var9;
}
private String sqlSessionFactoryBeanName;
private String basePackage;
private String mappers;
public String getConfigLocation() {
return configLocation;
}
public void setConfigLocation(String configLocation) {
this.configLocation = configLocation;
}
public String[] getMapperLocations() {
return mapperLocations;
}
public void setMapperLocations(String[] mapperLocations) {
this.mapperLocations = mapperLocations;
}
public String getTypeAliasesPackage() {
return typeAliasesPackage;
}
public void setTypeAliasesPackage(String typeAliasesPackage) {
this.typeAliasesPackage = typeAliasesPackage;
}
public String getTypeHandlersPackage() {
return typeHandlersPackage;
}
public void setTypeHandlersPackage(String typeHandlersPackage) {
this.typeHandlersPackage = typeHandlersPackage;
}
public boolean isCheckConfigLocation() {
return checkConfigLocation;
}
public void setCheckConfigLocation(boolean checkConfigLocation) {
this.checkConfigLocation = checkConfigLocation;
}
public ExecutorType getExecutorType() {
return executorType;
}
public void setExecutorType(ExecutorType executorType) {
this.executorType = executorType;
}
public Configuration getConfiguration() {
return configuration;
}
public void setConfiguration(Configuration configuration) {
this.configuration = configuration;
}
public String getSqlSessionFactoryBeanName() {
return sqlSessionFactoryBeanName;
}
public void setSqlSessionFactoryBeanName(String sqlSessionFactoryBeanName) {
this.sqlSessionFactoryBeanName = sqlSessionFactoryBeanName;
}
public String getBasePackage() {
return basePackage;
}
public void setBasePackage(String basePackage) {
this.basePackage = basePackage;
}
public String getMappers() {
return mappers;
}
public void setMappers(String mappers) {
this.mappers = mappers;
}
}
|
{
"content_hash": "771801a69ace16d327de3f466660f853",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 183,
"avg_line_length": 28.862745098039216,
"alnum_prop": 0.6811594202898551,
"repo_name": "xhujinjun/driver-school",
"id": "c478628eaa4dc93efb87fd055c5347a6c0c6493b",
"size": "4655",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "common/medal-mybatis/src/main/java/com/medal/framework/mybatis/config/MedalMybatisProperties.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2028"
},
{
"name": "CSS",
"bytes": "497285"
},
{
"name": "HTML",
"bytes": "2050008"
},
{
"name": "Java",
"bytes": "892245"
},
{
"name": "JavaScript",
"bytes": "15048105"
},
{
"name": "PHP",
"bytes": "51712"
},
{
"name": "PowerShell",
"bytes": "1266"
},
{
"name": "Ruby",
"bytes": "2060"
}
],
"symlink_target": ""
}
|
.. currio_coming_soon documentation master file, created by
sphinx-quickstart on Sun Feb 17 11:46:20 2013.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to currio_coming_soon's documentation!
====================================================================
Contents:
.. toctree::
:maxdepth: 2
install
deploy
tests
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
|
{
"content_hash": "e703d523da390c94b50d78137f21717b",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 76,
"avg_line_length": 20.4,
"alnum_prop": 0.5901960784313726,
"repo_name": "equinoxel/currio_coming_soon",
"id": "455e009f2bf3c5bcbceec4d436d5c99e14cbd82b",
"size": "510",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/index.rst",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "38"
},
{
"name": "JavaScript",
"bytes": "44"
},
{
"name": "Python",
"bytes": "33428"
},
{
"name": "Shell",
"bytes": "5083"
}
],
"symlink_target": ""
}
|
package org.assertj.core.internal.maps;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.data.MapEntry.entry;
import static org.assertj.core.error.ShouldContainValue.shouldContainValue;
import static org.assertj.core.test.Maps.mapOf;
import static org.assertj.core.test.TestData.someInfo;
import static org.assertj.core.test.TestFailures.failBecauseExpectedAssertionErrorWasNotThrown;
import static org.assertj.core.util.FailureMessages.actualIsNull;
import static org.mockito.Mockito.verify;
import java.util.Map;
import org.assertj.core.api.AssertionInfo;
import org.assertj.core.internal.Maps;
import org.assertj.core.internal.MapsBaseTest;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* Tests for <code>{@link Maps#assertContainsValue(AssertionInfo, Map, Object)}</code>.
*
* @author Nicolas François
* @author Joel Costigliola
*/
public class Maps_assertContainsValue_Test extends MapsBaseTest {
@Override
@BeforeEach
public void setUp() {
super.setUp();
actual = mapOf(entry("name", "Yoda"), entry("color", "green"), entry((String) null, (String) null));
}
@Test
public void should_pass_if_actual_contains_given_value() {
maps.assertContainsValue(someInfo(), actual, "Yoda");
}
@Test
public void should_fail_if_actual_is_null() {
assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> maps.assertContainsValue(someInfo(), null, "Yoda"))
.withMessage(actualIsNull());
}
@Test
public void should_success_if_value_is_null() {
maps.assertContainsValue(someInfo(), actual, null);
}
@Test
public void should_fail_if_actual_does_not_contain_value() {
AssertionInfo info = someInfo();
String value = "veryOld";
try {
maps.assertContainsValue(info, actual, value);
} catch (AssertionError e) {
verify(failures).failure(info, shouldContainValue(actual, value));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
}
|
{
"content_hash": "bd9401c9adfd1384fa26f9e2a4998d47",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 120,
"avg_line_length": 31.119402985074625,
"alnum_prop": 0.7266187050359713,
"repo_name": "xasx/assertj-core",
"id": "76b5ae80a156aad05b84768dbb94382d429ac899",
"size": "2692",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/test/java/org/assertj/core/internal/maps/Maps_assertContainsValue_Test.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "13307657"
},
{
"name": "Shell",
"bytes": "37294"
}
],
"symlink_target": ""
}
|
.PHONY: all build clean install uninstall test
bin:
mkdir -p bin
all: build test
test: build
setenv(PATH, bin:$(concat ":", PATH))
rspec
.DEFAULT: all
.SUBDIRS: lexer parser
|
{
"content_hash": "4e2f85bb4fa3d3286afbb02515fbec0b",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 46,
"avg_line_length": 13.142857142857142,
"alnum_prop": 0.6902173913043478,
"repo_name": "pasberth/parsef",
"id": "bbeb7cdff355f552208fee2e9a437c6638cefcac",
"size": "184",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "OMakefile",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "10420"
},
{
"name": "Haskell",
"bytes": "1014"
},
{
"name": "OCaml",
"bytes": "2320"
},
{
"name": "Perl",
"bytes": "193"
},
{
"name": "Ruby",
"bytes": "1497"
},
{
"name": "Shell",
"bytes": "1751"
}
],
"symlink_target": ""
}
|
package models
import (
"time"
)
type Review struct {
Id int64 `json:"id"`
Code string `json:"code"`
CompanyCode string `json:"company-code"`
Type string `json:"review-type"`
BodyHtml string `json:"body_html"`
Body string `json:"body"`
UserId int64 `json:"user-id"`
StarRating int64 `json:"star-rating"`
LikeCount int64 `json:"like-count"`
Active bool `json:"active"`
DeletedAt time.Time `json:"deleted-at"`
CreatedAt time.Time `json:"created-at"`
UpdatedAt time.Time `json:"updated-at"`
ClientId int64 `json:"client-id"`
TypeId int64 `json:"review-type-id"`
}
type Reviews []Review
|
{
"content_hash": "38971b27c88e130f501d834e9323e12c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 53,
"avg_line_length": 31.96,
"alnum_prop": 0.5331664580725908,
"repo_name": "hustbill/contact-service-go",
"id": "f97cac3aa45d90340200c347666849af4dfe27c2",
"size": "799",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "models/contact.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "799"
},
{
"name": "Makefile",
"bytes": "2008"
}
],
"symlink_target": ""
}
|
// Copyright (c) 2022 Egon Willighagen
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package org.bridgedb.resolvers;
import org.bridgedb.Xref;
/**
* Interface for compact identifier resolvers.
*
* @author egonw
*/
public interface IResolver {
/**
* Returns a URL to resolve the identifier for this service.
* @param xref - the xref belonging to the URL
* @return a String representation of the URL
*/
public String getURL(Xref xref);
}
|
{
"content_hash": "6ce502961021f92a14748acfb7a90fc2",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 75,
"avg_line_length": 29.333333333333332,
"alnum_prop": 0.7303719008264463,
"repo_name": "egonw/BridgeDb",
"id": "30d14c7598653bd0de92aad8da20a80592333ea1",
"size": "968",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "org.bridgedb/src/main/java/org/bridgedb/resolvers/IResolver.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "52"
},
{
"name": "CSS",
"bytes": "17388"
},
{
"name": "HTML",
"bytes": "2283"
},
{
"name": "Java",
"bytes": "1857446"
},
{
"name": "Perl",
"bytes": "143672"
},
{
"name": "R",
"bytes": "1959"
},
{
"name": "Shell",
"bytes": "24947"
}
],
"symlink_target": ""
}
|
<?php
namespace MissTheRaid\CharacterBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class MissTheRaidCharacterBundle extends Bundle
{
}
|
{
"content_hash": "20fea56f17fdfd5561a1f38ac3d4740f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 47,
"avg_line_length": 16.444444444444443,
"alnum_prop": 0.831081081081081,
"repo_name": "cjcodes/MissTheRaid",
"id": "4d93695d76bafcf0a19ce8a82ba80f07cabfa725",
"size": "148",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/MissTheRaid/CharacterBundle/MissTheRaidCharacterBundle.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2323"
},
{
"name": "JavaScript",
"bytes": "1002"
},
{
"name": "PHP",
"bytes": "107266"
},
{
"name": "Ruby",
"bytes": "861"
},
{
"name": "Shell",
"bytes": "388"
}
],
"symlink_target": ""
}
|
<?php
namespace pendalf89\filemanager\behaviors;
use yii;
use yii\base\Behavior;
use yii\db\ActiveRecord;
use pendalf89\filemanager\models\Mediafile;
use pendalf89\filemanager\models\Owners;
class MediafileBehavior extends Behavior
{
/**
* @var string owner name
*/
public $name = '';
/**
* @var array owner mediafiles attributes names
*/
public $attributes = [];
/**
* @inheritdoc
* @return array
*/
public function events()
{
return [
ActiveRecord::EVENT_AFTER_INSERT => 'addOwners',
ActiveRecord::EVENT_AFTER_UPDATE => 'updateOwners',
ActiveRecord::EVENT_BEFORE_DELETE => 'deleteOwners',
];
}
/**
* Add owners to mediafile
*/
public function addOwners()
{
foreach ($this->attributes as $attr) {
if ($mediafile = $this->loadModel(['url' => $this->owner->$attr])) {
$mediafile->addOwner($this->owner->primaryKey, $this->name, $attr);
}
}
}
/**
* Update owners of mediafile
*/
public function updateOwners()
{
foreach ($this->attributes as $attr) {
Mediafile::removeOwner($this->owner->primaryKey, $this->name, $attr);
if ($mediafile = $this->loadModel(['url' => $this->owner->$attr])) {
$mediafile->addOwner($this->owner->primaryKey, $this->name, $attr);
}
}
}
/**
* Delete owners of mediafile
*/
public function deleteOwners()
{
foreach ($this->attributes as $attr) {
Mediafile::removeOwner($this->owner->primaryKey, $this->name, $attr);
}
}
/**
* Load model by id
* @param int $id
* @return Mediafile
*/
private function loadModel($id)
{
return Mediafile::findOne($id);
}
/**
* Возвращает ссылку на миниатюру, заданную через аргументы $attribute и $alias
* @param string $alias Наименование миниатюры, задается в конфигурации filemanager
* @param bool|string $attribute Наименование атрибута (на случай, если в поведении
* казано несколько атрибутов)
* @return bool|string Вернет false, если нет атрибутов или указанный не найден.
*/
public function imageURL($alias, $attribute = false) {
if ($attribute && !in_array($attribute, $this->attributes)) {
return false;
} elseif ($attribute === false && !($attribute = reset($this->attributes))) {
return false;
}
$owner = Owners::findOne([
'owner_id' => $this->owner->primaryKey,
'owner' => $this->name,
'owner_attribute' => $attribute,
]);
if ($owner instanceof Owners) {
if ($mediaFile = Mediafile::findOne($owner->mediafile_id)) {
return $mediaFile->getThumbUrl($alias);
}
}
return false;
}
}
|
{
"content_hash": "c3fbca8fe8e6903228e957d5b29f9f77",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 88,
"avg_line_length": 27.76851851851852,
"alnum_prop": 0.5521840613537846,
"repo_name": "PendalF89/yii2-filemanager",
"id": "700bdd9cfebf1b41e0f4fce5b809bdfa2e0f4284",
"size": "3199",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "behaviors/MediafileBehavior.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "8146"
},
{
"name": "JavaScript",
"bytes": "5231"
},
{
"name": "PHP",
"bytes": "70392"
}
],
"symlink_target": ""
}
|
extern "C" {
#endif
int cpuusage();
int getcpuload();
#ifdef __cplusplus
}
#endif
|
{
"content_hash": "f616a51c09beee4df5aa49d7b5e301ab",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 18,
"avg_line_length": 7.166666666666667,
"alnum_prop": 0.6395348837209303,
"repo_name": "oliveagle/go-collectors",
"id": "ae9e34d905ec71aec482d5c404cc8c8bbf374df5",
"size": "381",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pdh/try_pdh/cpp_pdh/wpdh.hpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "50978"
},
{
"name": "C++",
"bytes": "4641"
},
{
"name": "Go",
"bytes": "278854"
},
{
"name": "Makefile",
"bytes": "484"
}
],
"symlink_target": ""
}
|
package at.ac.univie.isc.asio.brood;
import at.ac.univie.isc.asio.ConfigStore;
import at.ac.univie.isc.asio.Container;
import at.ac.univie.isc.asio.Id;
import at.ac.univie.isc.asio.flock.FlockAssembler;
import at.ac.univie.isc.asio.io.Payload;
import at.ac.univie.isc.asio.nest.D2rqNestAssembler;
import at.ac.univie.isc.asio.tool.StatefulMonitor;
import at.ac.univie.isc.asio.tool.Timeout;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import com.google.common.io.ByteSource;
import de.bechte.junit.runners.context.HierarchicalContextRunner;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import java.util.Collections;
import java.util.Map;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
@RunWith(HierarchicalContextRunner.class)
public class WardenTest {
public static final Runnable NOOP = new Runnable() {
@Override
public void run() {
;
}
};
@Rule
public final ExpectedException error = ExpectedException.none();
private final ConfigStore store = Mockito.mock(ConfigStore.class);
private final D2rqNestAssembler d2rq = Mockito.mock(D2rqNestAssembler.class);
private final FlockAssembler json = Mockito.mock(FlockAssembler.class);
private final Catalog catalog = Mockito.mock(Catalog.class);
private final Warden subject = new Warden(catalog, d2rq, json, store, Timeout.undefined());
@Test
public void should_have_correct_lifecycle_settings() throws Exception {
assertThat(subject.isAutoStartup(), equalTo(true));
assertThat(subject.getPhase(), equalTo(Integer.MAX_VALUE));
}
public class WhenNotRunning {
@Test
public void should_report_correct_state() throws Exception {
assertThat(subject.isRunning(), equalTo(false));
}
@Test
public void should_reject_deploy() throws Exception {
error.expect(StatefulMonitor.IllegalMonitorState.class);
subject.deployFromD2rqMapping(Id.valueOf("test"), ByteSource.empty());
subject.deployFromJson(Id.valueOf("test"), ByteSource.empty());
verifyZeroInteractions();
}
@Test
public void should_reject_dispose() throws Exception {
error.expect(StatefulMonitor.IllegalMonitorState.class);
subject.dispose(Id.valueOf("test"));
verifyZeroInteractions();
}
@Test
public void should_reject_stop() throws Exception {
error.expect(StatefulMonitor.IllegalMonitorState.class);
subject.stop(NOOP);
}
public class Start {
private final Map<String, ByteSource> d2rqConfigItems = ImmutableMap.of(
"first", ByteSource.empty()
, "second", ByteSource.empty()
);
private final Map<String, ByteSource> jsonConfigItems = ImmutableMap.of(
"single-json", ByteSource.empty()
);
@Before
public void mocks() throws Exception {
given(store.findAllWithIdentifier(Warden.D2RQ_SUFFIX)).willReturn(d2rqConfigItems);
given(store.findAllWithIdentifier(Warden.JSON_SUFFIX)).willReturn(jsonConfigItems);
given(d2rq.assemble(any(Id.class), any(ByteSource.class)))
.willReturn(StubContainer.create("test"));
given(json.assemble(any(Id.class), any(ByteSource.class)))
.willReturn(StubContainer.create("test"));
given(catalog.deploy(any(Container.class))).willReturn(Optional.<Container>absent());
}
@After
public void ensure_no_config_deleted() {
verify(store, never()).clear(anyString());
}
@Test
public void should_be_running_after_start() throws Exception {
subject.start();
assertThat("not running after #start()", subject.isRunning(), equalTo(true));
}
@Test
public void should_assemble_each_found_d2rq_config_item() throws Exception {
subject.start();
verify(d2rq).assemble(Id.valueOf("second"), ByteSource.empty());
verify(d2rq).assemble(Id.valueOf("first"), ByteSource.empty());
}
@Test
public void should_assemble_json_config_items() throws Exception {
subject.start();
verify(json).assemble(Id.valueOf("single-json"), ByteSource.empty());
}
@Test
public void should_activate_assembled_container() throws Exception {
final StubContainer first = StubContainer.create("first");
final StubContainer second = StubContainer.create("second");
given(d2rq.assemble(any(Id.class), any(ByteSource.class))).willReturn(first, second);
subject.start();
assertThat(first.isActivated(), equalTo(true));
assertThat(second.isActivated(), equalTo(true));
}
@Test
public void should_deploy_each_assembled_container() throws Exception {
final StubContainer expected = StubContainer.create("dummy");
given(d2rq.assemble(any(Id.class), any(ByteSource.class))).willReturn(expected);
given(json.assemble(any(Id.class), any(ByteSource.class))).willReturn(expected);
subject.start();
verify(catalog, times(3)).deploy(expected);
}
@Test
public void should_clean_up_replaced_containers() throws Exception {
final StubContainer former = StubContainer.create("former");
given(catalog.deploy(any(Container.class)))
.willReturn(Optional.<Container>of(former), Optional.<Container>absent());
subject.start();
assertThat(former.isClosed(), equalTo(true));
}
@Test
public void should_not_store_config_of_found_items_again() throws Exception {
subject.start();
verify(store, never()).save(anyString(), anyString(), any(ByteSource.class));
}
@Test
public void should_continue_if_one_deployment_fails() throws Exception {
given(d2rq.assemble(any(Id.class), any(ByteSource.class)))
.willThrow(new RuntimeException())
.willReturn(StubContainer.create("test"));
subject.start();
verify(catalog, times(2)).deploy(any(Container.class));
}
}
}
public class WhenRunning {
@Before
public void setUp() throws Exception {
subject.start();
}
@Test
public void should_report_correct_state() throws Exception {
assertThat(subject.isRunning(), equalTo(true));
}
@Test
public void should_reject_start() throws Exception {
error.expect(StatefulMonitor.IllegalMonitorState.class);
subject.start();
}
public class Deploy {
@Before
public void mockAssembler() {
given(d2rq.assemble(eq(Id.valueOf("test")), any(ByteSource.class)))
.willReturn(StubContainer.create("test"));
given(json.assemble(eq(Id.valueOf("test")), any(ByteSource.class)))
.willReturn(StubContainer.create("test"));
given(catalog.deploy(any(Container.class))).willReturn(Optional.<Container>absent());
given(catalog.drop(any(Id.class))).willReturn(Optional.<Container>absent());
}
@Test
public void should_deploy_assembled_container() throws Exception {
final StubContainer created = StubContainer.create("created");
given(d2rq.assemble(Id.valueOf("test"), ByteSource.empty())).willReturn(created);
subject.deployFromD2rqMapping(Id.valueOf("test"), ByteSource.empty());
verify(catalog).deploy(created);
}
@Test
public void should_save_config_of_new_container() throws Exception {
final ByteSource raw = ByteSource.wrap(Payload.randomWithLength(1024));
subject.deployFromD2rqMapping(Id.valueOf("test"), raw);
verify(store).save("test", Warden.D2RQ_SUFFIX, raw);
}
@Test
public void should_activate_new_container() throws Exception {
final StubContainer deployed = StubContainer.create("test");
given(d2rq.assemble(Id.valueOf("test"), ByteSource.empty())).willReturn(deployed);
subject.deployFromD2rqMapping(Id.valueOf("test"), ByteSource.empty());
assertThat(deployed.isActivated(), equalTo(true));
}
@Test
public void should_dispose_former_container() throws Exception {
final StubContainer it = StubContainer.create("test");
given(catalog.drop(Id.valueOf("test"))).willReturn(Optional.<Container>of(it));
subject.deployFromD2rqMapping(Id.valueOf("test"), ByteSource.empty());
assertThat("former container was not closed", it.isClosed(), equalTo(true));
}
@Test
public void should_clear_config_of_former_container() throws Exception {
given(catalog.drop(Id.valueOf("test")))
.willReturn(Optional.<Container>of(StubContainer.create("test")));
subject.deployFromD2rqMapping(Id.valueOf("test"), ByteSource.empty());
verify(store).clear("test");
}
}
public class Dispose {
@Test
public void should_return_false_if_target_container_is_not_deployed() throws Exception {
given(catalog.drop(Id.valueOf("not-there"))).willReturn(Optional.<Container>absent());
assertThat(subject.dispose(Id.valueOf("not-there")), equalTo(false));
}
@Test
public void should_clear_config_even_if_no_container_was_present() throws Exception {
given(catalog.drop(Id.valueOf("not-there"))).willReturn(Optional.<Container>absent());
subject.dispose(Id.valueOf("not-there"));
verify(store).clear("not-there");
}
@Test
public void should_return_true_if_target_container_was_present() throws Exception {
given(catalog.drop(Id.valueOf("test")))
.willReturn(Optional.<Container>of(StubContainer.create("test")));
catalog.deploy(StubContainer.create("test"));
assertThat(subject.dispose(Id.valueOf("test")), equalTo(true));
}
@Test
public void should_close_disposed_container() throws Exception {
final StubContainer it = StubContainer.create("test");
given(catalog.drop(Id.valueOf("test"))).willReturn(Optional.<Container>of(it));
subject.dispose(Id.valueOf("test"));
assertThat(it.isClosed(), equalTo(true));
}
@Test
public void should_remove_stored_config_of_disposed_container() throws Exception {
given(catalog.drop(Id.valueOf("test")))
.willReturn(Optional.<Container>of(StubContainer.create("test")));
subject.dispose(Id.valueOf("test"));
verify(store).clear("test");
}
}
public class Stop {
@Test
public void should_run_callback() throws Exception {
final Runnable callback = Mockito.mock(Runnable.class);
subject.stop(callback);
verify(callback).run();
}
@Test
public void should_not_be_running_after_stop() throws Exception {
subject.stop(NOOP);
assertThat(subject.isRunning(), equalTo(false));
}
@Test
public void should_clear_catalog() throws Exception {
subject.stop(NOOP);
verify(catalog).clear();
}
@Test
public void should_close_remaining_containers_from_catalog() throws Exception {
final StubContainer it = StubContainer.create("test");
given(catalog.clear()).willReturn(Collections.<Container>singleton(it));
subject.stop(NOOP);
assertThat("remaining container was not closed", it.isClosed(), equalTo(true));
}
}
}
}
|
{
"content_hash": "a7c26713744b342e803b613a7e9821cd",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 94,
"avg_line_length": 37.35849056603774,
"alnum_prop": 0.6753367003367003,
"repo_name": "pyranja/asio",
"id": "dba830a890e28c3af67c8afe4d51c56cd1df80f9",
"size": "12572",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "server/src/test/java/at/ac/univie/isc/asio/brood/WardenTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "128"
},
{
"name": "CSS",
"bytes": "20450"
},
{
"name": "HTML",
"bytes": "12067"
},
{
"name": "Java",
"bytes": "1340389"
},
{
"name": "JavaScript",
"bytes": "102274"
},
{
"name": "PowerShell",
"bytes": "541"
},
{
"name": "Shell",
"bytes": "5167"
},
{
"name": "XSLT",
"bytes": "4542"
}
],
"symlink_target": ""
}
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The tex2jax Preprocessor — MathJax v1.1 documentation</title>
<link rel="stylesheet" href="../_static/mj.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<!--<script type="text/javascript" src="../../../MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>-->
<link rel="top" title="MathJax v1.1 documentation" href="../index.html" />
<link rel="up" title="Configuration Objects" href="index.html" />
<link rel="next" title="The mml2jax Preprocessor" href="mml2jax.html" />
<link rel="prev" title="The Core Configuration Options" href="hub.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="mml2jax.html" title="The mml2jax Preprocessor"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="hub.html" title="The Core Configuration Options"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">MathJax v1.1 documentation</a> »</li>
<li><a href="index.html" accesskey="U">Configuration Objects</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="the-tex2jax-preprocessor">
<span id="configure-tex2jax"></span><h1>The tex2jax Preprocessor<a class="headerlink" href="#the-tex2jax-preprocessor" title="Permalink to this headline">¶</a></h1>
<p>The options below control the operation of the <cite>tex2jax</cite> preprocessor
that is run when you include <tt class="docutils literal"><span class="pre">"tex2jax.js"</span></tt> in the <cite>extensions</cite> array
of your configuration. They are listed with their default values. To
set any of these options, include a <tt class="docutils literal"><span class="pre">tex2jax</span></tt> section in your
<tt class="xref py py-meth docutils literal"><span class="pre">MathJax.Hub.Config()</span></tt> call. For example</p>
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">MathJax</span><span class="p">.</span><span class="nx">Hub</span><span class="p">.</span><span class="nx">Config</span><span class="p">({</span>
<span class="nx">tex2jax</span><span class="o">:</span> <span class="p">{</span>
<span class="nx">inlineMath</span><span class="o">:</span> <span class="p">[</span> <span class="p">[</span><span class="s1">'$'</span><span class="p">,</span><span class="s1">'$'</span><span class="p">],</span> <span class="p">[</span><span class="s1">'\\('</span><span class="p">,</span><span class="s1">'\\)'</span><span class="p">]</span> <span class="p">]</span>
<span class="p">}</span>
<span class="p">});</span>
</pre></div>
</div>
<p>would set the <tt class="docutils literal"><span class="pre">inlineMath</span></tt> delimiters for the <cite>tex2jax</cite>
preprocessor.</p>
<dl class="describe">
<dt>
<tt class="descname">inlineMath: [['\(','\)']]</tt></dt>
<dd><p>Array of pairs of strings that are to be used as in-line math
delimiters. The first in each pair is the initial delimiter and
the second is the terminal delimiter. You can have as many pairs
as you want. For example,</p>
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">inlineMath</span><span class="o">:</span> <span class="p">[</span> <span class="p">[</span><span class="s1">'$'</span><span class="p">,</span><span class="s1">'$'</span><span class="p">],</span> <span class="p">[</span><span class="s1">'\\('</span><span class="p">,</span><span class="s1">'\\)'</span><span class="p">]</span> <span class="p">]</span>
</pre></div>
</div>
<p>would cause <cite>tex2jax</cite> to look for <tt class="docutils literal"><span class="pre">$...$</span></tt> and <tt class="docutils literal"><span class="pre">\(...\)</span></tt> as
delimiters for inline mathematics. (Note that the single dollar
signs are not enabled by default because they are used too
frequently in normal text, so if you want to use them for math
delimiters, you must specify them explicitly.)</p>
<p>Note that the delimiters can’t look like HTML tags (i.e., can’t
include the less-than sign), as these would be turned into tags by
the browser before MathJax has the chance to run. You can only
include text, not tags, as your math delimiters.</p>
</dd></dl>
<dl class="describe">
<dt>
<tt class="descname">displayMath: [ ['$$','$$'], ['\[','\]'] ]</tt></dt>
<dd><p>Array of pairs of strings that are to be used as delimiters for
displayed equations. The first in each pair is the initial
delimiter and the second is the terminal delimiter. You can have
as many pairs as you want.</p>
<p>Note that the delimiters can’t look like HTML tags (i.e., can’t
include the less-than sign), as these would be turned into tags by
the browser before MathJax has the chance to run. You can only
include text, not tags, as your math delimiters.</p>
</dd></dl>
<dl class="describe">
<dt>
<tt class="descname">processEscapes: false</tt></dt>
<dd><p>When set to <tt class="docutils literal"><span class="pre">true</span></tt>, you may use <tt class="docutils literal"><span class="pre">\$</span></tt> to represent a literal
dollar sign, rather than using it as a math delimiter. When
<tt class="docutils literal"><span class="pre">false</span></tt>, <tt class="docutils literal"><span class="pre">\$</span></tt> will not be altered, and the dollar sign may be
considered part of a math delimiter. Typically this is set to
<tt class="docutils literal"><span class="pre">true</span></tt> if you enable the <tt class="docutils literal"><span class="pre">$</span> <span class="pre">...</span> <span class="pre">$</span></tt> in-line delimiters, so you
can type <tt class="docutils literal"><span class="pre">\$</span></tt> and <cite>tex2jax</cite> will convert it to a regular dollar
sign in the rendered document.</p>
</dd></dl>
<dl class="describe">
<dt>
<tt class="descname">processEnvironments: true</tt></dt>
<dd><p>When <tt class="docutils literal"><span class="pre">true</span></tt>, <cite>tex2jax</cite> looks not only for the in-line and
display math delimiters, but also for LaTeX environments
(<tt class="docutils literal"><span class="pre">\begin{something}...\end{something}</span></tt>) and marks them for
processing by MathJax. When <tt class="docutils literal"><span class="pre">false</span></tt>, LaTeX environments will
not be processed outside of math mode.</p>
</dd></dl>
<dl class="describe">
<dt>
<tt class="descname">preview: "TeX"</tt></dt>
<dd><p>This controls whether <cite>tex2jax</cite> inserts <tt class="docutils literal"><span class="pre">MathJax_Preview</span></tt> spans
to make a preview available, and what preview to use, when it
locates in-line or display mathematics in the page. The default
is <tt class="docutils literal"><span class="pre">"TeX"</span></tt>, which means use the TeX code as the preview (which
will be visible until it is processed by MathJax). Set to
<tt class="docutils literal"><span class="pre">"none"</span></tt> to prevent previews from being inserted (the math
will simply disappear until it is typeset). Set to an array
containing the description of an HTML snippet in order to use the
same preview for all equations on the page.</p>
<p>Examples:</p>
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">preview</span><span class="o">:</span> <span class="p">[</span><span class="s2">"[math]"</span><span class="p">],</span> <span class="c1">// insert the text "[math]" as the preview</span>
</pre></div>
</div>
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">preview</span><span class="o">:</span> <span class="p">[[</span><span class="s2">"img"</span><span class="p">,{</span><span class="nx">src</span><span class="o">:</span> <span class="s2">"/images/mypic.jpg"</span><span class="p">}]],</span> <span class="c1">// insert an image as the preview</span>
</pre></div>
</div>
<p>See the <a class="reference internal" href="../HTML-snippets.html#html-snippets"><em>description of HTML snippets</em></a> for
details on how to represent HTML code in this way.</p>
</dd></dl>
<dl class="describe">
<dt>
<tt class="descname">skipTags: ["script","noscript","style","textarea","pre","code"]</tt></dt>
<dd><p>This array lists the names of the tags whose contents should not
be processed by <cite>tex2jax</cite> (other than to look for ignore/process
classes as listed below). You can add to (or remove from) this
list to prevent MathJax from processing mathematics in specific
contexts.</p>
</dd></dl>
<dl class="describe">
<dt>
<tt class="descname">ignoreClass: "tex2jax_ignore"</tt></dt>
<dd><p>This is the class name used to mark elements whose contents should
not be processed by tex2jax (other than to look for the
<tt class="docutils literal"><span class="pre">processClass</span></tt> pattern below). Note that this is a regular
expression, and so you need to be sure to quote any <cite>regexp</cite>
special characters. The pattern is automatically preceeded by
<tt class="docutils literal"><span class="pre">'(^|</span> <span class="pre">)('</span></tt> and followed by <tt class="docutils literal"><span class="pre">')(</span> <span class="pre">|$)'</span></tt>, so your pattern will
have to match full words in the class name. Assigning an element
this class name will prevent <cite>tex2jax</cite> from processing its
contents.</p>
</dd></dl>
<dl class="describe">
<dt>
<tt class="descname">processClass: "tex2jax_process"</tt></dt>
<dd><p>This is the class name used to mark elements whose contents
<em>should</em> be processed by <cite>tex2jax</cite>. This is used to turn on
processing within tags that have been marked as ignored or skipped
above. Note that this is a regular expression, and so you need to
be sure to quote any <cite>regexp</cite> special characters. The pattern is
automatically preceeded by <tt class="docutils literal"><span class="pre">'(^|</span> <span class="pre">)('</span></tt> and followed by <tt class="docutils literal"><span class="pre">')(</span>
<span class="pre">|$)'</span></tt>, so your pattern will have to match full words in the class
name. Use this to restart processing within an element that has
been marked as ignored above.</p>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="hub.html"
title="previous chapter">The Core Configuration Options</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="mml2jax.html"
title="next chapter">The mml2jax Preprocessor</a></p>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" size="18" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="mml2jax.html" title="The mml2jax Preprocessor"
>next</a> |</li>
<li class="right" >
<a href="hub.html" title="The Core Configuration Options"
>previous</a> |</li>
<li><a href="../index.html">MathJax v1.1 documentation</a> »</li>
<li><a href="index.html" >Configuration Objects</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2011 Design Science.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
</div>
</body>
</html>
|
{
"content_hash": "00a08338cb087a4a55e6609d69efdc14",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 461,
"avg_line_length": 55.99581589958159,
"alnum_prop": 0.6593439438093103,
"repo_name": "manusajith/mathjax_rails",
"id": "ec7a48f780d5fe38a101da272bc373b94ab37ccf",
"size": "13385",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "vendor/mathjax-MathJax-da8d488/docs/html/options/tex2jax.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "2659"
}
],
"symlink_target": ""
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>generic-environments: Not compatible</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.10.0 / generic-environments - 8.6.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
generic-environments
<small>
8.6.0
<span class="label label-info">Not compatible</span>
</small>
</h1>
<p><em><script>document.write(moment("2020-07-16 08:04:26 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-07-16 08:04:26 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
conf-m4 1 Virtual package relying on m4
coq 8.10.0 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.05.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.05.0 Official 4.05.0 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.8.1 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/generic-environments"
license: "LGPL"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/GenericEnvironments"]
depends: [
"ocaml"
"coq" {>= "8.6" & < "8.7~"}
]
tags: [ "keyword: generic environments" "keyword: typing" "keyword: type theory" "category: Mathematics/Logic/Type theory" ]
authors: [ "Emmanuel Polonowski <emmanuel.polonowski@u-pec.fr> [http://lacl.u-pec.fr/polonowski/]" ]
bug-reports: "https://github.com/coq-contribs/generic-environments/issues"
dev-repo: "git+https://github.com/coq-contribs/generic-environments.git"
synopsis: "Generic_Environments"
description: """
http://lacl.u-pec.fr/polonowski/Develop/Generic_Env/gen-env.html
Generic_Environments is a library which provides an abstract data type of environments, as a functor parameterized by a module defining variables, and a function which builds environments for such variables with any Type of type. Usual operations over environments are defined, along with an extensive set of basic and more advanced properties. Moreover, an implementation using lists satisfying and all the required properties is provided."""
flags: light-uninstall
url {
src:
"https://github.com/coq-contribs/generic-environments/archive/v8.6.0.tar.gz"
checksum: "md5=53df6c28d6bd4daa1d581c9397432681"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-generic-environments.8.6.0 coq.8.10.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.10.0).
The following dependencies couldn't be met:
- coq-generic-environments -> coq < 8.7~ -> ocaml < 4.03.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-generic-environments.8.6.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
<small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small>
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
|
{
"content_hash": "c6238b38c35d11eab4ca83248c766df8",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 458,
"avg_line_length": 45.053892215568865,
"alnum_prop": 0.56632110579479,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "bce1da87bb09e7d7a5acd1b44d40fe0491ee6f15",
"size": "7526",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.05.0-2.0.6/released/8.10.0/generic-environments/8.6.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
}
|
const BaseRouter = require('../');
const expect = require('chai').expect;
describe('Router', function () {
describe('::extend', function () {
it('should allow default routes to be overridden and custom routes to be added', function () {
var customRoutes = {
get: {
'/:id': true, // override existing
'/test': true // create new
},
put: null // replace entire verb
};
var router = BaseRouter.extend({
model: {},
controller: {},
routes: customRoutes
});
expect(router.get['/:id']).to.equal(customRoutes.get['/:id']);
expect(router.get['/test']).to.equal(customRoutes.get['/test']);
expect(router.put).to.equal(customRoutes.put);
});
});
require('./lib/assign_model');
require('./lib/created_by');
require('./lib/is_admin');
require('./lib/is_authenticated');
});
|
{
"content_hash": "da96ba2536e8f12b035fb36c2153b3ab",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 98,
"avg_line_length": 29.8,
"alnum_prop": 0.5704697986577181,
"repo_name": "iros/router",
"id": "6b4746fb8dccd14b7fbb2bfe780f220e8ff214f0",
"size": "894",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/index.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
}
|
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
public class TXTReader : Singleton<TXTReader> {
// Use this for initialization
void Start () {
LevelData.Instance.data_Level = new List<Level> ();
InitLevel ();
}
public void InitLevel()
{
TextAsset data = Resources.Load(GameConst.UrlConfigLevel_1) as TextAsset;
string[] text = data.text.Split (new string[] {"\r\n"}, System.StringSplitOptions.RemoveEmptyEntries);
for (int i = 1; i < text.Length; i++)
{
Level level = new Level();
level.id = int.Parse(text[i].Split(',')[0]);
level.name = text[i].Split(',')[1];
level.type = text[i].Split(',')[2];
level.posX = int.Parse(text[i].Split(',')[3]);
level.posY = int.Parse(text[i].Split(',')[4]);
LevelData.Instance.data_Level.Add(level);
}
for (int i = 0; i < LevelData.Instance.data_Level.Count; i++)
{
Debug.Log(LevelData.Instance.data_Level[i].id + ", " + LevelData.Instance.data_Level[i].name);
}
}
}
public enum TypeLevel
{
Map,
NPC,
House,
Character,
}
public class Level
{
public int id;
public string name;
public string type;
public int posX;
public int posY;
}
|
{
"content_hash": "e31ebf16437718a0c9952875b8489687",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 104,
"avg_line_length": 22.71153846153846,
"alnum_prop": 0.65961049957663,
"repo_name": "deadlove01/dracula",
"id": "ec31c2537f7d02477f5ae03d9425fdb24d67d0e9",
"size": "1183",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/UnitySource/Assets/Scripts/Data/TXTReader.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "350172"
},
{
"name": "C#",
"bytes": "1436413"
},
{
"name": "JavaScript",
"bytes": "203536"
},
{
"name": "Smalltalk",
"bytes": "18771"
}
],
"symlink_target": ""
}
|
We made thousands of pre-made source code pieces for easy implementation in your own programming projects. Want to make unsearchable pdf with pdf extractor sdk in your VBScript app? ByteScout Premium Suite is designed for it. ByteScout Premium Suite is the bundle that includes twelve SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording.
Want to save time? You will save a lot of time on writing and testing code as you may just take the VBScript code from ByteScout Premium Suite for make unsearchable pdf with pdf extractor sdk below and use it in your application. Follow the instructions from scratch to work and copy the VBScript code. Check VBScript sample code samples to see if they respond to your needs and requirements for the project.
The trial version of ByteScout Premium Suite can be downloaded for free from our website. It also includes source code samples for VBScript and other programming languages.
## REQUEST FREE TECH SUPPORT
[Click here to get in touch](https://bytescout.zendesk.com/hc/en-us/requests/new?subject=ByteScout%20Premium%20Suite%20Question)
or just send email to [support@bytescout.com](mailto:support@bytescout.com?subject=ByteScout%20Premium%20Suite%20Question)
## ON-PREMISE OFFLINE SDK
[Get Your 60 Day Free Trial](https://bytescout.com/download/web-installer?utm_source=github-readme)
[Explore SDK Docs](https://bytescout.com/documentation/index.html?utm_source=github-readme)
[Sign Up For Online Training](https://academy.bytescout.com/)
## ON-DEMAND REST WEB API
[Get your API key](https://pdf.co/documentation/api?utm_source=github-readme)
[Explore Web API Documentation](https://pdf.co/documentation/api?utm_source=github-readme)
[Explore Web API Samples](https://github.com/bytescout/ByteScout-SDK-SourceCode/tree/master/PDF.co%20Web%20API)
## VIDEO REVIEW
[https://www.youtube.com/watch?v=NEwNs2b9YN8](https://www.youtube.com/watch?v=NEwNs2b9YN8)
<!-- code block begin -->
##### ****MakeUnsearchablePDF.vbs:**
```
' Create Bytescout.PDFExtractor.UnsearchablePDFMaker object
Set unsearchablePDFMaker = CreateObject("Bytescout.PDFExtractor.UnsearchablePDFMaker")
unsearchablePDFMaker.RegistrationName = "demo"
unsearchablePDFMaker.RegistrationKey = "demo"
' Load sample PDF document
unsearchablePDFMaker.LoadDocumentFromFile("..\..\sample1.pdf")
' Set PDF rendering resolution to 150 DPI. Higher value - better quality, but larger output file.
unsearchablePDFMaker.RenderingResolution = 150
' Set embedded images format
unsearchablePDFMaker.ImageFormat = 0 ' JPEG = 0; PNG = 1
' Set quality factor for JPEG format; from 0 to 100; default is 90.
' Lower quality - smaller the result file.
unsearchablePDFMaker.JPEGQuality = 60
' Process the document
unsearchablePDFMaker.MakePDFUnsearchable("result.pdf")
WScript.Echo "Unsearchable document saved as 'result.pdf'."
```
<!-- code block end -->
|
{
"content_hash": "c659edaaa3423d799c429f4a13c36a88",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 408,
"avg_line_length": 48.81666666666667,
"alnum_prop": 0.7907135541140321,
"repo_name": "bytescout/ByteScout-SDK-SourceCode",
"id": "c0e62addd737e5987e8a8674beb81ecfc671007a",
"size": "3138",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Premium Suite/VBScript/Make unsearchable pdf with pdf extractor sdk/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP.NET",
"bytes": "364116"
},
{
"name": "Apex",
"bytes": "243500"
},
{
"name": "Batchfile",
"bytes": "151832"
},
{
"name": "C",
"bytes": "224568"
},
{
"name": "C#",
"bytes": "12909855"
},
{
"name": "C++",
"bytes": "440474"
},
{
"name": "CSS",
"bytes": "56817"
},
{
"name": "Classic ASP",
"bytes": "46655"
},
{
"name": "Dockerfile",
"bytes": "776"
},
{
"name": "Gherkin",
"bytes": "3386"
},
{
"name": "HTML",
"bytes": "17276296"
},
{
"name": "Java",
"bytes": "1483408"
},
{
"name": "JavaScript",
"bytes": "3033610"
},
{
"name": "PHP",
"bytes": "838746"
},
{
"name": "Pascal",
"bytes": "398090"
},
{
"name": "PowerShell",
"bytes": "715204"
},
{
"name": "Python",
"bytes": "703542"
},
{
"name": "QMake",
"bytes": "880"
},
{
"name": "TSQL",
"bytes": "3080"
},
{
"name": "VBA",
"bytes": "383773"
},
{
"name": "VBScript",
"bytes": "1504410"
},
{
"name": "Visual Basic .NET",
"bytes": "9489450"
}
],
"symlink_target": ""
}
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<include layout="@layout/view_toolbar" />
<android.support.design.widget.TabLayout
android:id="@+id/referees_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/referees_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<ImageView
android:id="@+id/expanded_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black_transparent"
android:elevation="@dimen/matches_expanded_image_elevation"
android:src="@color/black"
android:visibility="invisible" />
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:elevation="@dimen/matches_expanded_image_elevation"
android:visibility="gone" />
</RelativeLayout>
|
{
"content_hash": "0f1a006140e2cd3bf3e18b3fd936ef68",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 74,
"avg_line_length": 34.89473684210526,
"alnum_prop": 0.6435394670688789,
"repo_name": "Mariovc/kinballwc2015",
"id": "3d74eab5e059a7253d7a161e51bc9970c669e8bc",
"size": "1989",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "app/src/main/res/layout/fragment_referees.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "169679"
}
],
"symlink_target": ""
}
|
package io.janusproject.kernel.bic;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import com.google.inject.Inject;
import io.janusproject.services.contextspace.ContextSpaceService;
import io.sarl.core.InnerContextAccess;
import io.sarl.lang.core.Address;
import io.sarl.lang.core.Agent;
import io.sarl.lang.core.AgentContext;
import io.sarl.lang.core.Event;
import io.sarl.lang.core.EventListener;
import io.sarl.lang.core.Skill;
import io.sarl.lang.core.Space;
import io.sarl.lang.core.SpaceID;
import io.sarl.lang.util.ClearableReference;
import io.sarl.lang.util.SynchronizedSet;
import io.sarl.util.Collections3;
import io.sarl.util.OpenEventSpace;
/**
* Janus implementation of SARL's {@link InnerContextSkill} built-in capacity.
*
* @author $Author: srodriguez$
* @author $Author: ngaud$
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
public class InnerContextSkill extends BuiltinSkill implements InnerContextAccess {
private static int installationOrder = -1;
private final Address agentAddressInInnerDefaultSpace;
private ClearableReference<Skill> skillBufferInternalEventBusCapacity;
/**
* Context inside the agent.
*/
private AgentContext innerContext;
@Inject
private ContextSpaceService contextService;
/**
* @param agent - owner of this skill.
* @param agentAddressInInnerDefaultSpace - address of the owner of this skill in its default space.
*/
InnerContextSkill(Agent agent, Address agentAddressInInnerDefaultSpace) {
super(agent);
this.agentAddressInInnerDefaultSpace = agentAddressInInnerDefaultSpace;
}
/** Replies the InternalEventBusCapacity skill as fast as possible.
*
* @return the skill
*/
protected final InternalEventBusCapacity getInternalEventBusCapacitySkill() {
if (this.skillBufferInternalEventBusCapacity == null || this.skillBufferInternalEventBusCapacity.get() == null) {
this.skillBufferInternalEventBusCapacity = $getSkill(InternalEventBusCapacity.class);
}
return $castSkill(InternalEventBusCapacity.class, this.skillBufferInternalEventBusCapacity);
}
@Override
public int getInstallationOrder() {
if (installationOrder < 0) {
installationOrder = installationOrder(this);
}
return installationOrder;
}
/**
* Replies if the inner context was instanciated. To create the inner context, call {@link #getInnerContext()}
*
* @return <code>true</code> if an instance of inner context exists, otherwise <code>false</code>.
*/
public synchronized boolean hasInnerContext() {
return this.innerContext != null;
}
/**
* Force to reset the inner context. This function does not update the context repository.
*
* <p>Do not call this function, exception if you are sure that the setting of the inner context to <code>null</code> only does
* not introduce problems.
*/
synchronized void resetInnerContext() {
this.innerContext = null;
}
@Override
protected String attributesToString() {
return super.attributesToString() + ", addressInDefaultspace = " + this.agentAddressInInnerDefaultSpace; //$NON-NLS-1$
}
@Override
protected void uninstall(UninstallationStage stage) {
if (stage == UninstallationStage.POST_DESTROY_EVENT) {
final AgentContext context = this.innerContext;
this.innerContext = null;
if (context != null) {
// Unregister the agent from the default space
final EventListener listener = getInternalEventBusCapacitySkill().asEventListener();
((OpenEventSpace) context.getDefaultSpace()).unregister(listener);
// Destroy the context
this.contextService.removeContext(context);
}
}
}
@Override
public synchronized AgentContext getInnerContext() {
if (this.innerContext == null) {
// Create the inner context.
this.innerContext = this.contextService.createContext(
this.agentAddressInInnerDefaultSpace.getSpaceId().getContextID(),
this.agentAddressInInnerDefaultSpace.getSpaceId().getID());
// Register the agent in the default space
final EventListener listener = getInternalEventBusCapacitySkill().asEventListener();
final OpenEventSpace defSpace = (OpenEventSpace) this.innerContext.getDefaultSpace();
defSpace.register(listener);
}
return this.innerContext;
}
@Override
public synchronized boolean hasMemberAgent() {
if (this.innerContext != null) {
final Set<UUID> participants = this.innerContext.getDefaultSpace().getParticipants();
assert participants != null;
return (participants.size() > 1) || ((participants.size() == 1) && (!participants.contains(getOwner().getID())));
}
return false;
}
@Override
public synchronized int getMemberAgentCount() {
if (this.innerContext != null) {
final SynchronizedSet<UUID> participants = this.innerContext.getDefaultSpace().getParticipants();
assert participants != null;
int count = participants.size();
if (participants.contains(getOwner().getID())) {
--count;
}
return count;
}
return 0;
}
@Override
public synchronized SynchronizedSet<UUID> getMemberAgents() {
if (this.innerContext != null) {
final SynchronizedSet<UUID> participants = this.innerContext.getDefaultSpace().getParticipants();
assert participants != null;
final Set<UUID> members = new HashSet<>();
final UUID myId = getOwner().getID();
for (final UUID id : participants) {
if (!id.equals(myId)) {
members.add(id);
}
}
return Collections3.synchronizedSet(members, members);
}
return Collections3.emptySynchronizedSet();
}
@Override
public boolean isInnerDefaultSpace(Space space) {
return isInnerDefaultSpace(space.getSpaceID());
}
@Override
public boolean isInnerDefaultSpace(SpaceID spaceID) {
final AgentContext context = this.innerContext;
return context != null && spaceID.equals(context.getDefaultSpace().getSpaceID());
}
@Override
public boolean isInnerDefaultSpace(UUID spaceID) {
final AgentContext context = this.innerContext;
return context != null && spaceID.equals(context.getDefaultSpace().getSpaceID().getID());
}
@Override
public boolean isInInnerDefaultSpace(Event event) {
if (event != null) {
final Address adr = event.getSource();
if (adr != null) {
return isInnerDefaultSpace(adr.getSpaceId());
}
}
return false;
}
}
|
{
"content_hash": "58e8149d66c37a010254247ea87e5194",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 128,
"avg_line_length": 30.96078431372549,
"alnum_prop": 0.7454084863837872,
"repo_name": "jgfoster/sarl",
"id": "0876bd08ce3fb1232f78e6fa5d51bab03b411e36",
"size": "7051",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/InnerContextSkill.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "178"
},
{
"name": "GAP",
"bytes": "1483810"
},
{
"name": "HTML",
"bytes": "287"
},
{
"name": "Java",
"bytes": "16931375"
},
{
"name": "JavaScript",
"bytes": "5968"
},
{
"name": "Shell",
"bytes": "7592"
},
{
"name": "TeX",
"bytes": "11189"
}
],
"symlink_target": ""
}
|
import rdkit
from rdkit.Chem import AllChem
from rdkit import DataStructs
__license__ = "X11"
METADATA = {
"id": "method_rdkit_ecfp6_1024_tanimoto",
"representation": "ecfp6_1024",
"similarity": "tanimoto"
}
def _compute_fingerprint(molecule):
return AllChem.GetMorganFingerprintAsBitVect(molecule, 3, nBits=1024)
def _compute_similarity(left, right):
return DataStructs.TanimotoSimilarity(left, right)
def create_model(train_ligands, train_decoys):
model = []
for molecule in train_ligands:
model.append({
"name": molecule.GetProp("_Name"),
"fingerprint": _compute_fingerprint(molecule)
})
model_information = {}
return model, model_information
def compute_score(model, molecule):
fingerprint = _compute_fingerprint(molecule)
similarities = [_compute_similarity(fingerprint, item["fingerprint"])
for item in model]
max_score = max(similarities)
index_of_max_score = similarities.index(max_score)
closest_molecule = model[index_of_max_score]
return {
"value": max_score,
"info": {
"closest": closest_molecule["name"]
}
}
def compute_similarity(left, right):
return _compute_similarity(_compute_fingerprint(left),
_compute_fingerprint(right))
|
{
"content_hash": "c5e06923b87320bc8304202f969fbf7a",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 73,
"avg_line_length": 26.98,
"alnum_prop": 0.6471460340993328,
"repo_name": "skodapetr/lbvs-environment",
"id": "7866692b9cdec258933eadfea495d6f58a90d101",
"size": "1396",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "methods/ecfp/ecfp6_1024_tanimoto.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "94529"
}
],
"symlink_target": ""
}
|
/* Controller */
var pollNewController = function($scope, $routeParams, poll) {
/* Model Initialization */
$scope.init = function(){
$scope.newQuestion = "";
$scope.newQuestionPlaceholder = "Who will win the NBA championship this year?";
$scope.newChoices = [];
$scope.newChoices.push({placeholder: "Cleveland Cavaliers", description: "", votes: 0});
$scope.newChoices.push({placeholder: "San Antonio Spurs", description: "", votes: 0});
$scope.showMaxSizeError = false;
};
$scope.addChoice = function () {
if ($scope.newChoices.length >= 2)
$scope.showMaxSizeError = false;
$scope.newChoices.push({placeholder: "Please enter the new choice", description: "", votes: 0});
};
$scope.deleteChoice = function ( choiceID ) {
if ($scope.newChoices.length <= 2)
$scope.showMaxSizeError = true;
if ($scope.newChoices.length > 2)
$scope.newChoices.splice(choiceID, 1);
};
$scope.hideMessage = function(){
$scope.showMaxSizeError = false;
};
$scope.insertPoll = function(){
var newPoll = {};
newPoll.question = $scope.newQuestion;
newPoll.options = $scope.newChoices;
//console.log(newPoll);
poll.new(newPoll,$scope.getUser().username).then(function(result) {
if (result.data.success){
bootbox.alert("Poll Added !");
$scope.init();
}
else
bootbox.alert(result.data.message);
}, function(reason) {
bootbox.alert("Error: " + reason);
});
};
$scope.init();
};
angular.module('poll.new', ['ngNewRouter'])
.controller('PollNewController', ['$scope', '$routeParams', 'poll', pollNewController]);
|
{
"content_hash": "450730f002ed62ceab00633d645948ae",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 106,
"avg_line_length": 30.11111111111111,
"alnum_prop": 0.5556141275698471,
"repo_name": "diegoingaramo/all-voting",
"id": "1011ce1e3fc41ddeea1657e172fb7542899b2e18",
"size": "1897",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/components/poll_new/poll_new.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2301"
},
{
"name": "HTML",
"bytes": "15253"
},
{
"name": "JavaScript",
"bytes": "79305"
}
],
"symlink_target": ""
}
|
from sklearn import datasets, metrics, cross_validation
import tensorflow as tf
from tensorflow.contrib import skflow
iris = datasets.load_iris()
X_train, X_test, y_train, y_test = cross_validation.train_test_split(iris.data, iris.target,
test_size=0.2, random_state=42)
def my_model(X, y):
"""
This is DNN with 10, 20, 10 hidden layers, and dropout of 0.5 probability.
Note: If you want to run this example with multiple GPUs, Cuda Toolkit 7.0 and
CUDNN 6.5 V2 from NVIDIA need to be installed beforehand.
"""
with tf.device('/gpu:1'):
layers = skflow.ops.dnn(X, [10, 20, 10], keep_prob=0.5)
with tf.device('/gpu:2'):
return skflow.models.logistic_regression(layers, y)
classifier = skflow.TensorFlowEstimator(model_fn=my_model, n_classes=3)
classifier.fit(X_train, y_train)
score = metrics.accuracy_score(y_test, classifier.predict(X_test))
print('Accuracy: {0:f}'.format(score))
|
{
"content_hash": "854df4fd2b9f8f274f8735ee1daf1edc",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 92,
"avg_line_length": 38.75,
"alnum_prop": 0.7075268817204301,
"repo_name": "panmari/tensorflow",
"id": "457e39caca902600c938d763a92b2f9979cdb8e1",
"size": "1551",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tensorflow/examples/skflow/multiple_gpu.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "153226"
},
{
"name": "C++",
"bytes": "7360924"
},
{
"name": "CMake",
"bytes": "29325"
},
{
"name": "CSS",
"bytes": "1297"
},
{
"name": "HTML",
"bytes": "683163"
},
{
"name": "Java",
"bytes": "50361"
},
{
"name": "JavaScript",
"bytes": "7188"
},
{
"name": "Jupyter Notebook",
"bytes": "1771416"
},
{
"name": "Objective-C",
"bytes": "1288"
},
{
"name": "Protocol Buffer",
"bytes": "102168"
},
{
"name": "Python",
"bytes": "4526515"
},
{
"name": "Shell",
"bytes": "117381"
},
{
"name": "TypeScript",
"bytes": "340911"
}
],
"symlink_target": ""
}
|
function fillNullFilter() {
return function(data) {
return (data == null || data == '') ? '-' : data;
}
}
angular.module('TheHub').filter('fillNull', fillNullFilter);
|
{
"content_hash": "4c44fe4038c44e8ddf1fc411e1d91c06",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 60,
"avg_line_length": 26.142857142857142,
"alnum_prop": 0.5956284153005464,
"repo_name": "pavan496/the-hub",
"id": "5a955fce47d81b841a6de20c51124699087e7010",
"size": "183",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/client/filters/fillers.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "737"
},
{
"name": "HTML",
"bytes": "8724"
},
{
"name": "JavaScript",
"bytes": "21278"
},
{
"name": "TypeScript",
"bytes": "23053"
}
],
"symlink_target": ""
}
|
using System;
using System.Runtime.InteropServices;
namespace Alachisoft.NCache.Common.Util
{
#if NETCORE
[StructLayout(LayoutKind.Sequential)]
internal class ProcessInformation
{
public IntPtr hProcess = IntPtr.Zero;
public IntPtr hThread = IntPtr.Zero;
public int dwProcessId;
public int dwThreadId;
}
#endif
}
|
{
"content_hash": "a3ccb3d6edb9e12beb9ad8326c831239",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 45,
"avg_line_length": 22.6875,
"alnum_prop": 0.699724517906336,
"repo_name": "Alachisoft/NCache",
"id": "533c78388f6a74d76e83b80e6e0afb14a0d187b2",
"size": "365",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Src/NCCommon/Util/ManualProcessCreator/ProcessInformation.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "12283536"
},
{
"name": "CSS",
"bytes": "707"
},
{
"name": "HTML",
"bytes": "16825"
},
{
"name": "JavaScript",
"bytes": "377"
}
],
"symlink_target": ""
}
|
module DistributorsHelper
end
|
{
"content_hash": "cdab296ede4d0cc2d00ea0777ee2502c",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 25,
"avg_line_length": 15,
"alnum_prop": 0.9,
"repo_name": "cliffroot/amc",
"id": "0206363d5728081fb556dce523d84fefc6ee7166",
"size": "30",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "app/helpers/distributors_helper.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "32958"
},
{
"name": "C++",
"bytes": "2219"
},
{
"name": "CSS",
"bytes": "3150"
},
{
"name": "CoffeeScript",
"bytes": "1374"
},
{
"name": "JavaScript",
"bytes": "641"
},
{
"name": "Ruby",
"bytes": "48317"
},
{
"name": "Shell",
"bytes": "120"
}
],
"symlink_target": ""
}
|
package com.java110.api.components.ownerRepair;
import com.java110.core.context.IPageData;
import com.java110.api.smo.ownerRepair.ICloseRepairDispatchSMO;
import com.java110.api.smo.ownerRepair.IListOwnerRepairsSMO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
/**
* @ClassName MyRepairDispatchComponent
* @Description TODO
* @Author wuxw
* @Date 2019/10/20 18:21
* @Version 1.0
* add by wuxw 2019/10/20
**/
@Component("myRepairDispatch")
public class MyRepairDispatchComponent {
@Autowired
private IListOwnerRepairsSMO listOwnerRepairsSMOImpl;
@Autowired
private ICloseRepairDispatchSMO closeRepairDispatchSMOImpl;
/**
* 查询业主报修列表
* @param pd 页面数据封装
* @return 返回 ResponseEntity 对象
*/
public ResponseEntity<String> list(IPageData pd){
return listOwnerRepairsSMOImpl.listOwnerRepairs(pd);
}
/**
* 结单处理
* @param pd 页面数据封装
* @return 返回 ResponseEntity 对象
*/
public ResponseEntity<String> closeOrder(IPageData pd){
return closeRepairDispatchSMOImpl.close(pd);
}
public IListOwnerRepairsSMO getListOwnerRepairsSMOImpl() {
return listOwnerRepairsSMOImpl;
}
public void setListOwnerRepairsSMOImpl(IListOwnerRepairsSMO listOwnerRepairsSMOImpl) {
this.listOwnerRepairsSMOImpl = listOwnerRepairsSMOImpl;
}
public ICloseRepairDispatchSMO getCloseRepairDispatchSMOImpl() {
return closeRepairDispatchSMOImpl;
}
public void setCloseRepairDispatchSMOImpl(ICloseRepairDispatchSMO closeRepairDispatchSMOImpl) {
this.closeRepairDispatchSMOImpl = closeRepairDispatchSMOImpl;
}
}
|
{
"content_hash": "b462a117343817b081490c3950ff61bf",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 99,
"avg_line_length": 27.825396825396826,
"alnum_prop": 0.7507130633200229,
"repo_name": "java110/MicroCommunity",
"id": "8def88dd38e791b43ef7c2ebf1f88afec75948ea",
"size": "1817",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "service-api/src/main/java/com/java110/api/components/ownerRepair/MyRepairDispatchComponent.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "737"
},
{
"name": "HTML",
"bytes": "12981"
},
{
"name": "Java",
"bytes": "19654092"
},
{
"name": "JavaScript",
"bytes": "19296"
},
{
"name": "Shell",
"bytes": "1121"
}
],
"symlink_target": ""
}
|
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>native-image-samples-client-library</artifactId>
<groupId>com.google.cloud</groupId>
<version>0.14.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>secretmanager-sample</artifactId>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>native-image-support</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-core</artifactId>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-secretmanager</artifactId>
</dependency>
</dependencies>
<build>
<!-- These plugins enable building the application to a JAR *not* using Native Image -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.example.SecretManagerSampleApplication</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>${native.maven.plugin.version}</version>
<configuration>
<mainClass>com.example.SecretManagerSampleApplication</mainClass>
<buildArgs>
--no-fallback
--no-server
--initialize-at-build-time
</buildArgs>
</configuration>
<executions>
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
|
{
"content_hash": "edd80b0a4f16c8140ae5eaae667113f8",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 101,
"avg_line_length": 29.938271604938272,
"alnum_prop": 0.5789690721649484,
"repo_name": "GoogleCloudPlatform/native-image-support-java",
"id": "9c5861025d8d326a52786365d5aba36eb5706fce",
"size": "2425",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "native-image-samples/native-image-samples-client-library/secretmanager-sample/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "3320"
},
{
"name": "Java",
"bytes": "145604"
},
{
"name": "Shell",
"bytes": "8173"
}
],
"symlink_target": ""
}
|
/* https://leetcode.com/problems/path-sum/#/description
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below binary tree and sum = 22,
5
/ \
4 8
/ / \
11 13 4
/ \ \
7 2 1
return true, as there exist a root-to-leaf path 5->4->11->2 which sum is 22.
*/
package ltree
func hasPathSum(root *TreeNode, sum int) bool {
if root == nil {
return false
}
if root.Left == nil && root.Right == nil && sum == root.Val {
return true
}
if !hasPathSum(root.Left, sum-root.Val) {
return hasPathSum(root.Right, sum-root.Val)
}
return true
}
|
{
"content_hash": "5367e9ccd0b07066b727cc3cc08d7008",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 148,
"avg_line_length": 26.24137931034483,
"alnum_prop": 0.5939553219448095,
"repo_name": "TTWShell/algorithms",
"id": "8ef8239ec60d334241105c78de6db7ce6939b5ef",
"size": "761",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "leetcode/tree/hasPathSum.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "943143"
},
{
"name": "Makefile",
"bytes": "368"
},
{
"name": "Shell",
"bytes": "421"
}
],
"symlink_target": ""
}
|
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (nonatomic, retain)UIImageView *splashView;
@end
|
{
"content_hash": "87bcdf6fd9361a6f9109c610be8f8bdd",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 60,
"avg_line_length": 24.428571428571427,
"alnum_prop": 0.7953216374269005,
"repo_name": "blighli/iPhone2015",
"id": "ee3dd83ae1b150ff296fa5416add79cee6f819a0",
"size": "327",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "nb15032毛琦/毛琦IOS 大作业/源代码/postCard/postCard/AppDelegate.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "57551727"
},
{
"name": "C",
"bytes": "989362"
},
{
"name": "C++",
"bytes": "841211"
},
{
"name": "CMake",
"bytes": "17255"
},
{
"name": "CSS",
"bytes": "45762"
},
{
"name": "GLSL",
"bytes": "4840"
},
{
"name": "HTML",
"bytes": "147506"
},
{
"name": "JavaScript",
"bytes": "545537"
},
{
"name": "Makefile",
"bytes": "5543"
},
{
"name": "Metal",
"bytes": "2713"
},
{
"name": "Objective-C",
"bytes": "21892970"
},
{
"name": "Objective-C++",
"bytes": "263154"
},
{
"name": "Ruby",
"bytes": "1031"
},
{
"name": "Shell",
"bytes": "36609"
},
{
"name": "Swift",
"bytes": "194188"
}
],
"symlink_target": ""
}
|
"""Automatic replacement of imported Python modules.
The hotswap module watches the source files of imported modules which are
replaced by its new version when the respective source files change.
The need for a program restart during development of long-running programs
like GUI applications for example is reduced.
Additionally this module can be called as a wrapper script:
hotswap.py [OPTIONS] <module.py> [args]
In this case module.py is imported as module and the function
module.main() is called. Hotswapping is enabled so that changes
in the source code take effect without restarting the program.
"""
version = "0.1"
__author__ = "Michael Krause"
__email__ = "michael@krause-software.de"
#
# CREDITS
# The idea and first implementation of the mechanism used by this module
# was first made public by Thomas Heller in a Usenet posting
# to comp.lang.python in 2001 (named autoreload.py).
# Updates for new-style classes were taken from a Usenet posting
# by Jeremy Fincher.
__all__ = ['run', 'stop', 'superreload']
import time
import os
import threading
import sys
import types
import imp
import getopt
def _get_compiled_ext():
for ext, mode, typ in imp.get_suffixes():
if typ == imp.PY_COMPILED:
return ext
# the official way to get the extension of compiled files (.pyc or .pyo)
PY_COMPILED_EXT = _get_compiled_ext()
class ModuleWatcher:
SECONDS_BETWEEN_CHECKS = 0.1
SKIP_SYSTEM_MODULES = False
NOTIFYFUNC = None
VERBOSE = False
running = 0
def __init__(self):
# If we don't do this, there may be tracebacks
# when shutting down python.
import atexit
atexit.register(self.stop)
def run(self, skipsystem=SKIP_SYSTEM_MODULES,
seconds=SECONDS_BETWEEN_CHECKS,
notifyfunc=NOTIFYFUNC,
verbose=VERBOSE):
if self.running:
if verbose:
print "# hotswap already running"
return
self.SKIP_SYSTEM_MODULES = skipsystem
self.SECONDS_BETWEEN_CHECKS = seconds
self.NOTIFYFUNC = notifyfunc
self.VERBOSE = verbose
if self.VERBOSE:
print "# starting hotswap seconds=%s, skipsystem=%s" \
% (self.SECONDS_BETWEEN_CHECKS, self.SKIP_SYSTEM_MODULES)
self.running = 1
self.thread = threading.Thread(target=self._check_modules)
self.thread.setDaemon(1)
self.thread.start()
def stop(self):
if not self.running:
if self.VERBOSE:
print "# hotswap not running"
return
self.running = 0
self.thread.join()
if self.VERBOSE:
print "# hotswap stopped"
def _check_modules(self):
while self.running:
time.sleep(self.SECONDS_BETWEEN_CHECKS)
for m in sys.modules.values():
if not hasattr(m, '__file__'):
# We only check modules that have a plain file
# as Python source.
continue
if m.__name__ == '__main__':
# __main__ cannot be reloaded without executing
# its code a second time, so we skip it.
continue
file = m.__file__
path, ext = os.path.splitext(file)
if self.SKIP_SYSTEM_MODULES:
# do not check system modules
sysprefix = sys.prefix + os.sep
if file.startswith(sysprefix):
continue
if ext.lower() == '.py':
ext = PY_COMPILED_EXT
file = path + PY_COMPILED_EXT
if ext != PY_COMPILED_EXT:
continue
try:
if os.stat(file[:-1])[8] <= os.stat(file)[8]:
# This module is unchanged if the .py-file
# is older than the compiled .pyc or .pyo file.
continue
except OSError:
continue
try:
print ">>>",m.__name__
superreload(m, verbose=self.VERBOSE)
if hasattr(m, 'onHotswap') and callable(m.onHotswap):
print "yeah?"
# The module can invalidate cached results or post
# redisplay operations by defining function named
# onHotswap that is called after a reload.
m.onHotswap()
if callable(self.NOTIFYFUNC):
self.NOTIFYFUNC(module=m)
except:
import traceback
traceback.print_exc(0)
def update_function(old, new, attrnames):
for name in attrnames:
try:
setattr(old, name, getattr(new, name))
except AttributeError:
pass
def superreload(module,
reload=reload,
_old_objects = {},
verbose=True):
"""superreload (module) -> module
Enhanced version of the builtin reload function.
superreload replaces the class dictionary of every top-level
class in the module with the new one automatically,
as well as every function's code object.
"""
# retrieve the attributes from the module before the reload,
# and remember them in _old_objects.
for name, object in module.__dict__.items():
key = (module.__name__, name)
_old_objects.setdefault(key, []).append(object)
if verbose:
print "# reloading module %r" % module
newmodule = reload(module)
# XXX We have a problem here if importing the module fails!
# iterate over all objects and update them
for name, new_obj in newmodule.__dict__.items():
# print "updating", `name`, type(new_obj), `new_obj`
key = (newmodule.__name__, name)
if _old_objects.has_key(key):
for old_obj in _old_objects[key]:
if type(old_obj) == types.TypeType and \
old_obj.__module__ == newmodule.__name__:
# New-style classes support __getattribute__, which is called
# on *any* attribute access, so they get updated the first
# time they're used after a reload.
# We have to pass in newvalue because of Python's scoping.
def updater(self, s, newvalue=new_obj):
# This function is to be an __getattr__ or __getattribute__.
try:
self.__class__ = newvalue
except:
try:
del self.__class__.__getattribute__
except AttributeError:
del self.__class__.__getattr__
return getattr(self, s)
old_obj.__getattribute__ = updater
elif type(new_obj) == types.ClassType:
old_obj.__dict__.update(new_obj.__dict__)
elif type(new_obj) == types.FunctionType:
update_function(old_obj,
new_obj,
"func_code func_defaults func_doc".split())
elif type(new_obj) == types.MethodType:
update_function(old_obj.im_func,
new_obj.im_func,
"func_code func_defaults func_doc".split())
return newmodule
_watcher = ModuleWatcher()
run = _watcher.run
stop = _watcher.stop
def modulename(path):
return os.path.splitext(path)[0].replace(os.sep, '.')
def importmodule(filename):
"""Returns the imported module of this source file.
This function tries to find this source file as module
on the Python path, so that its typical module name is used.
If this does not work, the directory of this file is inserted
at the beginning of sys.path and the import is attempted again.
"""
sourcefile = os.path.abspath(filename)
modfile = os.path.basename(sourcefile)
# Given an absolute filename of a python source file,
# we need to find it on the Python path to calculate its
# proper module name.
candidates = []
for p in sys.path:
pdir = p + os.sep
checkfile = os.path.join(p, modfile)
if os.path.normcase(sourcefile).startswith(os.path.normcase(pdir)):
relmodfile = sourcefile[len(pdir):]
candidates.append((len(relmodfile), relmodfile))
if candidates:
# Pick the most specific module path from all candidates
candidates.sort()
modname = modulename(candidates[0][1])
else:
modname = modulename(os.path.basename(sourcefile))
try:
# In case the source file was in the Python path
# it can be imported now.
module = __import__(modname, globals(), locals(), [])
except ImportError, e:
failed_modname = str(e).split()[-1]
if str(e).split()[-1] == modname:
# The ImportError wasn't caused by some nested import
# but our module was not found, so we add the source files
# directory to the path and import it again.
modname = modulename(os.path.basename(sourcefile))
sys.path.insert(0, os.path.dirname(sourcefile))
module = __import__(modname, globals(), locals(), [])
else:
import traceback
tb = sys.exc_traceback
if tb:
tb = tb.tb_next
traceback.print_exception(sys.exc_type, sys.exc_value, tb)
# The module to be imported could be found but raised an
# ImportError itself.
raise e
# We have to deal module nesting like logging.handlers
# before calling the modules main function.
components = modname.split('.')
for comp in components[1:]:
module = getattr(module, comp)
return module
#----------------------------------------------------------------------------
class Usage(Exception):
def __init__(self, msg):
self.msg = msg
def usage(argv0):
print >>sys.stderr, """Usage: %s [OPTIONS] <module.py>
Import module and call module.main() with hotswap enabled.
Subsequent modifications in module.py and other source files of
modules being used are monitored periodically and put into effect
without restarting the program.
Options:
-h, --help Display this help then exit.
-w, --wait Wait number of seconds between checks. [0.1]
-s, --skipsystem Skip check of system modules beneath (%s). [False]
-v, --verbose Display diagnostic messages. [False]
""" % (argv0, sys.prefix)
#----------------------------------------------------------------------------
def main(argv=None):
if argv is None:
argv = sys.argv
wait = ModuleWatcher.SECONDS_BETWEEN_CHECKS
skipsystem = ModuleWatcher.SKIP_SYSTEM_MODULES
verbose = ModuleWatcher.VERBOSE
# parse command line arguments
try:
try:
opts, args = getopt.getopt(argv[1:], "hw:sv",
["help", "wait",
"skipsystem", "verbose"])
except getopt.error, msg:
raise Usage(msg)
for o, a in opts:
if o in ("-h", "--help"):
usage(argv[0])
return 0
if o in ("-w", "--wait"):
try:
wait = float(a)
except ValueError:
raise Usage("Parameter -w/--wait expects a float value")
if o in ("-s", "--skipsystem"):
skipsystem = True
if o in ("-v", "--verbose"):
verbose = True
except Usage, err:
print >>sys.stderr, "%s:" % argv[0],
print >>sys.stderr, err.msg
print >>sys.stderr, "for help use --help"
return 2
# Remove hotswap options from arguments
if args:
del argv[1:-len(args)]
else:
del argv[1:]
if len(argv) <= 1:
usage(argv[0])
sys.exit(1)
firstarg = argv[1]
sourcefile = os.path.abspath(firstarg)
if not os.path.isfile(sourcefile):
print "%s: File '%s' does not exist." % (os.path.basename(argv[0]),
sourcefile)
sys.exit(1)
try:
module = importmodule(sourcefile)
except ImportError, e:
print "%s: Unable to import '%s' as module: %s" % (os.path.basename(argv[0]),
sourcefile, e)
sys.exit(1)
# Remove hotswap.py from arguments that argv looks as
# if no additional wrapper was present.
del argv[0]
# Start hotswapping
run(skipsystem=skipsystem,
seconds=wait,
verbose=verbose)
# Run the Python source file with hotswapping enabled.
module.main()
if __name__ == '__main__':
main()
|
{
"content_hash": "e18d52dae5bfa53331a7776ba2b863a7",
"timestamp": "",
"source": "github",
"line_count": 364,
"max_line_length": 85,
"avg_line_length": 37.11813186813187,
"alnum_prop": 0.5326030641699356,
"repo_name": "zindy/Imaris",
"id": "aca906c629df7f586295d0fe14647a6d63f3a200",
"size": "13534",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "hotswap.py",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Jupyter Notebook",
"bytes": "2493857"
},
{
"name": "Python",
"bytes": "303130"
}
],
"symlink_target": ""
}
|
package com.twitter.finagle.tracing
import com.twitter.conversions.time._
import com.twitter.io.Buf
import com.twitter.util.Time
import com.twitter.util.{Return, Throw}
import org.junit.runner.RunWith
import org.mockito.Matchers.any
import org.mockito.Mockito.{never, times, verify, when, atLeast}
import org.scalatest.junit.JUnitRunner
import org.scalatest.mock.MockitoSugar
import org.scalatest.{OneInstancePerTest, BeforeAndAfter, FunSuite}
import scala.util.Random
@RunWith(classOf[JUnitRunner])
class TraceTest extends FunSuite with MockitoSugar with BeforeAndAfter with OneInstancePerTest {
val Seq(id0, id1, id2) = 0 until 3 map { i =>
TraceId(Some(SpanId(i)), Some(SpanId(i)), SpanId(i), None, Flags(i))
}
test("have a default id without parents, etc.") {
assert(Trace.id match {
case TraceId(None, None, _, None, Flags(0), None) => true
case _ => false
})
}
test("Trace.letTracer") {
var runs = 0
val tracer = mock[Tracer]
assert(Trace.tracers.isEmpty)
Trace.letTracer(tracer) {
assert(Trace.tracers == List(tracer))
runs += 1
}
assert(runs == 1)
}
test("Trace.letId") {
var didRun = false
val priorId = Trace.id
Trace.letId(id0) {
assert(Trace.id == id0)
didRun = true
}
assert(didRun)
assert(Trace.id == priorId)
}
test("Trace.letId: set a fresh id when none exist") {
assert(Trace.idOption == None)
val defaultId = Trace.id
Trace.letId(Trace.nextId) {
assert(Trace.id != defaultId)
assert(Trace.id match {
case TraceId(None, None, _, None, Flags(0), None) => true
case _ => false
})
}
}
test("Trace.letId: set a derived id when one exists") {
Trace.letId(Trace.nextId) {
val topId = Trace.id
Trace.letId(Trace.nextId) {
assert(Trace.id match {
case TraceId(Some(traceId), Some(parentId), _, None, Flags(0), _)
if traceId == topId.traceId && parentId == topId.spanId =>
true
case _ => false
})
}
}
}
test("Trace.letId: not set additional terminal id") {
Trace.letId(Trace.nextId, true) {
val topId = Trace.id
Trace.letId(Trace.nextId, true) {
assert(Trace.id == topId)
}
}
}
test("Trace.letId: not set id when terminal id exists") {
Trace.letId(Trace.nextId, true) {
val topId = Trace.id
Trace.letId(Trace.nextId) {
assert(Trace.id == topId)
}
}
}
val tracer1 = mock[Tracer]
val tracer2 = mock[Tracer]
when(tracer1.isActivelyTracing(any[TraceId])).thenReturn(true)
when(tracer2.isActivelyTracing(any[TraceId])).thenReturn(true)
test("Trace.traceService") {
var didRun = false
Trace.letTracer(tracer1) {
val priorId = Trace.id
Trace.traceService("service", "rpcname") {
assert(Trace.id != priorId)
didRun = true
}
verify(tracer1, atLeast(3)).record(any[Record])
assert(Trace.id == priorId)
}
assert(didRun)
}
test("Trace.record: report topmost id to all tracers") {
Time.withCurrentTimeFrozen { tc =>
Trace.letTracerAndId(tracer1, id0) {
val ann = Annotation.Message("hello")
Trace.record(ann)
verify(tracer1, times(1)).record(any[Record])
Trace.letId(id1) {
Trace.record(ann)
verify(tracer1, times(1)).record(Record(id1, Time.now, ann))
tc.advance(1.second)
Trace.letId(id2) {
Trace.record(ann)
verify(tracer1, times(1)).record(Record(id2, Time.now, ann))
tc.advance(1.second)
Trace.letTracerAndId(tracer2, id0) {
Trace.record(ann)
verify(tracer1, times(1)).record(Record(id0, Time.now, ann))
verify(tracer2, times(1)).record(Record(id0, Time.now, ann))
}
}
}
}
}
}
test("Trace.record: record IDs not in the stack to all tracers") {
Time.withCurrentTimeFrozen { tc =>
Trace.letTracerAndId(tracer1, id0) {
Trace.letTracer(tracer2) {
val rec1 = Record(id1, Time.now, Annotation.Message("wtf"))
Trace.record(rec1)
verify(tracer1, times(1)).record(rec1)
verify(tracer2, times(1)).record(rec1)
val rec0 = Record(id0, Time.now, Annotation.Message("wtf0"))
Trace.record(rec0)
verify(tracer1, times(1)).record(rec0)
verify(tracer2, times(1)).record(rec0)
}
}
}
}
test("Trace.record: record binary annotations") {
Time.withCurrentTimeFrozen { tc =>
Trace.letTracerAndId(tracer1, id0) {
val rec1 = Record(id0, Time.now, Annotation.BinaryAnnotation("key", "test"))
Trace.recordBinary("key", "test")
verify(tracer1, times(1)).record(rec1)
}
}
}
test("Trace.record: not report when tracing turned off") {
try {
Trace.disable()
Trace.letTracer(tracer2) {
Trace.letTracerAndId(tracer1, id0) {
Trace.letTracer(tracer1) {
Trace.letTracer(tracer2) {
Trace.letId(id0) {
verify(tracer1, never()).record(any[Record])
verify(tracer2, never()).record(any[Record])
Trace.record("oh hey")
verify(tracer1, never()).record(any[Record])
verify(tracer2, never()).record(any[Record])
}
}
}
}
}
} finally {
Trace.enable()
}
}
/* TODO temporarily disabled until we can mock stopwatches
"Trace.time" in Time.withCurrentTimeFrozen { tc =>
val tracer = new BufferingTracer()
val duration = 1.second
Trace.pushTracer(tracer)
Trace.time("msg") {
tc.advance(duration)
}
tracer.iterator foreach { r =>
r.annotation mustEqual Annotation.Message("msg")
r.duration mustEqual Some(duration)
}
}
*/
test("pass flags to next id") {
val flags = Flags().setDebug
val id = TraceId(Some(SpanId(1L)), Some(SpanId(2L)), SpanId(3L), None, flags)
Trace.letId(id) {
val nextId = Trace.nextId
assert(id.flags == nextId.flags)
}
}
test("set empty flags in next id if no current id set") {
val nextId = Trace.nextId
assert(nextId.flags == Flags())
}
test("generates 64-bit SpanIDs by default") {
val nextId = Trace.nextId
assert(nextId.spanId.toString.length == 16)
}
test("Trace.letTracerAndNextId: start with a default TraceId") {
Time.withCurrentTimeFrozen { tc =>
val tracer = mock[Tracer]
when(tracer.sampleTrace(any[TraceId])).thenReturn(None)
when(tracer.isActivelyTracing(any[TraceId])).thenReturn(true)
Trace.letTracerAndNextId(tracer) {
val currentId = Trace.id
assert(currentId match {
case TraceId(None, None, _, None, Flags(0), None) => true
case _ => false
})
assert(Trace.isTerminal == false)
assert(Trace.tracers == List(tracer))
Trace.record("Hello world")
verify(tracer, times(1)).sampleTrace(currentId)
verify(tracer, times(1))
.record(Record(currentId, Time.now, Annotation.Message("Hello world"), None))
}
}
}
test("Trace.letTracerAndNextId: use parent's sampled if it is defined") {
Time.withCurrentTimeFrozen { tc =>
val tracer = mock[Tracer]
when(tracer.sampleTrace(any[TraceId])).thenReturn(Some(true))
val parentId =
TraceId(Some(SpanId(123)), Some(SpanId(456)), SpanId(789), Some(false), Flags(0))
Trace.letId(parentId) {
Trace.letTracerAndNextId(tracer) {
val currentId = Trace.id
assert(currentId match {
case TraceId(Some(_traceId), Some(_parentId), _, Some(_sampled), Flags(0), _)
if (_traceId == parentId.traceId) && (_parentId == parentId.spanId) &&
(_sampled == parentId.sampled.get) =>
true
case _ => false
})
when(tracer.isActivelyTracing(currentId)).thenReturn(currentId.sampled.getOrElse(true))
assert(Trace.isTerminal == false)
assert(Trace.tracers == List(tracer))
verify(tracer, never()).sampleTrace(currentId)
Trace.record("Hello world")
verify(tracer, never()).record(any[Record])
}
}
}
}
test("Trace.letTracerAndNextId: call with terminal=true") {
Time.withCurrentTimeFrozen { tc =>
val tracer = mock[Tracer]
when(tracer.sampleTrace(any[TraceId])).thenReturn(None)
when(tracer.isActivelyTracing(any[TraceId])).thenReturn(true)
Trace.letTracerAndNextId(tracer, true) {
val currentId = Trace.id
assert(currentId match {
case TraceId(None, None, _, None, Flags(0), None) => true
case _ => false
})
assert(Trace.isTerminal == true)
assert(Trace.tracers == List(tracer))
verify(tracer, times(1)).sampleTrace(currentId)
Trace.record("Hello world")
verify(tracer, times(1))
.record(Record(currentId, Time.now, Annotation.Message("Hello world"), None))
}
}
}
test("Trace.letTracerAndNextId: trace with terminal set for the current state") {
Time.withCurrentTimeFrozen { tc =>
val tracer = mock[Tracer]
when(tracer.sampleTrace(any[TraceId])).thenReturn(Some(true))
when(tracer.isActivelyTracing(any[TraceId])).thenReturn(true)
val parentId =
TraceId(Some(SpanId(123)), Some(SpanId(456)), SpanId(789), Some(true), Flags(0))
Trace.letId(parentId, terminal = true) {
Trace.letTracerAndNextId(tracer) {
val currentId = Trace.id
assert(currentId == parentId)
assert(Trace.isTerminal == true)
assert(Trace.tracers == List(tracer))
verify(tracer, never()).sampleTrace(currentId)
Trace.record("Hello world")
verify(tracer, times(1))
.record(Record(currentId, Time.now, Annotation.Message("Hello world"), None))
}
}
}
}
test("Trace.isActivelyTracing") {
val id = TraceId(Some(SpanId(12)), Some(SpanId(13)), SpanId(14), None, Flags(0L))
val tracer1 = mock[Tracer]
val tracer2 = mock[Tracer]
val tracer = BroadcastTracer(Seq(tracer1, tracer2))
// no tracers, not tracing
assert(!Trace.isActivelyTracing)
// only the null tracer, still false
Trace.letTracerAndId(NullTracer, id) {
assert(!Trace.isActivelyTracing)
}
Trace.letTracer(tracer) {
Trace.letId(id) {
// Even if one tracer returns, then true
when(tracer1.isActivelyTracing(any[TraceId])).thenReturn(false)
when(tracer2.isActivelyTracing(any[TraceId])).thenReturn(true)
assert(Trace.isActivelyTracing)
// when everything returns true, then true
when(tracer1.isActivelyTracing(any[TraceId])).thenReturn(true)
when(tracer2.isActivelyTracing(any[TraceId])).thenReturn(true)
assert(Trace.isActivelyTracing)
// tracing enabled flag overrides individual tracer decisions
when(tracer1.isActivelyTracing(any[TraceId])).thenReturn(true)
when(tracer2.isActivelyTracing(any[TraceId])).thenReturn(true)
Trace.disable()
assert(!Trace.isActivelyTracing)
Trace.enable()
assert(Trace.isActivelyTracing)
// when everything returns false, then false
when(tracer1.isActivelyTracing(any[TraceId])).thenReturn(false)
when(tracer2.isActivelyTracing(any[TraceId])).thenReturn(false)
assert(!Trace.isActivelyTracing)
}
}
}
test("trace ID serialization: valid ids (64-bit)") {
// TODO: Consider using scalacheck here. (CSL-595)
def longs(seed: Long) = {
val rng = new Random(seed)
Seq.fill(10) { rng.nextLong() }
}
def spanIds(seed: Long): Seq[Option[SpanId]] =
None +: (longs(seed) map (l => Some(SpanId(l))))
val traceIds = for {
traceId <- spanIds(1L)
parentId <- traceId +: spanIds(2L)
maybeSpanId <- parentId +: spanIds(3L)
spanId <- maybeSpanId.toSeq
flags <- Seq(Flags(0L), Flags(Flags.Debug))
sampled <- Seq(None, Some(false), Some(true))
} yield TraceId(traceId, parentId, spanId, sampled, flags)
for (id <- traceIds)
assert(Trace.idCtx.tryUnmarshal(Trace.idCtx.marshal(id)) == Return(id))
}
test("trace ID serialization: valid ids (128-bit)") {
val traceId = TraceId(Some(SpanId(1L)), Some(SpanId(1L)), SpanId(2L), None, Flags(Flags.Debug), Some(SpanId(2L)))
assert(Trace.idCtx.tryUnmarshal(Trace.idCtx.marshal(traceId)) == Return(traceId))
}
// example from X-Amzn-Trace-Id: Root=1-5759e988-bd862e3fe1be46a994272793;Sampled=1
test("Trace.nextTraceIdHigh: encodes epoch seconds") {
Time.withTimeAt(Time.fromSeconds(1465510280)) { tc => // Thursday, June 9, 2016 10:11:20 PM
val traceIdHigh = Trace.nextTraceIdHigh()
assert(traceIdHigh.toString.startsWith("5759e988")) == true
}
}
test("trace ID serialization: throw in handle on invalid size") {
val bytes = new Array[Byte](33)
Trace.idCtx.tryUnmarshal(Buf.ByteArray.Owned(bytes)) match {
case Throw(_: IllegalArgumentException) =>
case rv => fail(s"Got $rv")
}
}
}
|
{
"content_hash": "6c3fc43d1ca0c37da309de6d46f055fb",
"timestamp": "",
"source": "github",
"line_count": 412,
"max_line_length": 117,
"avg_line_length": 32.46601941747573,
"alnum_prop": 0.6155053827751196,
"repo_name": "mkhq/finagle",
"id": "f3da99b8f2da2de51fd31fdb2df2987ea0296727",
"size": "13376",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "finagle-core/src/test/scala/com/twitter/finagle/tracing/TraceTest.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "6256"
},
{
"name": "Java",
"bytes": "360872"
},
{
"name": "Lua",
"bytes": "15245"
},
{
"name": "Python",
"bytes": "56461"
},
{
"name": "R",
"bytes": "4245"
},
{
"name": "Ruby",
"bytes": "25330"
},
{
"name": "Scala",
"bytes": "5675637"
},
{
"name": "Shell",
"bytes": "4772"
},
{
"name": "Thrift",
"bytes": "19699"
}
],
"symlink_target": ""
}
|
package com.github.mkopylec.webbackend.jersey.exceptions;
import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR;
public class ServerException extends ApplicationException {
public ServerException(String errorCode, String message) {
super(errorCode, message, INTERNAL_SERVER_ERROR);
}
}
|
{
"content_hash": "1887fa9bf13b207b0fb922a863ba9520",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 69,
"avg_line_length": 32,
"alnum_prop": 0.78125,
"repo_name": "mkopylec/web-spring-boot-starters",
"id": "95c3f6f590712c26f13aaf0b405a9e25cee22192",
"size": "320",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "web-backend-spring-jersey/src/main/java/com/github/mkopylec/webbackend/jersey/exceptions/ServerException.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "13212"
},
{
"name": "Java",
"bytes": "43965"
}
],
"symlink_target": ""
}
|
require "active_support/core_ext/module/redefine_method"
require "action_controller"
require "action_controller/test_case"
require "action_view"
require "rails-dom-testing"
module ActionView
# = Action View Test Case
class TestCase < ActiveSupport::TestCase
class TestController < ActionController::Base
include ActionDispatch::TestProcess
attr_accessor :request, :response, :params
class << self
# Overrides AbstractController::Base#controller_path
attr_accessor :controller_path
end
def controller_path=(path)
self.class.controller_path = path
end
def initialize
super
self.class.controller_path = ""
@request = ActionController::TestRequest.create(self.class)
@response = ActionDispatch::TestResponse.new
@request.env.delete("PATH_INFO")
@params = ActionController::Parameters.new
end
end
module Behavior
extend ActiveSupport::Concern
include ActionDispatch::Assertions, ActionDispatch::TestProcess
include Rails::Dom::Testing::Assertions
include ActionController::TemplateAssertions
include ActionView::Context
include ActionDispatch::Routing::PolymorphicRoutes
include AbstractController::Helpers
include ActionView::Helpers
include ActionView::RecordIdentifier
include ActionView::RoutingUrlFor
include ActiveSupport::Testing::ConstantLookup
delegate :lookup_context, to: :controller
attr_accessor :controller, :output_buffer, :rendered
module ClassMethods
def tests(helper_class)
case helper_class
when String, Symbol
self.helper_class = "#{helper_class.to_s.underscore}_helper".camelize.safe_constantize
when Module
self.helper_class = helper_class
end
end
def determine_default_helper_class(name)
determine_constant_from_test_name(name) do |constant|
Module === constant && !(Class === constant)
end
end
def helper_method(*methods)
# Almost a duplicate from ActionController::Helpers
methods.flatten.each do |method|
_helpers.module_eval <<-end_eval, __FILE__, __LINE__ + 1
def #{method}(*args, &block) # def current_user(*args, &block)
_test_case.send(:'#{method}', *args, &block) # _test_case.send(:'current_user', *args, &block)
end # end
ruby2_keywords(:'#{method}') if respond_to?(:ruby2_keywords, true)
end_eval
end
end
attr_writer :helper_class
def helper_class
@helper_class ||= determine_default_helper_class(name)
end
def new(*)
include_helper_modules!
super
end
private
def include_helper_modules!
helper(helper_class) if helper_class
include _helpers
end
end
def setup_with_controller
controller_class = Class.new(ActionView::TestCase::TestController)
@controller = controller_class.new
@request = @controller.request
@view_flow = ActionView::OutputFlow.new
# empty string ensures buffer has UTF-8 encoding as
# new without arguments returns ASCII-8BIT encoded buffer like String#new
@output_buffer = ActiveSupport::SafeBuffer.new ""
@rendered = +""
test_case_instance = self
controller_class.define_method(:_test_case) { test_case_instance }
end
def config
@controller.config if @controller.respond_to?(:config)
end
def render(options = {}, local_assigns = {}, &block)
view.assign(view_assigns)
@rendered << output = view.render(options, local_assigns, &block)
output
end
def rendered_views
@_rendered_views ||= RenderedViewsCollection.new
end
def _routes
@controller._routes if @controller.respond_to?(:_routes)
end
# Need to experiment if this priority is the best one: rendered => output_buffer
class RenderedViewsCollection
def initialize
@rendered_views ||= Hash.new { |hash, key| hash[key] = [] }
end
def add(view, locals)
@rendered_views[view] ||= []
@rendered_views[view] << locals
end
def locals_for(view)
@rendered_views[view]
end
def rendered_views
@rendered_views.keys
end
def view_rendered?(view, expected_locals)
locals_for(view).any? do |actual_locals|
expected_locals.all? { |key, value| value == actual_locals[key] }
end
end
end
included do
setup :setup_with_controller
ActiveSupport.run_load_hooks(:action_view_test_case, self)
helper do
def protect_against_forgery?
false
end
def _test_case
controller._test_case
end
end
end
private
# Need to experiment if this priority is the best one: rendered => output_buffer
def document_root_element
Nokogiri::HTML::Document.parse(@rendered.blank? ? @output_buffer : @rendered).root
end
module Locals
attr_accessor :rendered_views
def render(options = {}, local_assigns = {})
case options
when Hash
if block_given?
rendered_views.add options[:layout], options[:locals]
elsif options.key?(:partial)
rendered_views.add options[:partial], options[:locals]
end
else
rendered_views.add options, local_assigns
end
super
end
end
# The instance of ActionView::Base that is used by +render+.
def view
@view ||= begin
view = @controller.view_context
view.singleton_class.include(_helpers)
view.extend(Locals)
view.rendered_views = rendered_views
view.output_buffer = output_buffer
view
end
end
alias_method :_view, :view
INTERNAL_IVARS = [
:@NAME,
:@failures,
:@assertions,
:@__io__,
:@_assertion_wrapped,
:@_assertions,
:@_result,
:@_routes,
:@controller,
:@_layouts,
:@_files,
:@_rendered_views,
:@method_name,
:@output_buffer,
:@_partials,
:@passed,
:@rendered,
:@request,
:@routes,
:@tagged_logger,
:@_templates,
:@options,
:@test_passed,
:@view,
:@view_context_class,
:@view_flow,
:@_subscribers,
:@html_document
]
def _user_defined_ivars
instance_variables - INTERNAL_IVARS
end
# Returns a Hash of instance variables and their values, as defined by
# the user in the test case, which are then assigned to the view being
# rendered. This is generally intended for internal use and extension
# frameworks.
def view_assigns
Hash[_user_defined_ivars.map do |ivar|
[ivar[1..-1].to_sym, instance_variable_get(ivar)]
end]
end
def method_missing(selector, *args)
begin
routes = @controller.respond_to?(:_routes) && @controller._routes
rescue
# Don't call routes, if there is an error on _routes call
end
if routes &&
(routes.named_routes.route_defined?(selector) ||
routes.mounted_helpers.method_defined?(selector))
@controller.__send__(selector, *args)
else
super
end
end
def respond_to_missing?(name, include_private = false)
begin
routes = defined?(@controller) && @controller.respond_to?(:_routes) && @controller._routes
rescue
# Don't call routes, if there is an error on _routes call
end
routes &&
(routes.named_routes.route_defined?(name) ||
routes.mounted_helpers.method_defined?(name))
end
end
include Behavior
end
end
|
{
"content_hash": "6d974cb7958215eeb84b8bef5aefa421",
"timestamp": "",
"source": "github",
"line_count": 290,
"max_line_length": 113,
"avg_line_length": 28.655172413793103,
"alnum_prop": 0.5797833935018051,
"repo_name": "rafaelfranca/omg-rails",
"id": "c93cf64d6e23c7025874f782d60f0de8f97a8e03",
"size": "8341",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "actionview/lib/action_view/test_case.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "34354"
},
{
"name": "CoffeeScript",
"bytes": "40425"
},
{
"name": "HTML",
"bytes": "203046"
},
{
"name": "JavaScript",
"bytes": "94068"
},
{
"name": "Ruby",
"bytes": "11146870"
},
{
"name": "Yacc",
"bytes": "968"
}
],
"symlink_target": ""
}
|
package org.languagetool;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.util.List;
import org.junit.Test;
import org.languagetool.language.GermanyGerman;
import org.languagetool.rules.RuleMatch;
public class JLanguageToolTest {
@Test
public void testGerman() throws IOException {
JLanguageTool tool = new JLanguageTool(Languages.getLanguageForShortCode("de"));
assertEquals(0, tool.check("Ein Test, der keine Fehler geben sollte.").size());
assertEquals(1, tool.check("Ein Test Test, der Fehler geben sollte.").size());
tool.setListUnknownWords(true);
// no spelling mistakes as we have not created a variant:
assertEquals(0, tool.check("I can give you more a detailed description").size());
//test unknown words listing
assertEquals("[I, can, description, detailed, give, more, you]", tool.getUnknownWords().toString());
}
@Test
public void testGermanyGerman() throws IOException {
JLanguageTool tool = new JLanguageTool(Languages.getLanguageForShortCode("de-DE"));
assertEquals(0, tool.check("Ein Test, der keine Fehler geben sollte.").size());
assertEquals(1, tool.check("Ein Test Test, der Fehler geben sollte.").size());
tool.setListUnknownWords(true);
// German rule has no effect with English error, but they are spelling mistakes:
assertEquals(6, tool.check("I can give you more a detailed description").size());
//test unknown words listing
assertEquals("[I, can, description, detailed, give, more, you]", tool.getUnknownWords().toString());
}
@Test
public void testPositionsWithGerman() throws IOException {
JLanguageTool tool = new JLanguageTool(Languages.getLanguageForShortCode("de-DE"));
List<RuleMatch> matches = tool.check("Stundenkilometer");
assertEquals(1, matches.size());
RuleMatch match = matches.get(0);
assertEquals(0, match.getLine());
assertEquals(1, match.getColumn());
}
@Test
public void testCleanOverlappingWithGerman() throws IOException {
JLanguageTool tool = new JLanguageTool(Languages.getLanguageForShortCode("de-DE"));
// Juxtaposed errors in "TRGS - Technische" should not be removed.
List<RuleMatch> matches = tool.check("TRGS - Technische Regeln für Gefahrstoffe");
assertEquals(3, matches.size());
}
@Test
public void testAdvancedTypography() {
Language lang = new GermanyGerman();
assertEquals(lang.toAdvancedTypography("Das ist..."), "Das ist…");
assertEquals(lang.toAdvancedTypography("Meinten Sie \"entschieden\" oder \"entscheidend\"?"), "Meinten Sie „entschieden“ oder „entscheidend“?");
assertEquals(lang.toAdvancedTypography("Meinten Sie \'entschieden\' oder \'entscheidend\'?"), "Meinten Sie ‚entschieden‘ oder ‚entscheidend‘?");
assertEquals(lang.toAdvancedTypography("z. B."), "z.\u00a0B.");
assertEquals(lang.toAdvancedTypography("z.B."), "z.\u00a0B.");
}
}
|
{
"content_hash": "08052c30ab38386f0f7b4e1a7602f829",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 148,
"avg_line_length": 41.436619718309856,
"alnum_prop": 0.7182188987083616,
"repo_name": "EMResearch/EMB",
"id": "11525147a37f48f5c0c324e92f595f53dcbe6449",
"size": "3821",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jdk_8_maven/cs/rest/original/languagetool/languagetool-language-modules/de/src/test/java/org/languagetool/JLanguageToolTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "17751"
},
{
"name": "C#",
"bytes": "314780"
},
{
"name": "CSS",
"bytes": "155749"
},
{
"name": "Dockerfile",
"bytes": "6278"
},
{
"name": "EJS",
"bytes": "13193"
},
{
"name": "HTML",
"bytes": "1980397"
},
{
"name": "Java",
"bytes": "13878146"
},
{
"name": "JavaScript",
"bytes": "4551141"
},
{
"name": "Kotlin",
"bytes": "62153"
},
{
"name": "Less",
"bytes": "29035"
},
{
"name": "Lex",
"bytes": "1418"
},
{
"name": "Perl",
"bytes": "82062"
},
{
"name": "Procfile",
"bytes": "26"
},
{
"name": "Pug",
"bytes": "3626"
},
{
"name": "Python",
"bytes": "129221"
},
{
"name": "Ruby",
"bytes": "683"
},
{
"name": "Shell",
"bytes": "51395"
},
{
"name": "Smarty",
"bytes": "2380"
},
{
"name": "Starlark",
"bytes": "23296"
},
{
"name": "TSQL",
"bytes": "4320"
},
{
"name": "Thrift",
"bytes": "1245"
},
{
"name": "TypeScript",
"bytes": "701370"
},
{
"name": "XSLT",
"bytes": "18724"
}
],
"symlink_target": ""
}
|
namespace peloton {
namespace brain {
#define DEFAULT_SAMPLE_WEIGHT 1.0
#define DEFAULT_COLUMN_VALUE 0.5
#define DEFAULT_METRIC_VALUE 0
enum SampleType {
SAMPLE_TYPE_INVALID = 0,
SAMPLE_TYPE_ACCESS = 1, // accessed attributes
SAMPLE_TYPE_UPDATE = 2 // updated attributes
};
//===--------------------------------------------------------------------===//
// Sample
//===--------------------------------------------------------------------===//
class Sample : public Printable {
public:
Sample(const size_t column_count)
: columns_accessed_(
std::vector<double>(column_count, DEFAULT_COLUMN_VALUE)),
weight_(DEFAULT_SAMPLE_WEIGHT),
sample_type_(SAMPLE_TYPE_ACCESS) {}
Sample(const std::vector<double> &columns_accessed,
double weight = DEFAULT_SAMPLE_WEIGHT,
SampleType sample_type = SAMPLE_TYPE_ACCESS)
: columns_accessed_(columns_accessed),
weight_(weight),
sample_type_(sample_type) {}
// get the distance from other sample
double GetDistance(const Sample &other) const;
// get difference after removing other sample
Sample GetDifference(const Sample &other) const;
// multiplication operator with a scalar
Sample &operator*(const double &rhs);
// addition operator with a sample
Sample &operator+(const Sample &rhs);
// the sample's weight
inline double GetWeight() const { return (weight_); }
// the sample type
inline SampleType GetSampleType() const { return (sample_type_); }
inline const std::vector<double> GetColumnsAccessed() const {
return (columns_accessed_);
}
// set the columns accessed
inline void SetColumnsAccessed(const std::vector<double> columns_accessed) {
columns_accessed_ = columns_accessed;
}
// get enabled columns
std::vector<oid_t> GetEnabledColumns() const;
// Get a string representation for debugging
const std::string GetInfo() const;
// Convert this sample into a parseable string
const std::string ToString() const;
bool operator==(const Sample &other) const;
//===--------------------------------------------------------------------===//
// MEMBERS
//===--------------------------------------------------------------------===//
private:
// column accessed bitmap
std::vector<double> columns_accessed_;
// weight of the sample
double weight_;
// type of sample
SampleType sample_type_;
};
} // namespace brain
} // namespace peloton
namespace std {
template <>
struct hash<peloton::brain::Sample> {
size_t operator()(const peloton::brain::Sample &sample) const {
// Compute individual hash values using XOR and bit shifting:
long hash = 31;
auto columns = sample.GetColumnsAccessed();
auto sample_size = columns.size();
for (size_t sample_itr = 0; sample_itr < sample_size; sample_itr++) {
hash *= (columns[sample_itr] + 31);
}
return hash;
}
};
}
|
{
"content_hash": "3882ce54490247f71cc692248a56e425",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 80,
"avg_line_length": 27.214953271028037,
"alnum_prop": 0.6088598901098901,
"repo_name": "prashasthip/peloton",
"id": "5e5ce7eb644dd15ec30c47c2e663e2575230f99d",
"size": "3369",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/include/brain/sample.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "44625"
},
{
"name": "C++",
"bytes": "5767040"
},
{
"name": "CMake",
"bytes": "109338"
},
{
"name": "Java",
"bytes": "44640"
},
{
"name": "Objective-C",
"bytes": "4030"
},
{
"name": "PLpgSQL",
"bytes": "5855"
},
{
"name": "Python",
"bytes": "63317"
},
{
"name": "Ruby",
"bytes": "1310"
},
{
"name": "Shell",
"bytes": "14149"
}
],
"symlink_target": ""
}
|
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "0cd3f28b83e3497948a04b024ed72be7",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "32fea64179b151260374a15e3ade69346eed73c9",
"size": "188",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Euphorbiaceae/Euphorbia/Euphorbia apocynoides/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
}
|
<!doctype html>
<html lang="en">
<head>
<meta charset="utf8"/>
<title>flickrPickr example</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.3.0/pure-min.css">
<link rel="stylesheet" href="deps/modal.css"/>
<link rel="stylesheet" href="deps/typeahead.css"/>
</head>
<body>
<a href="#">Flick a pick!</a>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="deps/fickr.js"></script>
<script type="text/javascript" src="deps/modal.js"></script>
<script type="text/javascript" src="deps/typeahead.js"></script>
<script type="text/javascript" src="flickrPickr.js"></script>
<script type="text/javascript">
fickr.init(/* Flickr credentials (see https://github.com/blackchair/fickr) */);
$('a').click(function() {
$(this).flickrPickr({
'fickr': fickr,
'close': function (selections) { console.log(selections); }
});
});
</script>
</body>
</html>
|
{
"content_hash": "1aa49971b6f3ff8b1602dbf7c5374674",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 94,
"avg_line_length": 38.7037037037037,
"alnum_prop": 0.6162679425837321,
"repo_name": "blackchair/flickrPickr",
"id": "846832f9cadbe7e31d387a8e47d8ceca6c4b2da2",
"size": "1045",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "example.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "13911"
}
],
"symlink_target": ""
}
|
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "dad9edd76c35cb08d75a9d810cd0f7e9",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "a7f36a298e7e5671348876824ace9372f6dd2a3f",
"size": "190",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Apiales/Apiaceae/Angelica/Angelica alpina/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
}
|
require 'optparse'
class KablameOptions
def opts
OptionParser.new do |opts|
opts.banner = "Usage: #{@type}-kablame [options] <directories>"
opts.on("-f", "--formats xml,html", Array, "List of file formats to #{@type}-kablame") do |list|
@formats = list
end
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
end
end
def initialize(type)
@type = type
end
def format_parse(args)
opts.parse!(args)
@formats
end
def self.print_usage(type)
puts self.new(type).opts
end
end
|
{
"content_hash": "354db7e812bac73bf34b5347c5869c0e",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 102,
"avg_line_length": 19.419354838709676,
"alnum_prop": 0.5813953488372093,
"repo_name": "jdunphy/kablame-gem",
"id": "5f7dd2776a5d628ce1a6d7c5dd4a136d26dbfa0f",
"size": "602",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/kablame_options.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "7735"
}
],
"symlink_target": ""
}
|
package hudson.plugins.warnings;
import hudson.plugins.analysis.core.AbstractHealthDescriptor;
import hudson.plugins.analysis.core.HealthDescriptor;
import hudson.plugins.analysis.util.model.AnnotationProvider;
import org.jvnet.localizer.Localizable;
/**
* A health descriptor for warnings build results.
*
* @author Ulli Hafner
*/
public class WarningsHealthDescriptor extends AbstractHealthDescriptor {
/** Unique ID of this class. */
private static final long serialVersionUID = -3404826986876607396L;
/**
* Creates a new instance of {@link WarningsHealthDescriptor} based on the
* values of the specified descriptor.
*
* @param healthDescriptor the descriptor to copy the values from
*/
public WarningsHealthDescriptor(final HealthDescriptor healthDescriptor) {
super(healthDescriptor);
}
@Override
protected Localizable createDescription(final AnnotationProvider result) {
if (result.getNumberOfAnnotations() == 0) {
return Messages._Warnings_ResultAction_HealthReportNoItem();
}
else if (result.getNumberOfAnnotations() == 1) {
return Messages._Warnings_ResultAction_HealthReportSingleItem();
}
else {
return Messages._Warnings_ResultAction_HealthReportMultipleItem(result.getNumberOfAnnotations());
}
}
}
|
{
"content_hash": "c6e5753a941fb11c5411ea5b57558f76",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 109,
"avg_line_length": 33.4390243902439,
"alnum_prop": 0.7184536834427425,
"repo_name": "hudson3-plugins/warnings-plugin",
"id": "23e6945c89b28a6bfc636bafb7b22f70306436fe",
"size": "1371",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/main/java/hudson/plugins/warnings/WarningsHealthDescriptor.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "456877"
},
{
"name": "Shell",
"bytes": "737"
}
],
"symlink_target": ""
}
|
Syntax:
<strong>`lognand`</strong> <em>parameters</em> => <em>return-type</em>
Documentation of parameters and return-results.
Examples (not from CLHS...):
```lisp
CL-USER> (example-code 'a 'b 'c)
'return-result
```
|
{
"content_hash": "c5bc3885ae7ebc97286d5a9a171040d8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 70,
"avg_line_length": 17,
"alnum_prop": 0.6742081447963801,
"repo_name": "agreco/llthw",
"id": "6334c67c8d8167d168a28751fd98207698f185e5",
"size": "271",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "reference/lognand.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
}
|
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* 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.wizecommerce.hecuba.astyanax;
import java.nio.ByteBuffer;
import java.util.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import com.google.common.base.Joiner;
import com.netflix.astyanax.*;
import com.netflix.astyanax.clock.ClockType;
import com.netflix.astyanax.connectionpool.Host;
import com.netflix.astyanax.connectionpool.HostStats;
import com.netflix.astyanax.connectionpool.NodeDiscoveryType;
import com.netflix.astyanax.connectionpool.OperationResult;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import com.netflix.astyanax.connectionpool.impl.*;
import com.netflix.astyanax.impl.AstyanaxConfigurationImpl;
import com.netflix.astyanax.model.*;
import com.netflix.astyanax.query.ColumnQuery;
import com.netflix.astyanax.query.PreparedIndexExpression;
import com.netflix.astyanax.query.RowQuery;
import com.netflix.astyanax.serializers.StringSerializer;
import com.netflix.astyanax.thrift.ThriftFamilyFactory;
import com.wizecommerce.hecuba.*;
import com.wizecommerce.hecuba.util.ClientManagerUtils;
import com.wizecommerce.hecuba.util.ConfigUtils;
/**
* @author Eran Chinthaka Withana
*/
public class AstyanaxBasedHecubaClientManager<K> extends HecubaClientManager<K> {
Keyspace keyspace;
ColumnFamily<K, String> columnFamily;
ColumnFamily<String, K> secondaryIndexColumnFamily;
AstyanaxConfigurationImpl astyanaxConfigurationImpl;
ConnectionPoolConfigurationImpl connectionPoolConfigurationImpl;
CountingConnectionPoolMonitor connectionPoolMonitor;
AstyanaxContext<Keyspace> context;
AstyanaxContext<Cluster> clusterContext;
Serializer<K> keySerializer;
private Clock clock = ClockType.ASYNC_MICRO.get();
public AstyanaxBasedHecubaClientManager() {
}
public AstyanaxBasedHecubaClientManager(CassandraParamsBean parameters, Serializer<K> keySerializer) {
super(parameters);
initialize(getClusterName(), getLocationURL(), getPort(), getKeyspace());
this.columnFamily = new ColumnFamily<K, String>(getColumnFamilyName(), keySerializer, StringSerializer.get());
this.keySerializer = keySerializer;
if (columnsToIndexOnColumnNameAndValue != null && columnsToIndexOnColumnNameAndValue.size() > 0) {
String secondaryIndexedColumnFamily = ConfigUtils.getInstance().getConfiguration().getString(
HecubaConstants.GLOBAL_PROP_NAME_PREFIX + "." + columnFamily + ".secondaryIndexCF",
columnFamily.getName() + HecubaConstants.SECONDARY_INDEX_CF_NAME_SUFFIX);
this.secondaryIndexColumnFamily = new ColumnFamily<String, K>(secondaryIndexedColumnFamily,
StringSerializer.get(), keySerializer);
}
}
public void initialize(String clusterName, String locationUrls, String port, String keyspaceName) {
astyanaxConfigurationImpl = new AstyanaxConfigurationImpl();
final Configuration configuration = ConfigUtils.getInstance().getConfiguration();
astyanaxConfigurationImpl.setDiscoveryType(NodeDiscoveryType.valueOf(configuration.getString(
HecubaConstants.ASTYANAX_NODE_DISCOVERY_TYPE, "RING_DESCRIBE")));
astyanaxConfigurationImpl.setConnectionPoolType(ConnectionPoolType.
valueOf(configuration.getString(
HecubaConstants.ASTYANAX_CONNECTION_POOL_TYPE,
"TOKEN_AWARE")));
connectionPoolConfigurationImpl = new ConnectionPoolConfigurationImpl("MyConnectionPool").setPort(
Integer.parseInt(port)).setSeeds(getListOfNodesAndPorts(locationUrls, port)).setMaxConnsPerHost(
configuration.getInteger(HecubaConstants.ASTYANAX_MAX_CONNS_PER_HOST, 3));
// Will resort hosts per token partition every 10 seconds
SmaLatencyScoreStrategyImpl smaLatencyScoreStrategyImpl = new SmaLatencyScoreStrategyImpl(
configuration.getInteger(HecubaConstants.ASTYANAX_LATENCY_AWARE_UPDATE_INTERVAL, 10000),
configuration.getInteger(HecubaConstants.ASTYANAX_LATENCY_AWARE_RESET_INTERVAL, 10000),
configuration.getInteger(HecubaConstants.ASTYANAX_LATENCY_AWARE_WINDOW_SIZE, 100),
configuration.getFloat(HecubaConstants.ASTYANAX_LATENCY_AWARE_BADNESS_INTERVAL, 0.5f));
// Enabled SMA. Omit this to use round robin with a token range.
connectionPoolConfigurationImpl.setLatencyScoreStrategy(smaLatencyScoreStrategyImpl);
if(StringUtils.isNotBlank(username) && StringUtils.isNotBlank(password)) {
SimpleAuthenticationCredentials simpleAuth =new SimpleAuthenticationCredentials(username, password);
connectionPoolConfigurationImpl.setAuthenticationCredentials(simpleAuth);
}
connectionPoolMonitor = new CountingConnectionPoolMonitor();
context = new AstyanaxContext.Builder().forCluster(clusterName).forKeyspace(keyspaceName)
.withAstyanaxConfiguration(astyanaxConfigurationImpl)
.withConnectionPoolConfiguration(connectionPoolConfigurationImpl)
.withConnectionPoolMonitor(connectionPoolMonitor).buildKeyspace(
ThriftFamilyFactory.getInstance());
context.start();
keyspace = context.getEntity();
if (clusterContext == null) {
initiateClusterContext(clusterName);
}
}
@Override
public void updateString(K key, String columnName, String value, long timestamp, int ttl) {
MutationBatch m = keyspace.prepareMutationBatch();
// set the timestamp, if set.
if (timestamp > 0) {
m.setTimestamp(timestamp);
}
updateSecondaryIndexes(key, columnName, value, ttl, m);
m.withRow(columnFamily, key).putColumn(columnName, value, ttl > 0 ? ttl : null);
try {
m.execute();
} catch (ConnectionException e) {
log.error(ExceptionUtils.getStackTrace(e));
}
}
private void updateSecondaryIndexes(K key, String columnName, String value, int ttl, MutationBatch mutationBatch) {
// first check whether we have secondary indexes enabled for this CF and the given column has a secondary
// index on it.
if (isSecondaryIndexByColumnNameAndValueEnabledForColumn(columnName)) {
// first retrieve the old value of this column to delete it from the secondary index.
final String oldValue = readString(key, columnName);
updateSecondaryIndexColumnFamily(key, columnName, value, ttl, mutationBatch, oldValue);
}
if (isSecondaryIndexByColumnNameEnabledForColumn(columnName)) {
updateSecondaryIndexColumnFamily(key, columnName, "", ttl, mutationBatch, "");
}
}
private void updateSecondaryIndexColumnFamily(K key, String columnName, String value, int ttl,
MutationBatch mutationBatch, String oldValue) {
// enqueue a deletion to the secondary index to remove the previous value of this column.
if (!StringUtils.isBlank(oldValue) && !"null".equalsIgnoreCase(oldValue)) {
mutationBatch.withRow(secondaryIndexColumnFamily, getSecondaryIndexKey(columnName, oldValue)).deleteColumn(
key);
}
// add the new value to the secondary index CF. Make sure to handle the TTLs properly.
mutationBatch.withRow(secondaryIndexColumnFamily, getSecondaryIndexKey(columnName, value)).putColumn(key, key,
keySerializer,
ttl > 0 ?
ttl :
null);
}
@Override
public void updateByteBuffer(K key, String columnName, ByteBuffer value) {
try {
MutationBatch m = keyspace.prepareMutationBatch();
m.withRow(columnFamily, key).putColumn(columnName, value, null);
m.execute();
} catch (ConnectionException e) {
log.warn("Couldn't update byte buffer ", e);
}
}
public AstyanaxContext<Cluster> initiateClusterContext(String clusterName) {
clusterContext = new AstyanaxContext.Builder().forCluster(clusterName).withAstyanaxConfiguration(
new AstyanaxConfigurationImpl()).withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl(
clusterName).setMaxConnsPerHost(1).setSeeds(getListOfNodesAndPorts(locationURLs, ports)).setPort(
Integer.parseInt(ports))).withConnectionPoolMonitor(new CountingConnectionPoolMonitor()).buildCluster(
ThriftFamilyFactory.getInstance());
clusterContext.start();
return clusterContext;
}
@Override
public void updateRow(K key, Map<String, Object> row, Map<String, Long> timestamps, Map<String, Integer> ttls) throws Exception {
// Inserting data
MutationBatch m = keyspace.prepareMutationBatch();
MutationBatch secondaryIndexMutation = keyspace.prepareMutationBatch();
ColumnListMutation<String> columnListMutation = m.withRow(columnFamily, key);
// check whether we have to set the timestamps.
final boolean timestampsDefined = timestamps != null;
for (String columnName : row.keySet()) {
final Object value = row.get(columnName);
// we will set the ttls if defined, if we pass that as null so that internally it will NOT set the ttls.
final Integer ttl = ttls == null ? null : ttls.get(columnName);
String valueToInsert = ClientManagerUtils.getInstance().convertValueForStorage(value);
// if timestamps are set, pass that on to the columnListMutation. The tricky thing here is once you set
// a timestamp that will be used from that point beyond. So if a timestamp is NOT defined at least for one
// column name then we need to set that timestamp to proper system timestamp.
if (timestampsDefined) {
columnListMutation.setTimestamp(timestamps.get(columnName) == null || timestamps.get(columnName) < 1 ?
clock.getCurrentTime() : timestamps.get(columnName));
}
columnListMutation.putColumn(columnName, valueToInsert, ttl);
updateSecondaryIndexes(key, columnName, valueToInsert, ttl == null ? -1 : ttl, secondaryIndexMutation);
}
try {
// first update secondary indexes.
if (!secondaryIndexMutation.isEmpty()) {
final OperationResult<Void> secondaryIndexMutationExecResult = secondaryIndexMutation.execute();
log.debug("Row Inserted into Cassandra secondary indexes. Exec Time = " +
secondaryIndexMutationExecResult.getLatency() + ", " +
"Host used = " + secondaryIndexMutationExecResult.getHost().getHostName());
}
OperationResult<Void> result = m.execute();
log.debug("Row Inserted into Cassandra. Exec Time = " + result.getLatency() + ", Host used = " +
result.getHost().getHostName());
} catch (ConnectionException e) {
if (log.isDebugEnabled()) {
log.debug("HecubaClientManager error while updating key " + key.toString());
}
throw e;
}
}
@Override
public String readString(K key, String columnName) {
Column<String> columnByName = readColumn(key, columnName);
return columnByName == null ? null : columnByName.getStringValue();
}
private Column<String> readColumn(K key, String columnName) {
try {
OperationResult<ColumnList<String>> result = keyspace.prepareQuery(columnFamily).getKey(key).execute();
return result.getResult().getColumnByName(columnName);
} catch (ConnectionException e) {
if (log.isDebugEnabled()) {
log.debug("HecubaClientManager error while reading key " + key.toString() + ". " +
ExceptionUtils.getStackTrace(e));
}
}
return null;
}
@Override
public CassandraColumn readColumnInfo(K key, String columnName) {
Column<String> columnByName = readColumn(key, columnName);
return columnByName == null ? null : new CassandraColumn(columnByName.getName(), columnByName.getStringValue(),
columnByName.getTimestamp(), columnByName.getTtl());
}
public CassandraResultSet<K, String> readAllColumns(K key) throws ConnectionException {
try {
OperationResult<ColumnList<String>> result = keyspace.prepareQuery(columnFamily).getKey(key).execute();
ColumnList<String> columns = result.getResult();
if (isClientAdapterDebugMessagesEnabled) {
log.info("Row retrieved from Cassandra. Exec Time (micro-sec) = " + result.getLatency() / 1000 +
", Host used = " + result.getHost() + ", Key = " + key);
}
return new AstyanaxResultSet<>(columns);
} catch (ConnectionException e) {
if (log.isDebugEnabled()) {
log.debug("HecubaClientManager error while reading key " + key.toString());
}
throw e;
}
}
@Override
public CassandraResultSet<K, String> readColumnSlice(K key, String start, String end, boolean reversed, int count) {
try {
final OperationResult<ColumnList<String>> executeResult = keyspace.prepareQuery(columnFamily).getKey(key)
.withColumnRange(start, end, reversed,
count).execute();
if (executeResult != null) {
return new AstyanaxResultSet<K, String>(executeResult.getResult());
}
} catch (ConnectionException e) {
log.warn("Couldn't execute column slice query ", e);
}
return null;
}
@Override
public CassandraResultSet readAllColumnsBySecondaryIndex(Map<String, String> parameters, int limit) {
List<PreparedIndexExpression<K, String>> clauses = new ArrayList<PreparedIndexExpression<K, String>>();
for (Map.Entry<String, String> entry : parameters.entrySet()) {
PreparedIndexExpression<K, String> clause = columnFamily.newIndexClause().whereColumn(entry.getKey())
.equals().value(entry.getValue());
clauses.add(clause);
}
OperationResult<Rows<K, String>> result;
try {
result = keyspace.prepareQuery(columnFamily).searchWithIndex()
// .setStartKey(0L)
.addPreparedExpressions(clauses).execute();
Rows<K, String> rowItems = result.getResult();
if (rowItems.size() > 0) {
Row<K, String> row = rowItems.getRowByIndex(0);
AstyanaxResultSet<K, String> resultSet = new AstyanaxResultSet<K, String>(row.getColumns());
return resultSet;
}
} catch (ConnectionException e) {
log.warn("HecubaClientManager error while reading secondary index key " + parameters.toString());
if (log.isDebugEnabled()) {
log.debug("Caught Exception", e);
}
}
return null;
}
@Override
public Long getCounterValue(K key, String counterColumnName) {
try {
RowQuery<K, String> row = keyspace.prepareQuery(columnFamily).getKey(key);
if (row != null) {
ColumnQuery<String> column = row.getColumn(counterColumnName);
if (column != null) {
OperationResult<Column<String>> executeResult = column.execute();
if (executeResult != null) {
Column<String> result = executeResult.getResult();
return result != null ? result.getLongValue() : 0L;
} else {
return 0L;
}
} else {
return 0L;
}
} else {
return 0L;
}
} catch (ConnectionException e) {
if (log.isDebugEnabled()) {
log.debug("HecubaClientManager error while reading key " + key.toString() + ". " +
ExceptionUtils.getStackTrace(e));
log.debug("Caught Exception", e);
}
}
return 0L;
}
@Override
public void updateCounter(K key, String counterColumnName, long value) {
try {
keyspace.prepareColumnMutation(columnFamily, key, counterColumnName).incrementCounterColumn(value)
.execute();
} catch (ConnectionException e) {
log.error(ExceptionUtils.getStackTrace(e));
}
}
@Override
public void incrementCounter(K key, String counterColumnName) {
this.updateCounter(key, counterColumnName, 1);
}
@Override
public void decrementCounter(K key, String counterColumnName) {
this.updateCounter(key, counterColumnName, -1);
}
@Override
public void deleteColumn(K key, String columnName) {
MutationBatch m = keyspace.prepareMutationBatch();
// first check whether this is a column we have a seconday index on.
if (isSecondaryIndexByColumnNameAndValueEnabledForColumn(columnName)) {
final Column<String> oldColumn = readColumn(key, columnName);
if (oldColumn != null) {
m.withRow(secondaryIndexColumnFamily, getSecondaryIndexKey(columnName, oldColumn.getStringValue()))
.deleteColumn(key);
}
}
if (isSecondaryIndexByColumnNameEnabledForColumn(columnName)) {
m.withRow(secondaryIndexColumnFamily, getSecondaryIndexKey(columnName, "")).deleteColumn(key);
}
// delete the column from the main CF
m.withRow(columnFamily, key).deleteColumn(columnName);
try {
m.execute();
} catch (ConnectionException e) {
log.error(ExceptionUtils.getStackTrace(e));
}
}
@Override
public void deleteRow(K key, long timestamp) {
try {
MutationBatch m = keyspace.prepareMutationBatch();
timestamp = timestamp > 0 ? timestamp : keyspace.getConfig().getClock().getCurrentTime();
// first delete all the secondary indexes.
if (isSecondaryIndexByColumnNameAndValueEnabled || isSecondaryIndexesByColumnNamesEnabled) {
// first read the old values of columns.
final CassandraResultSet<K, String> oldValues = readColumns(key, columnsToIndexOnColumnNameAndValue);
if (isSecondaryIndexByColumnNameAndValueEnabled) {
for (String columnName : columnsToIndexOnColumnNameAndValue) {
m.withRow(secondaryIndexColumnFamily, getSecondaryIndexKey(columnName, oldValues.getString(
columnName))).setTimestamp(timestamp).deleteColumn(key);
}
}
if (isSecondaryIndexesByColumnNamesEnabled) {
for (String columnName : oldValues.getColumnNames()) {
if (columnName.matches(secondaryIdxByColumnPattern)) {
m.withRow(secondaryIndexColumnFamily, getSecondaryIndexKey(columnName, "")).setTimestamp(
timestamp).deleteColumn(key);
}
}
}
}
// now delete the main row.
m.withRow(columnFamily, key).setTimestamp(timestamp).delete();
m.execute();
} catch (ConnectionException e) {
log.error(ExceptionUtils.getStackTrace(e));
} catch (Exception e) {
log.error(ExceptionUtils.getStackTrace(e));
}
}
@Override
public CassandraResultSet<K, String> retrieveBySecondaryIndex(String columnName, String columnValue) {
if (isSecondaryIndexByColumnNameAndValueEnabledForColumn(columnName)) {
return retrieveFromSecondaryIndex(columnName, columnValue);
}
return null;
}
@Override
public CassandraResultSet<K, String> retrieveBySecondaryIndex(String columnName, List<String> columnValues) {
if (isSecondaryIndexByColumnNameAndValueEnabledForColumn(columnName)) {
return retrieveFromSecondaryIndex(columnName, columnValues);
}
return null;
}
private CassandraResultSet<K, String> retrieveFromSecondaryIndex(String columnName, String columnValue) {
try {
List<K> mappingObjectIds = retrieveKeysFromSecondaryIndex(columnName, columnValue);
if (CollectionUtils.isNotEmpty(mappingObjectIds)) {
return readAllColumns(new HashSet<K>(mappingObjectIds));
}
} catch (Exception e) {
log.warn("Error executing retrieveBySecondaryIndex ", e);
}
return null;
}
private CassandraResultSet<K, String> retrieveFromSecondaryIndex(String columnName, List<String> columnValues) {
try {
Map<String, List<K>> keysMap = retrieveKeysFromSecondaryIndex(columnName, columnValues);
if (MapUtils.isNotEmpty(keysMap)) {
Set<K> keys = new HashSet<>();
for (List<K> keysForColValue : keysMap.values()) {
keys.addAll(keysForColValue);
}
return readAllColumns(keys);
}
} catch (Exception e) {
log.warn("Error executing retrieveBySecondaryIndex for multiple column values", e);
}
return null;
}
@Override
public CassandraResultSet<K, String> retrieveByColumnNameBasedSecondaryIndex(String columnName) {
if (isSecondaryIndexByColumnNameEnabledForColumn(columnName)) {
return retrieveFromSecondaryIndex(columnName, "");
}
return null;
}
@Override
public CassandraResultSet<K, String> readColumns(K key, List<String> columnName) throws Exception {
final OperationResult<ColumnList<String>> operationResult = keyspace.prepareQuery(columnFamily).getKey(key)
.withColumnSlice(columnName).execute();
if (operationResult != null) {
return new AstyanaxResultSet<K, String>(operationResult.getResult());
}
return null;
}
@Override
public CassandraResultSet<K, String> readColumns(Set<K> keys, List<String> columnNames) throws Exception {
if (CollectionUtils.isNotEmpty(columnNames)) {
final OperationResult<Rows<K, String>> result = keyspace.prepareQuery(columnFamily).getKeySlice(keys)
.withColumnSlice(columnNames).execute();
if (isClientAdapterDebugMessagesEnabled) {
log.info(columnNames.size() + " columns retrieved from Cassandra [Astyanax] for " + keys.size() +
" keys . Exec Time (micro-sec) = " + (result.getLatency() / 1000) + ", Host used = " +
result.getHost());
}
return new AstyanaxResultSet<K, String>(result);
} else {
return readAllColumns(keys);
}
}
@Override
public CassandraResultSet<K, String> readAllColumns(Set<K> keys) throws Exception {
// This method was added as part of multi-get feature for cache calls.
try {
OperationResult<Rows<K, String>> result = keyspace.prepareQuery(columnFamily).getKeySlice(keys).execute();
if (isClientAdapterDebugMessagesEnabled) {
log.info("Rows retrieved from Cassandra [Astyanax] (for " + keys.size() + " keys). Exec Time " +
"(micro-sec) = " + result.getLatency() / 1000 + ", Host used = " + result.getHost());
}
return new AstyanaxResultSet<K, String>(result);
} catch (ConnectionException e) {
log.warn("HecubaClientManager [Astyanax] error while reading multiple keys. Number of keys = " +
keys.size() + ", keys = " + keys.toString());
if (log.isDebugEnabled()) {
log.debug("Caught Exception while reading for multiple keys", e);
logDownedHosts();
}
throw e;
}
}
@Override
public CassandraResultSet<K, String> readColumnSlice(Set<K> keys, String start, String end, boolean reversed) {
try {
final OperationResult<Rows<K, String>> rowSliceQueryResult = keyspace.prepareQuery(columnFamily)
.getKeySlice(keys).withColumnRange(
start, end, reversed, Integer.MAX_VALUE).execute();
return new AstyanaxResultSet<K, String>(rowSliceQueryResult);
} catch (ConnectionException e) {
log.warn("error while executing a row slice query ", e);
if (log.isDebugEnabled()) {
logDownedHosts();
}
}
return null;
}
@Override
public void deleteColumns(K key, List<String> columnNameList) {
for (String columnName : columnNameList) {
deleteColumn(key, columnName);
}
}
@Override
public List<K> retrieveKeysBySecondaryIndex(String columnName, String columnValue) {
if (isSecondaryIndexByColumnNameAndValueEnabledForColumn(columnName)) {
return retrieveKeysFromSecondaryIndex(columnName, columnValue);
}
return null;
}
@Override
public Map<String, List<K>> retrieveKeysBySecondaryIndex(String columnName, List<String> columnValues) {
if (isSecondaryIndexByColumnNameAndValueEnabledForColumn(columnName)) {
return retrieveKeysFromSecondaryIndex(columnName, columnValues);
}
return null;
}
@Override
public List<K> retrieveKeysByColumnNameBasedSecondaryIndex(String columnName) {
if (isSecondaryIndexByColumnNameEnabledForColumn(columnName)) {
return retrieveKeysFromSecondaryIndex(columnName, "");
}
return null;
}
private List<K> retrieveKeysFromSecondaryIndex(String columnName, String columnValue) {
try {
String secondaryIndexKey = getSecondaryIndexKey(columnName, columnValue);
final OperationResult<ColumnList<K>> result = keyspace.prepareQuery(secondaryIndexColumnFamily).getKey(
secondaryIndexKey).execute();
if (isClientAdapterDebugMessagesEnabled) {
log.debug("Secondary Index Row for " + secondaryIndexKey + " retrieved from Cassandra. Exec Time = " +
result.getLatency() + ", Host used = " + result.getHost().getHostName());
}
if (result != null && result.getResult().size() > 0) {
final Iterator<Column<K>> iterator = result.getResult().iterator();
List<K> rowKeys = new ArrayList<K>();
while (iterator.hasNext()) {
rowKeys.add(iterator.next().getName());
}
return rowKeys;
}
} catch (Exception e) {
log.warn("Error executing retrieveKeysFromSecondaryIndex ", e);
if (log.isDebugEnabled()) {
logDownedHosts();
}
}
return null;
}
private Map<String, List<K>> retrieveKeysFromSecondaryIndex(String columnName, List<String> columnValues) {
try {
List<String> secondaryIndexKeys = getSecondaryIndexKeys(columnName, columnValues);
OperationResult<Rows<String, K>> result = keyspace.prepareQuery(secondaryIndexColumnFamily).getKeySlice(
secondaryIndexKeys).execute();
if (isClientAdapterDebugMessagesEnabled) {
log.debug("Secondary Index Row for " + Joiner.on(",").join(secondaryIndexKeys) +
" retrieved from Cassandra. Exec Time = " +
result.getLatency() + ", Host used = " + result.getHost().getHostName());
}
if (result != null && result.getResult().size() > 0) {
Map<String, List<K>> rowKeysMap = new HashMap<>();
Iterator<Row<String, K>> rowIterator = result.getResult().iterator();
while (rowIterator.hasNext()) {
Row<String, K> row = rowIterator.next();
Iterator<Column<K>> columnIterator = row.getColumns().iterator();
List<K> keys = new ArrayList<>();
while (columnIterator.hasNext()) {
keys.add(columnIterator.next().getName());
}
if (CollectionUtils.isNotEmpty(keys)) {
rowKeysMap.put(getSecondaryIndexedColumnValue(row.getKey()), keys);
}
}
return rowKeysMap;
}
} catch (Exception e) {
log.warn("Error executing retrieveKeysFromSecondaryIndex for multiple column values", e);
if (log.isDebugEnabled()) {
logDownedHosts();
}
}
return null;
}
@Override
protected void logDownedHosts() {
Map<Host, HostStats> hostStatsMap = connectionPoolMonitor.getHostStats();
StringBuilder allHostsSB = new StringBuilder("All Hosts = {");
StringBuilder downedHostsSB = new StringBuilder("Downed Hosts = {");
for (Host host : hostStatsMap.keySet()) {
allHostsSB.append(host.getHostName() + ", ");
HostStats stats = hostStatsMap.get(host);
if (stats != null && !stats.isUp()) {
downedHostsSB.append(host.getHostName() + ", ");
}
}
if (allHostsSB.toString().endsWith(", ")) {
allHostsSB.setLength(allHostsSB.length() - 2);
}
allHostsSB.append("}");
log.debug(allHostsSB.toString());
if (downedHostsSB.toString().endsWith(", ")) {
downedHostsSB.setLength(downedHostsSB.length() - 2);
}
downedHostsSB.append("}");
log.debug(downedHostsSB.toString());
}
@Override
public void shutDown() {
clusterContext.shutdown();
context.shutdown();
connectionPoolConfigurationImpl.shutdown();
}
}
|
{
"content_hash": "0c4bb6d798c4c8961c4f567e1c139827",
"timestamp": "",
"source": "github",
"line_count": 750,
"max_line_length": 130,
"avg_line_length": 36.397333333333336,
"alnum_prop": 0.740017583705766,
"repo_name": "WizeCommerce/hecuba",
"id": "d80fcc7174278b84089b6291e92f27b6a10ecce2",
"size": "27298",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/wizecommerce/hecuba/astyanax/AstyanaxBasedHecubaClientManager.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "376503"
}
],
"symlink_target": ""
}
|
<?php
namespace App\Http\Controllers\Admin;
use App\Category;
use App\Http\Controllers\ViewController;
use App\Setting;
use Exception;
use Illuminate\Http\Request;
class AdminController extends AdminItemController
{
use ViewController;
protected $SuperUserUAL;
protected $AdminUserUAL;
protected $PageSize = PHP_INT_MAX;
protected $IndexOrderByCategory = false; // for global settings such as Category, Setting ...
protected $CategoryWithUAM = false; // for management with category such as Article, File, User ...
protected $CheckIfUserPassCategory = false; //check whether the UAL or ID satisfy selected category
protected $CategoryRoot = 'Admin\AdminCategoryController';
protected $SettingRoot = 'Admin\AdminSettingController';
private $_appendMsg = [
'category0' => 'Empty category list. [Category]',
'category1' => 'Access denied. [Category]',
'user_not_pass_category' => 'Request User(UAL or ID) does not satisfy selected category. [Category]',
];
protected function initSetting(&$target, $name, $category, $index, &$request)
{
try
{
$item = Setting::getSettingByName($name, $category);
$target = $item->$index;
}
catch(Exception $ex)
{
$this->AdminUserUAL = $this->SuperUserUAL;
$trace = $category.'::'.$name.'->'.$index;
if(!session('error'))
$request->session()->flash('error', '<a href="'.action($this->SettingRoot.'@index').'#'.$category.'" class="alert-link">Invalid setting! {'.$trace.'} [SuperUser Mode]</a>');
}
}
protected function initCategory(&$target, $name, $category, $index, &$request)
{
try
{
$item = Category::getCategoryByName($name, $category);
$target = $item->$index;
}
catch(Exception $ex)
{
$this->AdminUserUAL = $this->SuperUserUAL;
$trace = $category.'::'.$name.'->'.$index;
if(!session('error'))
$request->session()->flash('error', '<a href="'.action($this->CategoryRoot.'@index').'#'.$category.'" class="alert-link">Invalid category! {'.$trace.'} [SuperUser Mode]</a>');
}
}
protected function checkConflict(&$request)
{
$allowMaxUAL_SuperUser = -1;
$allowMaxUAL_Administrator = -1;
$this->initCategory($allowMaxUAL_SuperUser, 'SuperUser', 'User', 'allowMaxUAL', $request);
$this->initCategory($allowMaxUAL_Administrator, 'Administrator', 'User', 'allowMaxUAL', $request);
if($allowMaxUAL_SuperUser > $this->SuperUserUAL || $allowMaxUAL_Administrator > $this->AdminUserUAL)
{
$trace = 'User::SuperUser|Administrator->allowMaxUAL';
if(!session('error'))
$request->session()->flash('error', '<a href="'.action($this->CategoryRoot.'@index').'#User" class="alert-link">Invalid category! {'.$trace.'} [Conflict]</a>');
}
}
public function __construct(Request $request)
{
$this->_appendMsg['category0'] = '<a href="'.action($this->CategoryRoot.'@index').'#'.$this->Name.'" class="alert-link">'.$this->_appendMsg['category0'].' {'.$this->Name.'}</a>';
$this->exceptionAdd($this->_appendMsg);
$this->SuperUserUAL = config('config.SuperUserUAL');
$this->initSetting($this->AdminUserUAL, 'Administrator', 'User', 'MaxUAL', $request);
$this->checkConflict($request);
$this->ViewExtend = $this->shareViewArguments();
}
protected function getCategories()
{
if($this->CategoryWithUAM == false)
return parent::getCategories();
$categories = Category::getCategoriesByCurrentUser($this->Name);
if(count($categories) == 0)
throw new Exception('category0');
return $categories;
}
protected function getIndexSQL(&$Item)
{
if($this->IndexOrderByCategory == false)
return parent::getIndexSQL($Item);
$user = auth()->user();
if($this->isAuthenticated('null', 'read') == true)
$items = $Item::orderBy('category')->orderBy('updated_at', 'desc')->paginate($this->PageSize);
else
$items = $Item::where('UAL', '>=', $user->UAL)->orderBy('category')->orderBy('updated_at', 'desc')->paginate($this->PageSize);
return $items;
}
protected function beforeSave(&$Item, $id, &$item, &$request, $func)
{
parent::beforeSave($Item, $id, $item, $request, $func);
//check if the relationship of id, UAL, and category is correct
if($this->CategoryWithUAM == true && Category::isCurrentUserPassCategoryItem($this->Name, $request->category, true) == false)
throw new Exception('category1');
//check category, ($id != 0 means Root, because Root has no category.)
if($this->CheckIfUserPassCategory == true && Category::isUserPassCategoryItem($this->Name, $request->category, $request->UAL, $request->id, false) == false)
throw new Exception('user_not_pass_category');
}
}
|
{
"content_hash": "44c3487de80f9fb6730fac53c9432a3e",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 191,
"avg_line_length": 38.84090909090909,
"alnum_prop": 0.6050321825629023,
"repo_name": "gingzai/Laravel-CMF",
"id": "72ede2ad96f50e8d747c8499dac28f920d416b99",
"size": "5127",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/Http/Controllers/Admin/AdminController.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "412"
},
{
"name": "CSS",
"bytes": "72"
},
{
"name": "JavaScript",
"bytes": "1785"
},
{
"name": "PHP",
"bytes": "212760"
}
],
"symlink_target": ""
}
|
import * as React from "react";
import {
GoogleViz,
GoogleChartWrapper,
ReactGoogleChartPropsWithDefaults,
GoogleChartControlProp,
GoogleChartControl,
GoogleChartDashboard,
GoogleChartEditor
} from "../types";
import { generateUniqueID } from "../generate-unique-id";
import { GoogleChartDataTable } from "./GoogleChartDataTable";
import { GoogleChartEvents } from "./GoogleChartEvents";
export type Props = {
google: GoogleViz;
graphID?: string | null;
graph_id?: string | null;
options?: ReactGoogleChartPropsWithDefaults["options"];
chartWrapperParams?: {};
chartType: ReactGoogleChartPropsWithDefaults["chartType"];
width?: ReactGoogleChartPropsWithDefaults["width"];
height?: ReactGoogleChartPropsWithDefaults["height"];
style?: ReactGoogleChartPropsWithDefaults["style"];
className?: ReactGoogleChartPropsWithDefaults["className"];
rootProps?: ReactGoogleChartPropsWithDefaults["rootProps"];
} & ReactGoogleChartPropsWithDefaults;
export interface State {
googleChartWrapper: GoogleChartWrapper | null;
isReady: boolean;
googleChartDashboard: GoogleChartDashboard | null;
googleChartEditor: GoogleChartEditor | null;
googleChartControls:
| { control: GoogleChartControl; controlProp: GoogleChartControlProp }[]
| null;
}
let controlCounter = 0;
export class GoogleChart extends React.Component<Props, State> {
state = {
googleChartWrapper: null,
googleChartDashboard: null,
googleChartControls: null,
googleChartEditor: null,
isReady: false
} as State;
graphID: null | string = null;
private dashboard_ref: React.RefObject<HTMLDivElement> = React.createRef();
private toolbar_ref: React.RefObject<HTMLDivElement> = React.createRef();
private getGraphID = () => {
const { graphID, graph_id } = this.props;
let instanceGraphID: string;
if (graphID === null && graph_id === null) {
if (this.graphID === null) {
instanceGraphID = generateUniqueID();
} else {
instanceGraphID = this.graphID;
}
} else if (graphID !== null && graph_id === null) {
instanceGraphID = graphID as string;
} else if (graph_id !== null && graphID === null) {
instanceGraphID = graph_id as string;
} else {
instanceGraphID = graphID as string;
}
this.graphID = instanceGraphID;
return this.graphID as string;
};
private getControlID = (id: undefined | string, index: number) => {
controlCounter += 1;
let controlID: string;
if (typeof id === "undefined") {
controlID = `googlechart-control-${index}-${controlCounter}`;
} else {
controlID = id;
}
return controlID;
};
addControls = (
googleChartWrapper: GoogleChartWrapper,
googleChartDashboard: GoogleChartDashboard
) => {
const { google, controls } = this.props;
const googleChartControls =
controls === null
? null
: controls.map((control, i) => {
const {
controlID: controlIDMaybe,
controlType,
options: controlOptions,
controlWrapperParams
} = control;
const controlID = this.getControlID(controlIDMaybe, i);
return {
controlProp: control,
control: new google.visualization.ControlWrapper({
containerId: controlID,
controlType,
options: controlOptions,
...controlWrapperParams
})
};
});
if (googleChartControls === null) {
return null;
}
googleChartDashboard.bind(
googleChartControls.map(({ control }) => control),
googleChartWrapper
);
for (let chartControl of googleChartControls) {
const { control, controlProp } = chartControl;
const { controlEvents = [] } = controlProp;
for (let event of controlEvents) {
const { callback, eventName } = event;
google.visualization.events.removeListener(
control,
eventName,
callback
);
google.visualization.events.addListener(
control,
eventName,
(...args: any[]) => {
callback({
chartWrapper: googleChartWrapper,
controlWrapper: control,
props: this.props as any,
google: google,
eventArgs: args
});
}
);
}
}
return googleChartControls;
};
componentDidMount() {
const {
options,
google,
chartType,
chartWrapperParams,
toolbarItems,
getChartEditor,
getChartWrapper
} = this.props;
const chartConfig = {
chartType,
options,
containerId: this.getGraphID(),
...chartWrapperParams
};
const googleChartWrapper = new google.visualization.ChartWrapper(
chartConfig
);
googleChartWrapper.setOptions(options);
getChartWrapper(googleChartWrapper, google);
const googleChartDashboard = new google.visualization.Dashboard(
this.dashboard_ref
);
const googleChartControls = this.addControls(
googleChartWrapper,
googleChartDashboard
);
if (toolbarItems !== null) {
google.visualization.drawToolbar(
this.toolbar_ref.current as HTMLDivElement,
toolbarItems
);
}
let googleChartEditor: null | GoogleChartEditor = null;
if (getChartEditor !== null) {
googleChartEditor = new google.visualization.ChartEditor();
getChartEditor({
chartEditor: googleChartEditor,
chartWrapper: googleChartWrapper,
google
});
}
this.setState({
googleChartEditor,
googleChartControls: googleChartControls,
googleChartDashboard: googleChartDashboard,
googleChartWrapper,
isReady: true
});
}
shouldComponentUpdate(nextProps: Props, nextState: State) {
return this.state.isReady !== nextState.isReady;
}
renderChart = () => {
const {
width,
height,
options,
style,
className,
rootProps,
google
} = this.props;
const divStyle = {
height: height || (options && options.height),
width: width || (options && options.width),
...style
};
return (
<div
id={this.getGraphID()}
style={divStyle}
className={className}
{...rootProps}
>
{this.state.isReady && this.state.googleChartWrapper !== null ? (
<React.Fragment>
<GoogleChartDataTable
googleChartWrapper={this.state.googleChartWrapper}
google={google}
googleChartDashboard={this.state.googleChartDashboard}
/>
<GoogleChartEvents
googleChartWrapper={this.state.googleChartWrapper}
google={google}
/>
</React.Fragment>
) : null}
</div>
);
};
renderControl = (
filter = ({
control,
controlProp
}: {
control: GoogleChartControl;
controlProp: GoogleChartControlProp;
}) => true
) => {
return this.state.isReady && this.state.googleChartControls !== null ? (
<React.Fragment>
{this.state.googleChartControls
.filter(({ controlProp, control }) => {
return filter({ control, controlProp });
})
.map(({ control, controlProp }) => {
return (
<div
key={control.getContainerId()}
id={control.getContainerId()}
/>
);
})}
</React.Fragment>
) : null;
};
renderToolBar = () => {
if (this.props.toolbarItems === null) return null;
return <div ref={this.toolbar_ref} />;
};
render() {
const { width, height, options, style } = this.props;
const divStyle = {
height: height || (options && options.height),
width: width || (options && options.width),
...style
};
if (this.props.render !== null) {
return (
<div ref={this.dashboard_ref} style={divStyle}>
<div ref={this.toolbar_ref} id="toolbar" />
{this.props.render({
renderChart: this.renderChart,
renderControl: this.renderControl,
renderToolbar: this.renderToolBar
})}
</div>
);
} else {
return (
<div ref={this.dashboard_ref} style={divStyle}>
{this.renderControl(({ controlProp }) => {
return controlProp.controlPosition !== "bottom";
})}
{this.renderChart()}
{this.renderControl(({ controlProp }) => {
return controlProp.controlPosition === "bottom";
})}
{this.renderToolBar()}
</div>
);
}
}
}
|
{
"content_hash": "2df414bfd0a8a362e9e3cad6de1854f0",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 77,
"avg_line_length": 29.211920529801326,
"alnum_prop": 0.5966900929494445,
"repo_name": "RakanNimer/react-google-charts",
"id": "b58e008b2c4017a02c3e704ee9a217e7af93ea63",
"size": "8822",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/components/GoogleChart.tsx",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "20743"
}
],
"symlink_target": ""
}
|
require 'spec_helper'
describe Auth0::Api::V2::Guardian do
before :all do
dummy_instance = DummyClass.new
dummy_instance.extend(Auth0::Api::V2::Guardian)
@instance = dummy_instance
end
context '.guardian_factors' do
it 'is expected to respond to a guardian_factors method' do
expect(@instance).to respond_to(:guardian_factors)
end
it 'is expected to respond to a get_guardian_factors method' do
expect(@instance).to respond_to(:get_guardian_factors)
end
it 'is expected to get /api/v2/guardian/factors' do
expect(@instance).to receive(:get).with(
'/api/v2/guardian/factors'
)
expect { @instance.guardian_factors }.not_to raise_error
end
end
context '.guardian_enrollment' do
it 'is expected to respond to a guardian_enrollment method' do
expect(@instance).to respond_to(:guardian_enrollment)
end
it 'is expected to call get request to /api/v2/guardian/enrollments/ENROLLMENT_ID' do
expect(@instance).to receive(:get).with(
'/api/v2/guardian/enrollments/ENROLLMENT_ID'
)
expect { @instance.guardian_enrollment('ENROLLMENT_ID') }.not_to raise_error
end
it 'is expected to raise an exception when the enrollment ID is empty' do
expect { @instance.guardian_enrollment(nil) }.to raise_exception(Auth0::MissingParameter)
end
end
context '.delete_guardian_enrollment' do
it 'is expected to respond to a delete_guardian_enrollment method' do
expect(@instance).to respond_to(:delete_guardian_enrollment)
end
it 'is expected to delete /api/v2/guardian/enrollments/ENROLLMENT_ID' do
expect(@instance).to receive(:delete).with('/api/v2/guardian/enrollments/ENROLLMENT_ID')
@instance.delete_guardian_enrollment('ENROLLMENT_ID')
end
it 'is expected not to delete /api/v2/guardian/enrollments/ENROLLMENT_ID if enrollment_id is blank' do
expect(@instance).not_to receive(:delete)
expect { @instance.delete_guardian_enrollment(nil) }.to raise_exception(
Auth0::MissingParameter
)
end
end
context '.guardian_sms_templates' do
it 'is expected to respond to a guardian_sms_templates method' do
expect(@instance).to respond_to(:guardian_sms_templates)
end
it 'is expected to call get request to /api/v2/guardian/factors/sms/templates' do
expect(@instance).to receive(:get).with(
'/api/v2/guardian/factors/sms/templates'
)
expect { @instance.guardian_sms_templates }.not_to raise_error
end
end
context '.guardian_update_enrollment_verification_templates' do
it 'is expected to respond to a guardian_update_enrollment_verification_templates method' do
expect(@instance).to respond_to(:guardian_update_enrollment_verification_templates)
end
it 'is expected to patch /api/v2/guardian/factors/sms/templates' do
expect(@instance).to receive(:put).with('/api/v2/guardian/factors/sms/templates', 'BODY')
@instance.guardian_update_enrollment_verification_templates('BODY')
end
end
context '.guardian_sns_provider_config' do
it 'is expected to respond to a guardian_sns_provider_config method' do
expect(@instance).to respond_to(:guardian_sns_provider_config)
end
it 'is expected to call get request to /api/v2/guardian/factors/push-notification/providers/sns' do
expect(@instance).to receive(:get).with(
'/api/v2/guardian/factors/push-notification/providers/sns'
)
expect { @instance.guardian_sns_provider_config }.not_to raise_error
end
end
context '.guardian_update_sns_provider_config' do
it 'is expected to respond to a guardian_update_sns_provider_config method' do
expect(@instance).to respond_to(:guardian_update_sns_provider_config)
end
it 'is expected to patch /api/v2/guardian/factors/push-notification/providers/sns' do
expect(@instance).to receive(:put).with('/api/v2/guardian/factors/push-notification/providers/sns', 'BODY')
@instance.guardian_update_sns_provider_config('BODY')
end
end
context '.guardian_twillo_provider_config' do
it 'is expected to respond to a guardian_twillo_provider_config method' do
expect(@instance).to respond_to(:guardian_twillo_provider_config)
end
it 'is expected to call get request to /api/v2/guardian/factors/sms/providers/twilio' do
expect(@instance).to receive(:get).with(
'/api/v2/guardian/factors/sms/providers/twilio'
)
expect { @instance.guardian_twillo_provider_config }.not_to raise_error
end
end
context '.guardian_update_twillo_provider_config' do
it 'is expected to respond to a guardian_update_twillo_provider_config method' do
expect(@instance).to respond_to(:guardian_update_twillo_provider_config)
end
it 'is expected to patch /api/v2/guardian/factors/sms/providers/twilio' do
expect(@instance).to receive(:put).with('/api/v2/guardian/factors/sms/providers/twilio', 'BODY')
@instance.guardian_update_twillo_provider_config('BODY')
end
end
context '.guardian_create_enrollment_ticket' do
it 'is expected to respond to a guardian_create_enrollment_ticket method' do
expect(@instance).to respond_to(:guardian_create_enrollment_ticket)
end
it 'is expected to post /api/v2/guardian/enrollments/ticket' do
expect(@instance).to receive(:post).with('/api/v2/guardian/enrollments/ticket', 'BODY')
@instance.guardian_create_enrollment_ticket('BODY')
end
end
context '.guardian_update_factor' do
it 'is expected to respond to a guardian_update_factor method' do
expect(@instance).to respond_to(:guardian_update_factor)
end
it 'is expected to patch /api/v2/guardian/factors/NAME' do
expect(@instance).to receive(:put).with('/api/v2/guardian/factors/NAME', 'BODY')
@instance.guardian_update_factor('NAME', 'BODY')
end
end
end
|
{
"content_hash": "c11d870bd8b969a9924acc61ea53c7b9",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 113,
"avg_line_length": 38.54545454545455,
"alnum_prop": 0.7053571428571429,
"repo_name": "auth0/ruby-auth0",
"id": "99e53cb350fca5fe063065d9d0b8f317cd0a5a56",
"size": "5936",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/lib/auth0/api/v2/guardian_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "1209"
},
{
"name": "Ruby",
"bytes": "436027"
},
{
"name": "Shell",
"bytes": "343"
}
],
"symlink_target": ""
}
|
import React from "react"
import styled from "styled-components"
const Div = styled.div`
background: ${({ theme }) => theme.navBar.background};
box-sizing: border-box;
max-height: ${({ collapse }) => (collapse ? 0 : "90vh")};
transition: max-height 0.3s ease-in-out;
overflow: hidden;
width: 100%;
@media (${({ theme }) => theme.mediaQueries.tabletUp}) {
max-height: 5rem;
display: flex;
order: 2;
flex-grow: 100%;
width: auto;
}
`
export default ({ children, collapse }) => (
<Div collapse={collapse}>{children}</Div>
)
|
{
"content_hash": "bbaad506eccd90a68bd52255ffd20750",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 59,
"avg_line_length": 24.434782608695652,
"alnum_prop": 0.6227758007117438,
"repo_name": "mike360/textiles",
"id": "211d14a5a53677556860007695410f80565e78bb",
"size": "562",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/components/Navigation/NavCollapse.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "19072"
}
],
"symlink_target": ""
}
|
package quasar.sql
import slamdata.Predef._
import quasar.{NonTerminal, RenderTree, RenderedTree, SemanticError, Terminal, VarName},
RenderTree.ops._,
SemanticError._
import quasar.contrib.pathy.prettyPrint
import scala.AnyRef
import matryoshka._
import matryoshka.data.Fix
import matryoshka.implicits._
import scalaz._, Scalaz._, Validation.{success, failure}
object SemanticAnalysis {
type Failure = NonEmptyList[SemanticError]
private def fail[A](e: SemanticError) = Validation.failure[Failure, A](NonEmptyList(e))
sealed abstract class Synthetic
object Synthetic {
final case object SortKey extends Synthetic
implicit val show: Show[Synthetic] = Show.showFromToString
implicit val renderTree: RenderTree[Synthetic] =
RenderTree.fromShow[Synthetic]("Synthetic")
}
def normalizeProjectionsƒ[T](implicit TR: Recursive.Aux[T, Sql], TC: Corecursive.Aux[T, Sql])
: CoalgebraM[State[Option[String], ?], Sql, T] =
_.project match {
case sel @ Select(_, _, Some(TableRelationAST(table, alias @ Some(_))), _, _, _) =>
constantState(sel, alias)
case sel @ Select(_, _, Some(TableRelationAST(table, None)), _, _, _) =>
val head: Option[String] = pathy.Path.peel(table).map {
case (_, -\/(pathy.Path.DirName(dir))) => dir
case (_, \/-(pathy.Path.FileName(file))) => file
}
constantState(sel, head)
case op @ Binop(Embed(Ident(name)), Embed(StringLiteral(expr)), FieldDeref) =>
gets {
case Some(head) => (head === name).fold(ident[T](expr), op)
case None => op
}
case other => state(other)
}
private val syntheticPrefix = "__sd__"
/** Inserts synthetic fields into the projections of each `select` stmt to
* hold the values that will be used in sorting, and annotates each new
* projection with Synthetic.SortKey. The compiler will generate a step to
* remove these fields after the sort operation.
*/
def projectSortKeysƒ[T: Equal](implicit TR: Recursive.Aux[T, Sql], TC: Corecursive.Aux[T, Sql])
: Sql[T] => Option[Sql[T]] = {
case Select(d, projections, r, f, g, Some(OrderBy(keys))) => {
def matches(key: T): Proj[T] => Id[Option[T]] =
key.project match {
case Ident(keyName) => prj => some(prj) collect {
case Proj(_, Some(alias)) if keyName === alias => key
case Proj(Embed(Ident(projName)), None) if keyName === projName => key
case Proj(Embed(Splice(_)), _) => key
}
case _ => prj => {
(prj.expr === key)
.option(prj.alias orElse projectionName(key, None))
.join
.map(ident[T](_).embed)
}
}
// NB: order of the keys has to be preserved, so this complex fold
// seems to be the best way.
type Target = (List[Proj[T]], List[(OrderType, T)], Int)
val (projs2, keys2, _) = keys.foldRight[Target]((Nil, Nil, 0)) {
case ((orderType, expr), (projs, keys, index)) =>
projections.findMapM(matches(expr)).fold {
val name = syntheticPrefix + index.toString()
val proj2 = Proj(expr, Some(name))
val key2 = (orderType, ident[T](name).embed)
(proj2 :: projs, key2 :: keys, index + 1)
} (kExpr => (projs, (orderType, kExpr) :: keys, index))
}
select(d, projections ⊹ projs2, r, f, g, keys2.toNel map (OrderBy(_))).some
}
case _ => None
}
private val identifySyntheticsƒ: Algebra[Sql, List[Option[Synthetic]]] = {
case Select(_, projections, _, _, _, _) =>
projections.map(_.alias match {
case Some(name) if name.startsWith(syntheticPrefix) =>
Some(Synthetic.SortKey)
case _ => None
})
case _ => Nil
}
final case class BindingScope(scope: Map[String, SqlRelation[Unit]])
implicit val ShowBindingScope: Show[BindingScope] = new Show[BindingScope] {
override def show(v: BindingScope) = v.scope.toString
}
final case class TableScope(scope: Map[String, SqlRelation[Unit]])
implicit def ShowTableScope: Show[TableScope] =
new Show[TableScope] {
override def show(v: TableScope) = v.scope.toString
}
final case class Scope(tableScope: TableScope, bindingScope: BindingScope)
import Validation.FlatMap._
type ValidSem[A] = ValidationNel[SemanticError, A]
/** This analysis identifies all the named tables within scope at each node in
* the tree. If two tables are given the same name within the same scope,
* then because this leads to an ambiguity, an error is produced containing
* details on the duplicate name.
*/
def scopeTablesƒ[T](implicit T: Recursive.Aux[T, Sql]):
CoalgebraM[ValidSem, Sql, (Scope, T)] = {
case (Scope(ts, bs), Embed(expr)) => expr match {
case Select(_, _, relations, _, _, _) =>
@SuppressWarnings(Array("org.wartremover.warts.Recursion"))
def findRelations(r: SqlRelation[T]): ValidSem[Map[String, SqlRelation[Unit]]] =
r match {
case IdentRelationAST(name, aliasOpt) =>
success(Map(aliasOpt.getOrElse(name) ->
IdentRelationAST(name, aliasOpt)))
case VariRelationAST(vari, aliasOpt) =>
failure((UnboundVariable(VarName(vari.symbol)): SemanticError).wrapNel)
case TableRelationAST(file, aliasOpt) =>
success(Map(aliasOpt.getOrElse(prettyPrint(file)) -> TableRelationAST(file, aliasOpt)))
case ExprRelationAST(_, alias) =>
success(Map(alias -> ExprRelationAST((), alias)))
case JoinRelation(l, r, _, _) => for {
rels <- findRelations(l) tuple findRelations(r)
(left, right) = rels
rez <- (left.keySet intersect right.keySet).toList.toNel.cata(
nel => failure(nel.map(DuplicateRelationName(_):SemanticError)),
success(left ++ right))
} yield rez
}
relations.fold[ValidSem[Map[String, SqlRelation[Unit]]]](
success(Map[String, SqlRelation[Unit]]()))(
findRelations)
.map(m => expr.map((Scope(TableScope(m), bs), _)))
case Let(name, form, body) => {
val bs2: BindingScope =
BindingScope(bs.scope ++ Map(name.value -> ExprRelationAST((), name.value)))
success(Let(name, (Scope(ts, bs), form), (Scope(ts, bs2), body)))
}
case x => success(x.map((Scope(ts, bs), _)))
}
}
sealed abstract class Provenance {
import Provenance._
def & (that: Provenance): Provenance = Both(this, that)
def | (that: Provenance): Provenance = Either(this, that)
@SuppressWarnings(Array("org.wartremover.warts.Equals", "org.wartremover.warts.Recursion"))
def simplify: Provenance = this match {
case x : Either => anyOf(x.flatten.map(_.simplify).filterNot(_.equals(Empty)))
case x : Both => allOf(x.flatten.map(_.simplify).filterNot(_.equals(Empty)))
case _ => this
}
def namedRelations: Map[String, List[NamedRelation[Unit]]] =
relations.foldMap(_.namedRelations)
@SuppressWarnings(Array("org.wartremover.warts.Recursion"))
def relations: List[SqlRelation[Unit]] = this match {
case Empty => Nil
case Value => Nil
case Relation(value) => value :: Nil
case Either(v1, v2) => v1.relations ++ v2.relations
case Both(v1, v2) => v1.relations ++ v2.relations
}
def flatten: Set[Provenance] = Set(this)
// TODO: Implement Order for all sorts of types so we can get Equal (well,
// Order, even) defined properly for Provenance.
@SuppressWarnings(Array(
"org.wartremover.warts.AsInstanceOf",
"org.wartremover.warts.Equals"))
override def equals(that: scala.Any): Boolean = (this, that) match {
case (x, y) if (x.eq(y.asInstanceOf[AnyRef])) => true
case (Relation(v1), Relation(v2)) => v1 ≟ v2
case (Either(_, _), that @ Either(_, _)) => this.simplify.flatten == that.simplify.flatten
case (Both(_, _), that @ Both(_, _)) => this.simplify.flatten == that.simplify.flatten
case (_, _) => false
}
override def hashCode = this match {
case Either(_, _) => this.simplify.flatten.hashCode
case Both(_, _) => this.simplify.flatten.hashCode
case _ => super.hashCode
}
}
trait ProvenanceInstances {
import Provenance._
implicit val renderTree: RenderTree[Provenance] =
new RenderTree[Provenance] { self =>
@SuppressWarnings(Array("org.wartremover.warts.Recursion"))
def render(v: Provenance) = {
val ProvenanceNodeType = List("Provenance")
def nest(l: RenderedTree, r: RenderedTree, sep: String) = (l, r) match {
case (RenderedTree(_, ll, Nil), RenderedTree(_, rl, Nil)) =>
Terminal(ProvenanceNodeType, Some((ll.toList ++ rl.toList).mkString("(", s" $sep ", ")")))
case _ => NonTerminal(ProvenanceNodeType, Some(sep), l :: r :: Nil)
}
v match {
case Empty => Terminal(ProvenanceNodeType, Some("Empty"))
case Value => Terminal(ProvenanceNodeType, Some("Value"))
case Relation(value) => value.render.copy(nodeType = ProvenanceNodeType)
case Either(left, right) => nest(self.render(left), self.render(right), "|")
case Both(left, right) => nest(self.render(left), self.render(right), "&")
}
}
}
implicit val orMonoid: Monoid[Provenance] =
new Monoid[Provenance] {
def zero = Empty
def append(v1: Provenance, v2: => Provenance) = (v1, v2) match {
case (Empty, that) => that
case (this0, Empty) => this0
case _ => v1 | v2
}
}
implicit val andMonoid: Monoid[Provenance] =
new Monoid[Provenance] {
def zero = Empty
def append(v1: Provenance, v2: => Provenance) = (v1, v2) match {
case (Empty, that) => that
case (this0, Empty) => this0
case _ => v1 & v2
}
}
}
object Provenance extends ProvenanceInstances {
case object Empty extends Provenance
case object Value extends Provenance
final case class Relation(value: SqlRelation[Unit]) extends Provenance
final case class Either(left: Provenance, right: Provenance)
extends Provenance {
override def flatten: Set[Provenance] = {
@SuppressWarnings(Array("org.wartremover.warts.Recursion"))
def flatten0(x: Provenance): Set[Provenance] = x match {
case Either(left, right) => flatten0(left) ++ flatten0(right)
case _ => Set(x)
}
flatten0(this)
}
}
final case class Both(left: Provenance, right: Provenance)
extends Provenance {
override def flatten: Set[Provenance] = {
@SuppressWarnings(Array("org.wartremover.warts.Recursion"))
def flatten0(x: Provenance): Set[Provenance] = x match {
case Both(left, right) => flatten0(left) ++ flatten0(right)
case _ => Set(x)
}
flatten0(this)
}
}
def allOf[F[_]: Foldable](xs: F[Provenance]): Provenance =
xs.concatenate(andMonoid)
def anyOf[F[_]: Foldable](xs: F[Provenance]): Provenance =
xs.concatenate(orMonoid)
}
/** This phase infers the provenance of every expression, issuing errors
* if identifiers are used with unknown provenance. The phase requires
* TableScope and BindingScope annotations on the tree.
*/
def inferProvenanceƒ[T](implicit T: Corecursive.Aux[T, Sql]):
ElgotAlgebraM[(Scope, ?), ValidSem, Sql, Provenance] = {
case (Scope(ts, bs), expr) => expr match {
case Select(_, projections, _, _, _, _) =>
success(Provenance.allOf(projections.map(_.expr)))
case SetLiteral(_) => success(Provenance.Value)
case ArrayLiteral(_) => success(Provenance.Value)
case MapLiteral(_) => success(Provenance.Value)
case Splice(expr) => success(expr.getOrElse(Provenance.Empty))
case Vari(_) => success(Provenance.Value)
case Binop(left, right, _) => success(left & right)
case Unop(expr, _) => success(expr)
case Ident(name) =>
val scope = bs.scope.get(name) match {
case None => ts.scope.get(name)
case s => s
}
scope.fold({
// If `name` matches neither table nor binding scope we default to table scope.
// For example:
// `mystate := "CO"; select * from zips where state = mystate`
val localScope = if (ts.scope.isEmpty) bs.scope else ts.scope
Provenance.anyOf[Map[String, ?]]((localScope) ∘ (Provenance.Relation(_))) match {
case Provenance.Empty => fail(NoTableDefined(Ident[Fix[Sql]](name).embed))
case x => success(x)
}})(
(Provenance.Relation(_)) ⋙ success)
case InvokeFunction(_, args) => success(Provenance.allOf(args))
case Match(_, cases, _) =>
success(Provenance.allOf(cases.map(_.expr)))
case Switch(cases, _) =>
success(Provenance.allOf(cases.map(_.expr)))
case Let(_, form, body) => success(form & body)
case IntLiteral(_) => success(Provenance.Value)
case FloatLiteral(_) => success(Provenance.Value)
case StringLiteral(_) => success(Provenance.Value)
case BoolLiteral(_) => success(Provenance.Value)
case NullLiteral() => success(Provenance.Value)
}
}
type Annotations = (List[Option[Synthetic]], Provenance)
val synthElgotMƒ:
ElgotAlgebraM[(Scope, ?), ValidSem, Sql, List[Option[Synthetic]]] =
(identifySyntheticsƒ: Algebra[Sql, List[Option[Synthetic]]]).generalizeElgot[(Scope, ?)] ⋙ (_.point[ValidSem])
def addAnnotations[T](implicit T: Corecursive.Aux[T, Sql]):
ElgotAlgebraM[
((Scope, T), ?),
NonEmptyList[SemanticError] \/ ?,
Sql,
Cofree[Sql, Annotations]] =
e => attributeElgotM[(Scope, ?), ValidSem][Sql, Annotations](
ElgotAlgebraMZip[(Scope, ?), ValidSem, Sql].zip(
synthElgotMƒ,
inferProvenanceƒ)).apply(e.leftMap(_._1)).disjunction
def normalizeProjections[T](expr: T)(implicit TR: Recursive.Aux[T, Sql], TC: Corecursive.Aux[T, Sql]): T =
expr.anaM[T](normalizeProjectionsƒ[T]).run(None)._2
def projectSortKeys[T: Equal](expr: T)(implicit TR: Recursive.Aux[T, Sql], TC: Corecursive.Aux[T, Sql]): T =
expr.transCata[T](orOriginal(projectSortKeysƒ[T]))
// NB: identifySynthetics &&& (scopeTables >>> inferProvenance)
def annotate[T](expr: T)(implicit TR: Recursive.Aux[T, Sql], TC: Corecursive.Aux[T, Sql])
: NonEmptyList[SemanticError] \/ Cofree[Sql, Annotations] = {
val emptyScope: Scope = Scope(TableScope(Map()), BindingScope(Map()))
(emptyScope, expr).coelgotM[NonEmptyList[SemanticError] \/ ?](
addAnnotations,
scopeTablesƒ.apply(_).disjunction)
}
}
|
{
"content_hash": "393e1c77dcb6c225c056294911b20e3d",
"timestamp": "",
"source": "github",
"line_count": 376,
"max_line_length": 114,
"avg_line_length": 40.41489361702128,
"alnum_prop": 0.6051592524348512,
"repo_name": "drostron/quasar",
"id": "e38d2d3732a041a465f3fc987267cf4e5ef907dd",
"size": "15821",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sql/src/main/scala/quasar/sql/semantics.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "817"
},
{
"name": "CSS",
"bytes": "182"
},
{
"name": "HTML",
"bytes": "220"
},
{
"name": "Java",
"bytes": "20376"
},
{
"name": "JavaScript",
"bytes": "937"
},
{
"name": "Scala",
"bytes": "6619151"
},
{
"name": "Shell",
"bytes": "52323"
}
],
"symlink_target": ""
}
|
angular.module('izenda.common.ui').controller('IzendaShareController', [
'$scope',
'$izendaLocale',
'$izendaShareService',
izendaShareController]);
/**
* Share controller
*/
function izendaShareController(
$scope,
$izendaLocale,
$izendaShareService) {
'use strict';
$scope.$izendaShareService = $izendaShareService;
var vm = this;
vm.subjects = [];
vm.rights = [];
vm.shareRules = [];
var reset = function() {
vm.subjects = [];
vm.rights = [];
vm.shareRules = [];
};
/**
* Update available values
*/
vm.updateAvailableValues = function () {
var listImplementedSubjects = [];
angular.element.each(vm.shareRules, function () {
var shareRule = this;
if (angular.isString(shareRule.subject) && listImplementedSubjects.indexOf(shareRule.subject) < 0) {
listImplementedSubjects.push(shareRule.subject);
}
});
angular.element.each(vm.shareRules, function() {
var shareRule = this;
shareRule.availableSubjects = [];
angular.element.each(vm.subjects, function() {
var subject = this;
var subjectRecord = angular.extend({}, subject);
if (shareRule.subject !== subjectRecord.value && listImplementedSubjects.indexOf(subject.value) >= 0) {
// disable already selected subjects
subjectRecord.disabled = true;
} else {
subjectRecord.disabled = false;
}
shareRule.availableSubjects.push(subjectRecord);
});
shareRule.availableRights = [];
angular.element.each(vm.rights, function () {
var right = this;
var rightRecord = angular.extend({}, right);
rightRecord.disabled = false;
shareRule.availableRights.push(rightRecord);
});
});
};
/**
* Check is share rule selected right is valid
*/
vm.getShareRuleValidationMessage = function(shareRule) {
if (shareRule.right === null && shareRule.subject !== null)
return $izendaLocale.localeText('js_NessesarySelectRight', 'It is necessary to choose the right, otherwise it will be ignored.');
return null;
};
/**
* Subject <select> changed handler
*/
vm.onShareRuleSubjectChanged = function () {
vm.updateAvailableValues();
};
/**
* Add share rule
*/
vm.addShareRule = function() {
vm.shareRules.push({
subject: null,
right: null,
availableSubjects: [],
availableRights: []
});
vm.updateAvailableValues();
}
/**
* Initialize controller
*/
vm.initialize = function () {
$scope.$watch('$izendaShareService.isShareDataLoaded()', function (loaded) {
reset();
if (!loaded)
return;
vm.rights = [];
angular.copy($izendaShareService.getRights(), vm.rights);
vm.subjects = [];
angular.copy($izendaShareService.getSubjects(), vm.subjects);
vm.subjects.unshift({
text: '',
value: null
});
vm.shareRules = $izendaShareService.getShareRules();
angular.element.each(vm.shareRules, function() {
this.availableSubjects = [];
this.availableRights = [];
});
vm.updateAvailableValues();
});
};
}
|
{
"content_hash": "da0204538576ce9cee9e4a2d1233ba8e",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 132,
"avg_line_length": 25.666666666666668,
"alnum_prop": 0.6409090909090909,
"repo_name": "smoussavi/IzendaHours",
"id": "dbbe6f92fa17da923945f6680dfa46f4dc136fbd",
"size": "3082",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "IzendaHours/Reporting/Resources/components/common/controllers/share-controller.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "321373"
},
{
"name": "C#",
"bytes": "170571"
},
{
"name": "CSS",
"bytes": "934695"
},
{
"name": "HTML",
"bytes": "870177"
},
{
"name": "JavaScript",
"bytes": "5199408"
}
],
"symlink_target": ""
}
|
#pragma once
#include <butter/butter.h>
#if ( \
defined(BUTTER_FUNCTION_OVERRIDE_INCLUDE) && \
defined(BUTTER_FUNCTION_OVERRIDE))
#include BUTTER_FUNCTION_OVERRIDE_INCLUDE
#elif defined(BUTTER_USE_FOLLY_CONTAINERS)
#include <folly/Function.h>
#else
#include <functional>
#endif
namespace facebook {
namespace butter {
#if ( \
defined(BUTTER_FUNCTION_OVERRIDE_INCLUDE) && \
defined(BUTTER_FUNCTION_OVERRIDE))
template <typename... Ts>
using function = BUTTER_FUNCTION_OVERRIDE<Ts...>;
#elif defined(BUTTER_USE_FOLLY_CONTAINERS)
template <typename... Ts>
using function = folly::Function<Ts...>;
#else
template <typename... Ts>
using function = std::function<Ts...>;
#endif
} // namespace butter
} // namespace facebook
|
{
"content_hash": "73662b7f8f434e9ebb03b9fd13024702",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 50,
"avg_line_length": 18.23913043478261,
"alnum_prop": 0.6376638855780691,
"repo_name": "facebook/react-native",
"id": "724752498f88787bae1c1943ab1390bfbebea7d4",
"size": "1028",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "ReactCommon/butter/function.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "14919"
},
{
"name": "Batchfile",
"bytes": "289"
},
{
"name": "C",
"bytes": "19887"
},
{
"name": "C++",
"bytes": "3423550"
},
{
"name": "CMake",
"bytes": "67268"
},
{
"name": "HTML",
"bytes": "1473"
},
{
"name": "Java",
"bytes": "3708625"
},
{
"name": "JavaScript",
"bytes": "6850173"
},
{
"name": "Kotlin",
"bytes": "217061"
},
{
"name": "Makefile",
"bytes": "7460"
},
{
"name": "Objective-C",
"bytes": "1645407"
},
{
"name": "Objective-C++",
"bytes": "1196800"
},
{
"name": "Ruby",
"bytes": "289781"
},
{
"name": "Shell",
"bytes": "98157"
},
{
"name": "Starlark",
"bytes": "420424"
},
{
"name": "TypeScript",
"bytes": "74602"
},
{
"name": "XSLT",
"bytes": "2244"
}
],
"symlink_target": ""
}
|
function [ scale, dataReal, thresh1, thresh2, dataBool ] = getRealFeature15( mot )
scale = true;
humerus_length = sqrt(sum((mot.jointTrajectories{trajectoryID(mot,'relbow')}(:,1) - mot.jointTrajectories{trajectoryID(mot,'rshoulder')}(:,1)).^2));
thresh1 = 0;
thresh2 = 0.375*humerus_length;
p1 = trajectoryID(mot,'root');
p2 = trajectoryID(mot,'lhip');
p3 = trajectoryID(mot,'lankle');
q = trajectoryID(mot,'rankle');
d1 = mot.jointTrajectories{p1} - mot.jointTrajectories{p3};
d2 = mot.jointTrajectories{p2} - mot.jointTrajectories{p3};
n = cross(d1,d2);
n = n./repmat(sqrt(sum(n.^2)),3,1);
dataReal = dot(n,mot.jointTrajectories{q}-mot.jointTrajectories{p3});
if nargout > 4
dataBool = feature_AK_bool_footRightBackRelLegLeft_robust(mot);
end
|
{
"content_hash": "d8d3407107b27470fe18fdf462596149",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 148,
"avg_line_length": 32.82608695652174,
"alnum_prop": 0.7152317880794702,
"repo_name": "iqbalu/3D_Pose_Estimation_CVPR2016",
"id": "f69068bcfcfbca5d51c44ecb364e1465bc3273d3",
"size": "755",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tools_intern/analytics/FM_MT/getRealFeatures/getRealFeature15.m",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "3751"
},
{
"name": "C",
"bytes": "188196"
},
{
"name": "C++",
"bytes": "2016823"
},
{
"name": "CMake",
"bytes": "12832"
},
{
"name": "CSS",
"bytes": "3682"
},
{
"name": "HTML",
"bytes": "340919"
},
{
"name": "Limbo",
"bytes": "42"
},
{
"name": "M",
"bytes": "4133"
},
{
"name": "Makefile",
"bytes": "26071"
},
{
"name": "Matlab",
"bytes": "5856729"
},
{
"name": "Mercury",
"bytes": "520"
},
{
"name": "Objective-C",
"bytes": "6778"
},
{
"name": "Protocol Buffer",
"bytes": "662"
},
{
"name": "Shell",
"bytes": "20881"
},
{
"name": "TeX",
"bytes": "12883"
},
{
"name": "XSLT",
"bytes": "15892"
}
],
"symlink_target": ""
}
|
#ifndef SUB_H
#define SUB_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif
#include <sys/socket.h>
#include <net/if.h>
#ifdef PACKAGE
#define NAME PACKAGE
#else
#define NAME "sipcalc"
#endif
#if defined(HAVE_GETHOSTBYNAME_NETDB) && !defined(HAVE_GETHOSTBYNAME)
#define HAVE_GETHOSTBYNAME
#endif
#if defined(HAVE_GETHOSTBYNAME2_NETDB) && !defined(HAVE_GETHOSTBYNAME2)
#define HAVE_GETHOSTBYNAME
#endif
#if defined(HAVE_GETADDRINFO_NETDB) && !defined(HAVE_GETADDRINFO)
#define HAVE_GETADDRINFO
#endif
#if !defined(HAVE_U_INT8_T) && defined(HAVE_UINT8_T)
#define u_int8_t uint8_t
#endif
#if defined(HAVE_U_INT8_T) && !defined(HAVE_UINT8_T)
#define uint8_t u_int8_t
#endif
#if !defined(HAVE_U_INT16_T) && defined(HAVE_UINT16_T)
#define u_int16_t uint16_t
#endif
#if defined(HAVE_U_INT16_T) && !defined(HAVE_UINT16_T)
#define uint16_t u_int16_t
#endif
#if !defined(HAVE_U_INT32_T) && defined(HAVE_UINT32_T)
#define u_int32_t uint32_t
#endif
#if defined(HAVE_U_INT32_T) && !defined(HAVE_UINT32_T)
#define uint32_t u_int32_t
#endif
#ifndef PF_UNSPEC
#define PF_UNSPEC AF_UNSPEC
#endif
#ifndef PF_INET
#define PF_INET AF_INET
#endif
#ifndef PF_INET6
#define PF_INET6 AF_INET6
#endif
#define V4ADDR_VAL "0123456789."
#define V6ADDR_VAL "0123456789ABCDEFabcdef:"
#define NETMASK_VAL "0123456789"
#define TERMINATE(x) (x[sizeof(x)-1]='\0')
#define safe_strncpy(dest,src) strncpy(dest,src,sizeof(dest)-1+TERMINATE(dest)*0)
#define safe_strncat(dest,src) strncat(dest,src,sizeof(dest)-1+TERMINATE(dest)*0)
#define safe_snprintf(dest,whatever...) snprintf(dest,sizeof(dest),## whatever)
#define safe_bzero(dest) bzero((char *)dest,sizeof(dest))
/*
* Easier to define this ourselves then to use all the different
* versions from different platforms.
*/
struct sip_in6_addr {
union {
uint8_t u6_addr8[16];
uint16_t u6_addr16[8];
uint32_t u6_addr32[4];
} sip_in6_u;
#define sip6_addr sip_in6_u.u6_addr8
#define sip6_addr8 sip_in6_u.u6_addr8
#define sip6_addr16 sip_in6_u.u6_addr16
#define sip6_addr32 sip_in6_u.u6_addr32
};
struct v4addr {
char class;
char class_remark[64];
char pres_bitmap[36];
int n_nmaskbits;
u_int32_t n_cbroadcast;
u_int32_t n_broadcast;
u_int32_t n_cnaddr;
u_int32_t n_naddr;
u_int32_t n_cnmask;
u_int32_t n_nmask;
u_int32_t n_haddr;
u_int32_t i_broadcast;
};
/*
* Broadcast in this structure is sort of missleading, since ipv6 networks
* don't have broadcast addresses, but it's as good a name as any for the
* top address of a subnet.
*
* Prefix can also be directly translated to a ipv4 network address.
*/
struct v6addr {
char class_remark[64];
char comment[64];
struct sip_in6_addr haddr;
int nmaskbits;
struct sip_in6_addr nmask;
struct sip_in6_addr prefix;
struct sip_in6_addr suffix;
struct sip_in6_addr broadcast;
int type;
int real_v4;
};
struct if_info {
char name[IFNAMSIZ + 1];
char p_v4addr[19], p_v4nmask[16];
char p_v6addr[44];
char errorstr[64];
char cmdstr[128];
short flags;
short type;
struct v4addr v4ad;
struct v6addr v6ad;
struct if_info *next;
};
struct misc_args {
int numnets;
u_int32_t splitmask;
struct sip_in6_addr v6splitmask;
int v6splitnum;
};
struct ipv6_split {
char ipv6addr[40];
char ipv4addr[16];
char nmask[4];
};
struct argbox {
char str[128];
int type;
int resolv;
struct argbox *next;
};
struct dnsresp {
char str[128];
int type;
struct dnsresp *next;
};
#define AT_V4 1
#define AT_V6 2
#define AT_INT 3
#define AT_UNKWN 4
#define IFT_V4 1
#define IFT_V6 2
#define IFT_INTV4 3
#define IFT_INTV6 4
#define IFT_UNKWN 5
/* v4 args */
#define CF_INFO 0x01
#define CF_BITMAP 0x02
#define CIDR_INFO 0x04
#define CIDR_BITMAP 0x08
#define NET_INFO 0x10
#define V4SPLIT 0x20
#define V4VERBSPLIT 0x40
#define C_WILDCARD 0x80
/* v6 args */
#define V6_INFO 0x01
#define V4INV6 0x02
#define V6SPLIT 0x04
#define V6REV 0x08
#define V6VERBSPLIT 0x10
#define V6TYPE_STANDARD 1
#define V6TYPE_V4INV6 2
/*
* prototypes
*/
/*
* sub.c
*/
int out_int (struct if_info *if_cur, struct if_info *ifarg_cur, int v4args,
struct misc_args m_argv4, int v6args, struct misc_args m_argv6);
int out_cmdline (struct if_info *ifarg_cur, int v4args,
struct misc_args m_argv4, int v6args,
struct misc_args m_argv6, int recurse, int index);
int cleanline (char *sbuf, char *dbuf);
int get_stdin (char *args[]);
/*
* sub-func.c
*/
int count (char *buf, char ch);
int validate_v4addr (char *addr);
int validate_netmask (char *in_addr);
int getsplitnumv4 (char *buf, u_int32_t * splitmask);
int getsplitnumv6 (char *buf, struct sip_in6_addr *splitmask, int *v6splitnum);
int quadtonum (char *quad, u_int32_t * num);
char *numtoquad (u_int32_t num);
char *numtobitmap (u_int32_t num);
int parse_addr (struct if_info *ifi);
int get_addrv4 (struct if_info *ifi);
int get_addrv6 (struct if_info *ifi);
int split_ipv6addr (char *addr, struct ipv6_split *spstr);
int validate_s_v6addr (char *addr, int type);
int getcolon (char *addr, int pos, int type);
int v6addrtonum (struct ipv6_split spstr, struct v6addr *in6_addr, int type);
int v6masktonum (char *nmask, int *nmaskbits, struct sip_in6_addr *in6_addr);
int validate_v6addr (char *addr);
int v6addrtoprefix (struct v6addr *in6_addr);
int v6addrtosuffix (struct v6addr *in6_addr);
int v6addrtobroadcast (struct v6addr *in6_addr);
void v6_type (struct v6addr *in6_addr);
void v6_comment (struct v6addr *in6_addr);
int v6verifyv4 (struct sip_in6_addr addr);
char *get_comp_v6 (struct sip_in6_addr addr);
int mk_ipv6addr (struct v6addr *in6_addr, char *addr);
struct dnsresp *new_dnsresp (struct dnsresp *d_resp);
void free_dnsresp (struct dnsresp *d_resp);
char *resolve_addr (char *addr, int family, struct dnsresp *);
/*
* interface.c
*/
struct if_info *new_if (struct if_info *ifarg_cur);
void free_if (struct if_info *ifa);
struct if_info *get_if_ext ();
#endif /* SUB_H */
|
{
"content_hash": "5f5403987033a461a57f6ef4182673e6",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 81,
"avg_line_length": 23.988,
"alnum_prop": 0.7136901784225446,
"repo_name": "sii/sipcalc",
"id": "4fb9a862b38d5121cb8ba9dac94857db7de61a5f",
"size": "6147",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "include/sub.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "88131"
},
{
"name": "Shell",
"bytes": "93934"
}
],
"symlink_target": ""
}
|
using EFCoreExtend;
using EFCoreExtend.Commons;
using EFCoreExtend.Test;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using MySql.Data.MySqlClient;
using Newtonsoft.Json;
using Npgsql;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
namespace EFCoreExtend.Test
{
/// <summary>
/// 配置文件加载测试
/// </summary>
public class TestLuaLoad
{
static TestLuaLoad()
{
EFHelper.ServiceBuilder.AddLuaSqlDefault().BuildServices(); //添加lua sql模块
}
[Fact]
public void Test()
{
//加载指定的配置文件
var luasql = EFHelper.Services.GetLuaSqlMgr();
luasql.LoadFile(Directory.GetCurrentDirectory() + "/Datas/Lua/TestLoad/Person.lua");
luasql.LoadFile(Directory.GetCurrentDirectory() + "/Datas/Lua/TestLoad/Person1.txt");
luasql.LoadFile(new FileInfo(Directory.GetCurrentDirectory() + "/Datas/Lua/TestLoad/Person2.lua"));
luasql.LoadFile(new FileInfo(Directory.GetCurrentDirectory() + "/Datas/Lua/TestLoad/Person3.txt"));
Assert.True(luasql.Config.TableSqlInfos?.Count == 4);
}
[Fact]
public void Test1()
{
//加载指定目录的配置文件
var luasql = EFHelper.Services.GetLuaSqlMgr();
luasql.LoadDirectory(Directory.GetCurrentDirectory() + "/Datas/Lua/TestLoad"); //TestLoad目录下的所有lua文件(包括子目录)
Assert.True(luasql.Config.TableSqlInfos?.Count == 4);
}
[Fact]
public void Test10()
{
//加载指定目录的配置文件
var luasql = EFHelper.Services.GetLuaSqlMgr();
luasql.LoadDirectory(new DirectoryInfo(Directory.GetCurrentDirectory() + "/Datas/Lua/TestLoad")); //TestLoad目录下的所有lua文件(包括子目录)
Assert.True(luasql.Config.TableSqlInfos?.Count == 4);
}
[Fact]
public void Test11()
{
//加载指定目录的配置文件
var luasql = EFHelper.Services.GetLuaSqlMgr();
luasql.LoadDirectory(Directory.GetCurrentDirectory() + "/Datas/Lua/TestLoad", false);
Assert.True(luasql.Config.TableSqlInfos?.Count == 2);
}
[Fact]
public void Test12()
{
//加载指定目录的配置文件
var luasql = EFHelper.Services.GetLuaSqlMgr();
luasql.LoadDirectory(Directory.GetCurrentDirectory() + "/Datas/Lua/TestLoad", true, LuaSqlConfigFileExtType.txt); //TestLoad目录下的所有lua文件(包括子目录)
Assert.True(luasql.Config.TableSqlInfos?.Count == 4);
}
[Fact]
public void Test13()
{
//加载指定目录的配置文件
var luasql = EFHelper.Services.GetLuaSqlMgr();
luasql.LoadDirectory(Directory.GetCurrentDirectory() + "/Datas/Lua/TestLoad", false, LuaSqlConfigFileExtType.txt);
Assert.True(luasql.Config.TableSqlInfos?.Count == 2);
}
[Fact]
public void Test14()
{
//加载指定目录的配置文件
var luasql = EFHelper.Services.GetLuaSqlMgr();
luasql.LoadDirectory(Directory.GetCurrentDirectory() + "/Datas/Lua/TestLoad", true, LuaSqlConfigFileExtType.all); //TestLoad目录下的所有lua文件(包括子目录)
Assert.True(luasql.Config.TableSqlInfos?.Count == 8);
}
[Fact]
public void Test15()
{
//加载指定目录的配置文件
var luasql = EFHelper.Services.GetLuaSqlMgr();
luasql.LoadDirectory(Directory.GetCurrentDirectory() + "/Datas/Lua/TestLoad", false, LuaSqlConfigFileExtType.all);
Assert.True(luasql.Config.TableSqlInfos?.Count == 4);
}
/// <summary>
/// 清理配置
/// </summary>
[Fact]
public void Test2()
{
//加载指定目录的配置文件
var luasql = EFHelper.Services.GetLuaSqlMgr();
luasql.LoadDirectory(Directory.GetCurrentDirectory() + "/Datas/Lua/TestLoad", true, LuaSqlConfigFileExtType.all); //TestLoad目录下的所有lua文件(包括子目录)
Assert.True(luasql.Config.TableSqlInfos?.Count == 8);
luasql.Config.Remove("Person");
luasql.Config.Remove("Person1");
Assert.True(luasql.Config.TableSqlInfos?.Count == 6);
}
/// <summary>
/// 清理配置
/// </summary>
[Fact]
public void Test21()
{
//加载指定目录的配置文件
var luasql = EFHelper.Services.GetLuaSqlMgr();
luasql.LoadDirectory(Directory.GetCurrentDirectory() + "/Datas/Lua/TestLoad", true, LuaSqlConfigFileExtType.all); //TestLoad目录下的所有lua文件(包括子目录)
Assert.True(luasql.Config.TableSqlInfos?.Count == 8);
luasql.Config.Clear();
Assert.True(luasql.Config.TableSqlInfos?.Count == 0);
}
}
}
|
{
"content_hash": "7c1529f33aacf79b6012ac1f77a5fb0a",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 157,
"avg_line_length": 35.94814814814815,
"alnum_prop": 0.6064290129816609,
"repo_name": "skigs/EFCoreExtend",
"id": "55e2d9c9db7689f0498c9c05001fe589923c55cd",
"size": "5267",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/EFCoreExtend.Test/TestLua/TestLuaLoad.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "881298"
},
{
"name": "Lua",
"bytes": "35320"
}
],
"symlink_target": ""
}
|
//
// MBEvents.h
// Mockingbird Toolbox
//
// Created by Jesse Boyes on 7/13/09.
// Copyright (c) 2009 Gilt Groupe. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "MBAvailability.h"
/******************************************************************************/
#pragma mark -
#pragma mark MBEvents class
/******************************************************************************/
/*!
Provides a simple interface for posting `NSNotification` events of various
types.
*/
@interface MBEvents : NSObject
/*----------------------------------------------------------------------------*/
#pragma mark Posting events
/*! @name Posting events */
/*----------------------------------------------------------------------------*/
/*!
Posts a notification event.
@param event The name of the event to post.
*/
+ (void) postEvent:(nonnull NSString*)event;
/*!
Posts a notification event by constructing the event name
"`event`:`suffix`".
@param event The prefix of the event name to post.
@param suffix The suffix of the event name to post.
*/
+ (void) postEvent:(nonnull NSString*)event withSuffix:(nullable NSString*)suffix;
/*!
Posts a notification event containing the given object parameter.
@param event The name of the event to post.
@param obj The object to post with the event. This value will be
available in the `object` property of the `NSNotification`
created for the event.
*/
+ (void) postEvent:(nonnull NSString*)event withObject:(nullable id)obj;
/*!
Posts a notification event containing the given userInfo parameter.
@param event The name of the event to post.
@param userInfo The user info dictionary to post with the event. This
value will be available in the `userInfo` property of the
`NSNotification` created for the event.
*/
+ (void) postEvent:(nonnull NSString*)event withUserInfo:(nullable NSDictionary*)userInfo;
/*!
Posts a notification event along with the object instance sending the event.
@param event The name of the event to post.
@param sender The sender of the event. This object will be available in
the `object` property of the `NSNotification` created for the event.
*/
+ (void) postEvent:(nonnull NSString*)event fromSender:(nullable id)sender;
/*----------------------------------------------------------------------------*/
#pragma mark Constructing event-related names
/*! @name Constructing event-related names */
/*----------------------------------------------------------------------------*/
/*!
Constructs a string for an event-related name with the given suffix.
@param name The name to use for the root of the returned string. If
`nil`, this method returns `nil`.
@param suffix The optional suffix to apply to `name`. If `nil`, this
method returns `name`.
@return If `name` and `suffix` are both non-`nil`, the concatenation of
`name`, `:` and `suffix` is returned. Otherwise, the value of the
`name` parameter is returned.
Some notification names are parameterized, based on the name of components (or
other objects) at runtime. These methods return construct and return event
names.
*/
+ (nullable NSString*) name:(nullable NSString*)name withSuffix:(nullable NSString*)suffix;
/*----------------------------------------------------------------------------*/
#pragma mark Posting memory warnings
/*! @name Posting memory warnings */
/*----------------------------------------------------------------------------*/
#if MB_BUILD_UIKIT
/*!
Posts an artificial memory warning using the event name contained in the
`UIApplicationDidReceiveMemoryWarningNotification` constant.
This can be used to cause various application-wide caches to reduce their
non-persistent memory footprints.
*/
+ (void) postMemoryWarning;
#endif
@end
|
{
"content_hash": "1959aeddf802e4898180dabb78b00c18",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 91,
"avg_line_length": 34.64102564102564,
"alnum_prop": 0.5738958795953615,
"repo_name": "emaloney/MBToolbox",
"id": "d78fe02a8593fd58e72a88b34f26e65debd3418e",
"size": "4053",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Sources/Events/MBEvents.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "397542"
},
{
"name": "Shell",
"bytes": "27087"
}
],
"symlink_target": ""
}
|
(function(env) {
env.ddg_spice_thesaurus = function(api_result) {
"use strict";
if (!api_result || api_result.error) {
return Spice.failed("thesaurus");
}
// Check if user want to find antonym only
var searchAntonymOnly = (DDG.get_query().indexOf('antonym') > -1);
// Retrieve the word we did a lookup on
var script = $('[src*="/js/spice/thesaurus/"]')[0];
var source = $(script).attr("src");
var query = source.match(/thesaurus\/([^\/]+)/)[1];
query = decodeURIComponent(query);
// Search the results for the word type (noun, adjective etc) with the most entries
var wordTypeWithMostEntries;
var highestEntryCount = 0;
var exactWord;
// constants for types of relationship
var RELATIONSHIP_TYPE = {
SYNONYMS : "syn",
SIMILAR : "sim",
RELATED : "rel",
ANTONYMS : "ant"
};
$.each(api_result, function(wordType, words) { // wordType = ajective, noun etc...
var wordTypeEntryCount = 0;
$.each(words, function(relationshipType) { // relationshipType = synonym, antonym etc...
wordTypeEntryCount += words[relationshipType].length;
});
if (wordTypeEntryCount > highestEntryCount) {
highestEntryCount = wordTypeEntryCount;
wordTypeWithMostEntries = wordType;
}
});
if (!wordTypeWithMostEntries) {
return Spice.failed("thesaurus");
}
exactWord = api_result[wordTypeWithMostEntries];
// Can't find any antonym when searching for antonym
if (searchAntonymOnly && !exactWord.hasOwnProperty(RELATIONSHIP_TYPE.ANTONYMS)) {
return Spice.failed("thesaurus");
}
Spice.add({
id: 'thesaurus',
name: 'Thesaurus',
data: exactWord,
templates: {
group: 'text',
options:{
content: 'record',
moreAt: true
}
},
meta: {
sourceName: 'Big Huge Thesaurus',
sourceUrl: 'http://words.bighugelabs.com/' + query,
},
normalize: function(words) {
var result = {
title: DDG.capitalize(query),
subtitle: DDG.capitalize(wordTypeWithMostEntries),
record_keys : [],
record_data : {}
};
// Display any synonyms if present
if (words.hasOwnProperty(RELATIONSHIP_TYPE.SYNONYMS)) {
result.record_keys.push("Synonyms");
result.record_data["Synonyms"] = words[RELATIONSHIP_TYPE.SYNONYMS].join(', ');
}
// Display any similar words if present
if (words.hasOwnProperty(RELATIONSHIP_TYPE.SIMILAR)) {
result.record_keys.push("Similar");
result.record_data["Similar"] = words[RELATIONSHIP_TYPE.SIMILAR].join(', ');
}
// Display any related words if present
if (words.hasOwnProperty(RELATIONSHIP_TYPE.RELATED)) {
result.record_keys.push("Related");
result.record_data["Related"] = words[RELATIONSHIP_TYPE.RELATED].join(', ');
}
// Display any antonyms if present
if (words.hasOwnProperty(RELATIONSHIP_TYPE.ANTONYMS)) {
result.record_keys.push("Antonyms");
result.record_data["Antonyms"] = words[RELATIONSHIP_TYPE.ANTONYMS].join(', ');
}
return result;
}
});
}
}(this));
|
{
"content_hash": "537a7d21c777cbf03ea652eb54e2506b",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 116,
"avg_line_length": 37.01851851851852,
"alnum_prop": 0.4947473736868434,
"repo_name": "P71/zeroclickinfo-spice",
"id": "044db81170cc0ee0b976a25e40d57f7fa3bc7971",
"size": "3998",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "share/spice/thesaurus/thesaurus.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "92935"
},
{
"name": "Handlebars",
"bytes": "74363"
},
{
"name": "JavaScript",
"bytes": "562533"
},
{
"name": "Perl",
"bytes": "486186"
},
{
"name": "Perl 6",
"bytes": "12162"
},
{
"name": "Python",
"bytes": "3695"
}
],
"symlink_target": ""
}
|
#ifndef _PEI_MAIN_H_
#define _PEI_MAIN_H_
#include <PiPei.h>
#include <Ppi/DxeIpl.h>
#include <Ppi/MemoryDiscovered.h>
#include <Ppi/StatusCode.h>
#include <Ppi/Reset.h>
#include <Ppi/FirmwareVolume.h>
#include <Ppi/FirmwareVolumeInfo.h>
#include <Ppi/Decompress.h>
#include <Ppi/GuidedSectionExtraction.h>
#include <Ppi/LoadFile.h>
#include <Ppi/Security2.h>
#include <Ppi/TemporaryRamSupport.h>
#include <Library/DebugLib.h>
#include <Library/PeiCoreEntryPoint.h>
#include <Library/BaseLib.h>
#include <Library/HobLib.h>
#include <Library/PerformanceLib.h>
#include <Library/PeiServicesLib.h>
#include <Library/ReportStatusCodeLib.h>
#include <Library/PeCoffLib.h>
#include <Library/PeCoffGetEntryPointLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/CacheMaintenanceLib.h>
#include <Library/PcdLib.h>
#include <IndustryStandard/PeImage.h>
#include <Library/PeiServicesTablePointerLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Guid/FirmwareFileSystem2.h>
#include <Guid/FirmwareFileSystem3.h>
#include <Guid/AprioriFileName.h>
///
/// It is an FFS type extension used for PeiFindFileEx. It indicates current
/// Ffs searching is for all PEIMs can be dispatched by PeiCore.
///
#define PEI_CORE_INTERNAL_FFS_FILE_DISPATCH_TYPE 0xff
///
/// Pei Core private data structures
///
typedef union {
EFI_PEI_PPI_DESCRIPTOR *Ppi;
EFI_PEI_NOTIFY_DESCRIPTOR *Notify;
VOID *Raw;
} PEI_PPI_LIST_POINTERS;
///
/// PPI database structure which contains two link: PpiList and NotifyList. PpiList
/// is in head of PpiListPtrs array and notify is in end of PpiListPtrs.
///
typedef struct {
///
/// index of end of PpiList link list.
///
INTN PpiListEnd;
///
/// index of end of notify link list.
///
INTN NotifyListEnd;
///
/// index of the dispatched notify list.
///
INTN DispatchListEnd;
///
/// index of last installed Ppi description in PpiList link list.
///
INTN LastDispatchedInstall;
///
/// index of last dispatched notify in Notify link list.
///
INTN LastDispatchedNotify;
///
/// Ppi database.
///
PEI_PPI_LIST_POINTERS PpiListPtrs[FixedPcdGet32 (PcdPeiCoreMaxPpiSupported)];
} PEI_PPI_DATABASE;
//
// PEI_CORE_FV_HANDE.PeimState
// Do not change these values as there is code doing math to change states.
// Look for Private->Fv[FvCount].PeimState[PeimCount]++;
//
#define PEIM_STATE_NOT_DISPATCHED 0x00
#define PEIM_STATE_DISPATCHED 0x01
#define PEIM_STATE_REGISITER_FOR_SHADOW 0x02
#define PEIM_STATE_DONE 0x03
typedef struct {
EFI_FIRMWARE_VOLUME_HEADER *FvHeader;
EFI_PEI_FIRMWARE_VOLUME_PPI *FvPpi;
EFI_PEI_FV_HANDLE FvHandle;
UINT8 PeimState[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];
EFI_PEI_FILE_HANDLE FvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];
BOOLEAN ScanFv;
} PEI_CORE_FV_HANDLE;
typedef struct {
EFI_GUID FvFormat;
VOID *FvInfo;
UINT32 FvInfoSize;
EFI_PEI_NOTIFY_DESCRIPTOR NotifyDescriptor;
} PEI_CORE_UNKNOW_FORMAT_FV_INFO;
#define CACHE_SETION_MAX_NUMBER 0x10
typedef struct {
EFI_COMMON_SECTION_HEADER* Section[CACHE_SETION_MAX_NUMBER];
VOID* SectionData[CACHE_SETION_MAX_NUMBER];
UINTN SectionSize[CACHE_SETION_MAX_NUMBER];
UINTN AllSectionCount;
UINTN SectionIndex;
} CACHE_SECTION_DATA;
///
/// Forward declaration for PEI_CORE_INSTANCE
///
typedef struct _PEI_CORE_INSTANCE PEI_CORE_INSTANCE;
/**
Function Pointer type for PeiCore function.
@param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
and location of temporary RAM, the stack location and the BFV location.
@param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
An empty PPI list consists of a single descriptor with the end-tag
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
that both the PEI Foundation and any modules can leverage the associated service
calls and/or code in these early PPIs
@param OldCoreData Pointer to old core data that is used to initialize the
core's data areas.
**/
typedef
EFI_STATUS
(EFIAPI *PEICORE_FUNCTION_POINTER)(
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,
IN PEI_CORE_INSTANCE *OldCoreData
);
#define PEI_CORE_HANDLE_SIGNATURE SIGNATURE_32('P','e','i','C')
///
/// Pei Core private data structure instance
///
struct _PEI_CORE_INSTANCE {
UINTN Signature;
///
/// Point to ServiceTableShadow
///
EFI_PEI_SERVICES *Ps;
PEI_PPI_DATABASE PpiData;
///
/// The count of FVs which contains FFS and could be dispatched by PeiCore.
///
UINTN FvCount;
///
/// The instance arrary for FVs which contains FFS and could be dispatched by PeiCore.
///
PEI_CORE_FV_HANDLE Fv[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];
PEI_CORE_UNKNOW_FORMAT_FV_INFO UnknownFvInfo[FixedPcdGet32 (PcdPeiCoreMaxFvSupported)];
UINTN UnknownFvInfoCount;
EFI_PEI_FILE_HANDLE CurrentFvFileHandles[FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv)];
UINTN AprioriCount;
UINTN CurrentPeimFvCount;
UINTN CurrentPeimCount;
EFI_PEI_FILE_HANDLE CurrentFileHandle;
BOOLEAN PeimNeedingDispatch;
BOOLEAN PeimDispatchOnThisPass;
BOOLEAN PeimDispatcherReenter;
EFI_PEI_HOB_POINTERS HobList;
BOOLEAN SwitchStackSignal;
BOOLEAN PeiMemoryInstalled;
VOID *CpuIo;
EFI_PEI_SECURITY2_PPI *PrivateSecurityPpi;
EFI_PEI_SERVICES ServiceTableShadow;
EFI_PEI_PPI_DESCRIPTOR *XipLoadFile;
EFI_PHYSICAL_ADDRESS PhysicalMemoryBegin;
UINT64 PhysicalMemoryLength;
EFI_PHYSICAL_ADDRESS FreePhysicalMemoryTop;
UINTN HeapOffset;
BOOLEAN HeapOffsetPositive;
UINTN StackOffset;
BOOLEAN StackOffsetPositive;
PEICORE_FUNCTION_POINTER ShadowedPeiCore;
CACHE_SECTION_DATA CacheSection;
//
// For Loading modules at fixed address feature to cache the top address below which the
// Runtime code, boot time code and PEI memory will be placed. Please note that the offset between this field
// and Ps should not be changed since maybe user could get this top address by using the offet to Ps.
//
EFI_PHYSICAL_ADDRESS LoadModuleAtFixAddressTopAddress;
//
// The field is define for Loading modules at fixed address feature to tracker the PEI code
// memory range usage. It is a bit mapped array in which every bit indicates the correspoding memory page
// available or not.
//
UINT64 *PeiCodeMemoryRangeUsageBitMap;
//
// This field points to the shadowed image read function
//
PE_COFF_LOADER_READ_FILE ShadowedImageRead;
};
///
/// Pei Core Instance Data Macros
///
#define PEI_CORE_INSTANCE_FROM_PS_THIS(a) \
CR(a, PEI_CORE_INSTANCE, Ps, PEI_CORE_HANDLE_SIGNATURE)
///
/// Union of temporarily used function pointers (to save stack space)
///
typedef union {
PEICORE_FUNCTION_POINTER PeiCore;
EFI_PEIM_ENTRY_POINT2 PeimEntry;
EFI_PEIM_NOTIFY_ENTRY_POINT PeimNotifyEntry;
EFI_DXE_IPL_PPI *DxeIpl;
EFI_PEI_PPI_DESCRIPTOR *PpiDescriptor;
EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor;
VOID *Raw;
} PEI_CORE_TEMP_POINTERS;
typedef struct {
CONST EFI_SEC_PEI_HAND_OFF *SecCoreData;
EFI_PEI_PPI_DESCRIPTOR *PpiList;
VOID *Data;
} PEI_CORE_PARAMETERS;
//
// PeiCore function
//
/**
The entry routine to Pei Core, invoked by PeiMain during transition
from SEC to PEI. After switching stack in the PEI core, it will restart
with the old core data.
@param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
and location of temporary RAM, the stack location and the BFV location.
@param PpiList Points to a list of one or more PPI descriptors to be installed initially by the PEI core.
An empty PPI list consists of a single descriptor with the end-tag
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST. As part of its initialization
phase, the PEI Foundation will add these SEC-hosted PPIs to its PPI database such
that both the PEI Foundation and any modules can leverage the associated service
calls and/or code in these early PPIs
@param Data Pointer to old core data that is used to initialize the
core's data areas.
**/
VOID
EFIAPI
PeiCore (
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList,
IN VOID *Data
);
//
// Dispatcher support functions
//
/**
This is the POSTFIX version of the dependency evaluator. When a
PUSH [PPI GUID] is encountered, a pointer to the GUID is stored on
the evaluation stack. When that entry is poped from the evaluation
stack, the PPI is checked if it is installed. This method allows
some time savings as not all PPIs must be checked for certain
operation types (AND, OR).
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param DependencyExpression Pointer to a dependency expression. The Grammar adheres to
the BNF described above and is stored in postfix notation.
@retval TRUE if it is a well-formed Grammar
@retval FALSE if the dependency expression overflows the evaluation stack
if the dependency expression underflows the evaluation stack
if the dependency expression is not a well-formed Grammar.
**/
BOOLEAN
PeimDispatchReadiness (
IN EFI_PEI_SERVICES **PeiServices,
IN VOID *DependencyExpression
);
/**
Conduct PEIM dispatch.
@param SecCoreData Pointer to the data structure containing SEC to PEI handoff data
@param PrivateData Pointer to the private data passed in from caller
**/
VOID
PeiDispatcher (
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
IN PEI_CORE_INSTANCE *PrivateData
);
/**
Initialize the Dispatcher's data members
@param PrivateData PeiCore's private data structure
@param OldCoreData Old data from SecCore
NULL if being run in non-permament memory mode.
@param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
and location of temporary RAM, the stack location and the BFV location.
**/
VOID
InitializeDispatcherData (
IN PEI_CORE_INSTANCE *PrivateData,
IN PEI_CORE_INSTANCE *OldCoreData,
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData
);
/**
This routine parses the Dependency Expression, if available, and
decides if the module can be executed.
@param Private PeiCore's private data structure
@param FileHandle PEIM's file handle
@param PeimCount The index of last dispatched PEIM.
@retval TRUE Can be dispatched
@retval FALSE Cannot be dispatched
**/
BOOLEAN
DepexSatisfied (
IN PEI_CORE_INSTANCE *Private,
IN EFI_PEI_FILE_HANDLE FileHandle,
IN UINTN PeimCount
);
//
// PPI support functions
//
/**
Initialize PPI services.
@param PrivateData Pointer to the PEI Core data.
@param OldCoreData Pointer to old PEI Core data.
NULL if being run in non-permament memory mode.
**/
VOID
InitializePpiServices (
IN PEI_CORE_INSTANCE *PrivateData,
IN PEI_CORE_INSTANCE *OldCoreData
);
/**
Migrate the Hob list from the temporary memory stack to PEI installed memory.
@param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
and location of temporary RAM, the stack location and the BFV location.
@param PrivateData Pointer to PeiCore's private data structure.
**/
VOID
ConvertPpiPointers (
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
IN PEI_CORE_INSTANCE *PrivateData
);
/**
Install PPI services. It is implementation of EFI_PEI_SERVICE.InstallPpi.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param PpiList Pointer to ppi array that want to be installed.
@retval EFI_SUCCESS if all PPIs in PpiList are successfully installed.
@retval EFI_INVALID_PARAMETER if PpiList is NULL pointer
if any PPI in PpiList is not valid
@retval EFI_OUT_OF_RESOURCES if there is no more memory resource to install PPI
**/
EFI_STATUS
EFIAPI
PeiInstallPpi (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList
);
/**
Re-Install PPI services.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param OldPpi Pointer to the old PEI PPI Descriptors.
@param NewPpi Pointer to the new PEI PPI Descriptors.
@retval EFI_SUCCESS if the operation was successful
@retval EFI_INVALID_PARAMETER if OldPpi or NewPpi is NULL
if NewPpi is not valid
@retval EFI_NOT_FOUND if the PPI was not in the database
**/
EFI_STATUS
EFIAPI
PeiReInstallPpi (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_PPI_DESCRIPTOR *OldPpi,
IN CONST EFI_PEI_PPI_DESCRIPTOR *NewPpi
);
/**
Locate a given named PPI.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param Guid Pointer to GUID of the PPI.
@param Instance Instance Number to discover.
@param PpiDescriptor Pointer to reference the found descriptor. If not NULL,
returns a pointer to the descriptor (includes flags, etc)
@param Ppi Pointer to reference the found PPI
@retval EFI_SUCCESS if the PPI is in the database
@retval EFI_NOT_FOUND if the PPI is not in the database
**/
EFI_STATUS
EFIAPI
PeiLocatePpi (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_GUID *Guid,
IN UINTN Instance,
IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
IN OUT VOID **Ppi
);
/**
Install a notification for a given PPI.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param NotifyList Pointer to list of Descriptors to notify upon.
@retval EFI_SUCCESS if successful
@retval EFI_OUT_OF_RESOURCES if no space in the database
@retval EFI_INVALID_PARAMETER if not a good decriptor
**/
EFI_STATUS
EFIAPI
PeiNotifyPpi (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList
);
/**
Process the Notify List at dispatch level.
@param PrivateData PeiCore's private data structure.
**/
VOID
ProcessNotifyList (
IN PEI_CORE_INSTANCE *PrivateData
);
/**
Dispatch notifications.
@param PrivateData PeiCore's private data structure
@param NotifyType Type of notify to fire.
@param InstallStartIndex Install Beginning index.
@param InstallStopIndex Install Ending index.
@param NotifyStartIndex Notify Beginning index.
@param NotifyStopIndex Notify Ending index.
**/
VOID
DispatchNotify (
IN PEI_CORE_INSTANCE *PrivateData,
IN UINTN NotifyType,
IN INTN InstallStartIndex,
IN INTN InstallStopIndex,
IN INTN NotifyStartIndex,
IN INTN NotifyStopIndex
);
//
// Boot mode support functions
//
/**
This service enables PEIMs to ascertain the present value of the boot mode.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param BootMode A pointer to contain the value of the boot mode.
@retval EFI_SUCCESS The boot mode was returned successfully.
@retval EFI_INVALID_PARAMETER BootMode is NULL.
**/
EFI_STATUS
EFIAPI
PeiGetBootMode (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN OUT EFI_BOOT_MODE *BootMode
);
/**
This service enables PEIMs to update the boot mode variable.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param BootMode The value of the boot mode to set.
@return EFI_SUCCESS The value was successfully updated
**/
EFI_STATUS
EFIAPI
PeiSetBootMode (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN EFI_BOOT_MODE BootMode
);
//
// Security support functions
//
/**
Initialize the security services.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param OldCoreData Pointer to the old core data.
NULL if being run in non-permament memory mode.
**/
VOID
InitializeSecurityServices (
IN EFI_PEI_SERVICES **PeiServices,
IN PEI_CORE_INSTANCE *OldCoreData
);
/**
Verify a Firmware volume.
@param CurrentFvAddress Pointer to the current Firmware Volume under consideration
@retval EFI_SUCCESS Firmware Volume is legal
@retval EFI_SECURITY_VIOLATION Firmware Volume fails integrity test
**/
EFI_STATUS
VerifyFv (
IN EFI_FIRMWARE_VOLUME_HEADER *CurrentFvAddress
);
/**
Provide a callout to the security verification service.
@param PrivateData PeiCore's private data structure
@param VolumeHandle Handle of FV
@param FileHandle Handle of PEIM's ffs
@retval EFI_SUCCESS Image is OK
@retval EFI_SECURITY_VIOLATION Image is illegal
**/
EFI_STATUS
VerifyPeim (
IN PEI_CORE_INSTANCE *PrivateData,
IN EFI_PEI_FV_HANDLE VolumeHandle,
IN EFI_PEI_FILE_HANDLE FileHandle
);
/**
Gets the pointer to the HOB List.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param HobList Pointer to the HOB List.
@retval EFI_SUCCESS Get the pointer of HOB List
@retval EFI_NOT_AVAILABLE_YET the HOB List is not yet published
@retval EFI_INVALID_PARAMETER HobList is NULL (in debug mode)
**/
EFI_STATUS
EFIAPI
PeiGetHobList (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN OUT VOID **HobList
);
/**
Add a new HOB to the HOB List.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param Type Type of the new HOB.
@param Length Length of the new HOB to allocate.
@param Hob Pointer to the new HOB.
@return EFI_SUCCESS Success to create hob.
@retval EFI_INVALID_PARAMETER if Hob is NULL
@retval EFI_NOT_AVAILABLE_YET if HobList is still not available.
@retval EFI_OUT_OF_RESOURCES if there is no more memory to grow the Hoblist.
**/
EFI_STATUS
EFIAPI
PeiCreateHob (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN UINT16 Type,
IN UINT16 Length,
IN OUT VOID **Hob
);
/**
Builds a Handoff Information Table HOB
@param BootMode - Current Bootmode
@param MemoryBegin - Start Memory Address.
@param MemoryLength - Length of Memory.
@return EFI_SUCCESS Always success to initialize HOB.
**/
EFI_STATUS
PeiCoreBuildHobHandoffInfoTable (
IN EFI_BOOT_MODE BootMode,
IN EFI_PHYSICAL_ADDRESS MemoryBegin,
IN UINT64 MemoryLength
);
//
// FFS Fw Volume support functions
//
/**
Searches for the next matching file in the firmware volume.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param SearchType Filter to find only files of this type.
Type EFI_FV_FILETYPE_ALL causes no filtering to be done.
@param FvHandle Handle of firmware volume in which to search.
@param FileHandle On entry, points to the current handle from which to begin searching or NULL to start
at the beginning of the firmware volume. On exit, points the file handle of the next file
in the volume or NULL if there are no more files.
@retval EFI_NOT_FOUND The file was not found.
@retval EFI_NOT_FOUND The header checksum was not zero.
@retval EFI_SUCCESS The file was found.
**/
EFI_STATUS
EFIAPI
PeiFfsFindNextFile (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN UINT8 SearchType,
IN EFI_PEI_FV_HANDLE FvHandle,
IN OUT EFI_PEI_FILE_HANDLE *FileHandle
);
/**
Searches for the next matching section within the specified file.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
@param SectionType Filter to find only sections of this type.
@param FileHandle Pointer to the current file to search.
@param SectionData A pointer to the discovered section, if successful.
NULL if section not found
@retval EFI_NOT_FOUND The section was not found.
@retval EFI_SUCCESS The section was found.
**/
EFI_STATUS
EFIAPI
PeiFfsFindSectionData (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN EFI_SECTION_TYPE SectionType,
IN EFI_PEI_FILE_HANDLE FileHandle,
OUT VOID **SectionData
);
/**
Search the firmware volumes by index
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation
@param Instance This instance of the firmware volume to find. The value 0 is the Boot Firmware
Volume (BFV).
@param VolumeHandle On exit, points to the next volume handle or NULL if it does not exist.
@retval EFI_INVALID_PARAMETER VolumeHandle is NULL
@retval EFI_NOT_FOUND The volume was not found.
@retval EFI_SUCCESS The volume was found.
**/
EFI_STATUS
EFIAPI
PeiFfsFindNextVolume (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN UINTN Instance,
IN OUT EFI_PEI_FV_HANDLE *VolumeHandle
);
//
// Memory support functions
//
/**
Initialize the memory services.
@param PrivateData PeiCore's private data structure
@param SecCoreData Points to a data structure containing SEC to PEI handoff data, such as the size
and location of temporary RAM, the stack location and the BFV location.
@param OldCoreData Pointer to the PEI Core data.
NULL if being run in non-permament memory mode.
**/
VOID
InitializeMemoryServices (
IN PEI_CORE_INSTANCE *PrivateData,
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,
IN PEI_CORE_INSTANCE *OldCoreData
);
/**
Install the permanent memory is now available.
Creates HOB (PHIT and Stack).
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param MemoryBegin Start of memory address.
@param MemoryLength Length of memory.
@return EFI_SUCCESS Always success.
**/
EFI_STATUS
EFIAPI
PeiInstallPeiMemory (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN EFI_PHYSICAL_ADDRESS MemoryBegin,
IN UINT64 MemoryLength
);
/**
Memory allocation service on permanent memory,
not usable prior to the memory installation.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param MemoryType Type of memory to allocate.
@param Pages Number of pages to allocate.
@param Memory Pointer of memory allocated.
@retval EFI_SUCCESS The allocation was successful
@retval EFI_INVALID_PARAMETER Only AllocateAnyAddress is supported.
@retval EFI_NOT_AVAILABLE_YET Called with permanent memory not available
@retval EFI_OUT_OF_RESOURCES There is not enough HOB heap to satisfy the requirement
to allocate the number of pages.
**/
EFI_STATUS
EFIAPI
PeiAllocatePages (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Pages,
OUT EFI_PHYSICAL_ADDRESS *Memory
);
/**
Memory allocation service on the temporary memory.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param Size Amount of memory required
@param Buffer Address of pointer to the buffer
@retval EFI_SUCCESS The allocation was successful
@retval EFI_OUT_OF_RESOURCES There is not enough heap to satisfy the requirement
to allocate the requested size.
**/
EFI_STATUS
EFIAPI
PeiAllocatePool (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN UINTN Size,
OUT VOID **Buffer
);
/**
Routine for load image file.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param FileHandle Pointer to the FFS file header of the image.
@param PeimState The dispatch state of the input PEIM handle.
@param EntryPoint Pointer to entry point of specified image file for output.
@param AuthenticationState Pointer to attestation authentication state of image.
@retval EFI_SUCCESS Image is successfully loaded.
@retval EFI_NOT_FOUND Fail to locate necessary PPI
@retval Others Fail to load file.
**/
EFI_STATUS
PeiLoadImage (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_FILE_HANDLE FileHandle,
IN UINT8 PeimState,
OUT EFI_PHYSICAL_ADDRESS *EntryPoint,
OUT UINT32 *AuthenticationState
);
/**
Core version of the Status Code reporter
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param CodeType Type of Status Code.
@param Value Value to output for Status Code.
@param Instance Instance Number of this status code.
@param CallerId ID of the caller of this status code.
@param Data Optional data associated with this status code.
@retval EFI_SUCCESS if status code is successfully reported
@retval EFI_NOT_AVAILABLE_YET if StatusCodePpi has not been installed
**/
EFI_STATUS
EFIAPI
PeiReportStatusCode (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN EFI_STATUS_CODE_TYPE CodeType,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN CONST EFI_GUID *CallerId,
IN CONST EFI_STATUS_CODE_DATA *Data OPTIONAL
);
/**
Core version of the Reset System
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@retval EFI_NOT_AVAILABLE_YET PPI not available yet.
@retval EFI_DEVICE_ERROR Did not reset system.
Otherwise, resets the system.
**/
EFI_STATUS
EFIAPI
PeiResetSystem (
IN CONST EFI_PEI_SERVICES **PeiServices
);
/**
Initialize PeiCore Fv List.
@param PrivateData - Pointer to PEI_CORE_INSTANCE.
@param SecCoreData - Pointer to EFI_SEC_PEI_HAND_OFF.
**/
VOID
PeiInitializeFv (
IN PEI_CORE_INSTANCE *PrivateData,
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData
);
/**
Process Firmware Volum Information once FvInfoPPI install.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param NotifyDescriptor Address of the notification descriptor data structure.
@param Ppi Address of the PPI that was installed.
@retval EFI_SUCCESS if the interface could be successfully installed
**/
EFI_STATUS
EFIAPI
FirmwareVolmeInfoPpiNotifyCallback (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
IN VOID *Ppi
);
/**
Given the input VolumeHandle, search for the next matching name file.
@param FileName File name to search.
@param VolumeHandle The current FV to search.
@param FileHandle Pointer to the file matching name in VolumeHandle.
NULL if file not found
@retval EFI_NOT_FOUND No files matching the search criteria were found
@retval EFI_SUCCESS Success to search given file
**/
EFI_STATUS
EFIAPI
PeiFfsFindFileByName (
IN CONST EFI_GUID *FileName,
IN EFI_PEI_FV_HANDLE VolumeHandle,
OUT EFI_PEI_FILE_HANDLE *FileHandle
);
/**
Returns information about a specific file.
@param FileHandle Handle of the file.
@param FileInfo Upon exit, points to the file's information.
@retval EFI_INVALID_PARAMETER If FileInfo is NULL.
@retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file.
@retval EFI_SUCCESS File information returned.
**/
EFI_STATUS
EFIAPI
PeiFfsGetFileInfo (
IN EFI_PEI_FILE_HANDLE FileHandle,
OUT EFI_FV_FILE_INFO *FileInfo
);
/**
Returns information about the specified volume.
@param VolumeHandle Handle of the volume.
@param VolumeInfo Upon exit, points to the volume's information.
@retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume.
@retval EFI_INVALID_PARAMETER If VolumeInfo is NULL.
@retval EFI_SUCCESS Volume information returned.
**/
EFI_STATUS
EFIAPI
PeiFfsGetVolumeInfo (
IN EFI_PEI_FV_HANDLE VolumeHandle,
OUT EFI_FV_INFO *VolumeInfo
);
/**
This routine enable a PEIM to register itself to shadow when PEI Foundation
discovery permanent memory.
@param FileHandle File handle of a PEIM.
@retval EFI_NOT_FOUND The file handle doesn't point to PEIM itself.
@retval EFI_ALREADY_STARTED Indicate that the PEIM has been registered itself.
@retval EFI_SUCCESS Successfully to register itself.
**/
EFI_STATUS
EFIAPI
PeiRegisterForShadow (
IN EFI_PEI_FILE_HANDLE FileHandle
);
/**
Initialize image service that install PeiLoadFilePpi.
@param PrivateData Pointer to PeiCore's private data structure PEI_CORE_INSTANCE.
@param OldCoreData Pointer to Old PeiCore's private data.
If NULL, PeiCore is entered at first time, stack/heap in temporary memory.
If not NULL, PeiCore is entered at second time, stack/heap has been moved
to permenent memory.
**/
VOID
InitializeImageServices (
IN PEI_CORE_INSTANCE *PrivateData,
IN PEI_CORE_INSTANCE *OldCoreData
);
/**
The wrapper function of PeiLoadImageLoadImage().
@param This Pointer to EFI_PEI_LOAD_FILE_PPI.
@param FileHandle Pointer to the FFS file header of the image.
@param ImageAddressArg Pointer to PE/TE image.
@param ImageSizeArg Size of PE/TE image.
@param EntryPoint Pointer to entry point of specified image file for output.
@param AuthenticationState Pointer to attestation authentication state of image.
@return Status of PeiLoadImageLoadImage().
**/
EFI_STATUS
EFIAPI
PeiLoadImageLoadImageWrapper (
IN CONST EFI_PEI_LOAD_FILE_PPI *This,
IN EFI_PEI_FILE_HANDLE FileHandle,
OUT EFI_PHYSICAL_ADDRESS *ImageAddressArg, OPTIONAL
OUT UINT64 *ImageSizeArg, OPTIONAL
OUT EFI_PHYSICAL_ADDRESS *EntryPoint,
OUT UINT32 *AuthenticationState
);
/**
Provide a callback for when the security PPI is installed.
@param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
@param NotifyDescriptor The descriptor for the notification event.
@param Ppi Pointer to the PPI in question.
@return Always success
**/
EFI_STATUS
EFIAPI
SecurityPpiNotifyCallback (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
IN VOID *Ppi
);
/**
Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.
@param ParentFvCoreHandle Pointer of EFI_CORE_FV_HANDLE to parent Fv image that contain this Fv image.
@param ParentFvFileHandle File handle of a Fv type file that contain this Fv image.
@retval EFI_NOT_FOUND FV image can't be found.
@retval EFI_SUCCESS Successfully to process it.
@retval EFI_OUT_OF_RESOURCES Can not allocate page when aligning FV image
@retval Others Can not find EFI_SECTION_FIRMWARE_VOLUME_IMAGE section
**/
EFI_STATUS
ProcessFvFile (
IN PEI_CORE_FV_HANDLE *ParentFvCoreHandle,
IN EFI_PEI_FILE_HANDLE ParentFvFileHandle
);
/**
Get instance of PEI_CORE_FV_HANDLE for next volume according to given index.
This routine also will install FvInfo ppi for FV hob in PI ways.
@param Private Pointer of PEI_CORE_INSTANCE
@param Instance The index of FV want to be searched.
@return Instance of PEI_CORE_FV_HANDLE.
**/
PEI_CORE_FV_HANDLE *
FindNextCoreFvHandle (
IN PEI_CORE_INSTANCE *Private,
IN UINTN Instance
);
//
// Default EFI_PEI_CPU_IO_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
//
/**
Memory-based read services.
This function is to perform the Memory Access Read service based on installed
instance of the EFI_PEI_CPU_IO_PPI.
If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
return EFI_NOT_YET_AVAILABLE.
@param PeiServices An indirect pointer to the PEI Services Table
published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Width The width of the access. Enumerated in bytes.
@param Address The physical address of the access.
@param Count The number of accesses to perform.
@param Buffer A pointer to the buffer of data.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_NOT_YET_AVAILABLE The service has not been installed.
**/
EFI_STATUS
EFIAPI
PeiDefaultMemRead (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN EFI_PEI_CPU_IO_PPI_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
);
/**
Memory-based write services.
This function is to perform the Memory Access Write service based on installed
instance of the EFI_PEI_CPU_IO_PPI.
If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
return EFI_NOT_YET_AVAILABLE.
@param PeiServices An indirect pointer to the PEI Services Table
published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Width The width of the access. Enumerated in bytes.
@param Address The physical address of the access.
@param Count The number of accesses to perform.
@param Buffer A pointer to the buffer of data.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_NOT_YET_AVAILABLE The service has not been installed.
**/
EFI_STATUS
EFIAPI
PeiDefaultMemWrite (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN EFI_PEI_CPU_IO_PPI_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
);
/**
IO-based read services.
This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.
If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
return EFI_NOT_YET_AVAILABLE.
@param PeiServices An indirect pointer to the PEI Services Table
published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Width The width of the access. Enumerated in bytes.
@param Address The physical address of the access.
@param Count The number of accesses to perform.
@param Buffer A pointer to the buffer of data.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_NOT_YET_AVAILABLE The service has not been installed.
**/
EFI_STATUS
EFIAPI
PeiDefaultIoRead (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN EFI_PEI_CPU_IO_PPI_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
);
/**
IO-based write services.
This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.
If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
return EFI_NOT_YET_AVAILABLE.
@param PeiServices An indirect pointer to the PEI Services Table
published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Width The width of the access. Enumerated in bytes.
@param Address The physical address of the access.
@param Count The number of accesses to perform.
@param Buffer A pointer to the buffer of data.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_NOT_YET_AVAILABLE The service has not been installed.
**/
EFI_STATUS
EFIAPI
PeiDefaultIoWrite (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN EFI_PEI_CPU_IO_PPI_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
);
/**
8-bit I/O read operations.
If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
return 0.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@return An 8-bit value returned from the I/O space.
**/
UINT8
EFIAPI
PeiDefaultIoRead8 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
/**
Reads an 16-bit I/O port.
If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
return 0.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@return A 16-bit value returned from the I/O space.
**/
UINT16
EFIAPI
PeiDefaultIoRead16 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
/**
Reads an 32-bit I/O port.
If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
return 0.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@return A 32-bit value returned from the I/O space.
**/
UINT32
EFIAPI
PeiDefaultIoRead32 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
/**
Reads an 64-bit I/O port.
If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
return 0.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@return A 64-bit value returned from the I/O space.
**/
UINT64
EFIAPI
PeiDefaultIoRead64 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
/**
8-bit I/O write operations.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@param Data The data to write.
**/
VOID
EFIAPI
PeiDefaultIoWrite8 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT8 Data
);
/**
16-bit I/O write operations.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@param Data The data to write.
**/
VOID
EFIAPI
PeiDefaultIoWrite16 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT16 Data
);
/**
32-bit I/O write operations.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@param Data The data to write.
**/
VOID
EFIAPI
PeiDefaultIoWrite32 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT32 Data
);
/**
64-bit I/O write operations.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@param Data The data to write.
**/
VOID
EFIAPI
PeiDefaultIoWrite64 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT64 Data
);
/**
8-bit memory read operations.
If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
return 0.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@return An 8-bit value returned from the memory space.
**/
UINT8
EFIAPI
PeiDefaultMemRead8 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
/**
16-bit memory read operations.
If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
return 0.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@return An 16-bit value returned from the memory space.
**/
UINT16
EFIAPI
PeiDefaultMemRead16 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
/**
32-bit memory read operations.
If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
return 0.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@return An 32-bit value returned from the memory space.
**/
UINT32
EFIAPI
PeiDefaultMemRead32 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
/**
64-bit memory read operations.
If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
return 0.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@return An 64-bit value returned from the memory space.
**/
UINT64
EFIAPI
PeiDefaultMemRead64 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
/**
8-bit memory write operations.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@param Data The data to write.
**/
VOID
EFIAPI
PeiDefaultMemWrite8 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT8 Data
);
/**
16-bit memory write operations.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@param Data The data to write.
**/
VOID
EFIAPI
PeiDefaultMemWrite16 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT16 Data
);
/**
32-bit memory write operations.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@param Data The data to write.
**/
VOID
EFIAPI
PeiDefaultMemWrite32 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT32 Data
);
/**
64-bit memory write operations.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Address The physical address of the access.
@param Data The data to write.
**/
VOID
EFIAPI
PeiDefaultMemWrite64 (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT64 Data
);
extern EFI_PEI_CPU_IO_PPI gPeiDefaultCpuIoPpi;
//
// Default EFI_PEI_PCI_CFG2_PPI support for EFI_PEI_SERVICES table when PeiCore initialization.
//
/**
Reads from a given location in the PCI configuration space.
If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
return EFI_NOT_YET_AVAILABLE.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Width The width of the access. Enumerated in bytes.
See EFI_PEI_PCI_CFG_PPI_WIDTH above.
@param Address The physical address of the access. The format of
the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
@param Buffer A pointer to the buffer of data.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER The invalid access width.
@retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
**/
EFI_STATUS
EFIAPI
PeiDefaultPciCfg2Read (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_PCI_CFG2_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN OUT VOID *Buffer
);
/**
Write to a given location in the PCI configuration space.
If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM, then
return EFI_NOT_YET_AVAILABLE.
@param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Width The width of the access. Enumerated in bytes.
See EFI_PEI_PCI_CFG_PPI_WIDTH above.
@param Address The physical address of the access. The format of
the address is described by EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS.
@param Buffer A pointer to the buffer of data.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER The invalid access width.
@retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
**/
EFI_STATUS
EFIAPI
PeiDefaultPciCfg2Write (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_PCI_CFG2_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN OUT VOID *Buffer
);
/**
This function performs a read-modify-write operation on the contents from a given
location in the PCI configuration space.
@param PeiServices An indirect pointer to the PEI Services Table
published by the PEI Foundation.
@param This Pointer to local data for the interface.
@param Width The width of the access. Enumerated in bytes. Type
EFI_PEI_PCI_CFG_PPI_WIDTH is defined in Read().
@param Address The physical address of the access.
@param SetBits Points to value to bitwise-OR with the read configuration value.
The size of the value is determined by Width.
@param ClearBits Points to the value to negate and bitwise-AND with the read configuration value.
The size of the value is determined by Width.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER The invalid access width.
@retval EFI_NOT_YET_AVAILABLE If the EFI_PEI_PCI_CFG2_PPI is not installed by platform/chipset PEIM.
**/
EFI_STATUS
EFIAPI
PeiDefaultPciCfg2Modify (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_PCI_CFG2_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN VOID *SetBits,
IN VOID *ClearBits
);
extern EFI_PEI_PCI_CFG2_PPI gPeiDefaultPciCfg2Ppi;
/**
After PeiCore image is shadowed into permanent memory, all build-in FvPpi should
be re-installed with the instance in permanent memory and all cached FvPpi pointers in
PrivateData->Fv[] array should be fixed up to be pointed to the one in permenant
memory.
@param PrivateData Pointer to PEI_CORE_INSTANCE.
**/
VOID
PeiReinitializeFv (
IN PEI_CORE_INSTANCE *PrivateData
);
#endif
|
{
"content_hash": "145ed3b8e4ffb33ad312caa70c5da2c4",
"timestamp": "",
"source": "github",
"line_count": 1619,
"max_line_length": 121,
"avg_line_length": 33.203829524397776,
"alnum_prop": 0.6437487210967874,
"repo_name": "egraba/vbox_openbsd",
"id": "40b0ac27afad1c4cad8f22036838daab4b7b7c6c",
"size": "54299",
"binary": false,
"copies": "11",
"ref": "refs/heads/master",
"path": "VirtualBox-5.0.0/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Core/Pei/PeiMain.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ada",
"bytes": "88714"
},
{
"name": "Assembly",
"bytes": "4303680"
},
{
"name": "AutoIt",
"bytes": "2187"
},
{
"name": "Batchfile",
"bytes": "95534"
},
{
"name": "C",
"bytes": "192632221"
},
{
"name": "C#",
"bytes": "64255"
},
{
"name": "C++",
"bytes": "83842667"
},
{
"name": "CLIPS",
"bytes": "5291"
},
{
"name": "CMake",
"bytes": "6041"
},
{
"name": "CSS",
"bytes": "26756"
},
{
"name": "D",
"bytes": "41844"
},
{
"name": "DIGITAL Command Language",
"bytes": "56579"
},
{
"name": "DTrace",
"bytes": "1466646"
},
{
"name": "GAP",
"bytes": "350327"
},
{
"name": "Groff",
"bytes": "298540"
},
{
"name": "HTML",
"bytes": "467691"
},
{
"name": "IDL",
"bytes": "106734"
},
{
"name": "Java",
"bytes": "261605"
},
{
"name": "JavaScript",
"bytes": "80927"
},
{
"name": "Lex",
"bytes": "25122"
},
{
"name": "Logos",
"bytes": "4941"
},
{
"name": "Makefile",
"bytes": "426902"
},
{
"name": "Module Management System",
"bytes": "2707"
},
{
"name": "NSIS",
"bytes": "177212"
},
{
"name": "Objective-C",
"bytes": "5619792"
},
{
"name": "Objective-C++",
"bytes": "81554"
},
{
"name": "PHP",
"bytes": "58585"
},
{
"name": "Pascal",
"bytes": "69941"
},
{
"name": "Perl",
"bytes": "240063"
},
{
"name": "PowerShell",
"bytes": "10664"
},
{
"name": "Python",
"bytes": "9094160"
},
{
"name": "QMake",
"bytes": "3055"
},
{
"name": "R",
"bytes": "21094"
},
{
"name": "SAS",
"bytes": "1847"
},
{
"name": "Shell",
"bytes": "1460572"
},
{
"name": "SourcePawn",
"bytes": "4139"
},
{
"name": "TypeScript",
"bytes": "142342"
},
{
"name": "Visual Basic",
"bytes": "7161"
},
{
"name": "XSLT",
"bytes": "1034475"
},
{
"name": "Yacc",
"bytes": "22312"
}
],
"symlink_target": ""
}
|
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "d60a9fe9cb644a6443ca186bbb0cee85",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "8a3419af16bf891999fd44c36127eb5038c79de3",
"size": "183",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Goodeniaceae/Dampiera/Dampiera salahae/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
}
|
package net.tomp2p.nat;
import java.io.IOException;
import java.net.InetAddress;
import javax.xml.parsers.ParserConfigurationException;
import net.tomp2p.natpmp.Gateway;
import net.tomp2p.natpmp.MapRequestMessage;
import net.tomp2p.natpmp.NatPmpDevice;
import net.tomp2p.natpmp.NatPmpException;
import net.tomp2p.natpmp.ResultCode;
import org.bitlet.weupnp.GatewayDevice;
import org.bitlet.weupnp.GatewayDiscover;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
/**
* This class is used to do automatic port forwarding. It maps with PMP und UPNP
* and also unmaps them. It creates a shutdown hook in case the user exits the
* application without a proper shutdown.
*
* @author Thomas Bocek
*/
public class NATUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(NATUtils.class);
// UPNP
private GatewayDevice gatewayDevice;
private int externalPortTCP = -1;
private int externalPortUDP = -1;
// NAT-PMP
private NatPmpDevice pmpDevice;
private final Object shutdownLock = new Object();
/**
* Constructor.
*/
public NATUtils() {
shutdownHookEnabled();
}
/**
* Maps with the PMP protocol
* (http://en.wikipedia.org/wiki/NAT_Port_Mapping_Protocol). One of the
* drawbacks of this protocol is that it needs to know the IP of the router.
* To get the IP of the router in Java, we need to use netstat and parse the
* output.
*
* @param internalPortUDP
* The UDP internal port
* @param internalPortTCP
* The TCP internal port
* @param externalPortUDP
* The UDP external port
* @param externalPortTCP
* The TCP external port
* @return True, if the mapping was successful (i.e. the router supports
* PMP)
* @throws NatPmpException
* the router does not supports PMP
*/
public boolean mapPMP(final int internalPortUDP, final int internalPortTCP, final int externalPortUDP,
final int externalPortTCP) throws NatPmpException {
InetAddress gateway = Gateway.getIP();
pmpDevice = new NatPmpDevice(gateway);
MapRequestMessage mapTCP = new MapRequestMessage(true, internalPortTCP, externalPortTCP, Integer.MAX_VALUE,
null);
MapRequestMessage mapUDP = new MapRequestMessage(false, internalPortUDP, externalPortUDP, Integer.MAX_VALUE,
null);
pmpDevice.enqueueMessage(mapTCP);
pmpDevice.enqueueMessage(mapUDP);
pmpDevice.waitUntilQueueEmpty();
// UDP is nice to have, but we need TCP
return mapTCP.getResultCode() == ResultCode.Success;
}
/**
* Maps with UPNP protocol
* (http://en.wikipedia.org/wiki/Internet_Gateway_Device_Protocol). Since
* this uses broadcasting to discover routers, no calling the external
* program netstat is necessary.
*
* @param internalHost
* The internal host to map the ports to
* @param internalPortUDP
* The UDP internal port
* @param internalPortTCP
* The TCP internal port
* @param externalPortUDP
* The UDP external port
* @param externalPortTCP
* The TCP external port
* @return True, if at least one mapping was successful (i.e. the router
* supports UPNP)
* @throws IOException
* Exception
* @throws SAXException
* @throws ParserConfigurationException
*/
public boolean mapUPNP(final String internalHost, final int internalPortUDP, final int internalPortTCP,
final int externalPortUDP, final int externalPortTCP) throws IOException, SAXException,
ParserConfigurationException {
// -1 sets the default timeout to 1500 ms
if (gatewayDevice != null) {
gatewayDevice.deletePortMapping(this.externalPortTCP, "TCP");
gatewayDevice.deletePortMapping(this.externalPortUDP, "UDP");
}
GatewayDiscover discover = new GatewayDiscover();
discover.discover();
gatewayDevice = discover.getValidGateway();
if (gatewayDevice == null) {
LOGGER.info("no UPNP device found");
return false;
}
this.externalPortTCP = externalPortTCP;
this.externalPortUDP = externalPortUDP;
boolean mapTCP = gatewayDevice.addPortMapping(externalPortTCP, internalPortTCP, internalHost, "TCP",
"TomP2P mapping TCP");
boolean mapUDP = gatewayDevice.addPortMapping(externalPortUDP, internalPortUDP, internalHost, "UDP",
"TomP2P mapping UDP");
if (mapTCP && mapUDP) {
return true;
} else {
if (!mapTCP) {
LOGGER.warn("UPNP TCP mapping did failed");
}
if (!mapUDP) {
LOGGER.warn("UPNP UDP mapping did failed");
}
return false;
}
}
/**
* Unmap the device that has been mapped previously. Used during shutdown.
*
* @throws SAXException
* @throws IOException
*/
private void unmapUPNP() throws SAXException, IOException {
if (gatewayDevice != null) {
try {
boolean unmapTCP = gatewayDevice.deletePortMapping(this.externalPortTCP, "TCP");
boolean unmapUDP = gatewayDevice.deletePortMapping(this.externalPortUDP, "UDP");
if (!unmapTCP) {
LOGGER.warn("UPNP TCP unmapping did failed");
}
if (!unmapUDP) {
LOGGER.warn("UPNP UDP unmapping did failed");
}
} finally {
gatewayDevice = null;
}
}
}
/**
* Registers a shutdownhook to clean the NAT mapping. If this is not called,
* then the mapping may stay until the router is rebooted.
*/
private void shutdownHookEnabled() {
// The shutdown hook simply runs the shutdown method.
Thread t = new Thread(new Runnable() {
public void run() {
shutdown();
}
}, "TomP2P:NATUtils:ShutdownHook");
Runtime.getRuntime().addShutdownHook(t);
}
/**
* Since shutdown is also called from the shutdown hook, it might get called
* twice. Thus, this method deregister NAT mappings only once. If it already
* has been called, this method does nothing.
*/
public void shutdown() {
synchronized (shutdownLock) {
try {
unmapUPNP();
} catch (Exception e) {
LOGGER.error("UPNP UDP unmapping did failed", e);
}
if (pmpDevice != null) {
pmpDevice.shutdown();
pmpDevice = null;
}
}
}
}
|
{
"content_hash": "ca11290330cc2b8feda35c8a3f039940",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 110,
"avg_line_length": 30.455,
"alnum_prop": 0.7002134296503038,
"repo_name": "tomp2p/TomP2P",
"id": "71f7e461070dc42c81dd658a857119799e111959",
"size": "6682",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "nat/src/main/java/net/tomp2p/nat/NATUtils.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2328370"
},
{
"name": "Shell",
"bytes": "7045"
}
],
"symlink_target": ""
}
|
/****************************************************************************
** Meta object code from reading C++ file 'bitcoinamountfield.h'
**
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "qt/bitcoinamountfield.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'bitcoinamountfield.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.2.1. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
struct qt_meta_stringdata_BitcoinAmountField_t {
QByteArrayData data[6];
char stringdata[56];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
offsetof(qt_meta_stringdata_BitcoinAmountField_t, stringdata) + ofs \
- idx * sizeof(QByteArrayData) \
)
static const qt_meta_stringdata_BitcoinAmountField_t qt_meta_stringdata_BitcoinAmountField = {
{
QT_MOC_LITERAL(0, 0, 18),
QT_MOC_LITERAL(1, 19, 12),
QT_MOC_LITERAL(2, 32, 0),
QT_MOC_LITERAL(3, 33, 11),
QT_MOC_LITERAL(4, 45, 3),
QT_MOC_LITERAL(5, 49, 5)
},
"BitcoinAmountField\0valueChanged\0\0"
"unitChanged\0idx\0value\0"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_BitcoinAmountField[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
2, 14, // methods
1, 28, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
1, // signalCount
// signals: name, argc, parameters, tag, flags
1, 0, 24, 2, 0x06,
// slots: name, argc, parameters, tag, flags
3, 1, 25, 2, 0x08,
// signals: parameters
QMetaType::Void,
// slots: parameters
QMetaType::Void, QMetaType::Int, 4,
// properties: name, type, flags
5, QMetaType::LongLong, 0x00595103,
// properties: notify_signal_id
0,
0 // eod
};
void BitcoinAmountField::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
BitcoinAmountField *_t = static_cast<BitcoinAmountField *>(_o);
switch (_id) {
case 0: _t->valueChanged(); break;
case 1: _t->unitChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
default: ;
}
} else if (_c == QMetaObject::IndexOfMethod) {
int *result = reinterpret_cast<int *>(_a[0]);
void **func = reinterpret_cast<void **>(_a[1]);
{
typedef void (BitcoinAmountField::*_t)();
if (*reinterpret_cast<_t *>(func) == static_cast<_t>(&BitcoinAmountField::valueChanged)) {
*result = 0;
}
}
}
}
const QMetaObject BitcoinAmountField::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_BitcoinAmountField.data,
qt_meta_data_BitcoinAmountField, qt_static_metacall, 0, 0}
};
const QMetaObject *BitcoinAmountField::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *BitcoinAmountField::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_BitcoinAmountField.stringdata))
return static_cast<void*>(const_cast< BitcoinAmountField*>(this));
return QWidget::qt_metacast(_clname);
}
int BitcoinAmountField::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 2)
qt_static_metacall(this, _c, _id, _a);
_id -= 2;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 2)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 2;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< qint64*>(_v) = value(); break;
}
_id -= 1;
} else if (_c == QMetaObject::WriteProperty) {
void *_v = _a[0];
switch (_id) {
case 0: setValue(*reinterpret_cast< qint64*>(_v)); break;
}
_id -= 1;
} else if (_c == QMetaObject::ResetProperty) {
_id -= 1;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 1;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 1;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 1;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 1;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 1;
} else if (_c == QMetaObject::RegisterPropertyMetaType) {
if (_id < 1)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 1;
}
#endif // QT_NO_PROPERTIES
return _id;
}
// SIGNAL 0
void BitcoinAmountField::valueChanged()
{
QMetaObject::activate(this, &staticMetaObject, 0, 0);
}
QT_END_MOC_NAMESPACE
|
{
"content_hash": "1656905fd24c6365daa0a2dc51a39360",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 102,
"avg_line_length": 31.08823529411765,
"alnum_prop": 0.5765373699148534,
"repo_name": "dkcoinus/dkcoin_src",
"id": "253b13d06f4452fdf18d53e7c4848cbcacf98f54",
"size": "5285",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/qt/moc_bitcoinamountfield.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "468518"
},
{
"name": "C++",
"bytes": "4144533"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "Groff",
"bytes": "2108838"
},
{
"name": "HTML",
"bytes": "50621"
},
{
"name": "Java",
"bytes": "2100"
},
{
"name": "Makefile",
"bytes": "104165"
},
{
"name": "NSIS",
"bytes": "12610"
},
{
"name": "Objective-C",
"bytes": "2023"
},
{
"name": "Objective-C++",
"bytes": "7238"
},
{
"name": "Protocol Buffer",
"bytes": "2308"
},
{
"name": "Python",
"bytes": "401297"
},
{
"name": "QMake",
"bytes": "2019"
},
{
"name": "Shell",
"bytes": "756588"
}
],
"symlink_target": ""
}
|
#include "Type.h"
class TechParameter;
class AmpUnit
{
public:
enum AmpModel
{
NO_MODEL = 0,
GENERIC_AMP
};
public:
AmpUnit(
const string& amp_model_str_,
const TechParameter* tech_param_ptr_
);
~AmpUnit();
public:
double get_e_access() const { return m_e_access; }
private:
void init();
private:
AmpModel m_amp_model;
const TechParameter* m_tech_param_ptr;
double m_e_access;
};
#endif
|
{
"content_hash": "c99d81a33c88d14c9be9813ac56ad5c0",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 54,
"avg_line_length": 14.194444444444445,
"alnum_prop": 0.547945205479452,
"repo_name": "mit-carbon/Graphite-Cycle-Level",
"id": "0abee5721e22fdf99db25a66d6fbccde2c60d9e8",
"size": "557",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "contrib/orion/Buffer/AmpUnit.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "524506"
},
{
"name": "C++",
"bytes": "1622279"
},
{
"name": "Python",
"bytes": "2668"
},
{
"name": "Shell",
"bytes": "81"
}
],
"symlink_target": ""
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>zchinese: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.5.3 / zchinese - 8.6.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
zchinese
<small>
8.6.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-09-09 17:35:02 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-09-09 17:35:02 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.5.3 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.05.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.05.0 Official 4.05.0 release
ocaml-config 1 OCaml Switch Configuration
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/zchinese"
license: "Unknown"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/ZChinese"]
depends: [
"ocaml"
"coq" {>= "8.6" & < "8.7~"}
]
tags: [ "keyword: number theory" "keyword: chinese remainder" "keyword: primality" "keyword: prime numbers" "category: Mathematics/Arithmetic and Number Theory/Number theory" "category: Miscellaneous/Extracted Programs/Arithmetic" ]
authors: [ "Valérie Ménissier-Morain" ]
bug-reports: "https://github.com/coq-contribs/zchinese/issues"
dev-repo: "git+https://github.com/coq-contribs/zchinese.git"
synopsis: "A proof of the Chinese Remainder Lemma"
description:
"This is a rewriting of the contribution chinese-lemma using Zarith"
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/zchinese/archive/v8.6.0.tar.gz"
checksum: "md5=8eea3be462566ab13f9fb3b856ae313b"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-zchinese.8.6.0 coq.8.5.3</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.5.3).
The following dependencies couldn't be met:
- coq-zchinese -> coq >= 8.6
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-zchinese.8.6.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
|
{
"content_hash": "21ec1c4f2eb65d077e68a3207c1688c8",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 292,
"avg_line_length": 42.25609756097561,
"alnum_prop": 0.5455988455988456,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "723f0a947e6b85c15ce38943b8616cfc5105f2fd",
"size": "6957",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.05.0-2.0.1/released/8.5.3/zchinese/8.6.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
}
|
.wrapper{ /*width:954px;*/ }
.ui-btn, .ui-btn-prev, .ui-btn-next { margin-right:10px; }
.bills{ position:relative; float:left; width:1002px; background:#FFFFFF; border:1px solid #CFCFCF; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); padding: 10px 20px 10px 20px; }
.con-header { padding: 10px; }
.con-header dd { float: left; line-height: 30px; }
.p40{ width:40%; }
.p35{ width:35%; *width:34.9%;}
.p30{ width:30%; *width:29.9%;}
.p25{ width:25%; }
.p20{ width:20%; }
#identifier { /*margin-right: 36px;*/ }
#classes { float: right; /*margin-right: 10px;*/ }
#classes label { margin-left: 15px; }
.con-footer { padding: 10px 0; }
.con-footer p { margin-bottom: 10px; }
.con-footer label { display: inline-block; width: 75px; }
.con-footer span { padding-left: 30px; }
.con-footer .label-wrap{ width:75px;float:left;display:inline;line-height:30px;}
.con-footer .ctn-wrap{ overflow:hidden; padding:0 6px 0 10px; }
#note { width: 911px; }
.ui-jqgrid-bdiv .ui-state-highlight { background: none; }
.operating .ui-icon{ margin:0; }
.ui-widget-content .ui-icon {
background-image: url(img/ui-icons.png)/*{iconsContent}*/;
}
.ui-icon-plus { background-position:-80px 0; }
.ui-icon-trash { background-position:-64px 0; }
.ui-state-hover .ui-icon-plus { background-position:-80px 0; }
.ui-state-hover .ui-icon-trash { background-position:-64px 0; }
.ui-state-active .ui-icon {
background-image: url(img/ui-icons.png)/*{iconsActive}*/;
}
.has-audit{ width: 150px; height: 74px; background: url(img/audit.png) 0 0 no-repeat; position: absolute; right: 40px; bottom: 65px; }
.line{ line-height:0; height:0; border:none; border-bottom:1px dashed #CCC; color:#CCC; font-size:0; margin:18px 0; }
.ui-icon-folder-open{ display:inline-block; vertical-align:middle; margin:0 0 0 3px; }
#toolBottom{ margin-right:-10px; }
.shadow{-moz-box-shadow:1px 1px 3px rgba(0,0,0,.4); -webkit-box-shadow:1px 1px 3px rgba(0,0,0,.4); box-shadow:1px 1px 3px rgba(0,0,0,.4); }
.target_box{width:150px; padding:10px; border:1px solid #aaa; background-color:#fff;}
.target_box ul{ height:200px; overflow:auto; }
.target_box li{padding:4px; border-bottom:1px dotted #ddd; cursor:pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.target_box li:hover{ background:#f8f8f8; color:#cd0000;}
|
{
"content_hash": "d27606cc0e8c20e9174cd962f52beed3",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 172,
"avg_line_length": 54.142857142857146,
"alnum_prop": 0.6961301671064204,
"repo_name": "smart-vole/competition",
"id": "9efc2a4692990c2a3444f8c9faa844c806790ff5",
"size": "2274",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "shiro-web/src/main/webapp/static/css/blue/bills.css",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "752700"
},
{
"name": "Java",
"bytes": "1087518"
},
{
"name": "JavaScript",
"bytes": "493463"
},
{
"name": "PureBasic",
"bytes": "1005"
}
],
"symlink_target": ""
}
|
package edu.terryp.ee632.blackjack;
// Jackserver.java
import java.io.*;
import java.net.*;
import java.util.*;
public class Jackserver
{
public Jackserver (int port) throws IOException {
ServerSocket server = new ServerSocket (port);
while (true) {
Socket player = server.accept();
JackHandler j = new JackHandler (player);
j.start ();
}
}
public static void main (String[] args) throws IOException
{
// if (args.length !=2) throw new RuntimeException ("Syntax: Jackserver <port> <number of players>");
// new Jackserver (Integer.parseInt(args[0]), Integer.parseInt(args[1]));
if (args.length !=1) throw new RuntimeException ("Syntax: Jackserver <port>");
new Jackserver (Integer.parseInt(args[0]));
}
}
|
{
"content_hash": "9089d811ec29274b9e44603f2974ac39",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 102,
"avg_line_length": 27.37037037037037,
"alnum_prop": 0.6955345060893099,
"repo_name": "pitpitman/GraduateWork",
"id": "ae69ded2668e9cc5b54b8d25d430f936b028d17d",
"size": "739",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "EE632/blackjack/src/edu/terryp/ee632/blackjack/Jackserver.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "66281"
},
{
"name": "C",
"bytes": "143599"
},
{
"name": "C++",
"bytes": "86459"
},
{
"name": "CSS",
"bytes": "26409"
},
{
"name": "Common Lisp",
"bytes": "2491"
},
{
"name": "Groff",
"bytes": "50553"
},
{
"name": "HTML",
"bytes": "9543552"
},
{
"name": "Java",
"bytes": "4712599"
},
{
"name": "JavaScript",
"bytes": "4227"
},
{
"name": "Makefile",
"bytes": "6748"
},
{
"name": "Perl",
"bytes": "379818"
},
{
"name": "Perl6",
"bytes": "2424"
},
{
"name": "PostScript",
"bytes": "628801"
},
{
"name": "Prolog",
"bytes": "22274"
},
{
"name": "Shell",
"bytes": "178966"
},
{
"name": "XSLT",
"bytes": "10526"
}
],
"symlink_target": ""
}
|
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Get-IndexedItem ',
'Author': ['@James O\'Neill'],
'Description': ('Gets files which have been indexed by Windows desktop search.'),
'Background' : False,
'OutputExtension' : None,
'NeedsAdmin' : False,
'OpsecSafe' : True,
'Language' : 'powershell',
'MinLanguageVersion' : '2',
'Comments': [
'https://gallery.technet.microsoft.com/scriptcenter/Get-IndexedItem-PowerShell-5bca2dae'
]
}
# any options needed by the module, settable during runtime
self.options = {
# format:
# value_name : {description, required, default_value}
'Agent' : {
'Description' : 'Agent to run module on.',
'Required' : True,
'Value' : ''
},
'Terms' : {
'Description' : 'Terms to query the search indexer for.',
'Required' : True,
'Value' : 'password,pass,sensitive,admin,login,secret,creds,credentials'
}
}
# save off a copy of the mainMenu object to access external functionality
# like listeners/agent handlers/etc.
self.mainMenu = mainMenu
for param in params:
# parameter format is [Name, Value]
option, value = param
if option in self.options:
self.options[option]['Value'] = value
def generate(self):
# read in the common module source code
moduleSource = self.mainMenu.installPath + "/data/module_source/collection/Get-IndexedItem.ps1"
try:
f = open(moduleSource, 'r')
except:
print helpers.color("[!] Could not read module source path at: " + str(moduleSource))
return ""
moduleCode = f.read()
f.close()
script = moduleCode
script += "Get-IndexedItem "
for option,values in self.options.iteritems():
if option.lower() != "agent":
if values['Value'] and values['Value'] != '':
if values['Value'].lower() == "true":
# if we're just adding a switch
script += " -" + str(option)
else:
script += " -" + str(option) + " " + str(values['Value'])
# extract the fields we want
script += " | ?{!($_.ITEMURL -like '*AppData*')} | Select-Object ITEMURL, COMPUTERNAME, FILEOWNER, SIZE, DATECREATED, DATEACCESSED, DATEMODIFIED, AUTOSUMMARY"
script += " | fl | Out-String;"
return script
|
{
"content_hash": "13122ba9db53c695a8d8298aedd77cb0",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 166,
"avg_line_length": 32.71910112359551,
"alnum_prop": 0.4989697802197802,
"repo_name": "Hackplayers/Empire-mod-Hpys-tests",
"id": "25039924a02171ef5be2d0647ed64f6cd8014f90",
"size": "2912",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/modules/powershell/collection/get_indexed_item.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "1966"
},
{
"name": "Java",
"bytes": "496"
},
{
"name": "Objective-C",
"bytes": "2664"
},
{
"name": "PHP",
"bytes": "2041"
},
{
"name": "PowerShell",
"bytes": "16200977"
},
{
"name": "Python",
"bytes": "2675256"
},
{
"name": "Shell",
"bytes": "3603"
}
],
"symlink_target": ""
}
|
package org.apache.hadoop.hbase.io.hfile;
import org.apache.hadoop.hbase.io.HeapSize;
import org.apache.yetus.audience.InterfaceAudience;
/**
* In-memory BlockCache that may be backed by secondary layer(s).
*/
@InterfaceAudience.Private
public interface FirstLevelBlockCache extends ResizableBlockCache, HeapSize {
/**
* Whether the cache contains the block with specified cacheKey
*
* @param cacheKey cache key for the block
* @return true if it contains the block
*/
boolean containsBlock(BlockCacheKey cacheKey);
/**
* Specifies the secondary cache. An entry that is evicted from this cache due to a size
* constraint will be inserted into the victim cache.
*
* @param victimCache the second level cache
* @throws IllegalArgumentException if the victim cache had already been set
*/
void setVictimCache(BlockCache victimCache);
}
|
{
"content_hash": "98aa9ea59ed51c928fb43c6488c39be1",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 90,
"avg_line_length": 30.379310344827587,
"alnum_prop": 0.7502837684449489,
"repo_name": "ChinmaySKulkarni/hbase",
"id": "a0c34c9fe3ef834c61055093c3f40b15aca158d9",
"size": "1687",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/FirstLevelBlockCache.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "25330"
},
{
"name": "C",
"bytes": "28534"
},
{
"name": "C++",
"bytes": "56085"
},
{
"name": "CMake",
"bytes": "13186"
},
{
"name": "CSS",
"bytes": "37063"
},
{
"name": "Dockerfile",
"bytes": "4842"
},
{
"name": "Groovy",
"bytes": "37692"
},
{
"name": "HTML",
"bytes": "17275"
},
{
"name": "Java",
"bytes": "35158950"
},
{
"name": "JavaScript",
"bytes": "2694"
},
{
"name": "Makefile",
"bytes": "1359"
},
{
"name": "PHP",
"bytes": "8385"
},
{
"name": "Perl",
"bytes": "383739"
},
{
"name": "Python",
"bytes": "90226"
},
{
"name": "Ruby",
"bytes": "664576"
},
{
"name": "Shell",
"bytes": "254684"
},
{
"name": "Thrift",
"bytes": "52351"
},
{
"name": "XSLT",
"bytes": "6764"
}
],
"symlink_target": ""
}
|
class CreateProjectImages < ActiveRecord::Migration
def change
create_table :project_images do |t|
t.string :image
t.string :caption
t.references :project, index: true
t.timestamps
end
end
end
|
{
"content_hash": "8bebe5c9c152fa029f6a15958a4e97d5",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 51,
"avg_line_length": 20.90909090909091,
"alnum_prop": 0.6695652173913044,
"repo_name": "engageis/juntos.com.vc",
"id": "05246230d0da4216bce4bd54e1a2b5f9a96a1399",
"size": "230",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "db/migrate/20141126173438_create_project_images.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "579762"
},
{
"name": "HTML",
"bytes": "602826"
},
{
"name": "JavaScript",
"bytes": "243156"
},
{
"name": "Ruby",
"bytes": "770016"
}
],
"symlink_target": ""
}
|
@interface ABI44_0_0RNSVGPattern : ABI44_0_0RNSVGGroup
@property (nonatomic, strong) ABI44_0_0RNSVGLength *x;
@property (nonatomic, strong) ABI44_0_0RNSVGLength *y;
@property (nonatomic, strong) ABI44_0_0RNSVGLength *patternwidth;
@property (nonatomic, strong) ABI44_0_0RNSVGLength *patternheight;
@property (nonatomic, assign) ABI44_0_0RNSVGUnits patternUnits;
@property (nonatomic, assign) ABI44_0_0RNSVGUnits patternContentUnits;
@property (nonatomic, assign) CGAffineTransform patternTransform;
@property (nonatomic, assign) CGFloat minX;
@property (nonatomic, assign) CGFloat minY;
@property (nonatomic, assign) CGFloat vbWidth;
@property (nonatomic, assign) CGFloat vbHeight;
@property (nonatomic, strong) NSString *align;
@property (nonatomic, assign) ABI44_0_0RNSVGVBMOS meetOrSlice;
@end
|
{
"content_hash": "ee4c59a04f4b2f8efcadcea401801ec3",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 70,
"avg_line_length": 44.44444444444444,
"alnum_prop": 0.795,
"repo_name": "exponentjs/exponent",
"id": "63a6746aebe347878b0bf37091184a25e1250008",
"size": "867",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ios/versioned-react-native/ABI44_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI44_0_0RNSVGPattern.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "96902"
},
{
"name": "Batchfile",
"bytes": "382"
},
{
"name": "C",
"bytes": "896724"
},
{
"name": "C++",
"bytes": "867983"
},
{
"name": "CSS",
"bytes": "6732"
},
{
"name": "HTML",
"bytes": "152590"
},
{
"name": "IDL",
"bytes": "897"
},
{
"name": "Java",
"bytes": "4588748"
},
{
"name": "JavaScript",
"bytes": "9343259"
},
{
"name": "Makefile",
"bytes": "8790"
},
{
"name": "Objective-C",
"bytes": "10675806"
},
{
"name": "Objective-C++",
"bytes": "364286"
},
{
"name": "Perl",
"bytes": "5860"
},
{
"name": "Prolog",
"bytes": "287"
},
{
"name": "Python",
"bytes": "97564"
},
{
"name": "Ruby",
"bytes": "45432"
},
{
"name": "Shell",
"bytes": "6501"
}
],
"symlink_target": ""
}
|
package mx.nic.rdap.sql.objects;
import java.sql.ResultSet;
import java.sql.SQLException;
import mx.nic.rdap.core.db.Variant;
/**
* Data access class for the {@link Variant} object.
*
*/
public class VariantDbObj extends Variant implements DatabaseObject {
/**
* Default constructor
*/
public VariantDbObj() {
super();
}
/**
* Construcs Variant using a {@link ResultSet}
*
*/
public VariantDbObj(ResultSet resultSet) throws SQLException {
super();
loadFromDatabase(resultSet);
}
/*
* (non-Javadoc)
*
* @see
* mx.nic.rdap.server.db.DatabaseObject#loadFromDatabase(java.sql.ResultSet)
*/
@Override
public void loadFromDatabase(ResultSet resultSet) throws SQLException {
this.setId(resultSet.getLong("var_id"));
this.setIdnTable(resultSet.getString("var_idn_table"));
this.setDomainId(resultSet.getLong("dom_id"));
}
}
|
{
"content_hash": "509bdce88c4b8d08594cdca333e8d39c",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 77,
"avg_line_length": 20.25581395348837,
"alnum_prop": 0.7072330654420207,
"repo_name": "NICMx/rdap-sql-provider",
"id": "3ade914376ad978e6aa4bc8f61edd2ad553aba45",
"size": "871",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/mx/nic/rdap/sql/objects/VariantDbObj.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "366292"
}
],
"symlink_target": ""
}
|
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<script src="js/vendor/modernizr-2.6.2.min.js"></script>
</head>
<body>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->
<!-- Add your site or application content here -->
<section class="failSign">
<span id="currCount">0</span>
<span id="recordCount">0</span>
</section>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
<script>
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
</body>
</html>
|
{
"content_hash": "6a35f4d36416905201b10ee40477c542",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 279,
"avg_line_length": 48.44186046511628,
"alnum_prop": 0.57177148343735,
"repo_name": "jmadden85/accidentTracker",
"id": "210cf43fcf81821eb2a45cd5de70f9d135c68912",
"size": "2083",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "15643"
},
{
"name": "JavaScript",
"bytes": "734"
}
],
"symlink_target": ""
}
|
package eml.studio.client.ui.widget.shape;
import eml.studio.client.ui.connection.Connection;
import com.orange.links.client.shapes.Drawable;
/**
* Interface to represent a point, widget or mouse as a rectangle
*/
public interface Shape extends Drawable {
/**
*
* @return left margin
*/
int getLeft();
/**
*
* @return top margin
*/
int getTop();
/**
*
* @return width of the shape
*/
int getWidth();
/**
*
* @return height of the shape
*/
int getHeight();
/**
* Add a connection to this shape.
*
* @return whether or not a connection was added
*/
boolean addConnection(Connection connection);
/**
* Remove a connection to this shape.
*
* @return whether or not a connection was removed
*/
boolean removeConnection(Connection connection);
}
|
{
"content_hash": "0a64b820288940cd6705d678d98b943c",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 65,
"avg_line_length": 15.48076923076923,
"alnum_prop": 0.6608695652173913,
"repo_name": "ICT-BDA/EasyML",
"id": "f3b260fbe832363a35e8ec25f51c6bee45483dd4",
"size": "1006",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/eml/studio/client/ui/widget/shape/Shape.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "108503"
},
{
"name": "HTML",
"bytes": "36733"
},
{
"name": "Java",
"bytes": "1077997"
},
{
"name": "JavaScript",
"bytes": "109013"
},
{
"name": "Python",
"bytes": "4661"
},
{
"name": "Shell",
"bytes": "447"
}
],
"symlink_target": ""
}
|
technical debt paid
|
{
"content_hash": "9167a3cc327999cde979336de55fb797",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 19,
"avg_line_length": 20,
"alnum_prop": 0.85,
"repo_name": "louise-r-blue/sprint-2",
"id": "e6e5b8edc08f471502476b2219c7d1567fc07322",
"size": "31",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
}
|
:man_page: bson_init_from_json
bson_init_from_json()
=====================
Synopsis
--------
.. code-block:: c
bool
bson_init_from_json (bson_t *bson,
const char *data,
ssize_t len,
bson_error_t *error);
Parameters
----------
* ``bson``: A :symbol:`bson_t`.
* ``data``: A UTF-8 encoded string containing valid JSON.
* ``len``: The length of ``data`` in bytes excluding a trailing ``\0`` or -1 to determine the length with ``strlen()``.
* ``error``: An optional location for a :symbol:`bson_error_t`.
Description
-----------
The ``bson_init_from_json()`` function will initialize a new :symbol:`bson_t` by parsing the JSON found in ``data``. Only a single JSON object may exist in ``data`` or an error will be set and false returned.
``data`` should be in `MongoDB Extended JSON <https://docs.mongodb.com/manual/reference/mongodb-extended-json/>`_ format.
Errors
------
Errors are propagated via the ``error`` parameter.
Returns
-------
Returns ``true`` if valid JSON was parsed, otherwise ``false`` and ``error`` is set.
.. only:: html
.. taglist:: See Also:
:tags: create-bson json
|
{
"content_hash": "26fa4ea73305209828f0d4b299f2e3aa",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 208,
"avg_line_length": 26.155555555555555,
"alnum_prop": 0.6074766355140186,
"repo_name": "rcsanchez97/libbson",
"id": "c7b451f6d46d4063f4e22f5b021bdd8062f33b0c",
"size": "1177",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "doc/bson_init_from_json.rst",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4516"
},
{
"name": "C",
"bytes": "987222"
},
{
"name": "C++",
"bytes": "31423"
},
{
"name": "CMake",
"bytes": "22001"
},
{
"name": "M4",
"bytes": "69955"
},
{
"name": "Makefile",
"bytes": "8401"
},
{
"name": "Objective-C",
"bytes": "12342"
},
{
"name": "Shell",
"bytes": "16113"
}
],
"symlink_target": ""
}
|
package Paws::SNS::GetPlatformApplicationAttributesResponse;
use Moose;
has Attributes => (is => 'ro', isa => 'Paws::SNS::MapStringToString');
has _request_id => (is => 'ro', isa => 'Str');
1;
### main pod documentation begin ###
=head1 NAME
Paws::SNS::GetPlatformApplicationAttributesResponse
=head1 ATTRIBUTES
=head2 Attributes => L<Paws::SNS::MapStringToString>
Attributes include the following:
=over
=item *
C<EventEndpointCreated> -- Topic ARN to which EndpointCreated event
notifications should be sent.
=item *
C<EventEndpointDeleted> -- Topic ARN to which EndpointDeleted event
notifications should be sent.
=item *
C<EventEndpointUpdated> -- Topic ARN to which EndpointUpdate event
notifications should be sent.
=item *
C<EventDeliveryFailure> -- Topic ARN to which DeliveryFailure event
notifications should be sent upon Direct Publish delivery failure
(permanent) to one of the application's endpoints.
=back
=head2 _request_id => Str
=cut
|
{
"content_hash": "8c9416c98e1dc9b243020ade7235865a",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 72,
"avg_line_length": 18.884615384615383,
"alnum_prop": 0.7464358452138493,
"repo_name": "ioanrogers/aws-sdk-perl",
"id": "e99329c7644e74ab3fe27c3adee39975c2470266",
"size": "983",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "auto-lib/Paws/SNS/GetPlatformApplicationAttributesResponse.pm",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Makefile",
"bytes": "1292"
},
{
"name": "Perl",
"bytes": "20360380"
},
{
"name": "Perl 6",
"bytes": "99393"
},
{
"name": "Shell",
"bytes": "445"
}
],
"symlink_target": ""
}
|
exports.up = (knex, Promise) => {
return knex.schema.createTable('users', (table) => {
table.increments();
table.string('email').unique().notNullable();
table.string('password').notNullable();
table.boolean('admin').notNullable().defaultTo(false);
table.timestamp('created_at').notNullable().defaultTo(knex.raw('now()'));
});
};
exports.down = (knex, Promise) => {
return knex.schema.dropTable('users');
};
|
{
"content_hash": "098920989a58cac0e54b83a6bdaad3d0",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 77,
"avg_line_length": 33.38461538461539,
"alnum_prop": 0.6497695852534562,
"repo_name": "mjhea0/node-stripe-charge",
"id": "b8bf48361a008f2b803c84d22dd954bd25ef5b92",
"size": "434",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/server/db/migrations/20161112112035_users.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "116"
},
{
"name": "HTML",
"bytes": "11951"
},
{
"name": "JavaScript",
"bytes": "57648"
}
],
"symlink_target": ""
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.