text
stringlengths
2
1.04M
meta
dict
package com.amee.minecraft; import java.util.ArrayList; import java.util.List; import java.util.UUID; import com.amee.client.AmeeException; import com.amee.client.model.data.*; import com.amee.client.model.profile.*; import com.amee.client.service.AmeeObjectFactory; import com.amee.client.util.Choice; public class Calculation { private AmeeDataItem dataItem; private AmeeProfileCategory profileCategory; private String path; private List<String> drills; private Float cachedResult; private List<String> parameters; private String name; public Calculation(String _name, String _path, List<String> _drills, List<String> _parameters) { name = _name; parameters = _parameters; path = _path; drills = _drills; } public AmeeDataItem dataItem() { if (dataItem == null) { try { AmeeDrillDown drillDown; drillDown = AmeeObjectFactory.getInstance().getDrillDown(path + "/drill"); for (int i=0; i<drills.size(); i+=2) { drillDown.addSelection(drills.get(i), drills.get(i+1)); } drillDown.fetch(); dataItem = drillDown.getDataItem(); } catch (AmeeException e) { throw new RuntimeException("Couldn't fetch data item! " + e.getMessage()); } } return dataItem; } public AmeeProfileCategory profileCategory() { if (profileCategory == null) { try { profileCategory = AmeeObjectFactory.getInstance().getProfileCategory(CarbonCounter.profile(), path); } catch (AmeeException e) { throw new RuntimeException("Couldn't fetch profile category! " + e.getMessage()); } } return profileCategory; } public void calculate() { new CalculationThread(this).run(); } public void blockingCalculate() { if (cachedResult == null) { List<Choice> values = new ArrayList<Choice>(); for (int i=0; i<parameters.size(); i+=2) { values.add(new Choice(parameters.get(i), parameters.get(i+1))); } values.add(new Choice("name", name + "-" + UUID.randomUUID().toString())); try { // Get category AmeeProfileItem profileItem = profileCategory().addProfileItem(dataItem().getUid(), values); cachedResult = new Float(profileItem.getAmount().floatValue()); } catch (AmeeException e) { throw new RuntimeException("Problem creating profile item!"); } } Atmosphere.addToTotal(cachedResult); } public String name() { return name; } }
{ "content_hash": "03bcf39fd74b6b30c5951f7dab50d1ff", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 104, "avg_line_length": 25.408602150537636, "alnum_prop": 0.6948793906051629, "repo_name": "AMEE/climatecraft", "id": "97af01d3df95ccf990e6b56885d93d9dff81afce", "size": "2363", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "src/com/amee/minecraft/Calculation.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Java", "bytes": "11643" } ], "symlink_target": "" }
package org.immutables.fixture.jackson; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes.Type; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.As; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import org.immutables.value.Value; public interface PolymorphicMappings { @JsonSubTypes({ @Type(DatasetIdLocator.class), @Type(DatasetPathLocator.class), @Type(ImmutableDatasetIdLocator.class), @Type(ImmutableDatasetPathLocator.class) }) @JsonTypeInfo(use = Id.NAME, include = As.PROPERTY, property = "@class", visible = false) public interface DatasetLocator {} @Value.Immutable @Value.Style(visibility = Value.Style.ImplementationVisibility.PACKAGE) @JsonSerialize(as = ImmutableDatasetIdLocator.class) @JsonDeserialize(as = ImmutableDatasetIdLocator.class) public interface DatasetIdLocator extends DatasetLocator { String getDatasetId(); class Builder extends ImmutableDatasetIdLocator.Builder {} } @Value.Immutable @Value.Style(visibility = Value.Style.ImplementationVisibility.PACKAGE) @JsonSerialize(as = ImmutableDatasetIdLocator.class) @JsonDeserialize(as = ImmutableDatasetIdLocator.class) public interface DatasetPathLocator extends DatasetLocator { String getDatasetPath(); class Builder extends ImmutableDatasetPathLocator.Builder {} } }
{ "content_hash": "e7034c14584a25df20e20d660f4f6b1c", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 91, "avg_line_length": 39.475, "alnum_prop": 0.799240025332489, "repo_name": "weiwenqiang/GitHub", "id": "b4c22c01414252ef5ddb2ef8aa6f37ad8fc6308a", "size": "2191", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "expert/immutables/value-fixture/src/org/immutables/fixture/jackson/PolymorphicMappings.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "87" }, { "name": "C", "bytes": "42062" }, { "name": "C++", "bytes": "12137" }, { "name": "CMake", "bytes": "202" }, { "name": "CSS", "bytes": "75087" }, { "name": "Clojure", "bytes": "12036" }, { "name": "FreeMarker", "bytes": "21704" }, { "name": "Groovy", "bytes": "55083" }, { "name": "HTML", "bytes": "61549" }, { "name": "Java", "bytes": "42222825" }, { "name": "JavaScript", "bytes": "216823" }, { "name": "Kotlin", "bytes": "24319" }, { "name": "Makefile", "bytes": "19490" }, { "name": "Perl", "bytes": "280" }, { "name": "Prolog", "bytes": "1030" }, { "name": "Python", "bytes": "13032" }, { "name": "Scala", "bytes": "310450" }, { "name": "Shell", "bytes": "27802" } ], "symlink_target": "" }
#import "MGSplitView.h" #import "TiApp.h" #ifdef USE_TI_UIIPADSPLITWINDOW @implementation MGSplitView @synthesize layingOut; - (id)initWithFrame:(CGRect)frame controller:(MGSplitViewController*)controller_ { self = [super initWithFrame:frame]; if (self) { controller = controller_; layingOut = NO; singleLayout = NO; } return self; } - (void)dealloc { [super dealloc]; } -(void)setSingleLayout { singleLayout = YES; } // Force the controller's layout method to be called whenever an initial // layout request is made. We have to rely on the controller's layout method to properly // set the 'layingOut' flag, as well... dangerous, and fragile. -(void)layoutSubviews { if (!layingOut && !singleLayout) { [controller layoutSubviewsForInterfaceOrientation:[[[TiApp app] controller] windowOrientation] withAnimation:YES]; } else { [super layoutSubviews]; singleLayout = NO; } } @end #endif
{ "content_hash": "b719053a9114c7e71722fb418459b987", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 123, "avg_line_length": 20.93617021276596, "alnum_prop": 0.6788617886178862, "repo_name": "Vista7010/git_fuk_app", "id": "821f3554ee955ac26015921ad87beca819984af2", "size": "1301", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "build/iphone/Classes/MGSplitView/MGSplitView.m", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "144391" }, { "name": "C++", "bytes": "52728" }, { "name": "D", "bytes": "809096" }, { "name": "JavaScript", "bytes": "19928" }, { "name": "Matlab", "bytes": "1957" }, { "name": "Objective-C", "bytes": "3304766" }, { "name": "Shell", "bytes": "153" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_152-release) on Sat Sep 08 11:59:38 CEST 2018 --> <title>QNASummaryTableBuilder</title> <meta name="date" content="2018-09-08"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="QNASummaryTableBuilder"; } } catch(err) { } //--> var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTable.Comparators.html" title="class in com.dev.yvgenijsharovskij.n5kanjiandkanjistoryquiz.qna"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li>Next&nbsp;Class</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html" target="_top">Frames</a></li> <li><a href="QNASummaryTableBuilder.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">com.dev.yvgenijsharovskij.n5kanjiandkanjistoryquiz.qna</div> <h2 title="Class QNASummaryTableBuilder" class="title">Class QNASummaryTableBuilder</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>com.dev.yvgenijsharovskij.n5kanjiandkanjistoryquiz.qna.QNASummaryTableBuilder</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd>android.os.Parcelable</dd> </dl> <hr> <br> <pre>public class <span class="typeNameLabel">QNASummaryTableBuilder</span> extends java.lang.Object implements android.os.Parcelable</pre> <div class="block">Builds a QNASummary table based on the data provided through the <a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTable.html" title="class in com.dev.yvgenijsharovskij.n5kanjiandkanjistoryquiz.qna"><code>QNASummaryTable</code></a> class.</div> <dl> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>1.0</dd> <dt><span class="simpleTagLabel">Author:</span></dt> <dd>Yvgenij Sharovskij</dd> </dl> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ======== NESTED CLASS SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="nested.class.summary"> <!-- --> </a> <h3>Nested Class Summary</h3> <ul class="blockList"> <li class="blockList"><a name="nested.classes.inherited.from.class.android.os.Parcelable"> <!-- --> </a> <h3>Nested classes/interfaces inherited from interface&nbsp;android.os.Parcelable</h3> <code>android.os.Parcelable.ClassLoaderCreator&lt;T&gt;, android.os.Parcelable.Creator&lt;T&gt;</code></li> </ul> </li> </ul> <!-- =========== FIELD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="field.summary"> <!-- --> </a> <h3>Field Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> <caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Field and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>static android.os.Parcelable.Creator&lt;<a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html" title="class in com.dev.yvgenijsharovskij.n5kanjiandkanjistoryquiz.qna">QNASummaryTableBuilder</a>&gt;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#CREATOR">CREATOR</a></span></code> <div class="block">Creates the parcel object through the standard Parcelable.Creator.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="fields.inherited.from.class.android.os.Parcelable"> <!-- --> </a> <h3>Fields inherited from interface&nbsp;android.os.Parcelable</h3> <code>CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE</code></li> </ul> </li> </ul> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#QNASummaryTableBuilder-android.content.Context-">QNASummaryTableBuilder</a></span>(android.content.Context&nbsp;context)</code> <div class="block">Class constructor.</div> </td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#buildTable-android.content.Context-android.view.View-android.widget.TableLayout-java.util.ArrayList-">buildTable</a></span>(android.content.Context&nbsp;context, android.view.View&nbsp;v, android.widget.TableLayout&nbsp;tableLayout, java.util.ArrayList&lt;<a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTable.html" title="class in com.dev.yvgenijsharovskij.n5kanjiandkanjistoryquiz.qna">QNASummaryTable</a>&gt;&nbsp;qnaSummaryTableList)</code> <div class="block">Builds the table.</div> </td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#describeContents--">describeContents</a></span>()</code> <div class="block">Describes the kinds of special objects contained in this Parcelable instance's marshaled representation.</div> </td> </tr> <tr id="i2" class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#getCorrectAnswerRowResId--">getCorrectAnswerRowResId</a></span>()</code> <div class="block">Getter method for the <a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#mCorrectAnswerRowResId"><code>mCorrectAnswerRowResId</code></a>.</div> </td> </tr> <tr id="i3" class="rowColor"> <td class="colFirst"><code>java.lang.String</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#getDuplicatePositiveQuestion--">getDuplicatePositiveQuestion</a></span>()</code> <div class="block">Gets the duplicate positive QNA control question.</div> </td> </tr> <tr id="i4" class="altColor"> <td class="colFirst"><code>int[]</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#getDuplicatePositiveQuestionIndex--">getDuplicatePositiveQuestionIndex</a></span>()</code> <div class="block">Gets the duplicate positive QNA control question index.</div> </td> </tr> <tr id="i5" class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#getHeaderRowResId--">getHeaderRowResId</a></span>()</code> <div class="block">Getter method for the <a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#mHeaderRowResId"><code>mHeaderRowResId</code></a>.</div> </td> </tr> <tr id="i6" class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#getIsCorrectRowResId--">getIsCorrectRowResId</a></span>()</code> <div class="block">Getter method for the <a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#misCorrectRowResId"><code>misCorrectRowResId</code></a>.</div> </td> </tr> <tr id="i7" class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#getQuestionRowResId--">getQuestionRowResId</a></span>()</code> <div class="block">Getter method for the <a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#mQuestionRowResId"><code>mQuestionRowResId</code></a>.</div> </td> </tr> <tr id="i8" class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#getSelectedAnswerRowResId--">getSelectedAnswerRowResId</a></span>()</code> <div class="block">Getter method for the <a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#mSelectedAnswerRowResId"><code>mSelectedAnswerRowResId</code></a>.</div> </td> </tr> <tr id="i9" class="rowColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#isQuestionColumnFormatted--">isQuestionColumnFormatted</a></span>()</code> <div class="block">Returns true if the Table question column has been formatted according to the user-defined preferences.</div> </td> </tr> <tr id="i10" class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#onClickTextViewSorter-android.content.Context-android.widget.TextView-android.widget.TableLayout-java.util.ArrayList-java.util.Comparator-int-">onClickTextViewSorter</a></span>(android.content.Context&nbsp;context, android.widget.TextView&nbsp;textView, android.widget.TableLayout&nbsp;tableLayout, java.util.ArrayList&lt;<a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTable.html" title="class in com.dev.yvgenijsharovskij.n5kanjiandkanjistoryquiz.qna">QNASummaryTable</a>&gt;&nbsp;qnaSummaryTableList, java.util.Comparator&lt;? super <a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTable.html" title="class in com.dev.yvgenijsharovskij.n5kanjiandkanjistoryquiz.qna">QNASummaryTable</a>&gt;&nbsp;comparator, int&nbsp;switcher)</code> <div class="block">Sorts the table data.</div> </td> </tr> <tr id="i11" class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#setDuplicatePositiveQuestion-java.lang.String-">setDuplicatePositiveQuestion</a></span>(java.lang.String&nbsp;duplicatePositiveQuestion)</code> <div class="block">Sets the duplicate positive QNA control question.</div> </td> </tr> <tr id="i12" class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#setDuplicatePositiveQuestionIndex-int:A-">setDuplicatePositiveQuestionIndex</a></span>(int[]&nbsp;duplicatePositiveQuestionIndex)</code> <div class="block">Sets the duplicate positive QNA control question index.</div> </td> </tr> <tr id="i13" class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#setQuestionColumnFormatted-boolean-">setQuestionColumnFormatted</a></span>(boolean&nbsp;isQestionColumnFormatted)</code> <div class="block">Sets a boolean value if the Table question column has been formatted according to the user-defined preferences.</div> </td> </tr> <tr id="i14" class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#writeToParcel-android.os.Parcel-int-">writeToParcel</a></span>(android.os.Parcel&nbsp;dest, int&nbsp;flags)</code> <div class="block">Flatten this object in to a Parcel.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ FIELD DETAIL =========== --> <ul class="blockList"> <li class="blockList"><a name="field.detail"> <!-- --> </a> <h3>Field Detail</h3> <a name="CREATOR"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>CREATOR</h4> <pre>public static final&nbsp;android.os.Parcelable.Creator&lt;<a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html" title="class in com.dev.yvgenijsharovskij.n5kanjiandkanjistoryquiz.qna">QNASummaryTableBuilder</a>&gt; CREATOR</pre> <div class="block">Creates the parcel object through the standard Parcelable.Creator. Note: The Parcelable implementation in this class requires the non-null static field called CREATOR of a type that implements the Parcelable.Creator interface.</div> </li> </ul> </li> </ul> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="QNASummaryTableBuilder-android.content.Context-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>QNASummaryTableBuilder</h4> <pre>public&nbsp;QNASummaryTableBuilder(android.content.Context&nbsp;context)</pre> <div class="block">Class constructor. Initializes the local variables and sets the LayoutParams.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>context</code> - Context</dd> </dl> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="buildTable-android.content.Context-android.view.View-android.widget.TableLayout-java.util.ArrayList-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>buildTable</h4> <pre>public&nbsp;void&nbsp;buildTable(android.content.Context&nbsp;context, android.view.View&nbsp;v, android.widget.TableLayout&nbsp;tableLayout, java.util.ArrayList&lt;<a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTable.html" title="class in com.dev.yvgenijsharovskij.n5kanjiandkanjistoryquiz.qna">QNASummaryTable</a>&gt;&nbsp;qnaSummaryTableList)</pre> <div class="block">Builds the table.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>context</code> - Context</dd> <dd><code>v</code> - View</dd> <dd><code>tableLayout</code> - TableLayout</dd> <dd><code>qnaSummaryTableList</code> - data list as ArrayList<QNASummaryTable></dd> </dl> </li> </ul> <a name="onClickTextViewSorter-android.content.Context-android.widget.TextView-android.widget.TableLayout-java.util.ArrayList-java.util.Comparator-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>onClickTextViewSorter</h4> <pre>public&nbsp;void&nbsp;onClickTextViewSorter(android.content.Context&nbsp;context, android.widget.TextView&nbsp;textView, android.widget.TableLayout&nbsp;tableLayout, java.util.ArrayList&lt;<a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTable.html" title="class in com.dev.yvgenijsharovskij.n5kanjiandkanjistoryquiz.qna">QNASummaryTable</a>&gt;&nbsp;qnaSummaryTableList, java.util.Comparator&lt;? super <a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTable.html" title="class in com.dev.yvgenijsharovskij.n5kanjiandkanjistoryquiz.qna">QNASummaryTable</a>&gt;&nbsp;comparator, int&nbsp;switcher)</pre> <div class="block">Sorts the table data. Triggered through the onClick event of the header.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>context</code> - Context</dd> <dd><code>textView</code> - the clicked TextView</dd> <dd><code>tableLayout</code> - common TableLayout</dd> <dd><code>qnaSummaryTableList</code> - the data list as ArrayList<QNASummaryTable></dd> <dd><code>comparator</code> - the specific Comparator<? super QNASummaryTable> used for sorting the data</dd> <dd><code>switcher</code> - the Comparator switcher</dd> </dl> </li> </ul> <a name="getHeaderRowResId--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getHeaderRowResId</h4> <pre>public&nbsp;int&nbsp;getHeaderRowResId()</pre> <div class="block">Getter method for the <a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#mHeaderRowResId"><code>mHeaderRowResId</code></a>.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#mHeaderRowResId"><code>mHeaderRowResId</code></a></dd> </dl> </li> </ul> <a name="getQuestionRowResId--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getQuestionRowResId</h4> <pre>public&nbsp;int&nbsp;getQuestionRowResId()</pre> <div class="block">Getter method for the <a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#mQuestionRowResId"><code>mQuestionRowResId</code></a>.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#mQuestionRowResId"><code>mQuestionRowResId</code></a></dd> </dl> </li> </ul> <a name="getSelectedAnswerRowResId--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getSelectedAnswerRowResId</h4> <pre>public&nbsp;int&nbsp;getSelectedAnswerRowResId()</pre> <div class="block">Getter method for the <a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#mSelectedAnswerRowResId"><code>mSelectedAnswerRowResId</code></a>.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#mSelectedAnswerRowResId"><code>mSelectedAnswerRowResId</code></a></dd> </dl> </li> </ul> <a name="getCorrectAnswerRowResId--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getCorrectAnswerRowResId</h4> <pre>public&nbsp;int&nbsp;getCorrectAnswerRowResId()</pre> <div class="block">Getter method for the <a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#mCorrectAnswerRowResId"><code>mCorrectAnswerRowResId</code></a>.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#mCorrectAnswerRowResId"><code>mCorrectAnswerRowResId</code></a></dd> </dl> </li> </ul> <a name="getIsCorrectRowResId--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getIsCorrectRowResId</h4> <pre>public&nbsp;int&nbsp;getIsCorrectRowResId()</pre> <div class="block">Getter method for the <a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#misCorrectRowResId"><code>misCorrectRowResId</code></a>.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#misCorrectRowResId"><code>misCorrectRowResId</code></a></dd> </dl> </li> </ul> <a name="getDuplicatePositiveQuestion--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getDuplicatePositiveQuestion</h4> <pre>public&nbsp;java.lang.String&nbsp;getDuplicatePositiveQuestion()</pre> <div class="block">Gets the duplicate positive QNA control question.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>the duplicate positive QNA control question</dd> </dl> </li> </ul> <a name="setDuplicatePositiveQuestion-java.lang.String-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setDuplicatePositiveQuestion</h4> <pre>public&nbsp;void&nbsp;setDuplicatePositiveQuestion(java.lang.String&nbsp;duplicatePositiveQuestion)</pre> <div class="block">Sets the duplicate positive QNA control question.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>duplicatePositiveQuestion</code> - the duplicate positive QNA control question</dd> </dl> </li> </ul> <a name="getDuplicatePositiveQuestionIndex--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getDuplicatePositiveQuestionIndex</h4> <pre>public&nbsp;int[]&nbsp;getDuplicatePositiveQuestionIndex()</pre> <div class="block">Gets the duplicate positive QNA control question index. The index for both of the questions is returned</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>the duplicate positive QNA control question index, for both of the questions</dd> </dl> </li> </ul> <a name="setDuplicatePositiveQuestionIndex-int:A-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setDuplicatePositiveQuestionIndex</h4> <pre>public&nbsp;void&nbsp;setDuplicatePositiveQuestionIndex(int[]&nbsp;duplicatePositiveQuestionIndex)</pre> <div class="block">Sets the duplicate positive QNA control question index. The index for both of the questions is returned</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>duplicatePositiveQuestionIndex</code> - the duplicate positive QNA control question index, for both of the questions</dd> </dl> </li> </ul> <a name="isQuestionColumnFormatted--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isQuestionColumnFormatted</h4> <pre>public&nbsp;boolean&nbsp;isQuestionColumnFormatted()</pre> <div class="block">Returns true if the Table question column has been formatted according to the user-defined preferences.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>true, if the Table question column has been formatted according to the user-defined preferences</dd> </dl> </li> </ul> <a name="setQuestionColumnFormatted-boolean-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setQuestionColumnFormatted</h4> <pre>public&nbsp;void&nbsp;setQuestionColumnFormatted(boolean&nbsp;isQestionColumnFormatted)</pre> <div class="block">Sets a boolean value if the Table question column has been formatted according to the user-defined preferences.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>isQestionColumnFormatted</code> - if the Table question column has been formatted</dd> </dl> </li> </ul> <a name="writeToParcel-android.os.Parcel-int-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>writeToParcel</h4> <pre>public&nbsp;void&nbsp;writeToParcel(android.os.Parcel&nbsp;dest, int&nbsp;flags)</pre> <div class="block">Flatten this object in to a Parcel.</div> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>writeToParcel</code>&nbsp;in interface&nbsp;<code>android.os.Parcelable</code></dd> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>dest</code> - The Parcel in which the object should be written.</dd> <dd><code>flags</code> - Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.</dd> </dl> </li> </ul> <a name="describeContents--"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>describeContents</h4> <pre>public&nbsp;int&nbsp;describeContents()</pre> <div class="block">Describes the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of <a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html#writeToParcel-android.os.Parcel-int-"><code>writeToParcel(Parcel, int)</code></a>, the return value of this method must include the CONTENTS_FILE_DESCRIPTOR flag.</div> <dl> <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> <dd><code>describeContents</code>&nbsp;in interface&nbsp;<code>android.os.Parcelable</code></dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-files/index-1.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTable.Comparators.html" title="class in com.dev.yvgenijsharovskij.n5kanjiandkanjistoryquiz.qna"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li>Next&nbsp;Class</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/dev/yvgenijsharovskij/n5kanjiandkanjistoryquiz/qna/QNASummaryTableBuilder.html" target="_top">Frames</a></li> <li><a href="QNASummaryTableBuilder.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{ "content_hash": "16aeca8b725870cbb83c65f61efa771d", "timestamp": "", "source": "github", "line_count": 680, "max_line_length": 391, "avg_line_length": 47.455882352941174, "alnum_prop": 0.6844437558103502, "repo_name": "YvgenijSharovskij/Android-Java", "id": "db654e1ff4205b0a609153f47c7abf30f107f976", "size": "32270", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "N5KanjiAndKanjiStoryQuiz/JavaDoc/qna/QNASummaryTableBuilder.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "13416" }, { "name": "HTML", "bytes": "1739350" }, { "name": "Java", "bytes": "78410" }, { "name": "JavaScript", "bytes": "857" } ], "symlink_target": "" }
class Job < ActiveRecord::Base def jobsearch(jobs, zip) HTTParty.get("http://service.dice.com/api/rest/jobsearch/v1/simple.json?text=#{jobs}&city=#{zip}") end geocoded_by :company after_validation :geocode end
{ "content_hash": "97204559ee5eac33115d8d2b50b540e9", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 102, "avg_line_length": 22.5, "alnum_prop": 0.7111111111111111, "repo_name": "mattkellough/Neighborly_Dev", "id": "1142c2898b2075bb12907e8caba26ae4a8f92688", "size": "225", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/models/job.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2961" }, { "name": "CoffeeScript", "bytes": "211" }, { "name": "HTML", "bytes": "7380" }, { "name": "JavaScript", "bytes": "2949" }, { "name": "Ruby", "bytes": "24317" } ], "symlink_target": "" }
gRPC Kotlin Cloud Run Example ----------------------------- Run Locally: 1. In one shell / terminal window, start the server: ``` ./gradlew run ``` 1. In another shell / terminal window, run the client: ``` ./gradlew HelloWorldClient ``` You should see output like: `Greeter client received: Hello world` Deploy on Cloud Run: 1. [![Run on Google Cloud](https://deploy.cloud.run/button.svg)](https://deploy.cloud.run) *This will take a few minutes to build and deploy.* 1. From within Cloud Shell, run the client against the service you just deployed on Cloud Run, replacing `YOUR_CLOUD_RUN_DOMAIN_NAME` with your service's domain name and replacing `YOUR_PROJECT_ID` with your GCP project: ``` export PROJECT_ID=YOUR_PROJECT_ID docker run -it --entrypoint=/cnb/lifecycle/launcher gcr.io/$PROJECT_ID/grpc-hello-world-gradle \ "build/install/grpc-hello-world-gradle/bin/HelloWorldClientKt YOUR_CLOUD_RUN_DOMAIN_NAME" ``` You should see output like: `Greeter client received: Hello YOUR_CLOUD_RUN_DOMAIN_NAME`
{ "content_hash": "21b37b8d91ee64fdc633c45dcf95345c", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 220, "avg_line_length": 36.827586206896555, "alnum_prop": 0.6956928838951311, "repo_name": "GoogleCloudPlatform/kotlin-samples", "id": "bac7f8cebd6c34927ed1694fecaa14d1f9134c5c", "size": "1068", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "run/grpc-hello-world-gradle/README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Kotlin", "bytes": "107478" }, { "name": "Procfile", "bytes": "931" } ], "symlink_target": "" }
<!doctype html> <html lang=""> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="description" content="FTE Design Test"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>FTE Design Test</title> <base href="/"> <link rel="shortcut icon" type="image/x-icon" href="https://s0.wp.com/wp-content/themes/vip/espn-fivethirtyeight/assets/img/favicon.ico?v=1.0.2"> <link rel="icon" type="image/x-icon" href="https://s0.wp.com/wp-content/themes/vip/espn-fivethirtyeight/assets/img/favicon.ico?v=1.0.2"> <link rel="apple-touch-icon" href="https://s0.wp.com/wp-content/themes/vip/espn-fivethirtyeight/assets/img/apple-touch-icon.png?v=1.0.2"> <!-- Web Application Manifest --> <link rel="manifest" href="manifest.json"> <!-- Page styles --> <link rel="stylesheet" href="styles/main.css"> </head> <body> <article class="article"> <header class="article__header"> <h3 class="article__head">Can Derrick Rose Shoot?</h3> <p class="article__intro">Derrick Rose was a midrange god in the 2009-2010 season, banking 47 percent of his 794 attempts inside the arc. But he switched up his positioning a season later, migrating outward and more than sextupling his 3-point-shooting volume. Based on Rose's performance in last week's FIBA World Cup of Basketball, it might be time to return to the midrange jump shots that made him famous.</p> </header> <div class="graphic__mod"> <header class="graphic__header"> <h4 class="graphic__head">Rose's Great Migration Outward</h4> <div class="graphic__head__img__wrap"> <img src="images/rose_sillo.png" alt="Derrick Rose at the FIBA World Nap Cup" class="graphic__head__img"> </div> </header> <figure class="graphic__wrap"> <div id="js--viz__wrap--2009" class="viz__wrap"></div> <figcaption class="viz__caption--heatmap">2009&ndash;2010</figcaption> <img src="images/legend_seq.svg" alt="" class="viz__legend--efficiency"> </figure> <figure class="graphic__wrap"> <div id="js--viz__wrap--2010" class="viz__wrap"></div> <figcaption class="viz__caption--heatmap">2010&ndash;2011</figcaption> <img src="images/legend_seq.svg" alt="" class="viz__legend--efficiency"> </figure> </div> <div class="graphic__mod"> <header class="graphic__header"> <h4 class="graphic__head">Unrivaled Efficiency, But Only for a Season</h4> </header> <figure class="graphic__wrap"> <div id="js--viz__wrap--efficiency--2009" class="viz__wrap"></div> <figcaption class="viz__caption--heatmap">2009&ndash;2010</figcaption> <img src="images/legend_div.svg" alt="" class="viz__legend--efficiency"> </figure> <figure class="graphic__wrap"> <div id="js--viz__wrap--efficiency--2010" class="viz__wrap"></div> <figcaption class="viz__caption--heatmap">2010&ndash;2011</figcaption> <img src="images/legend_div.svg" alt="" class="viz__legend--efficiency"> </figure> </div> <!-- <footer class="graphic__footer">bug, based on ESPN data</footer> --> </article> <!-- build:js(app/) ../../scripts/main.min.js --> <script src="scripts/vendor/d3.js"></script> <script src="scripts/vendor/queue.js"></script> <script src="scripts/vendor/hexbin.js"></script> <script src="scripts/vendor/underscore.js"></script> <script src="scripts/main.js"></script> <!-- endbuild --> <!-- Google Analytics: change UA-XXXXX-X to be your site's ID --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXX-X', 'auto'); ga('send', 'pageview'); </script> <!-- Built with love using Web Starter Kit --> </body> </html>
{ "content_hash": "62aae9afe0cd266fdeaaace0539633b1", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 421, "avg_line_length": 51.426829268292686, "alnum_prop": 0.6239032487550391, "repo_name": "gwezerek/FTE", "id": "f4daf6f44838ca3c6c1afe73aca470e353f26913", "size": "4217", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/index.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "12157" }, { "name": "HTML", "bytes": "59095" }, { "name": "JavaScript", "bytes": "12985" } ], "symlink_target": "" }
package nl.knaw.dans.coar.shed; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.List; import javax.persistence.EntityTransaction; import nl.knaw.dans.coar.fedora.EMD; import nl.knaw.dans.coar.fedora.Fedora; import nl.knaw.dans.coar.fedora.PerDateDatasetIterator; import nl.knaw.dans.coar.rdb.JPAUtil; import nl.knaw.dans.coar.tika.TikaProfile; import nl.knaw.dans.coar.tika.TikaProfileStore; import nl.knaw.dans.coar.util.Reporter; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.yourmediashelf.fedora.client.FedoraClientException; import com.yourmediashelf.fedora.generated.management.DatastreamProfile; public class Conveyor { private static Logger logger = LoggerFactory.getLogger(Conveyor.class); private final PerDateDatasetIterator datasetIterator; private boolean savingFiles; private TikaProfileStore store; private FlatDatasetStore datasetStore; private EntityTransaction currentTx; private FlatDataset currentDataset; private Fedora fedora; private PDFProcessor pdfProcessor; //private ProfileIdentifierFilter idFilter; private DatasetDiscriminator datasetDiscriminator; private int fileCount; public Conveyor(PerDateDatasetIterator datasetIterator) { this.datasetIterator = datasetIterator; fedora = Fedora.instance(); store = new TikaProfileStore(JPAUtil.getEntityManager()); datasetStore = new FlatDatasetStore(JPAUtil.getEntityManager()); //idFilter = new ProfileIdentifierFilter(); datasetDiscriminator = new DatasetDiscriminator(); } public PDFProcessor getPdfProcessor() { if (pdfProcessor == null) { pdfProcessor = new PDFProcessor() { public void process(TikaProfile profile, InputStream data) { logger.warn("No PDFProcessor provided."); } }; } return pdfProcessor; } public void setPdfProcessor(PDFProcessor pdfProcessor) { this.pdfProcessor = pdfProcessor; } public boolean isSavingFiles() { return savingFiles; } public void setSavingFiles(boolean savingFiles) { this.savingFiles = savingFiles; } public void run() { while (datasetIterator.hasNext()) { String datasetId = datasetIterator.next(); currentDataset = new FlatDataset(datasetId); processDataset(datasetId); // write dataset properties EntityTransaction tx = datasetStore.newTransAction(); tx.begin(); FlatDataset dataset = datasetStore.findByNaturalId(datasetId); if (dataset == null) { dataset = new FlatDataset(datasetId); } dataset.setValues(currentDataset); datasetStore.saveOrUpdate(dataset); tx.commit(); datasetStore.clear(); currentDataset = null; } } public void processDataset(String datasetId) { if (datasetDiscriminator.accept(datasetId)) { EMD emd = null; try { emd = new EMD(fedora.getEMD(datasetId)); } catch (Exception e) { logger.error("While fetching EMD for {}", datasetId); Reporter.report("error_emd.csv", datasetId + ";" + e.getMessage()); return; } String metadataFormat = emd.getMetadataFormat(); currentDataset.setMetadataFormat(metadataFormat); if ("ARCHAEOLOGY".equals(metadataFormat) || emd.getAudiences().contains("easy-discipline:2")) { processArchDataset(datasetId, emd); } } else { logger.info("Discriminating {}", datasetId); } } protected void processArchDataset(String datasetId, EMD emd) { logger.info("Processing archeological dataset {}", datasetId); List<String> fileIds; try { fileIds = fedora.getFileIdentifiers(datasetId); } catch (Exception e) { logger.error("While fetching identifiers for {}", datasetId); Reporter.report("error_file_ids.csv", datasetId + ";" + e.getMessage()); return; } int filecount = fileIds.size(); currentDataset.setCountFiles(filecount); int pdfcount = 0; for (String fileId : fileIds) { try { DatastreamProfile dsProfile = fedora.getDSProfile(fileId); if ("application/pdf".equals(dsProfile.getDsMIME())) { pdfcount++; processPDF(datasetId, emd, fileId, dsProfile); } } catch (FedoraClientException e) { logger.error("While fetching dsProfile for {}", fileId); Reporter.report("error_dsprofile.csv", datasetId + ";" + fileId + ";" + e.getMessage()); } } currentDataset.setCountPdfs(pdfcount); } protected void processPDF(String datasetId, EMD emd, String fileId, DatastreamProfile dsProfile) { if (currentTx != null) { logger.warn("===============> Previous transaction not closed."); if (currentTx.isActive()) { logger.warn("=================> Rolling back previous transaction."); currentTx.rollback(); } store.clear(); } currentTx = store.newTransAction(); currentTx.begin(); Long id = store.getId(fileId); // if (id == null) { TikaProfile testprofile = store.findByNaturalId(fileId); if (testprofile != null) { logger.warn("HIBERNATE NOT REALY WORKING {} {} {}", datasetId, fileId, dsProfile.getDsLabel()); System.exit(-1); } logger.info(""); logger.info(">>>>>>>>>>>>> Start processing pdf {} {} {}", datasetId, fileId, dsProfile.getDsLabel()); TikaProfile profile = new TikaProfile(fileId, datasetId); //profile = new TikaProfile(fileId, datasetId); profile.setDatasetId(datasetId); profile.setDsLabel(dsProfile.getDsLabel()); profile.setDsMediatype(dsProfile.getDsMIME()); profile.setDsState(dsProfile.getDsState()); if (dsProfile.getDsSize() != null) profile.setDsSize(dsProfile.getDsSize().longValue()); if (dsProfile.getDsCreateDate() != null) profile.setDsCreationDate(dsProfile.getDsCreateDate().toGregorianCalendar().getTime()); profile.setEmd(emd); if (datasetIterator != null) logger.info("date {} Created new profile for {}", datasetIterator.getDate(), profile.getDsLabel()); try { processProfile(profile, datasetId, emd, fileId, dsProfile); store.saveOrUpdate(profile); currentTx.commit(); fileCount++; } catch (Exception e) { logger.error("While storing profile for {}", fileId); Reporter.report("error_file_data.csv", datasetId + ";" + fileId + ";" + e.getMessage()); currentTx.rollback(); } finally { store.clear(); currentTx = null; logger.info("///////// READY processing #{}# pdf {} {} {}", fileCount, datasetId, fileId, dsProfile.getDsLabel()); } } else { if (datasetIterator != null) logger.info("XXXXXXXXXXX date {} Not redoing analysis of {}", datasetIterator.getDate(), dsProfile.getDsLabel()); currentTx.commit(); fileCount++; store.clear(); currentTx = null; return; } /////////////////////////////////////////////////////////////////////////// } private TikaProfile processProfile(TikaProfile profile, String datasetId, EMD emd, String fileId, DatastreamProfile dsProfile) throws Exception { InputStream currentData = null; try { currentData = fedora.getFileData(fileId); if (isSavingFiles()) { currentData = saveFile(datasetId, emd, fileId, dsProfile, currentData); } logger.info("Analyzing {} {} {}", datasetId, fileId, dsProfile.getDsLabel()); getPdfProcessor().process(profile, currentData); } catch (Exception e) { logger.error("While fetching dsProfile for {}", fileId); Reporter.report("error_file_data.csv", datasetId + ";" + fileId + ";" + e.getMessage()); } finally { IOUtils.closeQuietly(currentData); } return profile; } private InputStream saveFile(String datasetId, EMD emd, String fileId, DatastreamProfile dsProfile, InputStream data) throws IOException { File dir = new File("COAR_FILES"); if (!dir.exists()) { dir.mkdir(); } String dsId = "eds_" + datasetId.split(":")[1]; File dsIdDir = new File(dir, dsId); if (!dsIdDir.exists()) { dsIdDir.mkdirs(); } String fId = "ef_" + fileId.split(":")[1]; File fIdDir = new File(dsIdDir, fId); if (!fIdDir.exists()) { fIdDir.mkdirs(); } String filename = dsProfile.getDsLabel(); if (filename == null | "".equals(filename)) { filename = fId; } FileOutputStream fos = new FileOutputStream(new File(fIdDir, filename)); IOUtils.copyLarge(data, fos); IOUtils.closeQuietly(fos); return new FileInputStream(new File(fIdDir, filename)); } }
{ "content_hash": "f19d5dd166b45427c118d19ade07c042", "timestamp": "", "source": "github", "line_count": 306, "max_line_length": 147, "avg_line_length": 34.14052287581699, "alnum_prop": 0.555949076289844, "repo_name": "dans-er/coar", "id": "78763c7f0739315cca609abd526a8870f25ab890", "size": "10447", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/nl/knaw/dans/coar/shed/Conveyor.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "137782" } ], "symlink_target": "" }
NODEMCU-UPLOADER=../nodemcu-uploader/nodemcu-uploader.py # Serial port PORT=/dev/ttyUSB0 SPEED=9600 ###################################################################### # End of user config ###################################################################### HTTP_FILES := $(wildcard http/*) SERVER_FILES := $(wildcard httpserver/*) $(wildcard http-init/*) config.default.json base64.lua class.lua config.lua console.lua RESPONDER_FILES := $(wildcard httpresponder/*) # Print usage usage: @echo "make upload FILE:=<file> to upload a specific file (i.e make upload FILE:=init.lua)" @echo "make upload_http to upload files to be served" @echo "make upload_server to upload the server code and init.lua" @echo "make upload_all to upload all" @echo $(TEST) # Upload one files only upload: @$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(FILE) # Upload HTTP files only upload_http: $(HTTP_FILES) @$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f)) upload_responder: $(RESPONDER_FILES) @$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f)) # Upload httpserver lua files (init and server module) upload_server: $(SERVER_FILES) $(RESPONDER_FILES) @$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f)) # Upload all upload_all: $(SERVER_FILES) $(RESPONDER_FILES) $(HTTP_FILES) @$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f))
{ "content_hash": "742ea39b2e7c592e68cd6a1f00f2f56f", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 128, "avg_line_length": 37.35897435897436, "alnum_prop": 0.6046671242278655, "repo_name": "Mr-Pi/nodemcu-extended-httpserver", "id": "a48168b8f77de34d13d28367c1f3da3d4d35f23c", "size": "1690", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Makefile", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "7826" }, { "name": "Lua", "bytes": "20612" }, { "name": "Makefile", "bytes": "1690" }, { "name": "Shell", "bytes": "709" } ], "symlink_target": "" }
require "cantina/client/version" require "omniauth/strategies/cantina" module Cantina module Client # Your code goes here... end end
{ "content_hash": "a8b06eecc1d307b626cebf675b2bb212", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 37, "avg_line_length": 17.75, "alnum_prop": 0.7464788732394366, "repo_name": "johankok/cantina-client", "id": "9d0c15093a7bbe4496f0657e3c413a6d6e792a82", "size": "142", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/cantina/client.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "3428" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:clickable="true" android:focusable="true" android:background="@drawable/selector"> <LinearLayout android:id="@+id/user_item" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="4dp" android:minHeight="?android:attr/listPreferredItemHeight" android:orientation="vertical"> <TextView android:id="@+id/txt_user_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="2dp" android:textAppearance="@style/TextAppearance.AppCompat.Title" android:textColor="#000" /> <TextView android:id="@+id/txt_user_id" android:layout_width="match_parent" android:layout_height="wrap_content" android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textColor="#000" /> <TextView android:id="@+id/txt_date_created" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="2dp" android:gravity="start" android:textAppearance="@style/TextAppearance.AppCompat.Body1" android:textColor="#000" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="match_parent" android:background="?android:attr/selectableItemBackground" /> </FrameLayout>
{ "content_hash": "7bd9ef1361ee4593502c81396bc0ee42", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 65, "avg_line_length": 30.854166666666668, "alnum_prop": 0.7413909520594193, "repo_name": "andersonacs/Android-Retrofit-Example", "id": "890ce4738e1699a2c681b37a049dc671caff3f11", "size": "1481", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "app/src/main/res/layout/itam_contacts.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "10455" } ], "symlink_target": "" }
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.transloadit.sdk"> </manifest>
{ "content_hash": "f4e8d3a6bfb1eca2a19ecdec201e9d31", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 68, "avg_line_length": 38.666666666666664, "alnum_prop": 0.7413793103448276, "repo_name": "transloadit/android-sdk", "id": "d74cc5041eb9749d4f93adadf8de66449d00dd1a", "size": "116", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "transloadit-android/src/main/AndroidManifest.xml", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "14871" } ], "symlink_target": "" }
package org.apache.camel.component.restlet; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.model.rest.RestBindingMode; import org.junit.Test; public class RestRestletPojoInOutTest extends RestletTestSupport { @Test public void testRestletPojoInOut() throws Exception { String body = "{\"id\": 123, \"name\": \"Donald Duck\"}"; String out = template.requestBody("http://localhost:" + portNum + "/users/lives", body, String.class); assertNotNull(out); assertEquals("{\"iso\":\"EN\",\"country\":\"England\"}", out); } @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { // configure to use restlet on localhost with the given port // and enable auto binding mode restConfiguration().component("restlet").host("localhost").port(portNum).bindingMode(RestBindingMode.auto); // use the rest DSL to define the rest services rest("/users/") .post("lives").type(UserPojo.class).outType(CountryPojo.class) .route() .bean(new UserService(), "livesWhere"); } }; } }
{ "content_hash": "4d969981e1bed1d4f28453469db9ad63", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 123, "avg_line_length": 36.270270270270274, "alnum_prop": 0.6035767511177347, "repo_name": "Fabryprog/camel", "id": "b34c212786dcd3e7be6762e0013355dccabce747", "size": "2144", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "components/camel-restlet/src/test/java/org/apache/camel/component/restlet/RestRestletPojoInOutTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Apex", "bytes": "6521" }, { "name": "Batchfile", "bytes": "2353" }, { "name": "CSS", "bytes": "17204" }, { "name": "Elm", "bytes": "10852" }, { "name": "FreeMarker", "bytes": "8015" }, { "name": "Groovy", "bytes": "14479" }, { "name": "HTML", "bytes": "909437" }, { "name": "Java", "bytes": "82182194" }, { "name": "JavaScript", "bytes": "102432" }, { "name": "Makefile", "bytes": "513" }, { "name": "Shell", "bytes": "17240" }, { "name": "TSQL", "bytes": "28835" }, { "name": "Tcl", "bytes": "4974" }, { "name": "Thrift", "bytes": "6979" }, { "name": "XQuery", "bytes": "546" }, { "name": "XSLT", "bytes": "271473" } ], "symlink_target": "" }
package net.oneandone.troilus; import java.time.Duration; import net.oneandone.troilus.Context; import net.oneandone.troilus.DeleteQuery; import com.datastax.driver.core.querybuilder.Clause; /** * Java8 adapter of a DeleteQuery */ class DeleteQueryAdapter extends MutationQueryAdapter<Deletion, DeleteQuery> implements Deletion { /** * @param ctx the context * @param query the query */ DeleteQueryAdapter(Context ctx, DeleteQuery query) { super(ctx, query); } @Override protected Deletion newQuery(Context newContext) { return new DeleteQueryAdapter(newContext, getQuery().newQuery(newContext)); } @Override public Deletion withTtl(Duration ttl) { return newQuery(getContext().withTtl((int) ttl.getSeconds())); } @Override public Deletion onlyIf(Clause... onlyIfConditions) { return new DeleteQueryAdapter(getContext(), getQuery().onlyIf(onlyIfConditions)); } @Override public Deletion ifExists() { return new DeleteQueryAdapter(getContext(), getQuery().ifExists()); } }
{ "content_hash": "aebe7c457c16b0e425ef8144cc37edc1", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 98, "avg_line_length": 22.897959183673468, "alnum_prop": 0.6836007130124777, "repo_name": "mindis/Troilus", "id": "7607e4e6a87562737b4bce7ea623587615c80aef", "size": "1741", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "troilus-core/src/main/java/net/oneandone/troilus/DeleteQueryAdapter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "708174" } ], "symlink_target": "" }
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2016 Couchbase, Inc. * * 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. */ #include <limits.h> #include "globaltask.h" std::atomic<size_t> GlobalTask::task_id_counter(1); GlobalTask::GlobalTask(Taskable& t, const Priority &p, double sleeptime, bool completeBeforeShutdown) : RCValue(), priority(p), blockShutdown(completeBeforeShutdown), state(TASK_RUNNING), taskId(nextTaskId()), taskable(t) { snooze(sleeptime); } void GlobalTask::snooze(const double secs) { if (secs == INT_MAX) { setState(TASK_SNOOZED, TASK_RUNNING); updateWaketime(hrtime_t(-1)); return; } hrtime_t curTime = gethrtime(); if (secs) { setState(TASK_SNOOZED, TASK_RUNNING); waketime.store(curTime + hrtime_t(secs * 1000000000)); } else { waketime.store(curTime); } }
{ "content_hash": "2707c755c9a7a2adcc1abf5c92d52d3f", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 79, "avg_line_length": 32.04347826086956, "alnum_prop": 0.6614654002713705, "repo_name": "hisundar/forestdb", "id": "57b0f61f87f5d611b9de64784a030e07b2cdf8d5", "size": "1474", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "src/globaltask.cc", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "8009" }, { "name": "C++", "bytes": "3118036" }, { "name": "CMake", "bytes": "51966" }, { "name": "Objective-C", "bytes": "3171" } ], "symlink_target": "" }
package net.reini; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; public class TimeExamples { public static void main(String[] args) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd MM uuuu HH:mm:ss"); LocalDateTime dateTime = LocalDateTime.parse("01 02 1903 12:34:56", formatter); System.out.println(dateTime); ZonedDateTime zonedDateTime = dateTime.atZone(ZoneId.of("CET")); System.out.println(zonedDateTime); } }
{ "content_hash": "12f34e00ada02cdeb2886529d4c8be9f", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 85, "avg_line_length": 30.22222222222222, "alnum_prop": 0.7555147058823529, "repo_name": "reinhapa/Sandbox", "id": "976428448418362d2864b6095630b5653082cbce", "size": "1697", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/net/reini/TimeExamples.java", "mode": "33188", "license": "mit", "language": [ { "name": "Dockerfile", "bytes": "53" }, { "name": "Gherkin", "bytes": "104" }, { "name": "Java", "bytes": "192968" } ], "symlink_target": "" }
@interface XNBaseNavigationController () @end @implementation XNBaseNavigationController - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = DEFAULT_BACKGROUND_COLOR; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated { if (self.viewControllers.count > 0) { // 自动隐藏和显示 tabbar viewController.hidesBottomBarWhenPushed = YES; } [super pushViewController:viewController animated:YES]; } @end
{ "content_hash": "5626a1ef959701a8dd964d59ed248b7a", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 87, "avg_line_length": 21.884615384615383, "alnum_prop": 0.7258347978910369, "repo_name": "TsuiOS/NICHelper", "id": "ce2fbbe09aaefe2cdecc464ca43f762268452d4f", "size": "781", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "NICHelper/Main/Controller/XNBaseNavigationController.m", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "1420" }, { "name": "Objective-C", "bytes": "135340" }, { "name": "Ruby", "bytes": "368" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ListView android:id="@+id/lvVoz" android:layout_width="match_parent" android:layout_height="wrap_content" > </ListView> </LinearLayout>
{ "content_hash": "48a228802242ed921f70df45567e7afc", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 72, "avg_line_length": 31.153846153846153, "alnum_prop": 0.6666666666666666, "repo_name": "gabrieltavaresmelo/alunoce2", "id": "588dd07256a4b05b198af71da5feddfeb3e45e3e", "size": "405", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "res/layout/dialog_voz.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "72551" } ], "symlink_target": "" }
<!doctype html> <html> <head> <title>Drug Information Search</title> <link rel="stylesheet" href="../css/bootstrap.min.css"/> <link rel="stylesheet" href="../css/font-awesome.min.css"/> </head> <body class="container"> <div class="jumbotron" style="margin-top: 50px;"> <!-- <h1><svg src="../img/pill.svg" style="width:10%;"></svg> Drug Information</h1> --> <h1><object type="image/svg+xml" data="../img/pill.svg" style="width:8%;"> </object> Drug Information</h1> <p id="description">Automates searches for drug and related information. For both consumers and healthcare providers. Information included here is all from public domain unless otherwise indicated <i>(with a *). </i><br/> <br/> This is an open-source project. Please <a href="mailto:hello@allgoodpeople.us">email Bernard</a> for suggestions or click the "Fork me" button below and us send a pull request. <a href="http://www.allgoodpeople.us/apps/druginformation">http://www.allgoodpeople.us/apps/druginformation</a></p> <div class="row"> <div class="col-md-3"> <h2>Author</h2> <p id="description"><a href="mailto:hello@allgoodpeople.us">Bernard Hsu</a><br/><a href="http://www.allgoodpeople.us">All Good People LLC</a></p> </div> <div class="col-md-3"> <h2>Consultant</h2> <p>Bill Budris, RPh<br/><a href="http://www.nmh.org">Northwestern Memorial Hospital Chicago, IL</a></p> </div> <div class="col-md-3"> <h2>Version</h2> <p>0.884</p> </div> <div class="col-md-3"> <h2>Build Date</h2> <p>30 November 2016</p> </div> </div> <p id="description"></a></p> <div class="row"> <div class="col-md-9"> <div class="btn-group" style="margin-top:35px;"> <a class="btn btn-primary btn-lg" role="button" href="http:/www.twitter.com/drugsandgenes" target="_blank"><span class="fa fa-twitter fa-lg"></span> Follow on Twitter</a> <a class="btn btn-warning btn-lg" role="button" href="http:/www.github.com/bbhsu2/druginformation" target="_blank"><span class="fa fa-github fa-lg"></span> Fork me on Github!</a> <a class="btn btn-success btn-lg" role="button" href="http:/www.allgoodpeople.us/apps/" target="_blank"><span class="fa fa-mobile fa-lg"></span> See More Apps!</a> </div> </div> <div class="col-md-3"></div> <div class="col-md-3"> <a href="http://www.allgoodpeople.us" ><img src="../img/allgoodpeople.png" class="img-rounded" style="width: 120px;" alt="..."></a> </div> </div> </div> <script src="../js/jquery-1.11.1.js"></script> <script src="../js/bootstrap.min.js"></script> </body> </html>
{ "content_hash": "9ec1afe5ed58abe9d04304230c3fa522", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 526, "avg_line_length": 52.294117647058826, "alnum_prop": 0.6291713535808025, "repo_name": "bbhsu2/druginformation", "id": "a9af47f5e419f5553a2431ede8edd7675883cbd6", "size": "2667", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "pages/about.html", "mode": "33261", "license": "mit", "language": [ { "name": "HTML", "bytes": "13524" }, { "name": "JavaScript", "bytes": "13299" } ], "symlink_target": "" }
:-include(graphColoringInstance1). :-dynamic(varNumber/3). symbolicOutput(0). % set to 1 to see symbolic output only; 0 otherwise. writeClauses:- atleastOneColorPerNode, atmostOneColorPerNode, differentColors. atleastOneColorPerNode:- numNodes(N), numColors(K), between(1,N,I), findall( x-I-J, between(1,K,J), C ), writeClause(C), fail. atleastOneColorPerNode. atmostOneColorPerNode:- numNodes(N), numColors(K), between(1,N,I), between(1,K,J1), between(1,K,J2), J1<J2, writeClause( [ \+x-I-J1, \+x-I-J2 ] ), fail. atmostOneColorPerNode. differentColors:- edge(I1,I2), numColors(K), between(1,K,J), writeClause( [ \+x-I1-J, \+x-I2-J ] ), fail. differentColors. displaySol([]). displaySol([Nv|S]):- num2var(Nv,x-I-J), write(I), write(': color '), write(J), nl, displaySol(S). % ========== No need to change the following: ===================================== main:- symbolicOutput(1), !, writeClauses, halt. % escribir bonito, no ejecutar main:- assert(numClauses(0)), assert(numVars(0)), tell(clauses), writeClauses, told, tell(header), writeHeader, told, unix('cat header clauses > infile.cnf'), unix('picosat -v -o model infile.cnf'), unix('cat model'), see(model), readModel(M), seen, displaySol(M), halt. var2num(T,N):- hash_term(T,Key), varNumber(Key,T,N),!. var2num(T,N):- retract(numVars(N0)), N is N0+1, assert(numVars(N)), hash_term(T,Key), assert(varNumber(Key,T,N)), assert( num2var(N,T) ), !. writeHeader:- numVars(N),numClauses(C),write('p cnf '),write(N), write(' '),write(C),nl. countClause:- retract(numClauses(N)), N1 is N+1, assert(numClauses(N1)),!. writeClause([]):- symbolicOutput(1),!, nl. writeClause([]):- countClause, write(0), nl. writeClause([Lit|C]):- w(Lit), writeClause(C),!. w( Lit ):- symbolicOutput(1), write(Lit), write(' '),!. w(\+Var):- var2num(Var,N), write(-), write(N), write(' '),!. w( Var):- var2num(Var,N), write(N), write(' '),!. unix(Comando):-shell(Comando),!. unix(_). readModel(L):- get_code(Char), readWord(Char,W), readModel(L1), addIfPositiveInt(W,L1,L),!. readModel([]). addIfPositiveInt(W,L,[N|L]):- W = [C|_], between(48,57,C), number_codes(N,W), N>0, !. addIfPositiveInt(_,L,L). readWord(99,W):- repeat, get_code(Ch), member(Ch,[-1,10]), !, get_code(Ch1), readWord(Ch1,W),!. readWord(-1,_):-!, fail. %end of file readWord(C,[]):- member(C,[10,32]), !. % newline or white space marks end of word readWord(Char,[Char|W]):- get_code(Char1), readWord(Char1,W), !. %========================================================================================
{ "content_hash": "942096fc0da0dc1b1ac3c3497f71b9c4", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 97, "avg_line_length": 41.064516129032256, "alnum_prop": 0.6241162608012569, "repo_name": "necavit/li-sat-encoded", "id": "3f6b655a15d7cedbcb52a6fffea5c1571a1f4bdc", "size": "2546", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "graph-coloring/solveWithSAT.pl", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "753" }, { "name": "Makefile", "bytes": "462" }, { "name": "Perl6", "bytes": "12137" }, { "name": "PostScript", "bytes": "291202" }, { "name": "Prolog", "bytes": "84617" }, { "name": "Shell", "bytes": "7363" } ], "symlink_target": "" }
#include "cvtest.h" #include <opencv2/ts.hpp> #include "Matrix.h" #include "types/Scalar.h" #include "core/RNG.h" #include "types/Size.h" #include "types/Point.h" namespace cvtest_general_callback { std::shared_ptr<overload_resolution> overload; NAN_METHOD(callback) { if (overload == nullptr) { throw std::runtime_error("cvtest_general_callback is empty"); } return overload->execute("cvtest", info); } } void cv_test::Init(Handle<Object> target, std::shared_ptr<overload_resolution> overload) { cvtest_general_callback::overload = overload; Local<Object> testns = Nan::New<Object>(); target->Set(Nan::New("cvtest").ToLocalChecked(), testns); //int64 readSeed(const char* str); overload->addOverload("cvtest", "", "readSeed", { make_param<std::string>("str","String") }, readSeed); Nan::SetMethod(testns, "readSeed", cvtest_general_callback::callback); // //void randUni(RNG& rng, Mat& a, const Scalar& param1, const Scalar& param2); overload->addOverload("cvtest", "", "randUni", { make_param<RNG*>("rng","RNG"), make_param<Matrix*>("a",Matrix::name), make_param<Scalar*>("param1","Scalar"), make_param<Scalar*>("param2","Scalar") }, randUni); Nan::SetMethod(testns, "randUni", cvtest_general_callback::callback); // //const char* getTypeName(int type); overload->addOverload("cvtest", "", "getTypeName", { make_param<int>("type","int") }, getTypeName); Nan::SetMethod(testns, "getTypeName", cvtest_general_callback::callback); //int typeByName(const char* type_name); overload->addOverload("cvtest", "", "typeByName", { make_param<std::string>("type_name","String") }, typeByName); Nan::SetMethod(testns, "typeByName", cvtest_general_callback::callback); // //string vec2str(const string& sep, const int* v, size_t nelems); //overload->addOverload("cvtest", "", "vec2str", {}, vec2str); // // //double getMinVal(int depth); overload->addOverload("cvtest", "", "getMinVal", { make_param<int>("depth","int") }, getMinVal); Nan::SetMethod(testns, "getMinVal", cvtest_general_callback::callback); //double getMaxVal(int depth); overload->addOverload("cvtest", "", "getMaxVal", { make_param<int>("depth","int") }, getMaxVal); Nan::SetMethod(testns, "getMaxVal", cvtest_general_callback::callback); // //Size randomSize(RNG& rng, double maxSizeLog); overload->addOverload("cvtest", "", "randomSize", { make_param<RNG*>("rng","RNG"), make_param<double>("maxSizeLog","double") }, randomSize_a); Nan::SetMethod(testns, "randomSize", cvtest_general_callback::callback); //void randomSize(RNG& rng, int minDims, int maxDims, double maxSizeLog, vector<int>& sz); overload->addOverload("cvtest", "", "randomSize", { make_param<RNG*>("rng","RNG"), make_param<int>("minDims","int"), make_param<int>("maxDims","int"), make_param<double>("maxSizeLog","double") }, randomSize_b); //int randomType(RNG& rng, int typeMask, int minChannels, int maxChannels); overload->addOverload("cvtest", "", "randomType", { make_param<RNG*> ("rng","RNG"), make_param<int> ("typeMask","int"), make_param<int> ("minChannels","int"), make_param<int> ("maxChannels","int") }, randomType); Nan::SetMethod(testns, "randomType", cvtest_general_callback::callback); //Mat randomMat(RNG& rng, Size size, int type, double minVal, double maxVal, bool useRoi); overload->addOverload("cvtest", "", "randomMat", { make_param<RNG*>("rng","RNG"), make_param<Size*>("size",Size::name), make_param<int> ("type","int"), make_param<double> ("minVal","double"), make_param<double> ("maxVal","double"), make_param<bool> ("useRoi","bool") }, randomMat_a); Nan::SetMethod(testns, "randomMat", cvtest_general_callback::callback); //Mat randomMat(RNG& rng, const vector<int>& size, int type, double minVal, double maxVal, bool useRoi); overload->addOverload("cvtest", "", "randomMat", { make_param<RNG*>("rng","RNG"), make_param<std::shared_ptr<std::vector<int>>>("size","Array<int>"), make_param<int>("type","int"), make_param<double>("minVal","double"), make_param<double>("maxVal","double"), make_param<bool>("useRoi","bool") }, randomMat_b); //void add(const Mat& a, double alpha, const Mat& b, double beta, // Scalar gamma, Mat& c, int ctype, bool calcAbs = false); overload->addOverload("cvtest", "", "add", { make_param<Matrix*>("a",Matrix::name), make_param<double>("alpha","double"), make_param<Matrix*>("b",Matrix::name), make_param<double>("beta","double"), make_param<Scalar*>("gamma","Scalar"), make_param<Matrix*>("c",Matrix::name), make_param<int>("ctype","int"), make_param<bool>("calcAbs","bool", false) }, add); Nan::SetMethod(testns, "add", cvtest_general_callback::callback); //void multiply(const Mat& a, const Mat& b, Mat& c, double alpha = 1); overload->addOverload("cvtest", "", "multiply", { make_param<Matrix*>("a",Matrix::name), make_param<Matrix*>("b",Matrix::name), make_param<Matrix*>("c",Matrix::name), make_param<double>("alpha","double", 1) }, multiply); Nan::SetMethod(testns, "multiply", cvtest_general_callback::callback); //void divide(const Mat& a, const Mat& b, Mat& c, double alpha = 1); overload->addOverload("cvtest", "", "divide", { make_param<Matrix*>("a",Matrix::name), make_param<Matrix*>("b",Matrix::name), make_param<Matrix*>("c",Matrix::name), make_param<double>("alpha","double", 1) }, divide); Nan::SetMethod(testns, "divide", cvtest_general_callback::callback); // //void convert(const Mat& src, cv::OutputArray dst, int dtype, double alpha = 1, double beta = 0); overload->addOverload("cvtest", "", "convert", { make_param<Matrix*>("src",Matrix::name), make_param<IOArray*>("dst","IOArray"), make_param<int>("dtype","int"), make_param<double>("alpha","double", 1), make_param<double>("beta","double", 0) }, convert); Nan::SetMethod(testns, "convert", cvtest_general_callback::callback); //void copy(const Mat& src, Mat& dst, const Mat& mask = Mat(), bool invertMask = false); overload->addOverload("cvtest", "", "copy", { make_param<Matrix*>("src",Matrix::name), make_param<Matrix*>("dst",Matrix::name), make_param<Matrix*>("mask",Matrix::name,Matrix::create()), make_param<bool>("invertMask","bool", false) }, copy); Nan::SetMethod(testns, "copy", cvtest_general_callback::callback); //void set(Mat& dst, const Scalar& gamma, const Mat& mask = Mat()); overload->addOverload("cvtest", "", "set", { make_param<Matrix*>("dst",Matrix::name), make_param<Scalar*>("gamma","Scalar" ), make_param<Matrix*>("mask",Matrix::name,Matrix:: create()) }, set); Nan::SetMethod(testns, "set", cvtest_general_callback::callback); // //// working with multi-channel arrays //void extract(const Mat& a, Mat& plane, int coi); overload->addOverload("cvtest", "", "extract", { make_param<Matrix*>("a",Matrix::name), make_param<Matrix*>("plane",Matrix::name), make_param<int>("coi","int") }, extract); Nan::SetMethod(testns, "extract", cvtest_general_callback::callback); //void insert(const Mat& plane, Mat& a, int coi); overload->addOverload("cvtest", "", "insert", { make_param<Matrix*>("plane",Matrix::name), make_param<Matrix*>("a",Matrix::name), make_param<int>("coi","int") }, insert); Nan::SetMethod(testns, "insert", cvtest_general_callback::callback); // //// checks that the array does not have NaNs and/or Infs and all the elements are //// within [min_val,max_val). idx is the index of the first "bad" element. //int check(const Mat& data, double min_val, double max_val, vector<int>* idx); overload->addOverload("cvtest", "", "check", { make_param<Matrix*>("data",Matrix::name), make_param<double>("min_val","double"), make_param<double>("max_val","double"), make_param<std::shared_ptr<std::vector<int>>>("idx","Array<int>") }, check); Nan::SetMethod(testns, "check", cvtest_general_callback::callback); // //// modifies values that are close to zero //void patchZeros(Mat& mat, double level); overload->addOverload("cvtest", "", "patchZeros", { make_param<Matrix*>("mat",Matrix::name), make_param<double>("level","double") }, patchZeros); Nan::SetMethod(testns, "patchZeros", cvtest_general_callback::callback); // //void transpose(const Mat& src, Mat& dst); overload->addOverload("cvtest", "", "transpose", { make_param<Matrix*>("src",Matrix::name), make_param<Matrix*>("dst",Matrix::name) }, transpose); Nan::SetMethod(testns, "transpose", cvtest_general_callback::callback); //void erode(const Mat& src, Mat& dst, const Mat& _kernel, Point anchor = Point(-1, -1), // int borderType = 0, const Scalar& borderValue = Scalar()); overload->addOverload("cvtest", "", "erode", { make_param<Matrix*>("src",Matrix::name), make_param<Matrix*>("dst",Matrix::name), make_param<Matrix*>("_kernel",Matrix::name), make_param<Point*>("anchor","Point", Point::create(-1, -1)), make_param<int>("borderType","int", 0), make_param<Scalar*>("borderValue","Scalar",Scalar::create()) }, erode); Nan::SetMethod(testns, "erode", cvtest_general_callback::callback); //void dilate(const Mat& src, Mat& dst, const Mat& _kernel, Point anchor = Point(-1, -1), // int borderType = 0, const Scalar& borderValue = Scalar()); overload->addOverload("cvtest", "", "dilate", { make_param<Matrix*>("src",Matrix::name), make_param<Matrix*>("dst",Matrix::name), make_param<Matrix*>("_kernel",Matrix::name), make_param<Point*>("anchor","Point", Point::create(-1, -1)), make_param<int>("borderType","int", 0), make_param<Scalar*>("borderValue","Scalar", Scalar::create()) }, dilate); Nan::SetMethod(testns, "dilate", cvtest_general_callback::callback); //void filter2D(const Mat& src, Mat& dst, int ddepth, const Mat& kernel, // Point anchor, double delta, int borderType, // const Scalar& borderValue = Scalar()); overload->addOverload("cvtest", "", "filter2D", { make_param<Matrix*>("src",Matrix::name), make_param<Matrix*>("dst",Matrix::name), make_param<int>("ddepth","int"), make_param<Matrix*>("kernel",Matrix::name), make_param<Point*>("anchor",Point::name), make_param<double>("delta","double"), make_param<int>("borderType","int"), make_param<Scalar*>("borderValue",Scalar::name, Scalar::create()) }, filter2D); Nan::SetMethod(testns, "filter2D", cvtest_general_callback::callback); //void copyMakeBorder(const Mat& src, Mat& dst, int top, int bottom, int left, int right, // int borderType, const Scalar& borderValue = Scalar()); overload->addOverload("cvtest", "", "copyMakeBorder", { make_param<Matrix*>("src",Matrix::name), make_param<Matrix*>("dst",Matrix::name), make_param<int>("top","int"), make_param<int>("bottom","int"), make_param<int>("left","int"), make_param<int>("right","int"), make_param<int>("borderType","int"), make_param<Scalar*>("borderValue",Scalar::name, Scalar::create()) }, copyMakeBorder); Nan::SetMethod(testns, "copyMakeBorder", cvtest_general_callback::callback); //Mat calcSobelKernel2D(int dx, int dy, int apertureSize, int origin = 0); overload->addOverload("cvtest", "", "calcSobelKernel2D", { make_param<int>("dx","int"), make_param<int>("dy","int"), make_param<int>("apertureSize","int"), make_param<int>("origin","int", 0) }, calcSobelKernel2D); Nan::SetMethod(testns, "calcSobelKernel2D", cvtest_general_callback::callback); //Mat calcLaplaceKernel2D(int aperture_size); overload->addOverload("cvtest", "", "calcLaplaceKernel2D", { make_param<int>("aperture_size","int") }, calcLaplaceKernel2D); Nan::SetMethod(testns, "calcLaplaceKernel2D", cvtest_general_callback::callback); // //void initUndistortMap(const Mat& a, const Mat& k, Size sz, Mat& mapx, Mat& mapy); overload->addOverload("cvtest", "", "initUndistortMap", { make_param<Matrix*>("a",Matrix::name), make_param<Matrix*>("k",Matrix::name), make_param<Size*>("sz",Size::name), make_param<Matrix*>("mapx",Matrix::name), make_param<Matrix*>("mapy",Matrix::name) }, initUndistortMap); Nan::SetMethod(testns, "initUndistortMap", cvtest_general_callback::callback); // //void minMaxLoc(const Mat& src, double* minval, double* maxval, // vector<int>* minloc, vector<int>* maxloc, const Mat& mask = Mat()); /*overload->addOverload("cvtest", "", "minMaxLoc", { make_param<Matrix* src make_param<double* minval make_param<double* maxval make_param<vector<int>* minloc make_param<vector<int>* maxloc make_param<Matrix* mask = Mat() }, minMaxLoc); */ //double norm(InputArray src, int normType, InputArray mask = noArray()); overload->addOverload("cvtest", "", "norm", { make_param<IOArray*>("src","IOArray"), make_param<int>("normType","int"), make_param<IOArray*>("mask","IOArray",IOArray:: noArray()) }, norm_a); Nan::SetMethod(testns, "norm", cvtest_general_callback::callback); //double norm(InputArray src1, InputArray src2, int normType, InputArray mask = noArray()); overload->addOverload("cvtest", "", "norm", { make_param<IOArray*>("src1","IOArray"), make_param<IOArray*>("src2","IOArray"), make_param<int>("normType","int"), make_param<IOArray*>("mask","IOArray",IOArray::noArray()) }, norm_b); //Scalar mean(const Mat& src, const Mat& mask = Mat()); overload->addOverload("cvtest", "", "mean", { make_param<Matrix*>("src",Matrix::name), make_param<Matrix*>("mask",Matrix::name,Matrix::create()) }, mean); Nan::SetMethod(testns, "mean", cvtest_general_callback::callback); //double PSNR(InputArray src1, InputArray src2); overload->addOverload("cvtest", "", "PSNR", { make_param<IOArray*>("src1","IOArray"), make_param<IOArray*>("src2","IOArray") }, PSNR); Nan::SetMethod(testns, "PSNR", cvtest_general_callback::callback); // //bool cmpUlps(const Mat& data, const Mat& refdata, int expMaxDiff, double* realMaxDiff, vector<int>* idx); /*overload->addOverload("cvtest", "", "cmpUlps", { Matrix* data Matrix* refdata int expMaxDiff double* realMaxDiff, vector<int>* idx }, cmpUlps);*/ // //// compares two arrays. max_diff is the maximum actual difference, //// success_err_level is maximum allowed difference, idx is the index of the first //// element for which difference is >success_err_level //// (or index of element with the maximum difference) //int cmpEps(const Mat& data, const Mat& refdata, double* max_diff, // double success_err_level, vector<int>* idx, // bool element_wise_relative_error); // (data: _mat.Mat, refdata: _mat.Mat, success_err_level: _st.double, element_wise_relative_error: boolean, //cb: (idx: Array<_st.int>, max_diff : _st.double) = > void): CMP_EPS_CODE overload->addOverload("cvtest", "", "cmpEps", { make_param<Matrix*>("data",Matrix::name), make_param<Matrix*>("refdata",Matrix::name), make_param<double>("success_err_level","double"), make_param<bool>("element_wise_relative_error","bool"), make_param<std::shared_ptr<overres::Callback>>("cb","Function") }, cmpEps); Nan::SetMethod(testns, "cmpEps", cvtest_general_callback::callback); // //// a wrapper for the previous function. in case of error prints the message to log file. //int cmpEps2(TS* ts, const Mat& data, const Mat& refdata, double success_err_level, // bool element_wise_relative_error, const char* desc); //overload->addOverload("cvtest", "", "cmpEps2", {}, cmpEps2); // //int cmpEps2_64f(TS* ts, const double* val, const double* refval, int len, // double eps, const char* param_name); //overload->addOverload("cvtest", "", "cmpEps2_64f", {}, cmpEps2_64f); // //void logicOp(const Mat& src1, const Mat& src2, Mat& dst, char c); overload->addOverload("cvtest", "", "logicOp", { make_param<Matrix*>("src1",Matrix::name), make_param<Matrix*>("src2",Matrix::name), make_param<Matrix*>("dst",Matrix::name), make_param<std::string>("c","String") }, logicOp_a); Nan::SetMethod(testns, "logicOp", cvtest_general_callback::callback); //void logicOp(const Mat& src, const Scalar& s, Mat& dst, char c); overload->addOverload("cvtest", "", "logicOp", { make_param<Matrix*>("src",Matrix::name), make_param<Scalar*>("s","Scalar"), make_param<Matrix*>("dst",Matrix::name), make_param<std::string>("c","String") }, logicOp_b); //void min(const Mat& src1, const Mat& src2, Mat& dst); overload->addOverload("cvtest", "", "min", { make_param<Matrix*>("src1",Matrix::name), make_param<Matrix*>("src2",Matrix::name), make_param<Matrix*>("dst",Matrix::name) }, min_a); Nan::SetMethod(testns, "min", cvtest_general_callback::callback); //void min(const Mat& src, double s, Mat& dst); overload->addOverload("cvtest", "", "min", { make_param<Matrix*>("src",Matrix::name), make_param<double>("s","double"), make_param<Matrix*>("dst",Matrix::name) }, min_b); //void max(const Mat& src1, const Mat& src2, Mat& dst); overload->addOverload("cvtest", "", "max", { make_param<Matrix*>("src1",Matrix::name), make_param<Matrix*>("src2",Matrix::name), make_param<Matrix*>("dst",Matrix::name) }, max_a); Nan::SetMethod(testns, "max", cvtest_general_callback::callback); //void max(const Mat& src, double s, Mat& dst); overload->addOverload("cvtest", "", "max", { make_param<Matrix*>("src",Matrix::name), make_param<double>("s","double"), make_param<Matrix*>("dst",Matrix::name) }, max_b); // //void compare(const Mat& src1, const Mat& src2, Mat& dst, int cmpop); overload->addOverload("cvtest", "", "compare", { make_param<Matrix*>("src1",Matrix::name), make_param<Matrix*>("src2",Matrix::name), make_param<Matrix*>("dst",Matrix::name), make_param<int>("cmpop","int") }, compare_a); Nan::SetMethod(testns, "compare", cvtest_general_callback::callback); //void compare(const Mat& src, double s, Mat& dst, int cmpop); overload->addOverload("cvtest", "", "compare", { make_param<Matrix*>("src",Matrix::name), make_param<double>("s","double"), make_param<Matrix*>("dst",Matrix::name), make_param<int>("cmpop","int") }, compare_b); //void gemm(const Mat& src1, const Mat& src2, double alpha, // const Mat& src3, double beta, Mat& dst, int flags); overload->addOverload("cvtest", "", "gemm", { make_param<Matrix*>("src1",Matrix::name), make_param<Matrix*>("src2",Matrix::name), make_param<double>("alpha","double"), make_param<Matrix*>("src3",Matrix::name), make_param<double>("beta","double"), make_param<Matrix*>("dst",Matrix::name), make_param<int>("flags","int") }, gemm); Nan::SetMethod(testns, "gemm", cvtest_general_callback::callback); //void transform(const Mat& src, Mat& dst, const Mat& transmat, const Mat& shift); overload->addOverload("cvtest", "", "transform", { make_param<Matrix*>("src",Matrix::name), make_param<Matrix*>("dst",Matrix::name), make_param<Matrix*>("transmat",Matrix::name), make_param<Matrix*>("shift",Matrix::name) }, transform); Nan::SetMethod(testns, "transform", cvtest_general_callback::callback); //double crossCorr(const Mat& src1, const Mat& src2); overload->addOverload("cvtest", "", "crossCorr", { make_param<Matrix*>("src1",Matrix::name), make_param<Matrix*>("src2",Matrix::name) }, crossCorr); Nan::SetMethod(testns, "crossCorr", cvtest_general_callback::callback); //void threshold(const Mat& src, Mat& dst, double thresh, double maxval, int thresh_type); overload->addOverload("cvtest", "", "threshold", { make_param<Matrix*>("src",Matrix::name), make_param<Matrix*>("dst",Matrix::name), make_param<double>("thresh","double"), make_param<double>("maxval","double"), make_param<int>("thresh_type","int") }, threshold); Nan::SetMethod(testns, "threshold", cvtest_general_callback::callback); ////void minMaxIdx(InputArray _img, double* minVal, double* maxVal, //// Point* minLoc, Point* maxLoc, InputArray _mask); // //overload->addOverload("cvtest", "", "minMaxIdx", {}, minMaxIdx); ////// test images generation functions ////void fillGradient(Mat& img, int delta = 5); //overload->addOverload("cvtest", "", "fillGradient", {}, fillGradient); ////void smoothBorder(Mat& img, const Scalar& color, int delta = 3); //overload->addOverload("cvtest", "", "smoothBorder", {}, smoothBorder); // //void printVersionInfo(bool useStdOut = true); overload->addOverload("cvtest", "", "printVersionInfo", { make_param<bool>("useStdOut","bool",true) }, printVersionInfo); Nan::SetMethod(testns, "printVersionInfo", cvtest_general_callback::callback); #ifdef HAVE_CUDA DeviceManager::Init(target); #endif }; POLY_METHOD(cv_test::readSeed) { auto str = info.at<std::string>(0); auto ret = cvtest::readSeed(str.c_str()); info.SetReturnValue(ret); } POLY_METHOD(cv_test::randUni) { auto rng = info.at<RNG *>(0)->_rng; auto a = info.at<Matrix * >(1)->_mat; auto param1 = info.at<Scalar *>(2)->_scalar; auto param2 = info.at<Scalar *>(3)->_scalar; cvtest::randUni(*rng, *a, *param1, *param2); } POLY_METHOD(cv_test::getTypeName) { auto type = info.at<int>(0); auto ret = std::string(cvtest::getTypeName(type)); info.SetReturnValue(ret); } POLY_METHOD(cv_test::typeByName) { auto type_name = info.at<std::string>(0); auto ret = cvtest::typeByName(type_name.c_str()); info.SetReturnValue(ret); } //POLY_METHOD(cv_test::vec2str){} POLY_METHOD(cv_test::getMinVal) { auto depth = info.at<int>(0); auto ret = cvtest::getMinVal(depth); info.SetReturnValue(ret); } POLY_METHOD(cv_test::getMaxVal) { auto depth = info.at<int>(0); auto ret = cvtest::getMaxVal(depth); info.SetReturnValue(ret); } POLY_METHOD(cv_test::randomSize_a) { auto rng = info.at<RNG *>(0)->_rng; auto maxSizeLog = info.at<double >(1); auto ret = new Size(); ret->_size = std::make_shared<cv::Size>(cvtest::randomSize(*rng, maxSizeLog)); info.SetReturnValue(ret); } POLY_METHOD(cv_test::randomSize_b) { auto rng = info.at<RNG*>(0)->_rng; auto minDims = info.at<int>(1); auto maxDims = info.at<int>(2); auto maxSizeLog = info.at<double>(3); auto sz = std::make_shared<std::vector<int>>(); cvtest::randomSize(*rng, minDims, maxDims, maxSizeLog, *sz); info.SetReturnValue(sz); } POLY_METHOD(cv_test::randomType) { auto rng = info.at<RNG*>(0)->_rng; auto typeMask = info.at<int >(1); auto minChannels = info.at<int >(2); auto maxChannels = info.at<int >(3); auto ret = cvtest::randomType(*rng, typeMask, minChannels, maxChannels); info.SetReturnValue(ret); } POLY_METHOD(cv_test::randomMat_a) { auto rng = info.at<RNG* >(0)->_rng; auto size = info.at<Size* >(1)->_size; auto type = info.at<int >(2); auto minVal = info.at<double>(3); auto maxVal = info.at<double>(4); auto useRoi = info.at<bool >(5); auto ret = new Matrix(); ret->_mat = std::make_shared<cv::Mat>(cvtest::randomMat(*rng, *size, type, minVal, maxVal, useRoi)); info.SetReturnValue(ret); } POLY_METHOD(cv_test::randomMat_b) { auto rng = info.at<RNG*>(0)->_rng; auto size = info.at<std::shared_ptr<std::vector<int>>>(1); auto type = info.at<int>(2); auto minVal = info.at<double>(3); auto maxVal = info.at<double>(4); auto useRoi = info.at<bool>(5); auto ret = new Matrix(); ret->_mat = std::make_shared<cv::Mat>(cvtest::randomMat(*rng, *size, type, minVal, maxVal, useRoi)); info.SetReturnValue(ret); } POLY_METHOD(cv_test::add) { auto a = info.at<Matrix*>(0)->_mat; auto alpha = info.at<double>(1); auto b = info.at<Matrix*>(2)->_mat; auto beta = info.at<double>(3); auto gamma = info.at<Scalar*>(4)->_scalar; auto c = info.at<Matrix*>(5)->_mat; auto ctype = info.at<int>(6); auto calcAbs = info.at<bool>(7); cvtest::add( *a , alpha , *b , beta , *gamma , *c , ctype , calcAbs ); } POLY_METHOD(cv_test::multiply) { auto a = info.at<Matrix*>(0)->_mat; auto b = info.at<Matrix*>(1)->_mat; auto c = info.at<Matrix*>(2)->_mat; auto alpha = info.at<double>(3); cvtest::multiply(*a, *b, *c, alpha); } POLY_METHOD(cv_test::divide) { auto a = info.at<Matrix*>(0)->_mat; auto b = info.at<Matrix*>(1)->_mat; auto c = info.at<Matrix*>(2)->_mat; auto alpha = info.at<double>(3); cvtest::divide(*a, *b, *c, alpha); } POLY_METHOD(cv_test::convert) { auto src = info.at<Matrix*>(0)->_mat; auto dst = info.at<IOArray*>(1)->GetOutputArray(); auto dtype = info.at<int>(2); auto alpha = info.at<double>(3); auto beta = info.at<double>(4); cvtest::convert(*src, dst, dtype, alpha, beta); } POLY_METHOD(cv_test::copy) { auto src = info.at<Matrix*>(0)->_mat; auto dst = info.at<Matrix*>(1)->_mat; auto mask = info.at<Matrix*>(2)->_mat; auto invertMask = info.at<bool>(3); cvtest::copy(*src, *dst, *mask, invertMask); } POLY_METHOD(cv_test::set) { auto dst = info.at<Matrix*>(0)->_mat; auto gamma = info.at<Scalar*>(1)->_scalar; auto mask = info.at<Matrix*>(2)->_mat; cvtest::set(*dst, *gamma, *mask); } POLY_METHOD(cv_test::extract) { auto a = info.at<Matrix*>(0)->_mat; auto plane = info.at<Matrix*>(1)->_mat; auto coi = info.at<int>(2); cvtest::extract(*a, *plane, coi); } POLY_METHOD(cv_test::insert) { auto plane = info.at<Matrix*>(0)->_mat; auto a = info.at<Matrix*>(1)->_mat; auto coi = info.at<int>(2); cvtest::insert(*plane, *a, coi); } POLY_METHOD(cv_test::check) { auto data = info.at<Matrix*>(0)->_mat; auto min_val = info.at<double>(1); auto max_val = info.at<double>(2); auto idx = info.at<std::shared_ptr<std::vector<int>>>(3); auto ret = cvtest::check(*data, min_val, max_val, idx.get()); info.SetReturnValue(ret); } POLY_METHOD(cv_test::patchZeros) { auto mat = info.at<Matrix*>(0)->_mat; auto level = info.at<double>(1); cvtest::patchZeros(*mat, level); } POLY_METHOD(cv_test::transpose) { auto src = info.at<Matrix*>(0)->_mat; auto dst = info.at<Matrix*>(1)->_mat; cvtest::transpose(*src, *dst); } POLY_METHOD(cv_test::erode) { auto src = info.at<Matrix*>(0)->_mat; auto dst = info.at<Matrix*>(1)->_mat; auto _kernel = info.at<Matrix*>(2)->_mat; auto anchor = info.at<Point*>(3)->_point; auto borderType = info.at<int>(4); auto borderValue = info.at<Scalar*>(5)->_scalar; cvtest::erode(*src, *dst, *_kernel, *anchor, borderType, *borderValue); } POLY_METHOD(cv_test::dilate) { auto src = info.at<Matrix*>(0)->_mat; auto dst = info.at<Matrix*>(1)->_mat; auto _kernel = info.at<Matrix*>(2)->_mat; auto anchor = info.at<Point*>(3)->_point; auto borderType = info.at<int>(4); auto borderValue = info.at<Scalar*>(5)->_scalar; cvtest::dilate(*src, *dst, *_kernel, *anchor, borderType, *borderValue); } POLY_METHOD(cv_test::filter2D) { auto src = info.at<Matrix*>(0)->_mat; auto dst = info.at<Matrix*>(1)->_mat; auto ddepth = info.at<int>(2); auto kernel = info.at<Matrix*>(3)->_mat; auto anchor = info.at<Point*>(4)->_point; auto delta = info.at<double>(5); auto borderType = info.at<int>(6); auto borderValue = info.at<Scalar*>(7)->_scalar; cvtest::filter2D( *src , *dst , ddepth , *kernel , *anchor , delta , borderType , *borderValue ); } POLY_METHOD(cv_test::copyMakeBorder) { auto src = info.at<Matrix*>(0)->_mat; auto dst = info.at<Matrix*>(1)->_mat; auto top = info.at<int>(2); auto bottom = info.at<int>(3); auto left = info.at<int>(4); auto right = info.at<int>(5); auto borderType = info.at<int>(6); auto borderValue = info.at<Scalar*>(7)->_scalar; cvtest::copyMakeBorder( *src, *dst, top, bottom, left, right, borderType, *borderValue ); } POLY_METHOD(cv_test::calcSobelKernel2D) { auto dx = info.at<int>(0); auto dy = info.at<int>(1); auto apertureSize = info.at<int>(2); auto origin = info.at<int>(3); auto ret = new Matrix(); ret->_mat = std::make_shared<cv::Mat>(cvtest::calcSobelKernel2D(dx, dy, apertureSize, origin)); info.SetReturnValue(ret); } POLY_METHOD(cv_test::calcLaplaceKernel2D) { auto aperture_size = info.at<int>(0); auto ret = new Matrix(); ret->_mat = std::make_shared<cv::Mat>(cvtest::calcLaplaceKernel2D(aperture_size)); info.SetReturnValue(ret); } POLY_METHOD(cv_test::initUndistortMap) { auto a = info.at<Matrix*>(0)->_mat; auto k = info.at<Matrix*>(1)->_mat; auto sz = info.at<Size*>(2)->_size; auto mapx = info.at<Matrix*>(3)->_mat; auto mapy = info.at<Matrix*>(4)->_mat; cvtest::initUndistortMap( *a, *k, *sz, *mapx, *mapy); } //POLY_METHOD(cv_test::minMaxLoc) {} POLY_METHOD(cv_test::norm_a) { auto src = info.at<IOArray*>(0)->GetInputArray(); auto normType = info.at<int>(1); auto mask = info.at<IOArray*>(2)->GetInputArray(); auto ret = cvtest::norm(src, normType, mask); info.SetReturnValue(ret); } POLY_METHOD(cv_test::norm_b) { auto src1 = info.at<IOArray*>(0)->GetInputArray(); auto src2 = info.at<IOArray*>(1)->GetInputArray(); auto normType = info.at<int>(2); auto mask = info.at<IOArray*>(3)->GetInputArray(); auto ret = cvtest::norm(src1,src2, normType, mask); info.SetReturnValue(ret); } POLY_METHOD(cv_test::mean) { auto src = info.at<Matrix*>(0)->_mat; auto mask = info.at<Matrix*>(1)->_mat; auto ret = new Scalar(); ret->_scalar = std::make_shared<cv::Scalar>(cvtest::mean(*src, *mask)); info.SetReturnValue(ret); } POLY_METHOD(cv_test::PSNR) { auto src1 = info.at<IOArray*>(0)->GetInputArray(); auto src2 = info.at<IOArray*>(1)->GetInputArray(); auto ret = cvtest::PSNR(src1, src1); info.SetReturnValue(ret); } //POLY_METHOD(cv_test::cmpUlps) {} POLY_METHOD(cv_test::cmpEps) { auto data = info.at<Matrix*>(0)->_mat; auto refdata = info.at<Matrix*>(1)->_mat; auto success_err_level = info.at<double>(2); auto element_wise_relative_error = info.at<bool>(3); auto cb = info.at<std::shared_ptr< overres::Callback>>(4); // (idx: Array<_st.int>, max_diff : _st.double) = > void): CMP_EPS_CODE auto idx = std::make_shared<std::vector<int>>(); double max_diff; auto ret = cvtest::cmpEps(*data, *refdata, &max_diff, success_err_level, idx.get(), element_wise_relative_error); cb->Call({ overres::make_value(idx), overres::make_value(max_diff) }); info.SetReturnValue(ret); } //POLY_METHOD(cv_test::cmpEps2) {} //POLY_METHOD(cv_test::cmpEps2_64f) {} POLY_METHOD(cv_test::logicOp_a) { auto src1 = info.at<Matrix*>(0)->_mat; auto src2 = info.at<Matrix*>(1)->_mat; auto dst = info.at<Matrix*>(2)->_mat; auto c = info.at<std::string>(3); cvtest::logicOp(*src1, *src2, *dst, c[0]); } POLY_METHOD(cv_test::logicOp_b) { auto src1 = info.at<Matrix*>(0)->_mat; auto s = info.at<Scalar*>(1)->_scalar; auto dst = info.at<Matrix*>(2)->_mat; auto c = info.at<std::string>(3); cvtest::logicOp(*src1, *s, *dst, c[0]); } POLY_METHOD(cv_test::min_a) { auto src1 = info.at<Matrix*>(0)->_mat; auto src2 = info.at<Matrix*>(1)->_mat; auto dst = info.at<Matrix*>(2)->_mat; cvtest::min(*src1, *src2, *dst); } POLY_METHOD(cv_test::min_b) { auto src = info.at<Matrix*>(0)->_mat; auto s = info.at<double>(1); auto dst = info.at<Matrix*>(2)->_mat; cvtest::min(*src, s, *dst); } POLY_METHOD(cv_test::max_a) { auto src1 = info.at<Matrix*>(0)->_mat; auto src2 = info.at<Matrix*>(1)->_mat; auto dst = info.at<Matrix*>(2)->_mat; cvtest::max(*src1, *src2, *dst); } POLY_METHOD(cv_test::max_b) { auto src = info.at<Matrix*>(0)->_mat; auto s = info.at<double>(1); auto dst = info.at<Matrix*>(2)->_mat; cvtest::max(*src, s, *dst); } POLY_METHOD(cv_test::compare_a) { auto src1 = info.at<Matrix*>(0)->_mat; auto src2 = info.at<Matrix*>(1)->_mat; auto dst = info.at<Matrix*>(2)->_mat; auto cmpop = info.at<int>(3); cvtest::compare(*src1, *src2, *dst, cmpop); } POLY_METHOD(cv_test::compare_b) { auto src = info.at<Matrix*>(0)->_mat; auto s = info.at<double>(1); auto dst = info.at<Matrix*>(2)->_mat; auto cmpop = info.at<int>(3); cvtest::compare(*src, s, *dst, cmpop); } POLY_METHOD(cv_test::gemm) { auto src1 = info.at<Matrix*>(0)->_mat; auto src2 = info.at<Matrix*>(1)->_mat; auto alpha = info.at<double>(2); auto src3 = info.at<Matrix*>(3)->_mat; auto beta = info.at<double>(4); auto dst = info.at<Matrix*>(5)->_mat; auto flags = info.at<int>(6); cvtest::gemm( *src1 , *src2 , alpha , *src3 , beta , *dst , flags); } POLY_METHOD(cv_test::transform) { auto src = info.at<Matrix*>(0)->_mat; auto dst = info.at<Matrix*>(1)->_mat; auto transmat = info.at<Matrix*>(2)->_mat; auto shift = info.at<Matrix*>(3)->_mat; cvtest::transform(*src, *dst, *transmat, *shift); } POLY_METHOD(cv_test::crossCorr) { auto src1 = info.at<Matrix*>(0)->_mat; auto src2 = info.at<Matrix*>(1)->_mat; auto ret = cvtest::crossCorr(*src1, *src2); info.SetReturnValue(ret); } POLY_METHOD(cv_test::threshold) { auto src = info.at<Matrix*>(0)->_mat; auto dst = info.at<Matrix*>(1)->_mat; auto thresh = info.at<double>(2); auto maxval = info.at<double>(3); auto thresh_type = info.at<int>(4); cvtest::threshold( *src , *dst , thresh , maxval , thresh_type ); } //POLY_METHOD(cv_test::minMaxIdx) {} //POLY_METHOD(cv_test::fillGradient) {} //POLY_METHOD(cv_test::smoothBorder) {} POLY_METHOD(cv_test::printVersionInfo) { auto useStdOut = info.at<bool>(0); cvtest::printVersionInfo(useStdOut); }
{ "content_hash": "c136165c3a2675f73f99387c76bdba6c", "timestamp": "", "source": "github", "line_count": 931, "max_line_length": 132, "avg_line_length": 35.87647690655209, "alnum_prop": 0.6425256728840454, "repo_name": "drorgl/node-alvision", "id": "d985b4fd5c4be378df5709ad4a6431d52c03dd31", "size": "33401", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/opencv/cvtest.cc", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "102" }, { "name": "C++", "bytes": "2031326" }, { "name": "JavaScript", "bytes": "1056" }, { "name": "Python", "bytes": "7254" }, { "name": "Shell", "bytes": "2428" }, { "name": "TypeScript", "bytes": "6549815" } ], "symlink_target": "" }
/* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F7xx_HAL_CONF_H #define __STM32F7xx_HAL_CONF_H #ifdef __cplusplus extern "C" { #endif #include "main.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* ########################## Module Selection ############################## */ /** * @brief This is the list of modules to be used in the HAL driver */ #define HAL_MODULE_ENABLED /* #define HAL_ADC_MODULE_ENABLED */ /* #define HAL_CRYP_MODULE_ENABLED */ /* #define HAL_CAN_MODULE_ENABLED */ /* #define HAL_CEC_MODULE_ENABLED */ /* #define HAL_CRC_MODULE_ENABLED */ /* #define HAL_CRYP_MODULE_ENABLED */ /* #define HAL_DAC_MODULE_ENABLED */ /* #define HAL_DCMI_MODULE_ENABLED */ /* #define HAL_DMA2D_MODULE_ENABLED */ /* #define HAL_ETH_MODULE_ENABLED */ /* #define HAL_NAND_MODULE_ENABLED */ /* #define HAL_NOR_MODULE_ENABLED */ /* #define HAL_SRAM_MODULE_ENABLED */ /* #define HAL_SDRAM_MODULE_ENABLED */ /* #define HAL_HASH_MODULE_ENABLED */ /* #define HAL_I2S_MODULE_ENABLED */ /* #define HAL_IWDG_MODULE_ENABLED */ /* #define HAL_LPTIM_MODULE_ENABLED */ /* #define HAL_LTDC_MODULE_ENABLED */ /* #define HAL_QSPI_MODULE_ENABLED */ /* #define HAL_RNG_MODULE_ENABLED */ /* #define HAL_RTC_MODULE_ENABLED */ /* #define HAL_SAI_MODULE_ENABLED */ #define HAL_SD_MODULE_ENABLED /* #define HAL_MMC_MODULE_ENABLED */ /* #define HAL_SPDIFRX_MODULE_ENABLED */ /* #define HAL_SPI_MODULE_ENABLED */ /* #define HAL_TIM_MODULE_ENABLED */ #define HAL_UART_MODULE_ENABLED /* #define HAL_USART_MODULE_ENABLED */ /* #define HAL_IRDA_MODULE_ENABLED */ /* #define HAL_SMARTCARD_MODULE_ENABLED */ /* #define HAL_WWDG_MODULE_ENABLED */ /* #define HAL_PCD_MODULE_ENABLED */ /* #define HAL_HCD_MODULE_ENABLED */ /* #define HAL_DFSDM_MODULE_ENABLED */ /* #define HAL_DSI_MODULE_ENABLED */ /* #define HAL_JPEG_MODULE_ENABLED */ /* #define HAL_MDIOS_MODULE_ENABLED */ /* #define HAL_SMBUS_MODULE_ENABLED */ /* #define HAL_MMC_MODULE_ENABLED */ #define HAL_GPIO_MODULE_ENABLED #define HAL_DMA_MODULE_ENABLED #define HAL_RCC_MODULE_ENABLED #define HAL_FLASH_MODULE_ENABLED #define HAL_PWR_MODULE_ENABLED #define HAL_I2C_MODULE_ENABLED #define HAL_CORTEX_MODULE_ENABLED /* ########################## HSE/HSI Values adaptation ##################### */ /** * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. * This value is used by the RCC HAL module to compute the system frequency * (when HSE is used as system clock source, directly or through the PLL). */ #if !defined (HSE_VALUE) #define HSE_VALUE ((uint32_t)25000000U) /*!< Value of the External oscillator in Hz */ #endif /* HSE_VALUE */ #if !defined (HSE_STARTUP_TIMEOUT) #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */ #endif /* HSE_STARTUP_TIMEOUT */ /** * @brief Internal High Speed oscillator (HSI) value. * This value is used by the RCC HAL module to compute the system frequency * (when HSI is used as system clock source, directly or through the PLL). */ #if !defined (HSI_VALUE) #define HSI_VALUE ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/ #endif /* HSI_VALUE */ /** * @brief Internal Low Speed oscillator (LSI) value. */ #if !defined (LSI_VALUE) #define LSI_VALUE ((uint32_t)32000U) /*!< LSI Typical Value in Hz*/ #endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz The real value may vary depending on the variations in voltage and temperature. */ /** * @brief External Low Speed oscillator (LSE) value. */ #if !defined (LSE_VALUE) #define LSE_VALUE ((uint32_t)32768U) /*!< Value of the External Low Speed oscillator in Hz */ #endif /* LSE_VALUE */ #if !defined (LSE_STARTUP_TIMEOUT) #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */ #endif /* LSE_STARTUP_TIMEOUT */ /** * @brief External clock source for I2S peripheral * This value is used by the I2S HAL module to compute the I2S clock source * frequency, this source is inserted directly through I2S_CKIN pad. */ #if !defined (EXTERNAL_CLOCK_VALUE) #define EXTERNAL_CLOCK_VALUE ((uint32_t)12288000U) /*!< Value of the Internal oscillator in Hz*/ #endif /* EXTERNAL_CLOCK_VALUE */ /* Tip: To avoid modifying this file each time you need to use different HSE, === you can define the HSE value in your toolchain compiler preprocessor. */ /* ########################### System Configuration ######################### */ /** * @brief This is the HAL system configuration section */ #define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */ #define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */ #define USE_RTOS 0U #define PREFETCH_ENABLE 0U #define ART_ACCLERATOR_ENABLE 0U /* To enable instruction cache and prefetch */ /* ########################## Assert Selection ############################## */ /** * @brief Uncomment the line below to expanse the "assert_param" macro in the * HAL drivers code */ /* #define USE_FULL_ASSERT 1 */ /* ################## Ethernet peripheral configuration ##################### */ /* Section 1 : Ethernet peripheral configuration */ /* MAC ADDRESS: MAC_ADDR0:MAC_ADDR1:MAC_ADDR2:MAC_ADDR3:MAC_ADDR4:MAC_ADDR5 */ #define MAC_ADDR0 2U #define MAC_ADDR1 0U #define MAC_ADDR2 0U #define MAC_ADDR3 0U #define MAC_ADDR4 0U #define MAC_ADDR5 0U /* Definition of the Ethernet driver buffers size and count */ #define ETH_RX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for receive */ #define ETH_TX_BUF_SIZE ETH_MAX_PACKET_SIZE /* buffer size for transmit */ #define ETH_RXBUFNB ((uint32_t)4U) /* 4 Rx buffers of size ETH_RX_BUF_SIZE */ #define ETH_TXBUFNB ((uint32_t)4U) /* 4 Tx buffers of size ETH_TX_BUF_SIZE */ /* Section 2: PHY configuration section */ /* DP83848_PHY_ADDRESS Address*/ #define DP83848_PHY_ADDRESS 0x01U /* PHY Reset delay these values are based on a 1 ms Systick interrupt*/ #define PHY_RESET_DELAY ((uint32_t)0x000000FFU) /* PHY Configuration delay */ #define PHY_CONFIG_DELAY ((uint32_t)0x00000FFFU) #define PHY_READ_TO ((uint32_t)0x0000FFFFU) #define PHY_WRITE_TO ((uint32_t)0x0000FFFFU) /* Section 3: Common PHY Registers */ #define PHY_BCR ((uint16_t)0x0000U) /*!< Transceiver Basic Control Register */ #define PHY_BSR ((uint16_t)0x0001U) /*!< Transceiver Basic Status Register */ #define PHY_RESET ((uint16_t)0x8000U) /*!< PHY Reset */ #define PHY_LOOPBACK ((uint16_t)0x4000U) /*!< Select loop-back mode */ #define PHY_FULLDUPLEX_100M ((uint16_t)0x2100U) /*!< Set the full-duplex mode at 100 Mb/s */ #define PHY_HALFDUPLEX_100M ((uint16_t)0x2000U) /*!< Set the half-duplex mode at 100 Mb/s */ #define PHY_FULLDUPLEX_10M ((uint16_t)0x0100U) /*!< Set the full-duplex mode at 10 Mb/s */ #define PHY_HALFDUPLEX_10M ((uint16_t)0x0000U) /*!< Set the half-duplex mode at 10 Mb/s */ #define PHY_AUTONEGOTIATION ((uint16_t)0x1000U) /*!< Enable auto-negotiation function */ #define PHY_RESTART_AUTONEGOTIATION ((uint16_t)0x0200U) /*!< Restart auto-negotiation function */ #define PHY_POWERDOWN ((uint16_t)0x0800U) /*!< Select the power down mode */ #define PHY_ISOLATE ((uint16_t)0x0400U) /*!< Isolate PHY from MII */ #define PHY_AUTONEGO_COMPLETE ((uint16_t)0x0020U) /*!< Auto-Negotiation process completed */ #define PHY_LINKED_STATUS ((uint16_t)0x0004U) /*!< Valid link established */ #define PHY_JABBER_DETECTION ((uint16_t)0x0002U) /*!< Jabber condition detected */ /* Section 4: Extended PHY Registers */ #define PHY_SR ((uint16_t)0x10U) /*!< PHY status register Offset */ #define PHY_SPEED_STATUS ((uint16_t)0x0002U) /*!< PHY Speed mask */ #define PHY_DUPLEX_STATUS ((uint16_t)0x0004U) /*!< PHY Duplex mask */ /* ################## SPI peripheral configuration ########################## */ /* CRC FEATURE: Use to activate CRC feature inside HAL SPI Driver * Activated: CRC code is present inside driver * Deactivated: CRC code cleaned from driver */ #define USE_SPI_CRC 0U /* Includes ------------------------------------------------------------------*/ /** * @brief Include module's header file */ #ifdef HAL_RCC_MODULE_ENABLED #include "stm32f7xx_hal_rcc.h" #endif /* HAL_RCC_MODULE_ENABLED */ #ifdef HAL_GPIO_MODULE_ENABLED #include "stm32f7xx_hal_gpio.h" #endif /* HAL_GPIO_MODULE_ENABLED */ #ifdef HAL_DMA_MODULE_ENABLED #include "stm32f7xx_hal_dma.h" #endif /* HAL_DMA_MODULE_ENABLED */ #ifdef HAL_CORTEX_MODULE_ENABLED #include "stm32f7xx_hal_cortex.h" #endif /* HAL_CORTEX_MODULE_ENABLED */ #ifdef HAL_ADC_MODULE_ENABLED #include "stm32f7xx_hal_adc.h" #endif /* HAL_ADC_MODULE_ENABLED */ #ifdef HAL_CAN_MODULE_ENABLED #include "stm32f7xx_hal_can.h" #endif /* HAL_CAN_MODULE_ENABLED */ #ifdef HAL_CEC_MODULE_ENABLED #include "stm32f7xx_hal_cec.h" #endif /* HAL_CEC_MODULE_ENABLED */ #ifdef HAL_CRC_MODULE_ENABLED #include "stm32f7xx_hal_crc.h" #endif /* HAL_CRC_MODULE_ENABLED */ #ifdef HAL_CRYP_MODULE_ENABLED #include "stm32f7xx_hal_cryp.h" #endif /* HAL_CRYP_MODULE_ENABLED */ #ifdef HAL_DMA2D_MODULE_ENABLED #include "stm32f7xx_hal_dma2d.h" #endif /* HAL_DMA2D_MODULE_ENABLED */ #ifdef HAL_DAC_MODULE_ENABLED #include "stm32f7xx_hal_dac.h" #endif /* HAL_DAC_MODULE_ENABLED */ #ifdef HAL_DCMI_MODULE_ENABLED #include "stm32f7xx_hal_dcmi.h" #endif /* HAL_DCMI_MODULE_ENABLED */ #ifdef HAL_ETH_MODULE_ENABLED #include "stm32f7xx_hal_eth.h" #endif /* HAL_ETH_MODULE_ENABLED */ #ifdef HAL_FLASH_MODULE_ENABLED #include "stm32f7xx_hal_flash.h" #endif /* HAL_FLASH_MODULE_ENABLED */ #ifdef HAL_SRAM_MODULE_ENABLED #include "stm32f7xx_hal_sram.h" #endif /* HAL_SRAM_MODULE_ENABLED */ #ifdef HAL_NOR_MODULE_ENABLED #include "stm32f7xx_hal_nor.h" #endif /* HAL_NOR_MODULE_ENABLED */ #ifdef HAL_NAND_MODULE_ENABLED #include "stm32f7xx_hal_nand.h" #endif /* HAL_NAND_MODULE_ENABLED */ #ifdef HAL_SDRAM_MODULE_ENABLED #include "stm32f7xx_hal_sdram.h" #endif /* HAL_SDRAM_MODULE_ENABLED */ #ifdef HAL_HASH_MODULE_ENABLED #include "stm32f7xx_hal_hash.h" #endif /* HAL_HASH_MODULE_ENABLED */ #ifdef HAL_I2C_MODULE_ENABLED #include "stm32f7xx_hal_i2c.h" #endif /* HAL_I2C_MODULE_ENABLED */ #ifdef HAL_I2S_MODULE_ENABLED #include "stm32f7xx_hal_i2s.h" #endif /* HAL_I2S_MODULE_ENABLED */ #ifdef HAL_IWDG_MODULE_ENABLED #include "stm32f7xx_hal_iwdg.h" #endif /* HAL_IWDG_MODULE_ENABLED */ #ifdef HAL_LPTIM_MODULE_ENABLED #include "stm32f7xx_hal_lptim.h" #endif /* HAL_LPTIM_MODULE_ENABLED */ #ifdef HAL_LTDC_MODULE_ENABLED #include "stm32f7xx_hal_ltdc.h" #endif /* HAL_LTDC_MODULE_ENABLED */ #ifdef HAL_PWR_MODULE_ENABLED #include "stm32f7xx_hal_pwr.h" #endif /* HAL_PWR_MODULE_ENABLED */ #ifdef HAL_QSPI_MODULE_ENABLED #include "stm32f7xx_hal_qspi.h" #endif /* HAL_QSPI_MODULE_ENABLED */ #ifdef HAL_RNG_MODULE_ENABLED #include "stm32f7xx_hal_rng.h" #endif /* HAL_RNG_MODULE_ENABLED */ #ifdef HAL_RTC_MODULE_ENABLED #include "stm32f7xx_hal_rtc.h" #endif /* HAL_RTC_MODULE_ENABLED */ #ifdef HAL_SAI_MODULE_ENABLED #include "stm32f7xx_hal_sai.h" #endif /* HAL_SAI_MODULE_ENABLED */ #ifdef HAL_SD_MODULE_ENABLED #include "stm32f7xx_hal_sd.h" #endif /* HAL_SD_MODULE_ENABLED */ #ifdef HAL_MMC_MODULE_ENABLED #include "stm32f7xx_hal_mmc.h" #endif /* HAL_MMC_MODULE_ENABLED */ #ifdef HAL_SPDIFRX_MODULE_ENABLED #include "stm32f7xx_hal_spdifrx.h" #endif /* HAL_SPDIFRX_MODULE_ENABLED */ #ifdef HAL_SPI_MODULE_ENABLED #include "stm32f7xx_hal_spi.h" #endif /* HAL_SPI_MODULE_ENABLED */ #ifdef HAL_TIM_MODULE_ENABLED #include "stm32f7xx_hal_tim.h" #endif /* HAL_TIM_MODULE_ENABLED */ #ifdef HAL_UART_MODULE_ENABLED #include "stm32f7xx_hal_uart.h" #endif /* HAL_UART_MODULE_ENABLED */ #ifdef HAL_USART_MODULE_ENABLED #include "stm32f7xx_hal_usart.h" #endif /* HAL_USART_MODULE_ENABLED */ #ifdef HAL_IRDA_MODULE_ENABLED #include "stm32f7xx_hal_irda.h" #endif /* HAL_IRDA_MODULE_ENABLED */ #ifdef HAL_SMARTCARD_MODULE_ENABLED #include "stm32f7xx_hal_smartcard.h" #endif /* HAL_SMARTCARD_MODULE_ENABLED */ #ifdef HAL_WWDG_MODULE_ENABLED #include "stm32f7xx_hal_wwdg.h" #endif /* HAL_WWDG_MODULE_ENABLED */ #ifdef HAL_PCD_MODULE_ENABLED #include "stm32f7xx_hal_pcd.h" #endif /* HAL_PCD_MODULE_ENABLED */ #ifdef HAL_HCD_MODULE_ENABLED #include "stm32f7xx_hal_hcd.h" #endif /* HAL_HCD_MODULE_ENABLED */ #ifdef HAL_DFSDM_MODULE_ENABLED #include "stm32f7xx_hal_dfsdm.h" #endif /* HAL_DFSDM_MODULE_ENABLED */ #ifdef HAL_DSI_MODULE_ENABLED #include "stm32f7xx_hal_dsi.h" #endif /* HAL_DSI_MODULE_ENABLED */ #ifdef HAL_JPEG_MODULE_ENABLED #include "stm32f7xx_hal_jpeg.h" #endif /* HAL_JPEG_MODULE_ENABLED */ #ifdef HAL_MDIOS_MODULE_ENABLED #include "stm32f7xx_hal_mdios.h" #endif /* HAL_MDIOS_MODULE_ENABLED */ #ifdef HAL_SMBUS_MODULE_ENABLED #include "stm32f7xx_hal_smbus.h" #endif /* HAL_SMBUS_MODULE_ENABLED */ /* Exported macro ------------------------------------------------------------*/ #ifdef USE_FULL_ASSERT /** * @brief The assert_param macro is used for function's parameters check. * @param expr: If expr is false, it calls assert_failed function * which reports the name of the source file and the source * line number of the call that failed. * If expr is true, it returns no value. * @retval None */ #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) /* Exported functions ------------------------------------------------------- */ void assert_failed(uint8_t* file, uint32_t line); #else #define assert_param(expr) ((void)0U) #endif /* USE_FULL_ASSERT */ #ifdef __cplusplus } #endif #endif /* __STM32F7xx_HAL_CONF_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
{ "content_hash": "042bb6a521327c9b24f4f3aa3ec23737", "timestamp": "", "source": "github", "line_count": 419, "max_line_length": 116, "avg_line_length": 35.47016706443914, "alnum_prop": 0.6248149643385816, "repo_name": "tyskink/STM32_Project", "id": "2af7377214298222020f9850b8424fe1677785cd", "size": "16822", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "STM32F7_CNN1/CNN_1/Inc/stm32f7xx_hal_conf.h", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Assembly", "bytes": "7913984" }, { "name": "C", "bytes": "219857516" }, { "name": "C++", "bytes": "1145309" }, { "name": "HTML", "bytes": "625387" } ], "symlink_target": "" }
var app, argv, config, express, fs, http, https, httpsPort, httpsServer, ip, options, os, port, request, server, _; express = require('express'); request = require('request'); fs = require('fs'); http = require('http'); https = require('https'); express = require('express'); _ = require('lodash'); os = require('os'); ip = require('ip'); argv = require('optimist').argv; process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0; ip = argv.local ? ip.address() : argv.ip || '127.0.0.1'; port = 7070; httpsPort = 7443; config = { useHttps: false }; app = express(); server = http.createServer(app); server.listen(port, ip, function() { return console.log("Express server listening on " + ip + ":" + port); }); if (config.useHttps) { options = { hostname: 'local.slkwrrm.com', key: fs.readFileSync('host.key', 'utf8'), cert: fs.readFileSync('host.cert', 'utf8') }; httpsServer = https.createServer(options, app); httpsServer.listen(httpsPort, ip, function() { return console.log("Express https server listening on " + ip + ":" + httpsPort); }); } app.use(express["static"]('build')); app.get('*', function(req, res) { return res.sendfile('build/index.html'); });
{ "content_hash": "51baaf521f7374c51c49bd3cabcaeab7", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 115, "avg_line_length": 24.3265306122449, "alnum_prop": 0.6459731543624161, "repo_name": "amschrader/silkworm", "id": "1af71dea9689a6bdfc86d6f7f345c8e237828023", "size": "1192", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "server/server.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "24478" }, { "name": "JavaScript", "bytes": "30944" } ], "symlink_target": "" }
<?php require_once './include/include_announce.php'; $info_hash = $_GET['info_hash']; if (!$info_hash) $bt->err('Multi-scrape denied!'); $infohash = bin2hex($info_hash); $r = db::o()->p($infohash)->query('SELECT seeders, leechers, downloaded FROM content_torrents WHERE info_hash=? LIMIT 1'); $row = db::o()->fetch_assoc($r); if (!$row) $bt->err('Unknown torrent. Infohash - ' . $infohash); $bt->benc_resp_raw($bt->benc(array('files' => array( $info_hash => array('complete' => (int) $row['seeders'], 'downloaded' => (int) $row['downloaded'], 'incomplete' => (int) $row['leechers']))))); ?>
{ "content_hash": "8dba0f02097f271bde4285d8808422d5", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 72, "avg_line_length": 36.72222222222222, "alnum_prop": 0.56732223903177, "repo_name": "TheCheat/CTRev", "id": "1a6f6f11c678500a5a49916510b8dc7cfa70df84", "size": "927", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "scrape.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "116062" }, { "name": "JavaScript", "bytes": "419031" }, { "name": "PHP", "bytes": "1408237" } ], "symlink_target": "" }
using System.Collections.Generic; namespace Azure.Analytics.Synapse.Artifacts.Models { /// <summary> File server read settings. </summary> public partial class FileServerReadSettings : StoreReadSettings { /// <summary> Initializes a new instance of FileServerReadSettings. </summary> public FileServerReadSettings() { Type = "FileServerReadSettings"; } /// <summary> Initializes a new instance of FileServerReadSettings. </summary> /// <param name="type"> The read setting type. </param> /// <param name="maxConcurrentConnections"> The maximum concurrent connection count for the source data store. Type: integer (or Expression with resultType integer). </param> /// <param name="additionalProperties"> . </param> /// <param name="recursive"> If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean). </param> /// <param name="wildcardFolderPath"> FileServer wildcardFolderPath. Type: string (or Expression with resultType string). </param> /// <param name="wildcardFileName"> FileServer wildcardFileName. Type: string (or Expression with resultType string). </param> /// <param name="fileListPath"> Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). </param> /// <param name="enablePartitionDiscovery"> Indicates whether to enable partition discovery. </param> /// <param name="partitionRootPath"> Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). </param> /// <param name="deleteFilesAfterCompletion"> Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). </param> /// <param name="modifiedDatetimeStart"> The start of file&apos;s modified datetime. Type: string (or Expression with resultType string). </param> /// <param name="modifiedDatetimeEnd"> The end of file&apos;s modified datetime. Type: string (or Expression with resultType string). </param> /// <param name="fileFilter"> Specify a filter to be used to select a subset of files in the folderPath rather than all files. Type: string (or Expression with resultType string). </param> internal FileServerReadSettings(string type, object maxConcurrentConnections, IDictionary<string, object> additionalProperties, object recursive, object wildcardFolderPath, object wildcardFileName, object fileListPath, bool? enablePartitionDiscovery, object partitionRootPath, object deleteFilesAfterCompletion, object modifiedDatetimeStart, object modifiedDatetimeEnd, object fileFilter) : base(type, maxConcurrentConnections, additionalProperties) { Recursive = recursive; WildcardFolderPath = wildcardFolderPath; WildcardFileName = wildcardFileName; FileListPath = fileListPath; EnablePartitionDiscovery = enablePartitionDiscovery; PartitionRootPath = partitionRootPath; DeleteFilesAfterCompletion = deleteFilesAfterCompletion; ModifiedDatetimeStart = modifiedDatetimeStart; ModifiedDatetimeEnd = modifiedDatetimeEnd; FileFilter = fileFilter; Type = type ?? "FileServerReadSettings"; } /// <summary> If true, files under the folder path will be read recursively. Default is true. Type: boolean (or Expression with resultType boolean). </summary> public object Recursive { get; set; } /// <summary> FileServer wildcardFolderPath. Type: string (or Expression with resultType string). </summary> public object WildcardFolderPath { get; set; } /// <summary> FileServer wildcardFileName. Type: string (or Expression with resultType string). </summary> public object WildcardFileName { get; set; } /// <summary> Point to a text file that lists each file (relative path to the path configured in the dataset) that you want to copy. Type: string (or Expression with resultType string). </summary> public object FileListPath { get; set; } /// <summary> Indicates whether to enable partition discovery. </summary> public bool? EnablePartitionDiscovery { get; set; } /// <summary> Specify the root path where partition discovery starts from. Type: string (or Expression with resultType string). </summary> public object PartitionRootPath { get; set; } /// <summary> Indicates whether the source files need to be deleted after copy completion. Default is false. Type: boolean (or Expression with resultType boolean). </summary> public object DeleteFilesAfterCompletion { get; set; } /// <summary> The start of file&apos;s modified datetime. Type: string (or Expression with resultType string). </summary> public object ModifiedDatetimeStart { get; set; } /// <summary> The end of file&apos;s modified datetime. Type: string (or Expression with resultType string). </summary> public object ModifiedDatetimeEnd { get; set; } /// <summary> Specify a filter to be used to select a subset of files in the folderPath rather than all files. Type: string (or Expression with resultType string). </summary> public object FileFilter { get; set; } } }
{ "content_hash": "9b4665f0cb12050920ab36ea8549be88", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 457, "avg_line_length": 86.359375, "alnum_prop": 0.7125022616247513, "repo_name": "jackmagic313/azure-sdk-for-net", "id": "3e5899e32f577882736afca3348b20c82870abb1", "size": "5665", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/Models/FileServerReadSettings.cs", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "15958" }, { "name": "C#", "bytes": "175000108" }, { "name": "CSS", "bytes": "5585" }, { "name": "HTML", "bytes": "225966" }, { "name": "JavaScript", "bytes": "13014" }, { "name": "PowerShell", "bytes": "201417" }, { "name": "Shell", "bytes": "13061" }, { "name": "Smarty", "bytes": "11127" }, { "name": "TypeScript", "bytes": "141835" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>my-tools</artifactId> <packaging>jar</packaging> <parent> <groupId>org.frank.outcomes</groupId> <artifactId>outcomes</artifactId> <version>1.0-SNAPSHOT</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web-services</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> </dependency> <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <classifier/> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-amqp</artifactId> </dependency> <dependency> <groupId>com.auth0</groupId> <artifactId>java-jwt</artifactId> </dependency> <dependency> <groupId>wsdl4j</groupId> <artifactId>wsdl4j</artifactId> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-jsr310</artifactId> </dependency> <dependency> <groupId>com.otms.alipay</groupId> <artifactId>alipay-sdk-java</artifactId> </dependency> <dependency> <groupId>com.otms.alipay</groupId> <artifactId>commons-logging</artifactId> </dependency> <dependency> <groupId>com.itextpdf</groupId> <artifactId>kernel</artifactId> <version>7.0.4</version> </dependency> <dependency> <groupId>com.itextpdf</groupId> <artifactId>io</artifactId> <version>7.0.4</version> </dependency> <dependency> <groupId>com.itextpdf</groupId> <artifactId>layout</artifactId> <version>7.0.4</version> </dependency> <dependency> <groupId>com.itextpdf</groupId> <artifactId>forms</artifactId> <version>7.0.4</version> </dependency> <dependency> <groupId>com.itextpdf</groupId> <artifactId>pdfa</artifactId> <version>7.0.4</version> </dependency> <dependency> <groupId>com.itextpdf</groupId> <artifactId>pdftest</artifactId> <version>7.0.4</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> <executions> <execution> <id>xjc</id> <goals> <goal>xjc</goal> </goals> </execution> </executions> <configuration> <schemaDirectory>${project.basedir}/src/main/resources/</schemaDirectory> <outputDirectory>${project.basedir}/src/main/java</outputDirectory> <clearOutputDir>false</clearOutputDir> </configuration> </plugin> </plugins> </build> </project>
{ "content_hash": "b0a82ffa3534c2172eb49af9de8030c2", "timestamp": "", "source": "github", "line_count": 150, "max_line_length": 104, "avg_line_length": 27.973333333333333, "alnum_prop": 0.7035271687321258, "repo_name": "daishicheng/outcomes", "id": "df8960630e5370a20d38573db20731a29697ca20", "size": "4196", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "my-tools/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "5444" }, { "name": "Java", "bytes": "275825" } ], "symlink_target": "" }
import React from 'react' import configureStore from 'redux-mock-store' import NavigationContainer from './NavigationContainer' import toJson from 'enzyme-to-json' import {shallow} from 'enzyme' describe('<NavigationContainer />', () => { it('should render', () => { const initialState = { navigationReducer: { navigation: { data: [ { id: 'home', title: 'Weather', tooltip: 'Weather', isActive: true, url: '/' }, { id: 'map', title: 'Map', tooltip: 'Weather map', isActive: false, url: '/map' } ], ui: { active: 'home' } }} } const mockStore = configureStore() const store = mockStore(initialState) const wrapper = shallow(<NavigationContainer store={store} />) expect(toJson(wrapper)).toMatchSnapshot() }) })
{ "content_hash": "bc71a3cb5cb3a09de2596584fce9aacc", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 66, "avg_line_length": 26.342105263157894, "alnum_prop": 0.4945054945054945, "repo_name": "gibbok/react-redux-weather-app", "id": "c9240c2276e373ce3f94d46a61f233290c631e24", "size": "1010", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/shared/navigation/NavigationContainer.test.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "54" }, { "name": "HTML", "bytes": "200" }, { "name": "JavaScript", "bytes": "3445008" } ], "symlink_target": "" }
"""Module implements quality functions for graph decompositions. """ from __future__ import division, print_function, absolute_import import six range = six.moves.range import numpy as np import scipy import scipy.sparse as sp from . import partitions class QualityFunction(object): def __init__(self): """Base class for implementing a quality function. """ # precompute quantities here pass def quality(self, membership): """Returns a quality score corresponding to membership vector. Parameters ---------- membership : np.array Membership vector Returns ------- float Quality """ raise NotImplementedError def find_optimal(self, initial_membership=None, num_runs=1, debug_level=0): """Find optimal decomposition. Parameters ---------- initial_membership : np.array, optional Initial membership assignment. If None specified, each component is assigned to separate subsystem. num_runs : int, optional Number of runs to try, can improve quality of decompositions. Default is 1. debug_level : int, optional Amount of debugging information to display, from 0 (no debugging information) to 3 (maximal debugging information) Returns ------- np.array Optimal membership array float Q value corresponding to optimal membership """ return partitions.greedy_search(self.quality, self.N, initial_membership=initial_membership, num_runs=num_runs, debug_level=debug_level) class Modularity(QualityFunction): def __init__(self, mx): """Class that implements Newman's modularity quality function. Parameters ---------- mx : 2-dimensional np.array Connectivity matrix of graph to partition into communities. """ mx = mx if sp.isspmatrix(mx) else np.asarray(mx) self.mx = mx.astype('float') self.ks = self.mx.sum(axis=1) self.total_stubs = self.ks.sum() self.N = mx.shape[0] def quality(self, membership): if len(membership) != self.N: raise ValueError('Membership should be array of length %d, not %d' % (self.N, len(membership))) q = 0 for comm in set(membership): ixs = membership == comm q += (self.mx[ixs,:][:,ixs].sum() - self.ks[ixs].sum()**2/self.total_stubs) return q / self.total_stubs class DirectedModularity(Modularity): def __init__(self, mx): """Class that implements Newman's directed modularity quality function. EA Leicht, MEJ Newman, "Community structure in directed networks", PRL, 2007. http://arxiv.org/abs/0709.4500 Parameters ---------- mx : 2-dimensional np.array Connectivity matrix of graph to partition into communities. """ super(DirectedModularity, self).__init__(mx) self.k_in = self.mx.sum(axis=0).flat self.k_out = self.mx.sum(axis=1).flat def quality(self, membership): q = 0.0 for comm in set(membership): ndxs = membership == comm q += (self.mx[ndxs,:][:,ndxs].sum() - (self.k_in[ndxs].sum()*self.k_out[ndxs].sum()) / self.total_stubs) return q / self.total_stubs class InfoMapCodeLength(QualityFunction): def __init__(self, mx, teleportation_prob=0.0): """Class that implements Rosvall's `map equation' quality function. Parameters ---------- mx : 2-dimensional np.array Connectivity matrix of graph to partition into communities. teleportation_prob : float (default 0.0) Probability of teleporting to random node. """ mx = np.asarray(mx) self.N = mx.shape[0] mx = mx.astype('float') # Create transition matrix self.trans = mx/mx.sum(axis=0)[None,:] if teleportation_prob > 0: teleportation_trans = np.ones(mx.shape) # np.fill_diagonal(teleportation_trans, 0) teleportation_trans /= teleportation_trans.sum(axis=0)[None,:] self.trans = (1-teleportation_prob)*self.trans + teleportation_prob*teleportation_trans # Get equilibrium probs and entropy evals, evecs = scipy.linalg.eig(self.trans) equil = np.real(evecs[:,np.isclose(evals,1)]) self.equil = np.ravel(equil / equil.sum()) self.equil_entropy = self.normed_entropy(self.equil) @staticmethod def normed_entropy(probs): #probs = probs[probs != 0.0] psum = sum(probs) probs = probs / (psum if psum != 0 else 1) return -np.sum(probs * np.log2(probs)) def quality(self, membership, extrainfo=False): comms = set(membership) K = len(comms) exit_probs = [] total_code_len = 0.0 for c in comms: ixs = membership == c comm_node_probs = self.equil[ixs] comm_p = comm_node_probs.sum() stay_prob = (self.trans[:,ixs][ixs,:].dot(comm_node_probs)).sum() comm_exit_prob = (comm_p - stay_prob) if comm_exit_prob > 0: plist = np.array(comm_node_probs.tolist() + [comm_exit_prob,]) else: plist = comm_node_probs comm_code_len = (comm_p + comm_exit_prob) * self.normed_entropy(plist) total_code_len += comm_code_len exit_probs.append(comm_exit_prob) if K > 1: total_code_len += sum(exit_probs) * self.normed_entropy(np.array(exit_probs)) # Return negative because we want to minimize, not maximize return -total_code_len
{ "content_hash": "220dba5f5b3d8df7dd0ac8928915b325", "timestamp": "", "source": "github", "line_count": 184, "max_line_length": 112, "avg_line_length": 29.53804347826087, "alnum_prop": 0.6325666973321067, "repo_name": "artemyk/graphy", "id": "ba62b4dbd9fcbe81ceb4e3203ff05e39e509950d", "size": "5435", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "graphy/qualityfuncs.py", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Python", "bytes": "48515" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "50e569277760a653f28aaef96c5f5967", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "cb0f25b1937dbb305989fc80cc51e8a6c1be2865", "size": "177", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Violaceae/Hybanthus/Hybanthus proctorii/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
namespace PCSMain { partial class MainScreen { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.menuGroupBar = new Syncfusion.Windows.Forms.Tools.GroupBar(); ((System.ComponentModel.ISupportInitialize)(this.menuGroupBar)).BeginInit(); this.SuspendLayout(); // // menuGroupBar // this.menuGroupBar.AllowDrop = true; this.menuGroupBar.AnimatedSelection = false; this.menuGroupBar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); this.menuGroupBar.BorderColor = System.Drawing.Color.White; this.menuGroupBar.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.menuGroupBar.Dock = System.Windows.Forms.DockStyle.Left; this.menuGroupBar.ExpandButtonToolTip = null; this.menuGroupBar.ExpandedWidth = 220; this.menuGroupBar.FlatLook = true; this.menuGroupBar.Font = new System.Drawing.Font("Segoe UI Semibold", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.menuGroupBar.ForeColor = System.Drawing.Color.White; this.menuGroupBar.GroupBarDropDownToolTip = null; this.menuGroupBar.HeaderBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(158)))), ((int)(((byte)(218))))); this.menuGroupBar.IndexOnVisibleItems = true; this.menuGroupBar.IntegratedScrolling = true; this.menuGroupBar.Location = new System.Drawing.Point(0, 0); this.menuGroupBar.MinimizeButtonToolTip = null; this.menuGroupBar.Name = "menuGroupBar"; this.menuGroupBar.NavigationPaneTooltip = null; this.menuGroupBar.PopupClientSize = new System.Drawing.Size(0, 0); this.menuGroupBar.Size = new System.Drawing.Size(293, 633); this.menuGroupBar.TabIndex = 0; this.menuGroupBar.Text = "groupBar1"; this.menuGroupBar.TextAlign = Syncfusion.Windows.Forms.Tools.TextAlignment.Left; this.menuGroupBar.VisualStyle = Syncfusion.Windows.Forms.VisualStyle.Metro; // // MainScreen // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.ClientSize = new System.Drawing.Size(895, 633); this.Controls.Add(this.menuGroupBar); this.Name = "MainScreen"; this.Load += new System.EventHandler(this.MainScreen_Load); ((System.ComponentModel.ISupportInitialize)(this.menuGroupBar)).EndInit(); this.ResumeLayout(false); } #endregion private Syncfusion.Windows.Forms.Tools.GroupBar menuGroupBar; } }
{ "content_hash": "a0a4bdcb52dc0cfcd341fdfb01c5d389", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 169, "avg_line_length": 47.278481012658226, "alnum_prop": 0.5989290495314592, "repo_name": "dungle/pcs", "id": "30c7426a607cf07d2824b2eae4d675f78edb4759", "size": "3737", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "MAP2013/PCSMain/MainScreen.Designer.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "26581423" } ], "symlink_target": "" }
<?xml version="1.0"?> <!-- --> <config> <modules> <Studioforty9_Gallery> <version>1.0.0</version> </Studioforty9_Gallery> </modules> <global> <models> <studioforty9_gallery> <class>Studioforty9_Gallery_Model</class> <resourceModel>studioforty9_gallery_resource</resourceModel> </studioforty9_gallery> <studioforty9_gallery_resource> <class>Studioforty9_Gallery_Model_Resource</class> <entities> <gallery_album> <table>studioforty9_gallery_album</table> </gallery_album> <gallery_album_store> <table>studioforty9_gallery_album_store</table> </gallery_album_store> <gallery_media> <table>studioforty9_gallery_media</table> </gallery_media> <gallery_media_store> <table>studioforty9_gallery_media_store</table> </gallery_media_store> <gallery_media_album> <table>studioforty9_gallery_media_album</table> </gallery_media_album> </entities> </studioforty9_gallery_resource> </models> <blocks> <studioforty9_gallery> <class>Studioforty9_Gallery_Block</class> </studioforty9_gallery> <studioforty9_gallery_adminhtml> <class>Studioforty9_Gallery_Block_Adminhtml</class> </studioforty9_gallery_adminhtml> </blocks> <helpers> <studioforty9_gallery> <class>Studioforty9_Gallery_Helper</class> </studioforty9_gallery> </helpers> <resources> <studioforty9_gallery_setup> <setup> <module>Studioforty9_Gallery</module> </setup> </studioforty9_gallery_setup> </resources> <rewrite> <album_url> <from><![CDATA[#^/gallery/album/(.*)/#]]></from> <to><![CDATA[gallery/index/album/url_key/$1/]]></to> <complete>1</complete> </album_url> <media_url> <from><![CDATA[#^/gallery/media/(.*)/#]]></from> <to><![CDATA[gallery/index/media/url_key/$1/]]></to> <complete>1</complete> </media_url> </rewrite> </global> <adminhtml> <layout> <updates> <studioforty9_gallery> <file>studioforty9_gallery.xml</file> </studioforty9_gallery> </updates> </layout> <translate> <modules> <Studioforty9_Gallery> <files> <default>Studioforty9_Gallery.csv</default> </files> </Studioforty9_Gallery> </modules> </translate> </adminhtml> <frontend> <routers> <studioforty9_gallery> <use>standard</use> <args> <module>Studioforty9_Gallery</module> <frontName>gallery</frontName> </args> </studioforty9_gallery> </routers> <layout> <updates> <studioforty9_gallery> <file>studioforty9_gallery.xml</file> </studioforty9_gallery> </updates> </layout> <translate> <modules> <studioforty9_gallery> <files> <default>Studioforty9_Gallery.csv</default> </files> </studioforty9_gallery> </modules> </translate> </frontend> <admin> <routers> <adminhtml> <use>admin</use> <args> <modules> <Studioforty9_Gallery after="Mage_Adminhtml">Studioforty9_Gallery_Adminhtml</Studioforty9_Gallery> </modules> </args> </adminhtml> </routers> </admin> <default> <studioforty9_gallery> <default> <breadcrumbs>1</breadcrumbs> <uselink>1</uselink> <link>Gallery</link> </default> <seo> <title>Gallery</title> <keywords></keywords> <description></description> </seo> <album> <perpage>15,30,50,100</perpage> </album> <media> <perpage>15,30,50,100</perpage> </media> </studioforty9_gallery> </default> <!-- PHPUnit Configuration --> <phpunit> <suite> <modules> <Studioforty9_Gallery/> </modules> </suite> </phpunit> </config>
{ "content_hash": "62b80fdd10f62e545f6699cddfb8534f", "timestamp": "", "source": "github", "line_count": 164, "max_line_length": 122, "avg_line_length": 31.408536585365855, "alnum_prop": 0.45195107746068724, "repo_name": "StudioForty9/Gallery", "id": "25ff784d8cb388b65f51e502505ba62cb8276d0a", "size": "5512", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/code/community/Studioforty9/Gallery/etc/config.xml", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "6438" }, { "name": "HTML", "bytes": "5059" }, { "name": "JavaScript", "bytes": "23023" }, { "name": "PHP", "bytes": "165245" } ], "symlink_target": "" }
<?php // src/Ppiatek/OrderBundle/Entity/Klient.php namespace Ppiatek\OrderBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity * @ORM\Table(name="klient") */ class Klient { /** * @ORM\Column(name="id_klient",type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ protected $id_klient; /** * @ORM\Column(type="string", length=127, nullable=false) */ protected $imie; /** * @ORM\Column(type="string", length=255, nullable=false) */ protected $nazwisko; /** * @ORM\OneToMany(targetEntity="Zamowienie", mappedBy="id_klient") **/ protected $zamowienia; public function __construct() { $this->zamowienia = new ArrayCollection(); } /** * Get id_klient * * @return integer */ public function getIdKlient() { return $this->id_klient; } /** * Set imie * * @param string $imie * @return Klient */ public function setImie($imie) { $this->imie = $imie; return $this; } /** * Get imie * * @return string */ public function getImie() { return $this->imie; } /** * Set nazwisko * * @param string $nazwisko * @return Klient */ public function setNazwisko($nazwisko) { $this->nazwisko = $nazwisko; return $this; } /** * Get nazwisko * * @return string */ public function getNazwisko() { return $this->nazwisko; } /** * Add zamowienia * * @param \Ppiatek\OrderBundle\Entity\Zamowienie $zamowienie * @return Klient */ public function addZamowienie(\Ppiatek\OrderBundle\Entity\Zamowienie $zamowienie) { $this->zamowienia[] = $zamowienie; return $this; } /** * Remove zamowienia * * @param \Ppiatek\OrderBundle\Entity\Zamowienie $zamowienie */ public function removeZamowienie(\Ppiatek\OrderBundle\Entity\Zamowienie $zamowienie) { $this->zamowienia->removeElement($zamowienie); } /** * Get zamowienia * * @return \Doctrine\Common\Collections\Collection */ public function getZamowienia() { return $this->zamowienia; } }
{ "content_hash": "f645932e35afb186fe67ea7159ee2d22", "timestamp": "", "source": "github", "line_count": 130, "max_line_length": 88, "avg_line_length": 18.49230769230769, "alnum_prop": 0.5519966722129783, "repo_name": "ppiatek/Symfony2products", "id": "9a9ef83c574076b6736426ecf1f149577e25a6d9", "size": "2404", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Ppiatek/OrderBundle/Entity/Klient.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "121338" } ], "symlink_target": "" }
<!DOCTYPE html> <html class="no-js"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> <link rel="stylesheet" href="css/poole.css"> <link rel="stylesheet" href="css/syntax.css"> <link rel="stylesheet" href="css/hyde.css"> <link rel="stylesheet" href="css/theme.css"> <link rel="stylesheet" href="//fonts.googleapis.com/css?family=PT+Sans:400,700|Russo+One"> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css"> <link href="//block.blokada.org/favicon.png" rel="icon"> </head> <body class="theme-base-theme1 layout-reverse"> <div class="content"> <div class="container"> <section id="main"> <h4>Blokada v4.6</h4> <p>The newest version brings new widgets, better host log, and improvements in stability. We also addressed several of your suggestions from Github!</p> <p>As usual, you can find details in our <a href="https://blokada.org/docs/changelog.html">changelog</a>.</p> <p>By the way, we've recently released <b>Blokada for iOS</>, which is also free. Please tell anyone who could be interested.</p> <p>Remember that using Blokada Tunnel or donating is what makes it possible for us to keep improving the app. Thanks!</p> <p><a class="dbox-donation-button" href="https://donorbox.org/blokada" style="background:#DF5401 url(https://d1iczxrky3cnb2.cloudfront.net/white_logo.png) no-repeat 18px center; color: #fff;text-decoration: none;font-family: Verdana,sans-serif;display: inline-block;font-size: 16px;padding: 13px 17px 13px 56px; -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px; box-shadow: 0 1px 0 0 #9c3a00; text-shadow: 0 1px rgba(0, 0, 0, 0.3);" >기부하기</a></p> <p><a href="https://blokada.org/api/v3/content/en/donate.html">더 많은 기부 옵션을 보려면 누르십시오.</a></p> <p><script src="https://donorbox.org/widget.js" type="text/javascript"></script><iframe src="https://donorbox.org/embed/blokada?only_donation_meter=true&donation_meter_color=%23ff5f00" height="100px" width="100%" style="max-width:500px; min-width:310px; max-height:none!important" seamless="seamless" name="donorbox" frameborder="0" scrolling="no"></iframe></p> </section> </div> </div> </body> </html>
{ "content_hash": "4134aaf095d5d2572b2466cb90a3b1ff", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 469, "avg_line_length": 53.2093023255814, "alnum_prop": 0.7194055944055944, "repo_name": "blokadaorg/blokadaorg.github.io", "id": "7e3e7fd21656b603a926ff5fb4c3cf27090f7b5c", "size": "2328", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "api/v4/content/ko_KR/updated.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "4147350" }, { "name": "HTML", "bytes": "12174017" }, { "name": "JavaScript", "bytes": "873309" }, { "name": "Ruby", "bytes": "161" }, { "name": "Shell", "bytes": "977" } ], "symlink_target": "" }
@implementation MessageTableViewCell - (void)awakeFromNib { // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end
{ "content_hash": "9efa03a4efeecaa61a533bef3e7a0fa8", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 60, "avg_line_length": 21.75, "alnum_prop": 0.7394636015325671, "repo_name": "chensy-and/maksmaigin", "id": "7e76954cae740a875bf0c85850a7017914708cad", "size": "440", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "LeanCloudDoc/leanmessage-demo-master/iOS/LeanMessageDemo/LeanMessageDemo/MessageTableViewCell.m", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "4344" }, { "name": "CSS", "bytes": "3683" }, { "name": "HTML", "bytes": "11221" }, { "name": "Java", "bytes": "1239658" }, { "name": "JavaScript", "bytes": "29044" }, { "name": "Objective-C", "bytes": "34607" }, { "name": "Ruby", "bytes": "228" } ], "symlink_target": "" }
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Class: Test::Unit::Collector::Dir</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" /> <script type="text/javascript"> // <![CDATA[ function popupCode( url ) { window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") } function toggleCode( id ) { if ( document.getElementById ) elem = document.getElementById( id ); else if ( document.all ) elem = eval( "document.all." + id ); else return false; elemStyle = elem.style; if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else { elemStyle.display = "none" } return true; } // Make codeblocks hidden by default document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) // ]]> </script> </head> <body> <div id="classHeader"> <table class="header-table"> <tr class="top-aligned-row"> <td><strong>Class</strong></td> <td class="class-name-in-header">Test::Unit::Collector::Dir</td> </tr> <tr class="top-aligned-row"> <td><strong>In:</strong></td> <td> <a href="../../../../files/lib/rake/ruby182_test_unit_fix_rb.html"> lib/rake/ruby182_test_unit_fix.rb </a> <br /> </td> </tr> <tr class="top-aligned-row"> <td><strong>Parent:</strong></td> <td> Object </td> </tr> </table> </div> <!-- banner header --> <div id="bodyContent"> <div id="contextContent"> </div> <div id="method-list"> <h3 class="section-bar">Methods</h3> <div class="name-list"> <a href="#M000792">collect_file</a>&nbsp;&nbsp; </div> </div> </div> <!-- if includes --> <div id="section"> <!-- if method_list --> <div id="methods"> <h3 class="section-bar">Public Instance methods</h3> <div id="method-M000792" class="method-detail"> <a name="M000792"></a> <div class="method-heading"> <a href="Dir.src/M000792.html" target="Code" class="method-signature" onclick="popupCode('Dir.src/M000792.html');return false;"> <span class="method-name">collect_file</span><span class="method-args">(name, suites, already_gathered)</span> </a> </div> <div class="method-description"> </div> </div> </div> </div> <div id="validator-badges"> <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> </div> </body> </html>
{ "content_hash": "5d9bab6afa68098d89fdd01f3660259b", "timestamp": "", "source": "github", "line_count": 137, "max_line_length": 120, "avg_line_length": 23, "alnum_prop": 0.5480799746112345, "repo_name": "ThoughtWorksStudios/oauth2_provider", "id": "560add00934b7a35d12c0ba7e374a8869aa6954d", "size": "3151", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tools/jruby-1.5.1/lib/ruby/gems/1.8/doc/rake-0.8.7/rdoc/classes/Test/Unit/Collector/Dir.html", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "210606" }, { "name": "Emacs Lisp", "bytes": "5062" }, { "name": "Java", "bytes": "90932" }, { "name": "JavaScript", "bytes": "671196" }, { "name": "Ruby", "bytes": "9647792" }, { "name": "VimL", "bytes": "914" } ], "symlink_target": "" }
{if $pagination and $pagination.PAGES > 1 and $pagination.PAGES < 10} <div class="pull-right"> {'GO_TO_PAGE'|i18n} <div class="btn-group"> {if $pagination.PREV} <a href="{$pagination.PREV}" class="btn page-previous">&larr;</a> {/if} {for $i=1 to $pagination.PAGES} <a href="{$pagination.URL}?p={$i}" class="btn {if $i == $pagination.PAGE}active{/if}">{$i}</a> {/for} {if $pagination.NEXT} <a href="{$pagination.NEXT}" class="btn page-next">&rarr;</a> {/if} </div> </div> <div class="clearfix"></div> {elseif $pagination and $pagination.PAGES >= 10} <form action="{$pagination.URL}" method="post" style="margin: 0;"> <div class="pull-right"> {'GO_TO_PAGE'|i18n} {if $pagination.PREV} <a class="btn btn-mini" href="{$pagination.PREV}" id="prev_page"><i class="icon-arrow-left"></i></a> {/if} <input type="text" name="{$pagination.VAR}" value="{$pagination.PAGE}" style="display: inline-block; margin-bottom: 0; width: 2em;" onclick="highlight(this);"> {'OF'|i18n} {$pagination.PAGES} {if $pagination.NEXT} <a class="btn btn-mini" href="{$pagination.NEXT}" id="next_page"><i class="icon-arrow-right"></i></a> {/if} </div> </form> <div class="clearfix"></div> {/if}
{ "content_hash": "4356610fd7844fc2bf8a91856d9a620c", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 162, "avg_line_length": 38.625, "alnum_prop": 0.6148867313915858, "repo_name": "ivacuum/dev.ivacuum.ru", "id": "c40b7c4321a0766301be2c97e0081179c2b0a502", "size": "1236", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "templates/block/pagination_top.html", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "63645" } ], "symlink_target": "" }
package de.jowisoftware.sshclient.util; public interface RingBuffer<E> extends Iterable<E> { public E get(int i); public void append(E element); public int size(); public E[] toArray(E[] array); public Iterable<E> reversed(); public RingBuffer<E> getSnapshot(); }
{ "content_hash": "540ffe73b6e905d7164a6b185cfc80a8", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 52, "avg_line_length": 29.9, "alnum_prop": 0.6622073578595318, "repo_name": "jochenwierum/sshclient", "id": "d0e589c6f495d2af258cdfc2b17c0242d91bfe2e", "size": "299", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/de/jowisoftware/sshclient/util/RingBuffer.java", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Java", "bytes": "779114" }, { "name": "XSLT", "bytes": "6144" } ], "symlink_target": "" }
Examples ======== Determining :math:`\beta` and :math:`\eta` Values ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Before any suppositions may be gathered, it is appropriate to calculate :math:`\beta` and :math:`\eta` values. Once we are satisfied that :math:`\beta` and :math:`\eta` match the raw data, we can move on to determining useful life characteristics for the product. Example 1: Complete Test Data ***************************** In this example, we will take a complete set of failure data that has no censorship and apply basic weibull analysis tool suite in order to achieve a simple, accurate, and useful analysis.:: import weibull # fail times include no censored data fail_times = [ 9402.7, 6082.4, 13367.2, 10644.6, 8632.0, 3043.4, 12860.2, 1034.5, 2550.9, 3637.1 ] # this is where the actual analysis and curve fitting occur analysis = weibull.Analysis(fail_times, unit='hour') analysis.fit(method='mle') analysis.probplot() In this example, we chose to use the Maximum Likelihood Estimation method of estimating :math:`\beta` and :math:`\eta`, which is shown in the ``analysis.fit(method='mle)`` line. If the ``fit()`` method were called with no parameters, it would - by default - have used linear regression. By examining the probability plot, we can visually determine if the :math:`\beta` and :math:`\eta` are appropriately calculated. By specifying a file name, the probability plot can be saved to a file ``analysis.probplot(file_name='prob.png')``. This is optional, of course, and not required. Example 2: Right-Censored Data ****************************** Often, it is necessary to use only the smallest amount of data in order to calculate the values for :math:`\beta` and :math:`\eta`. For instance, a long-running test might have 10 units on the test bench, but only 3 of them have failed. When the data is so small, the default linear regression fit method is probably going to yield better results than the maximum-likelihood estimation:: current_run_time = 4200.0 fail_times = [current_run_time] * 10 fail_times[7] = 1034.5 fail_times[8] = 2550.9 fail_times[6] = 3043.4 suspended = [True, True, True, True, True, False, False, False, True, True] analysis = weibull.Analysis(fail_times, suspended=suspended, unit='hour') analysis.fit() analysis.probplot() Again, we plot the raw data points against the calculated :math:`\beta` and :math:`\eta` in order to ensure that the linear regression is an appropriate fit for the data. As more failures occur, more accurate curve fits may be run. Life Calculations ^^^^^^^^^^^^^^^^^ Once :math:`\beta` and :math:`\eta` are determined, then they may be utilized to obtain the basic lifetime data that may be utilized for planning. One common reliability metric is the :ref:`b-life`. Obtaining a B10 life using the ``analysis`` object is trivial:: print(f'B10 life: {analysis.b(10):.0f}') As you can see, simply calling the ``b()`` function with the appropriate number as the parameter will return the B-life based on :math:`\beta` and :math:`\eta`. Basic Life Statistics ^^^^^^^^^^^^^^^^^^^^^ For user convenience, the ``mean``, ``median``, ``characteristic_life``, and ``mttf`` are defined as attributes of the class and may be called at any time after an initial curve fit. Note that there is some overlap with other class variables. For instance, the ``characteristic_life`` happens to be the same thing as ``eta``, but if a customer asks for the characteristic life, then having this available makes the code more readable and correspond more closely to the specification. Plotting ^^^^^^^^ We can also plot various functions of interest, such as the survival function and hazard functions, amongst others.:: analysis.pdf() # probability density function analysis.sf() # survival function analysis.hazard() # hazard function analysis.cdf() # cumulative distribution function analysis.fr() # failure rate Each of these will generate a plot of the function. For all plotting methods, if ``file_name`` is specified as a parameter, then the method will save to a file rather than display. For instance:: analysis.sf(file_name='survival_function.png') Test Design ^^^^^^^^^^^ The Design class is to be utilized for two scenarios: - determine the required number of units to prove the target reliability given a test cycles/duration - determine the required number of cycles/duration to prove the target reliability given a number of units To begin, first import and instantiate the Designer, which is the utility for the test designer. There are several parameters to consider and all of them are requirements or assumptions that must be entered as parameters for the Designer class: - target_cycles - the target to be proven in hours/days/weeks/cycles - reliability - defaults to 0.9 - confidence_level - defaults to 0.95 - expected_beta - an initial assumption for beta (defaults to 2) Shown are two example calculations for a target lifetime of 10000 hours with a reliability of 0.9 at a confidence level of 0.5 and beta assumption of 1.5:: import weibull designer = weibull.Design( target_cycles=10000, reliability=0.9, confidence_level=0.90, expected_beta=1.5 ) # The 'test_cycles' parameter can be in any units. # Days, weeks, hours, cycles, etc., so long # as the target unit is consistent print(f'Minimum number of units for 10000 hour run:{designer.num_of_units(test_cycles=10000)}') print(f'Minimum hours for 20 units: {designer.num_of_cycles(num_of_units=20)}') Weibayes Analysis ^^^^^^^^^^^^^^^^^ Use Weibayes analysis to assist with designing your test or evaluating reliability within a certain confidence interval based on historical data. You have a product that needs to be tested to B2 life of 40 million time units with a confidence limit of 95%. The product had an expected beta of 2 (lots of historical data there). B2 life is the same as 98% survival. Using the weibull test `Design` class, we need to run 62 units (the limit of our test rig) for 62 million time units with no failures:: import weibull designer = weibull.Design( target_cycles=40e6, reliability=0.98, confidence_level=0.95, expected_beta=2 ) print(f'Minimum hours for 62 units: {designer.num_of_cycles(num_of_units=62)}') Result:: 61860134.45191945 Weibayes analysis on the data would arrive at the same result.:: import weibull # we want N units to run for H hours each N = 62 H = 62.0e6 run_times_desired = [H] * N weibayes = weibull.Weibayes(run_times_desired, confidence_level=0.95, beta=2) print(f'B2 life: {weibayes.b(2)}') Results:: B2 life: 40090439.86038491 Note that this `B2` matches very closely with `target_cycles` value found in the above iteration of the `Design` class. We can further plot the data using `weibayes.plot()` resulting in: .. image:: images/weibayes.png
{ "content_hash": "4f13cde8780dcefee38d39e836e913c1", "timestamp": "", "source": "github", "line_count": 175, "max_line_length": 485, "avg_line_length": 41.70857142857143, "alnum_prop": 0.6877654473215509, "repo_name": "slightlynybbled/weibull", "id": "ba3bfdd8615a995711d3544dffaa125e8866a0ad", "size": "7299", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/examples.rst", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "45070" } ], "symlink_target": "" }
'use strict'; exports = module.exports = function(app, mongoose) { require('./schema/Achievement')(app, mongoose); };
{ "content_hash": "1f96f4096a53222f501804fb49c56fd1", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 52, "avg_line_length": 24.2, "alnum_prop": 0.6859504132231405, "repo_name": "twhyntie/user-guide", "id": "4dd34684357ab9669e6917b8b2d764501cb55047", "size": "121", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "models.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "61801" }, { "name": "HTML", "bytes": "3968" }, { "name": "JavaScript", "bytes": "8679" } ], "symlink_target": "" }
package com.ferox.physics.collision.shape; import com.ferox.math.Const; import com.ferox.math.Vector3; /** * Box represents a three dimensional rectangular prism centered on its local origin with configurable * dimensions aligned with its local x, y, and z axis. * * @author Michael Ludwig */ public class Box extends ConvexShape { private final Vector3 localTensorPartial; private final Vector3 halfExtents; /** * Create a new Box with the given dimensions. * * @param xExtent The x dimension or width * @param yExtent The y dimension or height * @param zExtent The z dimension or depth */ public Box(double xExtent, double yExtent, double zExtent) { localTensorPartial = new Vector3(); halfExtents = new Vector3(); setExtents(xExtent, yExtent, zExtent); } /** * @return Get the half extents of this box. It should not be mutated */ @Const public Vector3 getHalfExtents() { return halfExtents; } /** * @return Get the full extents of this box. This creates a new vector */ public Vector3 getExtents() { return new Vector3().scale(halfExtents, 2.0); } /** * Set the extents of this box to the given dimensions. * * @param width The x dimension or width of the box * @param height The y dimension or height of the box * @param depth The z dimension or depth of the box * * @throws IllegalArgumentException if any dimension is less than or equal to 0 */ public void setExtents(double width, double height, double depth) { if (width <= 0) { throw new IllegalArgumentException("Invalid width, must be greater than 0, not: " + width); } if (height <= 0) { throw new IllegalArgumentException("Invalid height, must be greater than 0, not: " + height); } if (depth <= 0) { throw new IllegalArgumentException("Invalid depth, must be greater than 0, not: " + depth); } halfExtents.set(width / 2.0, height / 2.0, depth / 2.0); localTensorPartial .set((height * height + depth * depth) / 12.0, (width * width + depth * depth) / 12.0, (width * width + height * height) / 12.0); updateBounds(); } /** * @return Get the width of this box */ public double getWidth() { return halfExtents.x * 2.0; } /** * @return Get the height of this box */ public double getHeight() { return halfExtents.y * 2.0; } /** * @return Get the depth of this box */ public double getDepth() { return halfExtents.z * 2.0; } @Override public Vector3 computeSupport(@Const Vector3 v, Vector3 result) { if (result == null) { result = new Vector3(); } double x = (v.x < 0.0 ? -halfExtents.x : halfExtents.x); double y = (v.y < 0.0 ? -halfExtents.y : halfExtents.y); double z = (v.z < 0.0 ? -halfExtents.z : halfExtents.z); return result.set(x, y, z); } @Override public Vector3 getInertiaTensor(double mass, Vector3 result) { if (result == null) { result = new Vector3(); } return result.scale(localTensorPartial, mass); } }
{ "content_hash": "337d6433daa4120ef6bed59d487ab8aa", "timestamp": "", "source": "github", "line_count": 114, "max_line_length": 105, "avg_line_length": 29.385964912280702, "alnum_prop": 0.5946268656716418, "repo_name": "geronimo-iia/ferox", "id": "5b16b1535139356acaa62ac026ea86764d1f72bc", "size": "4786", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ferox-physics/src/main/java/com/ferox/physics/collision/shape/Box.java", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "GLSL", "bytes": "4399" }, { "name": "Java", "bytes": "2734210" }, { "name": "JavaScript", "bytes": "8344" } ], "symlink_target": "" }
require 'reportify/builder' require 'reportify/column_format' require 'reportify/report_cell' require 'reportify/report_column' require 'reportify/report_format' require 'reportify/version' require 'reportify/column_formatters/cs_usd' require 'reportify/column_formatters/date_format' require 'reportify/column_formatters/time_format' require 'reportify/column_formatters/percent' require 'reportify/column_formatters/week_of_year' require 'reportify/column_formatters/whole_number' require 'reportify/report_formatters/html_table' require 'reportify/report_formatters/ruby_csv' module Reportify end
{ "content_hash": "5fc7672a227437e85e0e117376980050", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 50, "avg_line_length": 35.35294117647059, "alnum_prop": 0.8302828618968386, "repo_name": "infinitysw/reportify", "id": "00eb889226205df7d297303fa4f09ab2332e5064", "size": "601", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/reportify.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "23089" } ], "symlink_target": "" }
namespace safe_browsing { RemoteHostContactedSignalProcessor::RemoteHostContactedSignalProcessor() = default; RemoteHostContactedSignalProcessor::~RemoteHostContactedSignalProcessor() = default; void RemoteHostContactedSignalProcessor::ProcessSignal( const ExtensionSignal& signal) { DCHECK_EQ(ExtensionSignalType::kRemoteHostContacted, signal.GetType()); const auto& rhc_signal = static_cast<const RemoteHostContactedSignal&>(signal); // Extract only the host portion of the urls. std::string host_url = rhc_signal.remote_host_url().host(); ++(((remote_host_info_store_[rhc_signal.extension_id()]) [rhc_signal.protocol_type()])[host_url]); } std::unique_ptr<ExtensionTelemetryReportRequest_SignalInfo> RemoteHostContactedSignalProcessor::GetSignalInfoForReport( const extensions::ExtensionId& extension_id) { auto remote_host_info_store_it = remote_host_info_store_.find(extension_id); if (remote_host_info_store_it == remote_host_info_store_.end()) return nullptr; // Create the signal info protobuf. auto signal_info = std::make_unique<ExtensionTelemetryReportRequest_SignalInfo>(); ExtensionTelemetryReportRequest_SignalInfo_RemoteHostContactedInfo* remote_host_contacted_info = signal_info->mutable_remote_host_contacted_info(); for (auto& remote_host_urls_by_protocol_it : remote_host_info_store_it->second) { for (auto& remote_host_urls_it : remote_host_urls_by_protocol_it.second) { ExtensionTelemetryReportRequest_SignalInfo_RemoteHostContactedInfo_RemoteHostInfo* remote_host_pb = remote_host_contacted_info->add_remote_host(); remote_host_pb->set_url(std::move(remote_host_urls_it.first)); remote_host_pb->set_contact_count(remote_host_urls_it.second); remote_host_pb->set_connection_protocol( remote_host_urls_by_protocol_it.first); } } // Clear the data in the remote host urls store. remote_host_info_store_.erase(remote_host_info_store_it); return signal_info; } bool RemoteHostContactedSignalProcessor::HasDataToReportForTest() const { return !remote_host_info_store_.empty(); } } // namespace safe_browsing
{ "content_hash": "68f2bbfc2f8cb7df0b07af5f1a1db3a3", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 88, "avg_line_length": 39, "alnum_prop": 0.7385531135531136, "repo_name": "chromium/chromium", "id": "44a202b11e19b46d8fa6c95d768ccafdba3aa228", "size": "2549", "binary": false, "copies": "5", "ref": "refs/heads/main", "path": "chrome/browser/safe_browsing/extension_telemetry/remote_host_contacted_signal_processor.cc", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; using System.IO; using System.Threading; using System.Threading.Tasks; namespace Discord.Net.Queue { public class RequestQueue { public event Func<string, Bucket, int, Task> RateLimitTriggered; private readonly static ImmutableDictionary<GlobalBucket, Bucket> _globalLimits; private readonly static ImmutableDictionary<GuildBucket, Bucket> _guildLimits; private readonly static ImmutableDictionary<ChannelBucket, Bucket> _channelLimits; private readonly SemaphoreSlim _lock; private readonly RequestQueueBucket[] _globalBuckets; private readonly ConcurrentDictionary<ulong, RequestQueueBucket>[] _guildBuckets; private readonly ConcurrentDictionary<ulong, RequestQueueBucket>[] _channelBuckets; private CancellationTokenSource _clearToken; private CancellationToken _parentToken; private CancellationToken _cancelToken; static RequestQueue() { _globalLimits = new Dictionary<GlobalBucket, Bucket> { //REST [GlobalBucket.GeneralRest] = new Bucket(null, "rest", 0, 0, BucketTarget.Both), //No Limit //[GlobalBucket.Login] = new BucketDefinition(1, 1), [GlobalBucket.DirectMessage] = new Bucket("bot:msg:dm", 5, 5, BucketTarget.Bot), [GlobalBucket.SendEditMessage] = new Bucket("bot:msg:global", 50, 10, BucketTarget.Bot), //[GlobalBucket.Username] = new Bucket("bot:msg:global", 2, 3600, BucketTarget.Both), //Gateway [GlobalBucket.GeneralGateway] = new Bucket(null, "gateway", 120, 60, BucketTarget.Both), [GlobalBucket.UpdateStatus] = new Bucket(null, "status", 5, 1, BucketTarget.Both, GlobalBucket.GeneralGateway), //Rpc [GlobalBucket.GeneralRpc] = new Bucket(null, "rpc", 120, 60, BucketTarget.Both) }.ToImmutableDictionary(); _guildLimits = new Dictionary<GuildBucket, Bucket> { //REST [GuildBucket.SendEditMessage] = new Bucket("bot:msg:server", 5, 5, BucketTarget.Bot, GlobalBucket.SendEditMessage), [GuildBucket.DeleteMessage] = new Bucket("dmsg", 5, 1, BucketTarget.Bot), [GuildBucket.DeleteMessages] = new Bucket("bdmsg", 1, 1, BucketTarget.Bot), [GuildBucket.ModifyMember] = new Bucket("guild_member", 10, 10, BucketTarget.Bot), [GuildBucket.Nickname] = new Bucket("guild_member_nick", 1, 1, BucketTarget.Bot) }.ToImmutableDictionary(); //Client-Only _channelLimits = new Dictionary<ChannelBucket, Bucket> { //REST [ChannelBucket.SendEditMessage] = new Bucket("msg", 10, 10, BucketTarget.Client, GlobalBucket.SendEditMessage), }.ToImmutableDictionary(); } public static Bucket GetBucketInfo(GlobalBucket bucket) => _globalLimits[bucket]; public static Bucket GetBucketInfo(GuildBucket bucket) => _guildLimits[bucket]; public static Bucket GetBucketInfo(ChannelBucket bucket) => _channelLimits[bucket]; public RequestQueue() { _lock = new SemaphoreSlim(1, 1); _globalBuckets = new RequestQueueBucket[_globalLimits.Count]; foreach (var pair in _globalLimits) { //var target = _globalLimits[pair.Key].Target; //if (target == BucketTarget.Both || (target == BucketTarget.Bot && isBot) || (target == BucketTarget.Client && !isBot)) _globalBuckets[(int)pair.Key] = CreateBucket(pair.Value); } _guildBuckets = new ConcurrentDictionary<ulong, RequestQueueBucket>[_guildLimits.Count]; for (int i = 0; i < _guildLimits.Count; i++) { //var target = _guildLimits[(GuildBucket)i].Target; //if (target == BucketTarget.Both || (target == BucketTarget.Bot && isBot) || (target == BucketTarget.Client && !isBot)) _guildBuckets[i] = new ConcurrentDictionary<ulong, RequestQueueBucket>(); } _channelBuckets = new ConcurrentDictionary<ulong, RequestQueueBucket>[_channelLimits.Count]; for (int i = 0; i < _channelLimits.Count; i++) { //var target = _channelLimits[(GuildBucket)i].Target; //if (target == BucketTarget.Both || (target == BucketTarget.Bot && isBot) || (target == BucketTarget.Client && !isBot)) _channelBuckets[i] = new ConcurrentDictionary<ulong, RequestQueueBucket>(); } _clearToken = new CancellationTokenSource(); _cancelToken = CancellationToken.None; _parentToken = CancellationToken.None; } public async Task SetCancelTokenAsync(CancellationToken cancelToken) { await _lock.WaitAsync().ConfigureAwait(false); try { _parentToken = cancelToken; _cancelToken = CancellationTokenSource.CreateLinkedTokenSource(cancelToken, _clearToken.Token).Token; } finally { _lock.Release(); } } internal async Task<Stream> SendAsync(RestRequest request, BucketGroup group, int bucketId, ulong objId) { request.CancelToken = _cancelToken; var bucket = GetBucket(group, bucketId, objId); return await bucket.SendAsync(request).ConfigureAwait(false); } internal async Task<Stream> SendAsync(WebSocketRequest request, BucketGroup group, int bucketId, ulong objId) { request.CancelToken = _cancelToken; var bucket = GetBucket(group, bucketId, objId); return await bucket.SendAsync(request).ConfigureAwait(false); } private RequestQueueBucket CreateBucket(Bucket def) { var parent = def.Parent != null ? GetGlobalBucket(def.Parent.Value) : null; return new RequestQueueBucket(this, def, parent); } public void DestroyGuildBucket(GuildBucket type, ulong guildId) { //Assume this object is locked RequestQueueBucket bucket; _guildBuckets[(int)type].TryRemove(guildId, out bucket); } public void DestroyChannelBucket(ChannelBucket type, ulong channelId) { //Assume this object is locked RequestQueueBucket bucket; _channelBuckets[(int)type].TryRemove(channelId, out bucket); } private RequestQueueBucket GetBucket(BucketGroup group, int bucketId, ulong objId) { switch (group) { case BucketGroup.Global: return GetGlobalBucket((GlobalBucket)bucketId); case BucketGroup.Guild: return GetGuildBucket((GuildBucket)bucketId, objId); case BucketGroup.Channel: return GetChannelBucket((ChannelBucket)bucketId, objId); default: throw new ArgumentException($"Unknown bucket group: {group}", nameof(group)); } } private RequestQueueBucket GetGlobalBucket(GlobalBucket type) { return _globalBuckets[(int)type]; } private RequestQueueBucket GetGuildBucket(GuildBucket type, ulong guildId) { return _guildBuckets[(int)type].GetOrAdd(guildId, _ => CreateBucket(_guildLimits[type])); } private RequestQueueBucket GetChannelBucket(ChannelBucket type, ulong channelId) { return _channelBuckets[(int)type].GetOrAdd(channelId, _ => CreateBucket(_channelLimits[type])); } public async Task ClearAsync() { await _lock.WaitAsync().ConfigureAwait(false); try { _clearToken?.Cancel(); _clearToken = new CancellationTokenSource(); if (_parentToken != null) _cancelToken = CancellationTokenSource.CreateLinkedTokenSource(_clearToken.Token, _parentToken).Token; else _cancelToken = _clearToken.Token; } finally { _lock.Release(); } } internal async Task RaiseRateLimitTriggered(string id, Bucket bucket, int millis) { await RateLimitTriggered.Invoke(id, bucket, millis).ConfigureAwait(false); } } }
{ "content_hash": "8b3e8c8ae3c8c148f841be41c136f5cf", "timestamp": "", "source": "github", "line_count": 189, "max_line_length": 136, "avg_line_length": 46.04761904761905, "alnum_prop": 0.60783637826037, "repo_name": "Joe4evr/Discord.Net", "id": "37e5f816c4c72745cb3e4ced317128f62111fabb", "size": "8705", "binary": false, "copies": "2", "ref": "refs/heads/dev", "path": "src/Discord.Net/Net/Queue/RequestQueue.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "565278" } ], "symlink_target": "" }
package org.slc.sli.test.generators; import java.util.List; import java.util.Random; import org.apache.log4j.Logger; import org.slc.sli.test.edfi.entities.AcademicWeek; import org.slc.sli.test.edfi.entities.ReferenceType; public class AcademicWeekGenerator { private static final Logger log = Logger.getLogger(GradingPeriodGenerator.class); private String beginDate = null; private String endDate = null; Random generator = new Random(31); public AcademicWeek getAcademicWeek (String ID) { AcademicWeek aw = new AcademicWeek(); ReferenceType rt = new ReferenceType (); beginDate = "2011-03-04"; endDate = "2012-03-04"; rt.setId(ID); aw.getCalendarDateReference().add(rt); aw.setWeekIdentifier("AdcademicWeek"); aw.setBeginDate(beginDate); aw.setEndDate(endDate); int roll = 45 + (int) (generator.nextDouble() * (150 - 45)); aw.setTotalInstructionalDays(roll); return aw; } public static void main(String args[]) { AcademicWeekGenerator awg = new AcademicWeekGenerator (); String ID = "101101101"; for (int i = 0; i<10; i++) { AcademicWeek aw = awg.getAcademicWeek(ID); log.info("AcademicWeek = " + aw.getWeekIdentifier() + ",\n" + "beginDate = " + aw.getBeginDate() + ",\n" + "endDate = " + aw.getEndDate() + ",\n" + "totalInstructionalDays = " + aw.getTotalInstructionalDays() + ",\n" + "ID = " + aw.getCalendarDateReference().size() + ",\n\n" ); } } }
{ "content_hash": "72387d08990d268f98c672bb128507d9", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 131, "avg_line_length": 32.24, "alnum_prop": 0.6129032258064516, "repo_name": "inbloom/secure-data-service", "id": "2f93d92b90d68794caaec87f4fb82239f3b3b2a7", "size": "2229", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tools/data-tools/src/org/slc/sli/test/generators/AcademicWeekGenerator.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AspectJ", "bytes": "9748" }, { "name": "CSS", "bytes": "112888" }, { "name": "Clojure", "bytes": "37861" }, { "name": "CoffeeScript", "bytes": "18305" }, { "name": "Groovy", "bytes": "26568" }, { "name": "Java", "bytes": "12115410" }, { "name": "JavaScript", "bytes": "390822" }, { "name": "Objective-C", "bytes": "490386" }, { "name": "Python", "bytes": "34255" }, { "name": "Ruby", "bytes": "2543748" }, { "name": "Shell", "bytes": "111267" }, { "name": "XSLT", "bytes": "144746" } ], "symlink_target": "" }
class Queue(object): def __init__(self): self.items = [] def __str__(self): return ("Queue of size: %d" % len(self.items)) def isEmpty(self): return len(self.items) == 0 def enqueue(self, item): self.items.insert(0, item) def dequeue(self): return self.items.pop() def size(self): return len(self.items)
{ "content_hash": "d081a9a406537de98d5ad97ec1b28a8e", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 54, "avg_line_length": 20.105263157894736, "alnum_prop": 0.5445026178010471, "repo_name": "Bernardinhouessou/Projets_Autres", "id": "a33fa8367cc76d19261926317edef1914585f0be", "size": "382", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Python-Projets/Scripts/Algorithms-master/lists/queue.py", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "9812" }, { "name": "C", "bytes": "25730" }, { "name": "C#", "bytes": "1826" }, { "name": "C++", "bytes": "8278" }, { "name": "CSS", "bytes": "17218" }, { "name": "Groovy", "bytes": "20556" }, { "name": "HTML", "bytes": "17806707" }, { "name": "Hack", "bytes": "3435" }, { "name": "Java", "bytes": "21036831" }, { "name": "JavaScript", "bytes": "17665" }, { "name": "Lex", "bytes": "24122" }, { "name": "PHP", "bytes": "181894" }, { "name": "PLpgSQL", "bytes": "4202" }, { "name": "Perl", "bytes": "6946" }, { "name": "Python", "bytes": "189530" }, { "name": "Shell", "bytes": "91862" }, { "name": "TypeScript", "bytes": "1180" }, { "name": "XSLT", "bytes": "44906" } ], "symlink_target": "" }
namespace device { using mojom::SensorType; double GetSensorMaxAllowedFrequency(SensorType type) { switch (type) { case SensorType::AMBIENT_LIGHT: return SensorTraits<SensorType::AMBIENT_LIGHT>::kMaxAllowedFrequency; case SensorType::PROXIMITY: return SensorTraits<SensorType::PROXIMITY>::kMaxAllowedFrequency; case SensorType::ACCELEROMETER: return SensorTraits<SensorType::ACCELEROMETER>::kMaxAllowedFrequency; case SensorType::LINEAR_ACCELERATION: return SensorTraits< SensorType::LINEAR_ACCELERATION>::kMaxAllowedFrequency; case SensorType::GRAVITY: return SensorTraits<SensorType::GRAVITY>::kMaxAllowedFrequency; case SensorType::GYROSCOPE: return SensorTraits<SensorType::GYROSCOPE>::kMaxAllowedFrequency; case SensorType::MAGNETOMETER: return SensorTraits<SensorType::MAGNETOMETER>::kMaxAllowedFrequency; case SensorType::PRESSURE: return SensorTraits<SensorType::PRESSURE>::kMaxAllowedFrequency; case SensorType::ABSOLUTE_ORIENTATION_EULER_ANGLES: return SensorTraits< SensorType::ABSOLUTE_ORIENTATION_EULER_ANGLES>::kMaxAllowedFrequency; case SensorType::ABSOLUTE_ORIENTATION_QUATERNION: return SensorTraits< SensorType::ABSOLUTE_ORIENTATION_QUATERNION>::kMaxAllowedFrequency; case SensorType::RELATIVE_ORIENTATION_EULER_ANGLES: return SensorTraits< SensorType::RELATIVE_ORIENTATION_EULER_ANGLES>::kMaxAllowedFrequency; case SensorType::RELATIVE_ORIENTATION_QUATERNION: return SensorTraits< SensorType::RELATIVE_ORIENTATION_QUATERNION>::kMaxAllowedFrequency; // No default so the compiler will warn us if a new type is added. } NOTREACHED() << "Unknown sensor type " << type; return SensorTraits<SensorType::kMaxValue>::kMaxAllowedFrequency; } double GetSensorDefaultFrequency(mojom::SensorType type) { switch (type) { case SensorType::AMBIENT_LIGHT: return SensorTraits<SensorType::AMBIENT_LIGHT>::kDefaultFrequency; case SensorType::PROXIMITY: return SensorTraits<SensorType::PROXIMITY>::kDefaultFrequency; case SensorType::ACCELEROMETER: return SensorTraits<SensorType::ACCELEROMETER>::kDefaultFrequency; case SensorType::LINEAR_ACCELERATION: return SensorTraits<SensorType::LINEAR_ACCELERATION>::kDefaultFrequency; case SensorType::GRAVITY: return SensorTraits<SensorType::GRAVITY>::kDefaultFrequency; case SensorType::GYROSCOPE: return SensorTraits<SensorType::GYROSCOPE>::kDefaultFrequency; case SensorType::MAGNETOMETER: return SensorTraits<SensorType::MAGNETOMETER>::kDefaultFrequency; case SensorType::PRESSURE: return SensorTraits<SensorType::PRESSURE>::kDefaultFrequency; case SensorType::ABSOLUTE_ORIENTATION_EULER_ANGLES: return SensorTraits< SensorType::ABSOLUTE_ORIENTATION_EULER_ANGLES>::kDefaultFrequency; case SensorType::ABSOLUTE_ORIENTATION_QUATERNION: return SensorTraits< SensorType::ABSOLUTE_ORIENTATION_QUATERNION>::kDefaultFrequency; case SensorType::RELATIVE_ORIENTATION_EULER_ANGLES: return SensorTraits< SensorType::RELATIVE_ORIENTATION_EULER_ANGLES>::kDefaultFrequency; case SensorType::RELATIVE_ORIENTATION_QUATERNION: return SensorTraits< SensorType::RELATIVE_ORIENTATION_QUATERNION>::kDefaultFrequency; // No default so the compiler will warn us if a new type is added. } NOTREACHED() << "Unknown sensor type " << type; return SensorTraits<SensorType::kMaxValue>::kDefaultFrequency; } } // namespace device
{ "content_hash": "e38baf102b41da1a2ffb65776e8f1b14", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 79, "avg_line_length": 46.243589743589745, "alnum_prop": 0.752703077349598, "repo_name": "chromium/chromium", "id": "78baec0d0dfa228e4ae00875b4c8bdb9bfec5c83", "size": "3821", "binary": false, "copies": "6", "ref": "refs/heads/main", "path": "services/device/public/cpp/generic_sensor/sensor_traits.cc", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
package com.buschmais.xo.impl.proxy.entity.property; import com.buschmais.xo.impl.EntityPropertyManager; import com.buschmais.xo.impl.proxy.common.property.AbstractTransientPropertyGetMethod; import com.buschmais.xo.spi.metadata.method.TransientPropertyMethodMetadata; public class TransientPropertyGetMethod<Entity, Relation> extends AbstractTransientPropertyGetMethod<Entity, EntityPropertyManager<Entity, Relation, ?>> { public TransientPropertyGetMethod(EntityPropertyManager<Entity, Relation, ?> propertyManager, TransientPropertyMethodMetadata metadata) { super(propertyManager, metadata); } }
{ "content_hash": "deec109c5db2fcaa8177424b6464426c", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 154, "avg_line_length": 51.583333333333336, "alnum_prop": 0.8336025848142165, "repo_name": "SMB-TEC/extended-objects", "id": "5b93869fa95371d611a8fee138bed06acfa4e6a4", "size": "619", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "impl/src/main/java/com/buschmais/xo/impl/proxy/entity/property/TransientPropertyGetMethod.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "725697" } ], "symlink_target": "" }
function MainNavBar(Window) { //create module instance var self = Ti.UI.createTabGroup(); //create module instance var HomeWindow = require('ui/common/HomeWindow'), LocationWindow = require('ui/common/LocationWindow'), MoreWindow = require('ui/common/MoreWindow'); //create app tabs var homeWin = new HomeWindow(L('home')), locnWin = new LocationWindow(L('locn')); moreWin = new MoreWindow(L('more')); var homeTab = Ti.UI.createTab({ title: L('home'), icon: '/images/KS_nav_ui.png', window: homeWin }); homeWin.containingTab = homeTab; self.addTab(homeTab); var locnTab = Ti.UI.createTab({ title: L('locn'), icon: '/images/KS_nav_views.png', window: locnWin }); locnWin.containingTab = locnTab; self.addTab(locnTab); var moreTab = Ti.UI.createTab({ title: L('more'), icon: '/images/KS_nav_views.png', window: moreWin }); moreWin.containingTab = moreTab; self.addTab(moreTab); return self; }; module.exports = MainNavBar;
{ "content_hash": "53169c3aa46b6e745ce6d77e951a0155", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 55, "avg_line_length": 23.30952380952381, "alnum_prop": 0.6833503575076609, "repo_name": "rajanishr/SaiTemplePA", "id": "2ee90604bf525979cfe10fb23e8ae49414099ec9", "size": "979", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Resources/ui/common/MainNavBar.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "JavaScript", "bytes": "10548" } ], "symlink_target": "" }
<?php namespace Illuminate\Support\Traits; use Illuminate\Support\Fluent; use Illuminate\Contracts\Container\Container; trait CapsuleManagerTrait { /** * The current globally used instance. * * @var object */ protected static $instance; /** * The container instance. * * @var \Illuminate\Contracts\Container\Container */ protected $container; /** * Setup the IoC container instance. * * @param \Illuminate\Contracts\Container\Container $container * @return void */ protected function setupContainer(Container $container) { $this->container = $container; if (! $this->container->bound('config')) { $this->container->instance('config', new Fluent); } } /** * Make this capsule instance available globally. * * @return void */ public function setAsGlobal() { static::$instance = $this; } /** * Get the IoC container instance. * * @return \Illuminate\Contracts\Container\Container */ public function getContainer() { return $this->container; } /** * Set the IoC container instance. * * @param \Illuminate\Contracts\Container\Container $container * @return void */ public function setContainer(Container $container) { $this->container = $container; } }
{ "content_hash": "6311e5b5066f2da5fd16568387535518", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 68, "avg_line_length": 21.73913043478261, "alnum_prop": 0.5646666666666667, "repo_name": "focuslife/v0.1", "id": "dbf091113994920bef4837cb4477fea12878d121", "size": "1500", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "vendor/laravel/framework/src/Illuminate/Support/Traits/CapsuleManagerTrait.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "428" }, { "name": "CSS", "bytes": "72" }, { "name": "JavaScript", "bytes": "519" }, { "name": "PHP", "bytes": "273407" } ], "symlink_target": "" }
Advent Of Code 2016 (http://adventofcode.com/2016) repo with (very quickly coded) solutions
{ "content_hash": "cee72c546f42340c2c4ef2a9bf0ebcfb", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 91, "avg_line_length": 92, "alnum_prop": 0.782608695652174, "repo_name": "dragonfyre13/adventofcode2016", "id": "c04f6fcb8f16e1108cda2411d908448e1ec63c63", "size": "111", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "Jupyter Notebook", "bytes": "147507" } ], "symlink_target": "" }
package de.leanovate.swaggercheck.schema.model import de.leanovate.swaggercheck.schema.adapter.NodeAdapter /** * Element of a json schema model. */ trait Definition { /** * Validate a json node versus this schema object. * * @param schema the overall model * @param path the current json path elements * @param node the node to validate * @param nodeAdapter adapter for the various json node implementations one might find * @return validation result */ def validate[T](schema: Schema, path: JsonPath, node: T)(implicit nodeAdapter: NodeAdapter[T]): ValidationResult } object Definition { def build( schemaType: Option[String], allOf: Option[Seq[Definition]], enum: Option[List[String]], exclusiveMinimum: Option[Boolean], exclusiveMaximum: Option[Boolean], format: Option[String], items: Option[Definition], minItems: Option[Int], maxItems: Option[Int], minimum: Option[BigDecimal], maximum: Option[BigDecimal], minLength: Option[Int], maxLength: Option[Int], oneOf: Option[Seq[Definition]], pattern: Option[String], properties: Option[Map[String, Definition]], additionalProperties: Option[Either[Boolean, Definition]], required: Option[Set[String]], ref: Option[String], uniqueItems: Option[Boolean] ): Definition = { (allOf, oneOf) match { case (Some(definitions), _) => AllOfDefinition(definitions) case (_, Some(definitions)) => OneOfDefinition(definitions) case _ => schemaType match { case Some("object") => ObjectDefinition(required, properties, additionalProperties.getOrElse(Left(true))) case Some("array") => ArrayDefinition(minItems, maxItems, items) case Some("string") => StringDefinition(format, minLength, maxLength, pattern, enum) case Some("integer") => IntegerDefinition(format, minimum.map(_.longValue()), maximum.map(_.longValue())) case Some("number") => NumberDefinition(format, minimum.map(_.doubleValue()), maximum.map(_.doubleValue())) case Some("boolean") => BooleanDefinition case _ if ref.isDefined => ReferenceDefinition(ref.get) case _ => EmptyDefinition } } } }
{ "content_hash": "cff261e37a4118e859fb464a79c08c36", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 117, "avg_line_length": 39.516129032258064, "alnum_prop": 0.6179591836734694, "repo_name": "leanovate/swagger-check", "id": "a1deebec480fd47ad4070be42f53cba3d3bb4f17", "size": "2450", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "json-schema-model/src/main/scala/de/leanovate/swaggercheck/schema/model/Definition.scala", "mode": "33188", "license": "mit", "language": [ { "name": "Scala", "bytes": "216874" }, { "name": "Shell", "bytes": "132" } ], "symlink_target": "" }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "bf7f57dcc3ad7b03127ef38642fdc147", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.307692307692308, "alnum_prop": 0.6940298507462687, "repo_name": "mdoering/backbone", "id": "b99fe6c5f1907697b70be01f1a79535789b13a61", "size": "187", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Orchidaceae/Gomesa/Gomesa carlosregentii/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
namespace stan { namespace math { template <typename F> void jacobian(const F& f, const Eigen::Matrix<double, Eigen::Dynamic, 1>& x, Eigen::Matrix<double, Eigen::Dynamic, 1>& fx, Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic>& J) { using Eigen::Dynamic; using Eigen::Matrix; // Run nested autodiff in this scope nested_rev_autodiff nested; Matrix<var, Dynamic, 1> x_var(x); Matrix<var, Dynamic, 1> fx_var = f(x_var); fx.resize(fx_var.size()); J.resize(x.size(), fx_var.size()); fx = fx_var.val(); grad(fx_var(0).vi_); J.col(0) = x_var.adj(); for (int i = 1; i < fx_var.size(); ++i) { nested.set_zero_all_adjoints(); grad(fx_var(i).vi_); J.col(i) = x_var.adj(); } J.transposeInPlace(); } } // namespace math } // namespace stan #endif
{ "content_hash": "94a16c0e9383f7f91e859110dbf7b2fa", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 76, "avg_line_length": 27.133333333333333, "alnum_prop": 0.6044226044226044, "repo_name": "stan-dev/math", "id": "75692b0691195a2101a7e8eb3426833ba9babf7c", "size": "1049", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "stan/math/rev/functor/jacobian.hpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Ada", "bytes": "89079" }, { "name": "Assembly", "bytes": "566183" }, { "name": "Batchfile", "bytes": "33076" }, { "name": "C", "bytes": "7093229" }, { "name": "C#", "bytes": "54013" }, { "name": "C++", "bytes": "166268432" }, { "name": "CMake", "bytes": "820167" }, { "name": "CSS", "bytes": "11283" }, { "name": "Cuda", "bytes": "342187" }, { "name": "DIGITAL Command Language", "bytes": "32438" }, { "name": "Dockerfile", "bytes": "118" }, { "name": "Fortran", "bytes": "2299405" }, { "name": "HTML", "bytes": "8320473" }, { "name": "JavaScript", "bytes": "38507" }, { "name": "M4", "bytes": "10525" }, { "name": "Makefile", "bytes": "74538" }, { "name": "Meson", "bytes": "4233" }, { "name": "Module Management System", "bytes": "1545" }, { "name": "NASL", "bytes": "106079" }, { "name": "Objective-C", "bytes": "420" }, { "name": "Objective-C++", "bytes": "420" }, { "name": "Pascal", "bytes": "75208" }, { "name": "Perl", "bytes": "47080" }, { "name": "Python", "bytes": "1958975" }, { "name": "QMake", "bytes": "18714" }, { "name": "Roff", "bytes": "30570" }, { "name": "Ruby", "bytes": "5532" }, { "name": "SAS", "bytes": "1847" }, { "name": "SWIG", "bytes": "5501" }, { "name": "Shell", "bytes": "187001" }, { "name": "Starlark", "bytes": "29435" }, { "name": "XSLT", "bytes": "567938" }, { "name": "Yacc", "bytes": "22343" } ], "symlink_target": "" }
class AddDeliveredAtAndCanceledAtToSpreeShipments < ActiveRecord::Migration def change add_column :spree_shipments, :delivered_at, :datetime add_column :spree_shipments, :canceled_at, :datetime end end
{ "content_hash": "ab43c78005be3603233f05b671c3f2a6", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 75, "avg_line_length": 35.666666666666664, "alnum_prop": 0.780373831775701, "repo_name": "sunny2601/spree-point-of-sale", "id": "4e98d53eb288a0beed57a646dc34921d26c2b18f", "size": "214", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "db/migrate/20130723140316_add_delivered_at_and_canceled_at_to_spree_shipments.rb", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "1554" }, { "name": "HTML", "bytes": "10710" }, { "name": "JavaScript", "bytes": "658" }, { "name": "Ruby", "bytes": "103366" } ], "symlink_target": "" }
package calculadora; import java.awt.Dimension; import java.awt.event.KeyEvent; import java.math.BigDecimal; import java.math.RoundingMode; import javax.swing.JFrame; import javax.swing.UIManager; public class CalculadoraGuiPanel extends javax.swing.JPanel { private String input; private String output; private boolean igual,decimal; private BigDecimal total; private final static RoundingMode TIPO_DE_REDONDEO=RoundingMode.HALF_EVEN; private final static int ESCALA=20; public CalculadoraGuiPanel() { initComponents(); reiniciarValores(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { tecladoPanel = new javax.swing.JPanel(); cancelarBoton = new javax.swing.JButton(); borrarBoton = new javax.swing.JButton(); borrarUltimoBoton = new javax.swing.JButton(); porcentajeBoton = new javax.swing.JButton(); sieteBoton = new javax.swing.JButton(); ochoBoton = new javax.swing.JButton(); nueveBoton = new javax.swing.JButton(); dividirBoton = new javax.swing.JButton(); cuatroBoton = new javax.swing.JButton(); cincoBoton = new javax.swing.JButton(); seisBoton = new javax.swing.JButton(); multiplicarBoton = new javax.swing.JButton(); unoBoton = new javax.swing.JButton(); dosBoton = new javax.swing.JButton(); tresBoton = new javax.swing.JButton(); restarBoton = new javax.swing.JButton(); ceroBoton = new javax.swing.JButton(); puntoDecimalBoton = new javax.swing.JButton(); igualBoton = new javax.swing.JButton(); sumarBoton = new javax.swing.JButton(); displayPanel = new javax.swing.JPanel(); textboxOutput = new javax.swing.JTextField(); textboxInput = new javax.swing.JTextField(); setFocusable(false); setMaximumSize(new java.awt.Dimension(240, 310)); setMinimumSize(new java.awt.Dimension(240, 310)); setPreferredSize(new java.awt.Dimension(240, 310)); setLayout(new java.awt.BorderLayout()); tecladoPanel.setFocusable(false); tecladoPanel.setMaximumSize(new java.awt.Dimension(200, 250)); tecladoPanel.setMinimumSize(new java.awt.Dimension(200, 250)); tecladoPanel.setPreferredSize(new java.awt.Dimension(200, 250)); tecladoPanel.setLayout(new java.awt.GridLayout(5, 4)); cancelarBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N cancelarBoton.setText("C"); cancelarBoton.setFocusable(false); cancelarBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); cancelarBoton.setMaximumSize(new java.awt.Dimension(50, 50)); cancelarBoton.setMinimumSize(new java.awt.Dimension(50, 50)); cancelarBoton.setPreferredSize(new java.awt.Dimension(50, 50)); cancelarBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cancelarBotonActionPerformed(evt); } }); tecladoPanel.add(cancelarBoton); borrarBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N borrarBoton.setText("CE"); borrarBoton.setFocusable(false); borrarBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); borrarBoton.setMaximumSize(new java.awt.Dimension(50, 50)); borrarBoton.setMinimumSize(new java.awt.Dimension(50, 50)); borrarBoton.setPreferredSize(new java.awt.Dimension(50, 50)); borrarBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { borrarBotonActionPerformed(evt); } }); tecladoPanel.add(borrarBoton); borrarUltimoBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N borrarUltimoBoton.setText("<-"); borrarUltimoBoton.setFocusable(false); borrarUltimoBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); borrarUltimoBoton.setMaximumSize(new java.awt.Dimension(50, 50)); borrarUltimoBoton.setMinimumSize(new java.awt.Dimension(50, 50)); borrarUltimoBoton.setPreferredSize(new java.awt.Dimension(50, 50)); borrarUltimoBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { borrarUltimoBotonActionPerformed(evt); } }); tecladoPanel.add(borrarUltimoBoton); porcentajeBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N porcentajeBoton.setText("%"); porcentajeBoton.setToolTipText(""); porcentajeBoton.setFocusable(false); porcentajeBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); porcentajeBoton.setMaximumSize(new java.awt.Dimension(50, 50)); porcentajeBoton.setMinimumSize(new java.awt.Dimension(50, 50)); porcentajeBoton.setPreferredSize(new java.awt.Dimension(50, 50)); porcentajeBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { porcentajeBotonActionPerformed(evt); } }); tecladoPanel.add(porcentajeBoton); sieteBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N sieteBoton.setText("7"); sieteBoton.setFocusable(false); sieteBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); sieteBoton.setMaximumSize(new java.awt.Dimension(50, 50)); sieteBoton.setMinimumSize(new java.awt.Dimension(50, 50)); sieteBoton.setPreferredSize(new java.awt.Dimension(50, 50)); sieteBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { sieteBotonActionPerformed(evt); } }); tecladoPanel.add(sieteBoton); ochoBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N ochoBoton.setText("8"); ochoBoton.setFocusable(false); ochoBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); ochoBoton.setMaximumSize(new java.awt.Dimension(50, 50)); ochoBoton.setMinimumSize(new java.awt.Dimension(50, 50)); ochoBoton.setPreferredSize(new java.awt.Dimension(50, 50)); ochoBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ochoBotonActionPerformed(evt); } }); tecladoPanel.add(ochoBoton); nueveBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N nueveBoton.setText("9"); nueveBoton.setFocusable(false); nueveBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); nueveBoton.setMaximumSize(new java.awt.Dimension(50, 50)); nueveBoton.setMinimumSize(new java.awt.Dimension(50, 50)); nueveBoton.setPreferredSize(new java.awt.Dimension(50, 50)); nueveBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { nueveBotonActionPerformed(evt); } }); tecladoPanel.add(nueveBoton); dividirBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N dividirBoton.setText("/"); dividirBoton.setFocusable(false); dividirBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); dividirBoton.setMaximumSize(new java.awt.Dimension(50, 50)); dividirBoton.setMinimumSize(new java.awt.Dimension(50, 50)); dividirBoton.setPreferredSize(new java.awt.Dimension(50, 50)); dividirBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { dividirBotonActionPerformed(evt); } }); tecladoPanel.add(dividirBoton); cuatroBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N cuatroBoton.setText("4"); cuatroBoton.setFocusable(false); cuatroBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); cuatroBoton.setMaximumSize(new java.awt.Dimension(50, 50)); cuatroBoton.setMinimumSize(new java.awt.Dimension(50, 50)); cuatroBoton.setPreferredSize(new java.awt.Dimension(50, 50)); cuatroBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cuatroBotonActionPerformed(evt); } }); tecladoPanel.add(cuatroBoton); cincoBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N cincoBoton.setText("5"); cincoBoton.setFocusable(false); cincoBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); cincoBoton.setMaximumSize(new java.awt.Dimension(50, 50)); cincoBoton.setMinimumSize(new java.awt.Dimension(50, 50)); cincoBoton.setPreferredSize(new java.awt.Dimension(50, 50)); cincoBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cincoBotonActionPerformed(evt); } }); tecladoPanel.add(cincoBoton); seisBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N seisBoton.setText("6"); seisBoton.setFocusable(false); seisBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); seisBoton.setMaximumSize(new java.awt.Dimension(50, 50)); seisBoton.setMinimumSize(new java.awt.Dimension(50, 50)); seisBoton.setPreferredSize(new java.awt.Dimension(50, 50)); seisBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { seisBotonActionPerformed(evt); } }); tecladoPanel.add(seisBoton); multiplicarBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N multiplicarBoton.setText("*"); multiplicarBoton.setFocusable(false); multiplicarBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); multiplicarBoton.setMaximumSize(new java.awt.Dimension(50, 50)); multiplicarBoton.setMinimumSize(new java.awt.Dimension(50, 50)); multiplicarBoton.setPreferredSize(new java.awt.Dimension(50, 50)); multiplicarBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multiplicarBotonActionPerformed(evt); } }); tecladoPanel.add(multiplicarBoton); unoBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N unoBoton.setText("1"); unoBoton.setFocusable(false); unoBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); unoBoton.setMaximumSize(new java.awt.Dimension(50, 50)); unoBoton.setMinimumSize(new java.awt.Dimension(50, 50)); unoBoton.setPreferredSize(new java.awt.Dimension(50, 50)); unoBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { unoBotonActionPerformed(evt); } }); tecladoPanel.add(unoBoton); dosBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N dosBoton.setText("2"); dosBoton.setFocusable(false); dosBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); dosBoton.setMaximumSize(new java.awt.Dimension(50, 50)); dosBoton.setMinimumSize(new java.awt.Dimension(50, 50)); dosBoton.setPreferredSize(new java.awt.Dimension(50, 50)); dosBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { dosBotonActionPerformed(evt); } }); tecladoPanel.add(dosBoton); tresBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N tresBoton.setText("3"); tresBoton.setFocusable(false); tresBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); tresBoton.setMaximumSize(new java.awt.Dimension(50, 50)); tresBoton.setMinimumSize(new java.awt.Dimension(50, 50)); tresBoton.setPreferredSize(new java.awt.Dimension(50, 50)); tresBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { tresBotonActionPerformed(evt); } }); tecladoPanel.add(tresBoton); restarBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N restarBoton.setText("-"); restarBoton.setFocusable(false); restarBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); restarBoton.setMaximumSize(new java.awt.Dimension(50, 50)); restarBoton.setMinimumSize(new java.awt.Dimension(50, 50)); restarBoton.setPreferredSize(new java.awt.Dimension(50, 50)); restarBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { restarBotonActionPerformed(evt); } }); tecladoPanel.add(restarBoton); ceroBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N ceroBoton.setText("0"); ceroBoton.setFocusable(false); ceroBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); ceroBoton.setMaximumSize(new java.awt.Dimension(50, 50)); ceroBoton.setMinimumSize(new java.awt.Dimension(50, 50)); ceroBoton.setPreferredSize(new java.awt.Dimension(50, 50)); ceroBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ceroBotonActionPerformed(evt); } }); tecladoPanel.add(ceroBoton); puntoDecimalBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N puntoDecimalBoton.setText("."); puntoDecimalBoton.setFocusable(false); puntoDecimalBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); puntoDecimalBoton.setMaximumSize(new java.awt.Dimension(50, 50)); puntoDecimalBoton.setMinimumSize(new java.awt.Dimension(50, 50)); puntoDecimalBoton.setPreferredSize(new java.awt.Dimension(50, 50)); puntoDecimalBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { puntoDecimalBotonActionPerformed(evt); } }); tecladoPanel.add(puntoDecimalBoton); igualBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N igualBoton.setText("="); igualBoton.setFocusable(false); igualBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); igualBoton.setMaximumSize(new java.awt.Dimension(50, 50)); igualBoton.setMinimumSize(new java.awt.Dimension(50, 50)); igualBoton.setPreferredSize(new java.awt.Dimension(50, 50)); igualBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { igualBotonActionPerformed(evt); } }); tecladoPanel.add(igualBoton); sumarBoton.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N sumarBoton.setText("+"); sumarBoton.setFocusable(false); sumarBoton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); sumarBoton.setMaximumSize(new java.awt.Dimension(50, 100)); sumarBoton.setMinimumSize(new java.awt.Dimension(50, 100)); sumarBoton.setPreferredSize(new java.awt.Dimension(50, 100)); sumarBoton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { sumarBotonActionPerformed(evt); } }); tecladoPanel.add(sumarBoton); add(tecladoPanel, java.awt.BorderLayout.CENTER); displayPanel.setFocusable(false); displayPanel.setMaximumSize(new java.awt.Dimension(240, 60)); displayPanel.setMinimumSize(new java.awt.Dimension(240, 60)); displayPanel.setPreferredSize(new java.awt.Dimension(240, 60)); displayPanel.setLayout(new java.awt.GridLayout(2, 1)); textboxOutput.setEditable(false); textboxOutput.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N textboxOutput.setHorizontalAlignment(javax.swing.JTextField.RIGHT); textboxOutput.setFocusable(false); textboxOutput.setMaximumSize(new java.awt.Dimension(240, 30)); textboxOutput.setMinimumSize(new java.awt.Dimension(240, 30)); textboxOutput.setPreferredSize(new java.awt.Dimension(240, 30)); textboxOutput.setRequestFocusEnabled(false); displayPanel.add(textboxOutput); textboxInput.setEditable(false); textboxInput.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N textboxInput.setHorizontalAlignment(javax.swing.JTextField.RIGHT); textboxInput.setText("0"); textboxInput.setMaximumSize(new java.awt.Dimension(240, 30)); textboxInput.setMinimumSize(new java.awt.Dimension(240, 30)); textboxInput.setPreferredSize(new java.awt.Dimension(240, 30)); textboxInput.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { textboxInputActionPerformed(evt); } }); textboxInput.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { textboxInputKeyPressed(evt); } }); displayPanel.add(textboxInput); add(displayPanel, java.awt.BorderLayout.PAGE_START); }// </editor-fold>//GEN-END:initComponents //evento oprimir el boton de sumar private void sumarBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sumarBotonActionPerformed operar('+'); }//GEN-LAST:event_sumarBotonActionPerformed //evento oprimir el boton de restar private void restarBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_restarBotonActionPerformed operar('-'); }//GEN-LAST:event_restarBotonActionPerformed //evento oprimir el boton de multiplicar private void multiplicarBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_multiplicarBotonActionPerformed operar('*'); }//GEN-LAST:event_multiplicarBotonActionPerformed //evento oprimir el boton de dividir private void dividirBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dividirBotonActionPerformed operar('/'); }//GEN-LAST:event_dividirBotonActionPerformed //evento oprimir el boton de porcentaje private void porcentajeBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_porcentajeBotonActionPerformed porcentaje(); }//GEN-LAST:event_porcentajeBotonActionPerformed //evento oprimir el boton igual private void igualBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_igualBotonActionPerformed igualar(); }//GEN-LAST:event_igualBotonActionPerformed //evento oprimir el boton cancelar private void cancelarBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelarBotonActionPerformed reiniciarValores(); }//GEN-LAST:event_cancelarBotonActionPerformed //evento oprimir el boton borrar private void borrarBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_borrarBotonActionPerformed reiniciarEntrada(); }//GEN-LAST:event_borrarBotonActionPerformed //evento oprimir boton cero private void ceroBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ceroBotonActionPerformed ingresar("0"); }//GEN-LAST:event_ceroBotonActionPerformed //evento oprimir boton decimal private void puntoDecimalBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_puntoDecimalBotonActionPerformed if(!this.decimal) { ingresar("."); this.decimal=true; } }//GEN-LAST:event_puntoDecimalBotonActionPerformed ////evento oprimir boton uno private void unoBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unoBotonActionPerformed ingresar("1"); }//GEN-LAST:event_unoBotonActionPerformed //evento oprimir boton dos private void dosBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dosBotonActionPerformed ingresar("2"); }//GEN-LAST:event_dosBotonActionPerformed //evento oprimir boton tres private void tresBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tresBotonActionPerformed ingresar("3"); }//GEN-LAST:event_tresBotonActionPerformed //evento oprimir boton cuatro private void cuatroBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cuatroBotonActionPerformed ingresar("4"); }//GEN-LAST:event_cuatroBotonActionPerformed //evento oprimir boton cinco private void cincoBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cincoBotonActionPerformed ingresar("5"); }//GEN-LAST:event_cincoBotonActionPerformed //evento oprimir boton seis private void seisBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_seisBotonActionPerformed ingresar("6"); }//GEN-LAST:event_seisBotonActionPerformed //evento oprimir boton siete private void sieteBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sieteBotonActionPerformed ingresar("7"); }//GEN-LAST:event_sieteBotonActionPerformed //evento oprimir boton ocho private void ochoBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ochoBotonActionPerformed ingresar("8"); }//GEN-LAST:event_ochoBotonActionPerformed //evento oprimir boton nueve private void nueveBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nueveBotonActionPerformed ingresar("9"); }//GEN-LAST:event_nueveBotonActionPerformed private void borrarUltimoBotonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_borrarUltimoBotonActionPerformed borrarUltimo(); }//GEN-LAST:event_borrarUltimoBotonActionPerformed private void textboxInputActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textboxInputActionPerformed igualBoton.doClick(); }//GEN-LAST:event_textboxInputActionPerformed private void textboxInputKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textboxInputKeyPressed switch(evt.getKeyChar()) { case '%' : porcentajeBoton.doClick();break; case '7' : sieteBoton.doClick(); break; case '8' : ochoBoton.doClick(); break; case '9' : nueveBoton.doClick(); break; case '/' : dividirBoton.doClick(); break; case '4' : cuatroBoton.doClick(); break; case '5' : cincoBoton.doClick(); break; case '6' : seisBoton.doClick(); break; case '*' : multiplicarBoton.doClick(); break; case '1' : unoBoton.doClick(); break; case '2' : dosBoton.doClick(); break; case '3' : tresBoton.doClick(); break; case '-' : restarBoton.doClick(); break; case '0' : ceroBoton.doClick(); break; case '.' : puntoDecimalBoton.doClick(); break; case ',' : puntoDecimalBoton.doClick(); break; case '=' : igualBoton.doClick(); break; case '+' : sumarBoton.doClick(); break; } switch(evt.getKeyCode()) { case KeyEvent.VK_BACK_SPACE: borrarUltimoBoton.doClick(); break; case KeyEvent.VK_ESCAPE: cancelarBoton.doClick(); break; case KeyEvent.VK_DELETE: borrarBoton.doClick(); break; } }//GEN-LAST:event_textboxInputKeyPressed public static void main(String args[]) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) {} JFrame ventana=new JFrame("Calculadora"); CalculadoraGuiPanel calculadora=new CalculadoraGuiPanel(); calculadora.setLocation(0,0); ventana.setLocationRelativeTo(null); ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ventana.setMinimumSize(new Dimension(230, 345)); ventana.setResizable(false); ventana.setVisible(true); ventana.add(calculadora); calculadora.textboxInput.requestFocusInWindow(); } private void reiniciarValores() { this.total=new BigDecimal("0").setScale(ESCALA); this.igual=false; this.output=" "; this.textboxOutput.setText(""); reiniciarEntrada(); } private void reiniciarEntrada() { this.textboxInput.setText("0"); this.textboxInput.setEditable(false); this.decimal=false; this.input=" "; } //controla el ingreso mediante los botones private void ingresar(String dato) { if(this.igual) { this.igual=false; reiniciarEntrada(); } if(this.textboxInput.getText().equals("0") && !dato.equals(".") ) this.textboxInput.setText(dato); else this.textboxInput.setText(this.textboxInput.getText()+dato); } private void porcentaje() { //valida que el campo de entrada no este vacio if(!this.textboxInput.getText().isEmpty() ) { this.input=this.textboxInput.getText(); //valida que se pueda hacer el parseo if(canItParseToBigDecimal()) { try { BigDecimal a=new BigDecimal(this.input); if(!output.equals(" ")) a=this.total.multiply(new BigDecimal(this.input)); a=a.divide(new BigDecimal("100.0000"),ESCALA+1,TIPO_DE_REDONDEO); this.textboxInput.setText(a.stripTrailingZeros().toPlainString()); operar('%'); igualar(); } catch(ArithmeticException e) { reiniciarValores(); imprimirError(); } } } } private void igualar() { //si se ha ingresado al menos un número if(!this.output.equals(" ")) { operar('='); BigDecimal tb=this.total.setScale(ESCALA, TIPO_DE_REDONDEO); reiniciarValores(); this.igual=true; this.decimal=true; this.textboxInput.setText(tb.stripTrailingZeros().toPlainString()); } } //valida y ejecuta las operaciones private void operar(Character nuevoOperador) { //valida que el campo de entrada no este vacio if(!this.textboxInput.getText().isEmpty() ) { this.input=this.textboxInput.getText(); //valida que se pueda hacer el parseo if(canItParseToBigDecimal()) { boolean isMostrar=true; //si se cumple es por que este es el primer número if(output.equals(" ")) { this.output=this.input+nuevoOperador; this.total=stringToBigDecimal(); } else { //busca el último operador en la cola Character ultimoOperador=this.output.charAt(this.output.length()-1); try { ejecutarOperacion(ultimoOperador); this.output+=this.input+nuevoOperador; } catch(ArithmeticException e) { reiniciarValores(); imprimirError(); isMostrar=false; } } if(isMostrar) { reiniciarEntrada(); this.textboxOutput.setText(this.output); } } //fin de if(pasarADoubleBoolean()) }//fin de if(!this.textboxInput.getText().isEmpty() ) }//fin de private void operar(char nuevoOperador) private void ejecutarOperacion(Character ultimoOperador) throws ArithmeticException { switch(ultimoOperador) { case '+': this.total=this.total.add(stringToBigDecimal()); break; case '-': this.total=this.total.subtract(stringToBigDecimal()); break; case '*': this.total=this.total.multiply(stringToBigDecimal()); break; case '/': this.total=this.total.divide(stringToBigDecimal(),ESCALA+1,TIPO_DE_REDONDEO); break; } } private void borrarUltimo() { if(this.textboxInput.getText().isEmpty() || this.igual) reiniciarEntrada(); else { Character ultimo=this.textboxInput.getText().charAt(this.textboxInput.getText().length()-1); if(ultimo.equals('.')) this.decimal=false; this.textboxInput.setText(this.textboxInput.getText().substring(0, this.textboxInput.getText().length()-1)); if(this.textboxInput.getText().isEmpty()) reiniciarEntrada(); } } //valida que se pueda hacer el parseo, y controla la execepcion NumberFormatException private boolean canItParseToBigDecimal() { try { new BigDecimal(this.input); return true; } catch(NumberFormatException formatoE) { reiniciarValores(); imprimirError(); return false; } } //retorna lo ingresado en BigDecimal private BigDecimal stringToBigDecimal() { return new BigDecimal(this.input); } private void imprimirError() { this.textboxOutput.setText("Ha ocurrido un error de operación"); this.textboxInput.setText ("Precione C"); this.textboxInput.setEditable(false); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton borrarBoton; private javax.swing.JButton borrarUltimoBoton; private javax.swing.JButton cancelarBoton; private javax.swing.JButton ceroBoton; private javax.swing.JButton cincoBoton; private javax.swing.JButton cuatroBoton; private javax.swing.JPanel displayPanel; private javax.swing.JButton dividirBoton; private javax.swing.JButton dosBoton; private javax.swing.JButton igualBoton; private javax.swing.JButton multiplicarBoton; private javax.swing.JButton nueveBoton; private javax.swing.JButton ochoBoton; private javax.swing.JButton porcentajeBoton; private javax.swing.JButton puntoDecimalBoton; private javax.swing.JButton restarBoton; private javax.swing.JButton seisBoton; private javax.swing.JButton sieteBoton; private javax.swing.JButton sumarBoton; private javax.swing.JPanel tecladoPanel; private javax.swing.JTextField textboxInput; private javax.swing.JTextField textboxOutput; private javax.swing.JButton tresBoton; private javax.swing.JButton unoBoton; // End of variables declaration//GEN-END:variables }//public class CalculadoraGuiPanel extends javax.swing.JPanel
{ "content_hash": "ae5464200d196805aea288ccdb5eabe5", "timestamp": "", "source": "github", "line_count": 775, "max_line_length": 133, "avg_line_length": 43.0141935483871, "alnum_prop": 0.6447984161267099, "repo_name": "kevinesaa/calculadora", "id": "5d4202846515d795cf6d3cde348d1033ae821ef9", "size": "33340", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/calculadora/CalculadoraGuiPanel.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "33340" } ], "symlink_target": "" }
<?php namespace Acme\Test\Domain\Entity; use Acme\Domain\Entity\EntityInterface; use Acme\Domain\Entity\EntityTrait; /** * TestData for EntityTrait * * @author k.holy74@gmail.com */ final class EntityTraitTestData implements EntityInterface, \ArrayAccess, \IteratorAggregate { use EntityTrait; private $id; private $string; private $null; private $boolean; private $datetime; private $dateFormat; private function setDateTime(\DateTime $datetime) { $this->datetime = $datetime; } private function setDateFormat($dateFormat) { $this->dateFormat = $dateFormat; } public function getDatetimeAsString() { return (isset($this->datetime)) ? $this->datetime->format($this->dateFormat ?: 'Y-m-d H:i:s') : null; } }
{ "content_hash": "f938c4c4a75a7ca2425f03f88c7bf501", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 103, "avg_line_length": 18.55, "alnum_prop": 0.7223719676549866, "repo_name": "k-holy/create-my-own-framework-on-top-of-the-pimple", "id": "7e025fbbcfda1a878baaa436f65c3e5c6034b1f6", "size": "876", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/Acme/Test/Domain/Entity/EntityTraitTestData.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "517" }, { "name": "JavaScript", "bytes": "24773" }, { "name": "PHP", "bytes": "209503" } ], "symlink_target": "" }
package com.ztiany.layoutmanager; import android.annotation.SuppressLint; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.DividerItemDecoration; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import com.ztiany.recyclerview.R; /** * @author Ztiany * Email: ztiany3@gmail.com * Date : 2017-09-29 10:46 */ public class CustomLayoutManagerFragment extends Fragment { private static final String TAG = CustomLayoutManagerFragment.class.getSimpleName(); private int count; private RecyclerView mRecyclerView; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return mRecyclerView == null ? mRecyclerView = new RecyclerView(getContext()) : mRecyclerView; } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { mRecyclerView.setLayoutManager(new CustomLinearLayoutManager()); mRecyclerView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL)); mRecyclerView.setAdapter(new Adapter()); } private class Adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { Log.d(TAG, "onCreateViewHolder() ]" + ++count); View itemView = LayoutInflater.from(getContext()).inflate(R.layout.item_swipe_menu, parent, false); return new RecyclerView.ViewHolder(itemView) { }; } @SuppressLint("SetTextI18n") @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { ((TextView) holder.itemView.findViewById(R.id.tv_content)).setText("I am Item , position = " + position); holder.itemView.findViewById(R.id.tv_menu).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getContext(), "I am a menu", Toast.LENGTH_SHORT).show(); } }); } @Override public int getItemCount() { return 100; } } }
{ "content_hash": "65c5d64668964e1c539fa24599ba5b11", "timestamp": "", "source": "github", "line_count": 70, "max_line_length": 123, "avg_line_length": 36.142857142857146, "alnum_prop": 0.6909090909090909, "repo_name": "Ztiany/Repository", "id": "9700f11b0045b678a79d4b47a07cb4cf794f3aa0", "size": "2530", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Android/UISystem/RecyclerView/src/main/java/com/ztiany/layoutmanager/CustomLayoutManagerFragment.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "38608" }, { "name": "C++", "bytes": "52662" }, { "name": "CMake", "bytes": "316" }, { "name": "CSS", "bytes": "28" }, { "name": "Groovy", "bytes": "151193" }, { "name": "HTML", "bytes": "126611" }, { "name": "Java", "bytes": "632743" }, { "name": "Kotlin", "bytes": "81491" }, { "name": "Python", "bytes": "16189" } ], "symlink_target": "" }
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /// Gecko's pseudo-element definition. #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub enum PseudoElement { /// :after After, /// :before Before, /// :backdrop Backdrop, /// :cue Cue, /// :first-letter FirstLetter, /// :first-line FirstLine, /// :-moz-selection MozSelection, /// :-moz-focus-inner MozFocusInner, /// :-moz-focus-outer MozFocusOuter, /// :-moz-list-bullet MozListBullet, /// :-moz-list-number MozListNumber, /// :-moz-math-anonymous MozMathAnonymous, /// :-moz-number-wrapper MozNumberWrapper, /// :-moz-number-text MozNumberText, /// :-moz-number-spin-box MozNumberSpinBox, /// :-moz-number-spin-up MozNumberSpinUp, /// :-moz-number-spin-down MozNumberSpinDown, /// :-moz-progress-bar MozProgressBar, /// :-moz-range-track MozRangeTrack, /// :-moz-range-progress MozRangeProgress, /// :-moz-range-thumb MozRangeThumb, /// :-moz-meter-bar MozMeterBar, /// :-moz-placeholder MozPlaceholder, /// :placeholder Placeholder, /// :-moz-color-swatch MozColorSwatch, /// :-moz-text MozText, /// :-moz-oof-placeholder OofPlaceholder, /// :-moz-first-letter-continuation FirstLetterContinuation, /// :-moz-block-inside-inline-wrapper MozBlockInsideInlineWrapper, /// :-moz-mathml-anonymous-block MozMathMLAnonymousBlock, /// :-moz-xul-anonymous-block MozXULAnonymousBlock, /// :-moz-hframeset-border HorizontalFramesetBorder, /// :-moz-vframeset-border VerticalFramesetBorder, /// :-moz-line-frame MozLineFrame, /// :-moz-button-content ButtonContent, /// :-moz-cell-content CellContent, /// :-moz-dropdown-list DropDownList, /// :-moz-fieldset-content FieldsetContent, /// :-moz-frameset-blank FramesetBlank, /// :-moz-display-comboboxcontrol-frame MozDisplayComboboxControlFrame, /// :-moz-html-canvas-content HtmlCanvasContent, /// :-moz-inline-table InlineTable, /// :-moz-table Table, /// :-moz-table-cell TableCell, /// :-moz-table-column-group TableColGroup, /// :-moz-table-column TableCol, /// :-moz-table-wrapper TableWrapper, /// :-moz-table-row-group TableRowGroup, /// :-moz-table-row TableRow, /// :-moz-canvas Canvas, /// :-moz-pagebreak PageBreak, /// :-moz-page Page, /// :-moz-pagecontent PageContent, /// :-moz-page-sequence PageSequence, /// :-moz-scrolled-content ScrolledContent, /// :-moz-scrolled-canvas ScrolledCanvas, /// :-moz-scrolled-page-sequence ScrolledPageSequence, /// :-moz-column-content ColumnContent, /// :-moz-viewport Viewport, /// :-moz-viewport-scroll ViewportScroll, /// :-moz-anonymous-flex-item AnonymousFlexItem, /// :-moz-anonymous-grid-item AnonymousGridItem, /// :-moz-ruby Ruby, /// :-moz-ruby-base RubyBase, /// :-moz-ruby-base-container RubyBaseContainer, /// :-moz-ruby-text RubyText, /// :-moz-ruby-text-container RubyTextContainer, /// :-moz-tree-column MozTreeColumn(Box<[Atom]>), /// :-moz-tree-row MozTreeRow(Box<[Atom]>), /// :-moz-tree-separator MozTreeSeparator(Box<[Atom]>), /// :-moz-tree-cell MozTreeCell(Box<[Atom]>), /// :-moz-tree-indentation MozTreeIndentation(Box<[Atom]>), /// :-moz-tree-line MozTreeLine(Box<[Atom]>), /// :-moz-tree-twisty MozTreeTwisty(Box<[Atom]>), /// :-moz-tree-image MozTreeImage(Box<[Atom]>), /// :-moz-tree-cell-text MozTreeCellText(Box<[Atom]>), /// :-moz-tree-checkbox MozTreeCheckbox(Box<[Atom]>), /// :-moz-tree-progressmeter MozTreeProgressmeter(Box<[Atom]>), /// :-moz-tree-drop-feedback MozTreeDropFeedback(Box<[Atom]>), /// :-moz-svg-marker-anon-child MozSVGMarkerAnonChild, /// :-moz-svg-outer-svg-anon-child MozSVGOuterSVGAnonChild, /// :-moz-svg-foreign-content MozSVGForeignContent, /// :-moz-svg-text MozSVGText, } /// Important: If you change this, you should also update Gecko's /// nsCSSPseudoElements::IsEagerlyCascadedInServo. /// The number of eager pseudo-elements. pub const EAGER_PSEUDO_COUNT: usize = 4; /// The number of non-functional pseudo-elements. pub const SIMPLE_PSEUDO_COUNT: usize = 71; /// The number of tree pseudo-elements. pub const TREE_PSEUDO_COUNT: usize = 12; /// The number of all pseudo-elements. pub const PSEUDO_COUNT: usize = 83; /// The list of eager pseudos. pub const EAGER_PSEUDOS: [PseudoElement; EAGER_PSEUDO_COUNT] = [ PseudoElement::Before, PseudoElement::After, PseudoElement::FirstLine, PseudoElement::FirstLetter, ]; impl PseudoElement { /// Get the pseudo-element as an atom. #[inline] pub fn atom(&self) -> Atom { match *self { PseudoElement::After => atom!(":after"), PseudoElement::Before => atom!(":before"), PseudoElement::Backdrop => atom!(":backdrop"), PseudoElement::Cue => atom!(":cue"), PseudoElement::FirstLetter => atom!(":first-letter"), PseudoElement::FirstLine => atom!(":first-line"), PseudoElement::MozSelection => atom!(":-moz-selection"), PseudoElement::MozFocusInner => atom!(":-moz-focus-inner"), PseudoElement::MozFocusOuter => atom!(":-moz-focus-outer"), PseudoElement::MozListBullet => atom!(":-moz-list-bullet"), PseudoElement::MozListNumber => atom!(":-moz-list-number"), PseudoElement::MozMathAnonymous => atom!(":-moz-math-anonymous"), PseudoElement::MozNumberWrapper => atom!(":-moz-number-wrapper"), PseudoElement::MozNumberText => atom!(":-moz-number-text"), PseudoElement::MozNumberSpinBox => atom!(":-moz-number-spin-box"), PseudoElement::MozNumberSpinUp => atom!(":-moz-number-spin-up"), PseudoElement::MozNumberSpinDown => atom!(":-moz-number-spin-down"), PseudoElement::MozProgressBar => atom!(":-moz-progress-bar"), PseudoElement::MozRangeTrack => atom!(":-moz-range-track"), PseudoElement::MozRangeProgress => atom!(":-moz-range-progress"), PseudoElement::MozRangeThumb => atom!(":-moz-range-thumb"), PseudoElement::MozMeterBar => atom!(":-moz-meter-bar"), PseudoElement::MozPlaceholder => atom!(":-moz-placeholder"), PseudoElement::Placeholder => atom!(":placeholder"), PseudoElement::MozColorSwatch => atom!(":-moz-color-swatch"), PseudoElement::MozText => atom!(":-moz-text"), PseudoElement::OofPlaceholder => atom!(":-moz-oof-placeholder"), PseudoElement::FirstLetterContinuation => atom!(":-moz-first-letter-continuation"), PseudoElement::MozBlockInsideInlineWrapper => atom!(":-moz-block-inside-inline-wrapper"), PseudoElement::MozMathMLAnonymousBlock => atom!(":-moz-mathml-anonymous-block"), PseudoElement::MozXULAnonymousBlock => atom!(":-moz-xul-anonymous-block"), PseudoElement::HorizontalFramesetBorder => atom!(":-moz-hframeset-border"), PseudoElement::VerticalFramesetBorder => atom!(":-moz-vframeset-border"), PseudoElement::MozLineFrame => atom!(":-moz-line-frame"), PseudoElement::ButtonContent => atom!(":-moz-button-content"), PseudoElement::CellContent => atom!(":-moz-cell-content"), PseudoElement::DropDownList => atom!(":-moz-dropdown-list"), PseudoElement::FieldsetContent => atom!(":-moz-fieldset-content"), PseudoElement::FramesetBlank => atom!(":-moz-frameset-blank"), PseudoElement::MozDisplayComboboxControlFrame => atom!(":-moz-display-comboboxcontrol-frame"), PseudoElement::HtmlCanvasContent => atom!(":-moz-html-canvas-content"), PseudoElement::InlineTable => atom!(":-moz-inline-table"), PseudoElement::Table => atom!(":-moz-table"), PseudoElement::TableCell => atom!(":-moz-table-cell"), PseudoElement::TableColGroup => atom!(":-moz-table-column-group"), PseudoElement::TableCol => atom!(":-moz-table-column"), PseudoElement::TableWrapper => atom!(":-moz-table-wrapper"), PseudoElement::TableRowGroup => atom!(":-moz-table-row-group"), PseudoElement::TableRow => atom!(":-moz-table-row"), PseudoElement::Canvas => atom!(":-moz-canvas"), PseudoElement::PageBreak => atom!(":-moz-pagebreak"), PseudoElement::Page => atom!(":-moz-page"), PseudoElement::PageContent => atom!(":-moz-pagecontent"), PseudoElement::PageSequence => atom!(":-moz-page-sequence"), PseudoElement::ScrolledContent => atom!(":-moz-scrolled-content"), PseudoElement::ScrolledCanvas => atom!(":-moz-scrolled-canvas"), PseudoElement::ScrolledPageSequence => atom!(":-moz-scrolled-page-sequence"), PseudoElement::ColumnContent => atom!(":-moz-column-content"), PseudoElement::Viewport => atom!(":-moz-viewport"), PseudoElement::ViewportScroll => atom!(":-moz-viewport-scroll"), PseudoElement::AnonymousFlexItem => atom!(":-moz-anonymous-flex-item"), PseudoElement::AnonymousGridItem => atom!(":-moz-anonymous-grid-item"), PseudoElement::Ruby => atom!(":-moz-ruby"), PseudoElement::RubyBase => atom!(":-moz-ruby-base"), PseudoElement::RubyBaseContainer => atom!(":-moz-ruby-base-container"), PseudoElement::RubyText => atom!(":-moz-ruby-text"), PseudoElement::RubyTextContainer => atom!(":-moz-ruby-text-container"), PseudoElement::MozTreeColumn(..) => atom!(":-moz-tree-column"), PseudoElement::MozTreeRow(..) => atom!(":-moz-tree-row"), PseudoElement::MozTreeSeparator(..) => atom!(":-moz-tree-separator"), PseudoElement::MozTreeCell(..) => atom!(":-moz-tree-cell"), PseudoElement::MozTreeIndentation(..) => atom!(":-moz-tree-indentation"), PseudoElement::MozTreeLine(..) => atom!(":-moz-tree-line"), PseudoElement::MozTreeTwisty(..) => atom!(":-moz-tree-twisty"), PseudoElement::MozTreeImage(..) => atom!(":-moz-tree-image"), PseudoElement::MozTreeCellText(..) => atom!(":-moz-tree-cell-text"), PseudoElement::MozTreeCheckbox(..) => atom!(":-moz-tree-checkbox"), PseudoElement::MozTreeProgressmeter(..) => atom!(":-moz-tree-progressmeter"), PseudoElement::MozTreeDropFeedback(..) => atom!(":-moz-tree-drop-feedback"), PseudoElement::MozSVGMarkerAnonChild => atom!(":-moz-svg-marker-anon-child"), PseudoElement::MozSVGOuterSVGAnonChild => atom!(":-moz-svg-outer-svg-anon-child"), PseudoElement::MozSVGForeignContent => atom!(":-moz-svg-foreign-content"), PseudoElement::MozSVGText => atom!(":-moz-svg-text"), } } /// Returns an index of the pseudo-element. #[inline] pub fn index(&self) -> usize { match *self { PseudoElement::After => 0, PseudoElement::Before => 1, PseudoElement::Backdrop => 2, PseudoElement::Cue => 3, PseudoElement::FirstLetter => 4, PseudoElement::FirstLine => 5, PseudoElement::MozSelection => 6, PseudoElement::MozFocusInner => 7, PseudoElement::MozFocusOuter => 8, PseudoElement::MozListBullet => 9, PseudoElement::MozListNumber => 10, PseudoElement::MozMathAnonymous => 11, PseudoElement::MozNumberWrapper => 12, PseudoElement::MozNumberText => 13, PseudoElement::MozNumberSpinBox => 14, PseudoElement::MozNumberSpinUp => 15, PseudoElement::MozNumberSpinDown => 16, PseudoElement::MozProgressBar => 17, PseudoElement::MozRangeTrack => 18, PseudoElement::MozRangeProgress => 19, PseudoElement::MozRangeThumb => 20, PseudoElement::MozMeterBar => 21, PseudoElement::MozPlaceholder => 22, PseudoElement::Placeholder => 23, PseudoElement::MozColorSwatch => 24, PseudoElement::MozText => 25, PseudoElement::OofPlaceholder => 26, PseudoElement::FirstLetterContinuation => 27, PseudoElement::MozBlockInsideInlineWrapper => 28, PseudoElement::MozMathMLAnonymousBlock => 29, PseudoElement::MozXULAnonymousBlock => 30, PseudoElement::HorizontalFramesetBorder => 31, PseudoElement::VerticalFramesetBorder => 32, PseudoElement::MozLineFrame => 33, PseudoElement::ButtonContent => 34, PseudoElement::CellContent => 35, PseudoElement::DropDownList => 36, PseudoElement::FieldsetContent => 37, PseudoElement::FramesetBlank => 38, PseudoElement::MozDisplayComboboxControlFrame => 39, PseudoElement::HtmlCanvasContent => 40, PseudoElement::InlineTable => 41, PseudoElement::Table => 42, PseudoElement::TableCell => 43, PseudoElement::TableColGroup => 44, PseudoElement::TableCol => 45, PseudoElement::TableWrapper => 46, PseudoElement::TableRowGroup => 47, PseudoElement::TableRow => 48, PseudoElement::Canvas => 49, PseudoElement::PageBreak => 50, PseudoElement::Page => 51, PseudoElement::PageContent => 52, PseudoElement::PageSequence => 53, PseudoElement::ScrolledContent => 54, PseudoElement::ScrolledCanvas => 55, PseudoElement::ScrolledPageSequence => 56, PseudoElement::ColumnContent => 57, PseudoElement::Viewport => 58, PseudoElement::ViewportScroll => 59, PseudoElement::AnonymousFlexItem => 60, PseudoElement::AnonymousGridItem => 61, PseudoElement::Ruby => 62, PseudoElement::RubyBase => 63, PseudoElement::RubyBaseContainer => 64, PseudoElement::RubyText => 65, PseudoElement::RubyTextContainer => 66, PseudoElement::MozTreeColumn(..) => 67, PseudoElement::MozTreeRow(..) => 68, PseudoElement::MozTreeSeparator(..) => 69, PseudoElement::MozTreeCell(..) => 70, PseudoElement::MozTreeIndentation(..) => 71, PseudoElement::MozTreeLine(..) => 72, PseudoElement::MozTreeTwisty(..) => 73, PseudoElement::MozTreeImage(..) => 74, PseudoElement::MozTreeCellText(..) => 75, PseudoElement::MozTreeCheckbox(..) => 76, PseudoElement::MozTreeProgressmeter(..) => 77, PseudoElement::MozTreeDropFeedback(..) => 78, PseudoElement::MozSVGMarkerAnonChild => 79, PseudoElement::MozSVGOuterSVGAnonChild => 80, PseudoElement::MozSVGForeignContent => 81, PseudoElement::MozSVGText => 82, } } /// Returns an array of `None` values. /// /// FIXME(emilio): Integer generics can't come soon enough. pub fn pseudo_none_array<T>() -> [Option<T>; PSEUDO_COUNT] { [ None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None ] } /// Whether this pseudo-element is an anonymous box. #[inline] pub fn is_anon_box(&self) -> bool { match *self { PseudoElement::MozText => true, PseudoElement::OofPlaceholder => true, PseudoElement::FirstLetterContinuation => true, PseudoElement::MozBlockInsideInlineWrapper => true, PseudoElement::MozMathMLAnonymousBlock => true, PseudoElement::MozXULAnonymousBlock => true, PseudoElement::HorizontalFramesetBorder => true, PseudoElement::VerticalFramesetBorder => true, PseudoElement::MozLineFrame => true, PseudoElement::ButtonContent => true, PseudoElement::CellContent => true, PseudoElement::DropDownList => true, PseudoElement::FieldsetContent => true, PseudoElement::FramesetBlank => true, PseudoElement::MozDisplayComboboxControlFrame => true, PseudoElement::HtmlCanvasContent => true, PseudoElement::InlineTable => true, PseudoElement::Table => true, PseudoElement::TableCell => true, PseudoElement::TableColGroup => true, PseudoElement::TableCol => true, PseudoElement::TableWrapper => true, PseudoElement::TableRowGroup => true, PseudoElement::TableRow => true, PseudoElement::Canvas => true, PseudoElement::PageBreak => true, PseudoElement::Page => true, PseudoElement::PageContent => true, PseudoElement::PageSequence => true, PseudoElement::ScrolledContent => true, PseudoElement::ScrolledCanvas => true, PseudoElement::ScrolledPageSequence => true, PseudoElement::ColumnContent => true, PseudoElement::Viewport => true, PseudoElement::ViewportScroll => true, PseudoElement::AnonymousFlexItem => true, PseudoElement::AnonymousGridItem => true, PseudoElement::Ruby => true, PseudoElement::RubyBase => true, PseudoElement::RubyBaseContainer => true, PseudoElement::RubyText => true, PseudoElement::RubyTextContainer => true, PseudoElement::MozTreeColumn(..) => true, PseudoElement::MozTreeRow(..) => true, PseudoElement::MozTreeSeparator(..) => true, PseudoElement::MozTreeCell(..) => true, PseudoElement::MozTreeIndentation(..) => true, PseudoElement::MozTreeLine(..) => true, PseudoElement::MozTreeTwisty(..) => true, PseudoElement::MozTreeImage(..) => true, PseudoElement::MozTreeCellText(..) => true, PseudoElement::MozTreeCheckbox(..) => true, PseudoElement::MozTreeProgressmeter(..) => true, PseudoElement::MozTreeDropFeedback(..) => true, PseudoElement::MozSVGMarkerAnonChild => true, PseudoElement::MozSVGOuterSVGAnonChild => true, PseudoElement::MozSVGForeignContent => true, PseudoElement::MozSVGText => true, _ => false, } } /// Whether this pseudo-element is eagerly-cascaded. #[inline] pub fn is_eager(&self) -> bool { matches!(*self, PseudoElement::Before | PseudoElement::After | PseudoElement::FirstLine | PseudoElement::FirstLetter) } /// Whether this pseudo-element is tree pseudo-element. #[inline] pub fn is_tree_pseudo_element(&self) -> bool { match *self { PseudoElement::MozTreeColumn(..) => true, PseudoElement::MozTreeRow(..) => true, PseudoElement::MozTreeSeparator(..) => true, PseudoElement::MozTreeCell(..) => true, PseudoElement::MozTreeIndentation(..) => true, PseudoElement::MozTreeLine(..) => true, PseudoElement::MozTreeTwisty(..) => true, PseudoElement::MozTreeImage(..) => true, PseudoElement::MozTreeCellText(..) => true, PseudoElement::MozTreeCheckbox(..) => true, PseudoElement::MozTreeProgressmeter(..) => true, PseudoElement::MozTreeDropFeedback(..) => true, _ => false, } } /// Gets the flags associated to this pseudo-element, or 0 if it's an /// anonymous box. pub fn flags(&self) -> u32 { match *self { PseudoElement::After => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_after, PseudoElement::Before => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_before, PseudoElement::Backdrop => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_backdrop, PseudoElement::Cue => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_cue, PseudoElement::FirstLetter => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_firstLetter, PseudoElement::FirstLine => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_firstLine, PseudoElement::MozSelection => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozSelection, PseudoElement::MozFocusInner => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozFocusInner, PseudoElement::MozFocusOuter => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozFocusOuter, PseudoElement::MozListBullet => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozListBullet, PseudoElement::MozListNumber => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozListNumber, PseudoElement::MozMathAnonymous => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozMathAnonymous, PseudoElement::MozNumberWrapper => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozNumberWrapper, PseudoElement::MozNumberText => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozNumberText, PseudoElement::MozNumberSpinBox => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozNumberSpinBox, PseudoElement::MozNumberSpinUp => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozNumberSpinUp, PseudoElement::MozNumberSpinDown => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozNumberSpinDown, PseudoElement::MozProgressBar => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozProgressBar, PseudoElement::MozRangeTrack => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozRangeTrack, PseudoElement::MozRangeProgress => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozRangeProgress, PseudoElement::MozRangeThumb => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozRangeThumb, PseudoElement::MozMeterBar => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozMeterBar, PseudoElement::MozPlaceholder => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozPlaceholder, PseudoElement::Placeholder => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_placeholder, PseudoElement::MozColorSwatch => structs::SERVO_CSS_PSEUDO_ELEMENT_FLAGS_mozColorSwatch, PseudoElement::MozText => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::OofPlaceholder => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::FirstLetterContinuation => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::MozBlockInsideInlineWrapper => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::MozMathMLAnonymousBlock => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::MozXULAnonymousBlock => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::HorizontalFramesetBorder => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::VerticalFramesetBorder => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::MozLineFrame => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::ButtonContent => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::CellContent => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::DropDownList => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::FieldsetContent => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::FramesetBlank => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::MozDisplayComboboxControlFrame => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::HtmlCanvasContent => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::InlineTable => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::Table => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::TableCell => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::TableColGroup => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::TableCol => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::TableWrapper => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::TableRowGroup => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::TableRow => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::Canvas => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::PageBreak => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::Page => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::PageContent => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::PageSequence => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::ScrolledContent => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::ScrolledCanvas => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::ScrolledPageSequence => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::ColumnContent => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::Viewport => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::ViewportScroll => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::AnonymousFlexItem => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::AnonymousGridItem => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::Ruby => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::RubyBase => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::RubyBaseContainer => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::RubyText => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::RubyTextContainer => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::MozTreeColumn(..) => 0, PseudoElement::MozTreeRow(..) => 0, PseudoElement::MozTreeSeparator(..) => 0, PseudoElement::MozTreeCell(..) => 0, PseudoElement::MozTreeIndentation(..) => 0, PseudoElement::MozTreeLine(..) => 0, PseudoElement::MozTreeTwisty(..) => 0, PseudoElement::MozTreeImage(..) => 0, PseudoElement::MozTreeCellText(..) => 0, PseudoElement::MozTreeCheckbox(..) => 0, PseudoElement::MozTreeProgressmeter(..) => 0, PseudoElement::MozTreeDropFeedback(..) => 0, PseudoElement::MozSVGMarkerAnonChild => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::MozSVGOuterSVGAnonChild => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::MozSVGForeignContent => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, PseudoElement::MozSVGText => structs::CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY, } } /// Construct a pseudo-element from a `CSSPseudoElementType`. #[inline] pub fn from_pseudo_type(type_: CSSPseudoElementType) -> Option<Self> { match type_ { CSSPseudoElementType::after => { Some(PseudoElement::After) }, CSSPseudoElementType::before => { Some(PseudoElement::Before) }, CSSPseudoElementType::backdrop => { Some(PseudoElement::Backdrop) }, CSSPseudoElementType::cue => { Some(PseudoElement::Cue) }, CSSPseudoElementType::firstLetter => { Some(PseudoElement::FirstLetter) }, CSSPseudoElementType::firstLine => { Some(PseudoElement::FirstLine) }, CSSPseudoElementType::mozSelection => { Some(PseudoElement::MozSelection) }, CSSPseudoElementType::mozFocusInner => { Some(PseudoElement::MozFocusInner) }, CSSPseudoElementType::mozFocusOuter => { Some(PseudoElement::MozFocusOuter) }, CSSPseudoElementType::mozListBullet => { Some(PseudoElement::MozListBullet) }, CSSPseudoElementType::mozListNumber => { Some(PseudoElement::MozListNumber) }, CSSPseudoElementType::mozMathAnonymous => { Some(PseudoElement::MozMathAnonymous) }, CSSPseudoElementType::mozNumberWrapper => { Some(PseudoElement::MozNumberWrapper) }, CSSPseudoElementType::mozNumberText => { Some(PseudoElement::MozNumberText) }, CSSPseudoElementType::mozNumberSpinBox => { Some(PseudoElement::MozNumberSpinBox) }, CSSPseudoElementType::mozNumberSpinUp => { Some(PseudoElement::MozNumberSpinUp) }, CSSPseudoElementType::mozNumberSpinDown => { Some(PseudoElement::MozNumberSpinDown) }, CSSPseudoElementType::mozProgressBar => { Some(PseudoElement::MozProgressBar) }, CSSPseudoElementType::mozRangeTrack => { Some(PseudoElement::MozRangeTrack) }, CSSPseudoElementType::mozRangeProgress => { Some(PseudoElement::MozRangeProgress) }, CSSPseudoElementType::mozRangeThumb => { Some(PseudoElement::MozRangeThumb) }, CSSPseudoElementType::mozMeterBar => { Some(PseudoElement::MozMeterBar) }, CSSPseudoElementType::mozPlaceholder => { Some(PseudoElement::MozPlaceholder) }, CSSPseudoElementType::placeholder => { Some(PseudoElement::Placeholder) }, CSSPseudoElementType::mozColorSwatch => { Some(PseudoElement::MozColorSwatch) }, _ => None, } } /// Construct a `CSSPseudoElementType` from a pseudo-element #[inline] pub fn pseudo_type(&self) -> CSSPseudoElementType { use gecko_bindings::structs::CSSPseudoElementType_InheritingAnonBox; match *self { PseudoElement::After => CSSPseudoElementType::after, PseudoElement::Before => CSSPseudoElementType::before, PseudoElement::Backdrop => CSSPseudoElementType::backdrop, PseudoElement::Cue => CSSPseudoElementType::cue, PseudoElement::FirstLetter => CSSPseudoElementType::firstLetter, PseudoElement::FirstLine => CSSPseudoElementType::firstLine, PseudoElement::MozSelection => CSSPseudoElementType::mozSelection, PseudoElement::MozFocusInner => CSSPseudoElementType::mozFocusInner, PseudoElement::MozFocusOuter => CSSPseudoElementType::mozFocusOuter, PseudoElement::MozListBullet => CSSPseudoElementType::mozListBullet, PseudoElement::MozListNumber => CSSPseudoElementType::mozListNumber, PseudoElement::MozMathAnonymous => CSSPseudoElementType::mozMathAnonymous, PseudoElement::MozNumberWrapper => CSSPseudoElementType::mozNumberWrapper, PseudoElement::MozNumberText => CSSPseudoElementType::mozNumberText, PseudoElement::MozNumberSpinBox => CSSPseudoElementType::mozNumberSpinBox, PseudoElement::MozNumberSpinUp => CSSPseudoElementType::mozNumberSpinUp, PseudoElement::MozNumberSpinDown => CSSPseudoElementType::mozNumberSpinDown, PseudoElement::MozProgressBar => CSSPseudoElementType::mozProgressBar, PseudoElement::MozRangeTrack => CSSPseudoElementType::mozRangeTrack, PseudoElement::MozRangeProgress => CSSPseudoElementType::mozRangeProgress, PseudoElement::MozRangeThumb => CSSPseudoElementType::mozRangeThumb, PseudoElement::MozMeterBar => CSSPseudoElementType::mozMeterBar, PseudoElement::MozPlaceholder => CSSPseudoElementType::mozPlaceholder, PseudoElement::Placeholder => CSSPseudoElementType::placeholder, PseudoElement::MozColorSwatch => CSSPseudoElementType::mozColorSwatch, PseudoElement::MozText => CSSPseudoElementType_InheritingAnonBox, PseudoElement::OofPlaceholder => CSSPseudoElementType::NonInheritingAnonBox, PseudoElement::FirstLetterContinuation => CSSPseudoElementType_InheritingAnonBox, PseudoElement::MozBlockInsideInlineWrapper => CSSPseudoElementType_InheritingAnonBox, PseudoElement::MozMathMLAnonymousBlock => CSSPseudoElementType_InheritingAnonBox, PseudoElement::MozXULAnonymousBlock => CSSPseudoElementType_InheritingAnonBox, PseudoElement::HorizontalFramesetBorder => CSSPseudoElementType::NonInheritingAnonBox, PseudoElement::VerticalFramesetBorder => CSSPseudoElementType::NonInheritingAnonBox, PseudoElement::MozLineFrame => CSSPseudoElementType_InheritingAnonBox, PseudoElement::ButtonContent => CSSPseudoElementType_InheritingAnonBox, PseudoElement::CellContent => CSSPseudoElementType_InheritingAnonBox, PseudoElement::DropDownList => CSSPseudoElementType_InheritingAnonBox, PseudoElement::FieldsetContent => CSSPseudoElementType_InheritingAnonBox, PseudoElement::FramesetBlank => CSSPseudoElementType::NonInheritingAnonBox, PseudoElement::MozDisplayComboboxControlFrame => CSSPseudoElementType_InheritingAnonBox, PseudoElement::HtmlCanvasContent => CSSPseudoElementType_InheritingAnonBox, PseudoElement::InlineTable => CSSPseudoElementType_InheritingAnonBox, PseudoElement::Table => CSSPseudoElementType_InheritingAnonBox, PseudoElement::TableCell => CSSPseudoElementType_InheritingAnonBox, PseudoElement::TableColGroup => CSSPseudoElementType::NonInheritingAnonBox, PseudoElement::TableCol => CSSPseudoElementType::NonInheritingAnonBox, PseudoElement::TableWrapper => CSSPseudoElementType_InheritingAnonBox, PseudoElement::TableRowGroup => CSSPseudoElementType_InheritingAnonBox, PseudoElement::TableRow => CSSPseudoElementType_InheritingAnonBox, PseudoElement::Canvas => CSSPseudoElementType_InheritingAnonBox, PseudoElement::PageBreak => CSSPseudoElementType::NonInheritingAnonBox, PseudoElement::Page => CSSPseudoElementType_InheritingAnonBox, PseudoElement::PageContent => CSSPseudoElementType_InheritingAnonBox, PseudoElement::PageSequence => CSSPseudoElementType_InheritingAnonBox, PseudoElement::ScrolledContent => CSSPseudoElementType_InheritingAnonBox, PseudoElement::ScrolledCanvas => CSSPseudoElementType_InheritingAnonBox, PseudoElement::ScrolledPageSequence => CSSPseudoElementType_InheritingAnonBox, PseudoElement::ColumnContent => CSSPseudoElementType_InheritingAnonBox, PseudoElement::Viewport => CSSPseudoElementType_InheritingAnonBox, PseudoElement::ViewportScroll => CSSPseudoElementType_InheritingAnonBox, PseudoElement::AnonymousFlexItem => CSSPseudoElementType_InheritingAnonBox, PseudoElement::AnonymousGridItem => CSSPseudoElementType_InheritingAnonBox, PseudoElement::Ruby => CSSPseudoElementType_InheritingAnonBox, PseudoElement::RubyBase => CSSPseudoElementType_InheritingAnonBox, PseudoElement::RubyBaseContainer => CSSPseudoElementType_InheritingAnonBox, PseudoElement::RubyText => CSSPseudoElementType_InheritingAnonBox, PseudoElement::RubyTextContainer => CSSPseudoElementType_InheritingAnonBox, PseudoElement::MozTreeColumn(..) => CSSPseudoElementType::XULTree, PseudoElement::MozTreeRow(..) => CSSPseudoElementType::XULTree, PseudoElement::MozTreeSeparator(..) => CSSPseudoElementType::XULTree, PseudoElement::MozTreeCell(..) => CSSPseudoElementType::XULTree, PseudoElement::MozTreeIndentation(..) => CSSPseudoElementType::XULTree, PseudoElement::MozTreeLine(..) => CSSPseudoElementType::XULTree, PseudoElement::MozTreeTwisty(..) => CSSPseudoElementType::XULTree, PseudoElement::MozTreeImage(..) => CSSPseudoElementType::XULTree, PseudoElement::MozTreeCellText(..) => CSSPseudoElementType::XULTree, PseudoElement::MozTreeCheckbox(..) => CSSPseudoElementType::XULTree, PseudoElement::MozTreeProgressmeter(..) => CSSPseudoElementType::XULTree, PseudoElement::MozTreeDropFeedback(..) => CSSPseudoElementType::XULTree, PseudoElement::MozSVGMarkerAnonChild => CSSPseudoElementType_InheritingAnonBox, PseudoElement::MozSVGOuterSVGAnonChild => CSSPseudoElementType_InheritingAnonBox, PseudoElement::MozSVGForeignContent => CSSPseudoElementType_InheritingAnonBox, PseudoElement::MozSVGText => CSSPseudoElementType_InheritingAnonBox, } } /// Get a PseudoInfo for a pseudo pub fn pseudo_info(&self) -> (*mut structs::nsAtom, CSSPseudoElementType) { (self.atom().as_ptr(), self.pseudo_type()) } /// Get the argument list of a tree pseudo-element. #[inline] pub fn tree_pseudo_args(&self) -> Option<&[Atom]> { match *self { PseudoElement::MozTreeColumn(ref args) => Some(args), PseudoElement::MozTreeRow(ref args) => Some(args), PseudoElement::MozTreeSeparator(ref args) => Some(args), PseudoElement::MozTreeCell(ref args) => Some(args), PseudoElement::MozTreeIndentation(ref args) => Some(args), PseudoElement::MozTreeLine(ref args) => Some(args), PseudoElement::MozTreeTwisty(ref args) => Some(args), PseudoElement::MozTreeImage(ref args) => Some(args), PseudoElement::MozTreeCellText(ref args) => Some(args), PseudoElement::MozTreeCheckbox(ref args) => Some(args), PseudoElement::MozTreeProgressmeter(ref args) => Some(args), PseudoElement::MozTreeDropFeedback(ref args) => Some(args), _ => None, } } /// Construct a pseudo-element from an `Atom`. #[inline] pub fn from_atom(atom: &Atom) -> Option<Self> { if atom == &atom!(":after") { return Some(PseudoElement::After); } if atom == &atom!(":before") { return Some(PseudoElement::Before); } if atom == &atom!(":backdrop") { return Some(PseudoElement::Backdrop); } if atom == &atom!(":cue") { return Some(PseudoElement::Cue); } if atom == &atom!(":first-letter") { return Some(PseudoElement::FirstLetter); } if atom == &atom!(":first-line") { return Some(PseudoElement::FirstLine); } if atom == &atom!(":-moz-selection") { return Some(PseudoElement::MozSelection); } if atom == &atom!(":-moz-focus-inner") { return Some(PseudoElement::MozFocusInner); } if atom == &atom!(":-moz-focus-outer") { return Some(PseudoElement::MozFocusOuter); } if atom == &atom!(":-moz-list-bullet") { return Some(PseudoElement::MozListBullet); } if atom == &atom!(":-moz-list-number") { return Some(PseudoElement::MozListNumber); } if atom == &atom!(":-moz-math-anonymous") { return Some(PseudoElement::MozMathAnonymous); } if atom == &atom!(":-moz-number-wrapper") { return Some(PseudoElement::MozNumberWrapper); } if atom == &atom!(":-moz-number-text") { return Some(PseudoElement::MozNumberText); } if atom == &atom!(":-moz-number-spin-box") { return Some(PseudoElement::MozNumberSpinBox); } if atom == &atom!(":-moz-number-spin-up") { return Some(PseudoElement::MozNumberSpinUp); } if atom == &atom!(":-moz-number-spin-down") { return Some(PseudoElement::MozNumberSpinDown); } if atom == &atom!(":-moz-progress-bar") { return Some(PseudoElement::MozProgressBar); } if atom == &atom!(":-moz-range-track") { return Some(PseudoElement::MozRangeTrack); } if atom == &atom!(":-moz-range-progress") { return Some(PseudoElement::MozRangeProgress); } if atom == &atom!(":-moz-range-thumb") { return Some(PseudoElement::MozRangeThumb); } if atom == &atom!(":-moz-meter-bar") { return Some(PseudoElement::MozMeterBar); } if atom == &atom!(":-moz-placeholder") { return Some(PseudoElement::MozPlaceholder); } if atom == &atom!(":placeholder") { return Some(PseudoElement::Placeholder); } if atom == &atom!(":-moz-color-swatch") { return Some(PseudoElement::MozColorSwatch); } if atom == &atom!(":-moz-text") { return Some(PseudoElement::MozText); } if atom == &atom!(":-moz-oof-placeholder") { return Some(PseudoElement::OofPlaceholder); } if atom == &atom!(":-moz-first-letter-continuation") { return Some(PseudoElement::FirstLetterContinuation); } if atom == &atom!(":-moz-block-inside-inline-wrapper") { return Some(PseudoElement::MozBlockInsideInlineWrapper); } if atom == &atom!(":-moz-mathml-anonymous-block") { return Some(PseudoElement::MozMathMLAnonymousBlock); } if atom == &atom!(":-moz-xul-anonymous-block") { return Some(PseudoElement::MozXULAnonymousBlock); } if atom == &atom!(":-moz-hframeset-border") { return Some(PseudoElement::HorizontalFramesetBorder); } if atom == &atom!(":-moz-vframeset-border") { return Some(PseudoElement::VerticalFramesetBorder); } if atom == &atom!(":-moz-line-frame") { return Some(PseudoElement::MozLineFrame); } if atom == &atom!(":-moz-button-content") { return Some(PseudoElement::ButtonContent); } if atom == &atom!(":-moz-cell-content") { return Some(PseudoElement::CellContent); } if atom == &atom!(":-moz-dropdown-list") { return Some(PseudoElement::DropDownList); } if atom == &atom!(":-moz-fieldset-content") { return Some(PseudoElement::FieldsetContent); } if atom == &atom!(":-moz-frameset-blank") { return Some(PseudoElement::FramesetBlank); } if atom == &atom!(":-moz-display-comboboxcontrol-frame") { return Some(PseudoElement::MozDisplayComboboxControlFrame); } if atom == &atom!(":-moz-html-canvas-content") { return Some(PseudoElement::HtmlCanvasContent); } if atom == &atom!(":-moz-inline-table") { return Some(PseudoElement::InlineTable); } if atom == &atom!(":-moz-table") { return Some(PseudoElement::Table); } if atom == &atom!(":-moz-table-cell") { return Some(PseudoElement::TableCell); } if atom == &atom!(":-moz-table-column-group") { return Some(PseudoElement::TableColGroup); } if atom == &atom!(":-moz-table-column") { return Some(PseudoElement::TableCol); } if atom == &atom!(":-moz-table-wrapper") { return Some(PseudoElement::TableWrapper); } if atom == &atom!(":-moz-table-row-group") { return Some(PseudoElement::TableRowGroup); } if atom == &atom!(":-moz-table-row") { return Some(PseudoElement::TableRow); } if atom == &atom!(":-moz-canvas") { return Some(PseudoElement::Canvas); } if atom == &atom!(":-moz-pagebreak") { return Some(PseudoElement::PageBreak); } if atom == &atom!(":-moz-page") { return Some(PseudoElement::Page); } if atom == &atom!(":-moz-pagecontent") { return Some(PseudoElement::PageContent); } if atom == &atom!(":-moz-page-sequence") { return Some(PseudoElement::PageSequence); } if atom == &atom!(":-moz-scrolled-content") { return Some(PseudoElement::ScrolledContent); } if atom == &atom!(":-moz-scrolled-canvas") { return Some(PseudoElement::ScrolledCanvas); } if atom == &atom!(":-moz-scrolled-page-sequence") { return Some(PseudoElement::ScrolledPageSequence); } if atom == &atom!(":-moz-column-content") { return Some(PseudoElement::ColumnContent); } if atom == &atom!(":-moz-viewport") { return Some(PseudoElement::Viewport); } if atom == &atom!(":-moz-viewport-scroll") { return Some(PseudoElement::ViewportScroll); } if atom == &atom!(":-moz-anonymous-flex-item") { return Some(PseudoElement::AnonymousFlexItem); } if atom == &atom!(":-moz-anonymous-grid-item") { return Some(PseudoElement::AnonymousGridItem); } if atom == &atom!(":-moz-ruby") { return Some(PseudoElement::Ruby); } if atom == &atom!(":-moz-ruby-base") { return Some(PseudoElement::RubyBase); } if atom == &atom!(":-moz-ruby-base-container") { return Some(PseudoElement::RubyBaseContainer); } if atom == &atom!(":-moz-ruby-text") { return Some(PseudoElement::RubyText); } if atom == &atom!(":-moz-ruby-text-container") { return Some(PseudoElement::RubyTextContainer); } // We cannot generate PseudoElement::MozTreeColumn(..) from just an atom. // We cannot generate PseudoElement::MozTreeRow(..) from just an atom. // We cannot generate PseudoElement::MozTreeSeparator(..) from just an atom. // We cannot generate PseudoElement::MozTreeCell(..) from just an atom. // We cannot generate PseudoElement::MozTreeIndentation(..) from just an atom. // We cannot generate PseudoElement::MozTreeLine(..) from just an atom. // We cannot generate PseudoElement::MozTreeTwisty(..) from just an atom. // We cannot generate PseudoElement::MozTreeImage(..) from just an atom. // We cannot generate PseudoElement::MozTreeCellText(..) from just an atom. // We cannot generate PseudoElement::MozTreeCheckbox(..) from just an atom. // We cannot generate PseudoElement::MozTreeProgressmeter(..) from just an atom. // We cannot generate PseudoElement::MozTreeDropFeedback(..) from just an atom. if atom == &atom!(":-moz-svg-marker-anon-child") { return Some(PseudoElement::MozSVGMarkerAnonChild); } if atom == &atom!(":-moz-svg-outer-svg-anon-child") { return Some(PseudoElement::MozSVGOuterSVGAnonChild); } if atom == &atom!(":-moz-svg-foreign-content") { return Some(PseudoElement::MozSVGForeignContent); } if atom == &atom!(":-moz-svg-text") { return Some(PseudoElement::MozSVGText); } None } /// Construct a pseudo-element from an anonymous box `Atom`. #[inline] pub fn from_anon_box_atom(atom: &Atom) -> Option<Self> { if atom == &atom!(":-moz-text") { return Some(PseudoElement::MozText); } if atom == &atom!(":-moz-oof-placeholder") { return Some(PseudoElement::OofPlaceholder); } if atom == &atom!(":-moz-first-letter-continuation") { return Some(PseudoElement::FirstLetterContinuation); } if atom == &atom!(":-moz-block-inside-inline-wrapper") { return Some(PseudoElement::MozBlockInsideInlineWrapper); } if atom == &atom!(":-moz-mathml-anonymous-block") { return Some(PseudoElement::MozMathMLAnonymousBlock); } if atom == &atom!(":-moz-xul-anonymous-block") { return Some(PseudoElement::MozXULAnonymousBlock); } if atom == &atom!(":-moz-hframeset-border") { return Some(PseudoElement::HorizontalFramesetBorder); } if atom == &atom!(":-moz-vframeset-border") { return Some(PseudoElement::VerticalFramesetBorder); } if atom == &atom!(":-moz-line-frame") { return Some(PseudoElement::MozLineFrame); } if atom == &atom!(":-moz-button-content") { return Some(PseudoElement::ButtonContent); } if atom == &atom!(":-moz-cell-content") { return Some(PseudoElement::CellContent); } if atom == &atom!(":-moz-dropdown-list") { return Some(PseudoElement::DropDownList); } if atom == &atom!(":-moz-fieldset-content") { return Some(PseudoElement::FieldsetContent); } if atom == &atom!(":-moz-frameset-blank") { return Some(PseudoElement::FramesetBlank); } if atom == &atom!(":-moz-display-comboboxcontrol-frame") { return Some(PseudoElement::MozDisplayComboboxControlFrame); } if atom == &atom!(":-moz-html-canvas-content") { return Some(PseudoElement::HtmlCanvasContent); } if atom == &atom!(":-moz-inline-table") { return Some(PseudoElement::InlineTable); } if atom == &atom!(":-moz-table") { return Some(PseudoElement::Table); } if atom == &atom!(":-moz-table-cell") { return Some(PseudoElement::TableCell); } if atom == &atom!(":-moz-table-column-group") { return Some(PseudoElement::TableColGroup); } if atom == &atom!(":-moz-table-column") { return Some(PseudoElement::TableCol); } if atom == &atom!(":-moz-table-wrapper") { return Some(PseudoElement::TableWrapper); } if atom == &atom!(":-moz-table-row-group") { return Some(PseudoElement::TableRowGroup); } if atom == &atom!(":-moz-table-row") { return Some(PseudoElement::TableRow); } if atom == &atom!(":-moz-canvas") { return Some(PseudoElement::Canvas); } if atom == &atom!(":-moz-pagebreak") { return Some(PseudoElement::PageBreak); } if atom == &atom!(":-moz-page") { return Some(PseudoElement::Page); } if atom == &atom!(":-moz-pagecontent") { return Some(PseudoElement::PageContent); } if atom == &atom!(":-moz-page-sequence") { return Some(PseudoElement::PageSequence); } if atom == &atom!(":-moz-scrolled-content") { return Some(PseudoElement::ScrolledContent); } if atom == &atom!(":-moz-scrolled-canvas") { return Some(PseudoElement::ScrolledCanvas); } if atom == &atom!(":-moz-scrolled-page-sequence") { return Some(PseudoElement::ScrolledPageSequence); } if atom == &atom!(":-moz-column-content") { return Some(PseudoElement::ColumnContent); } if atom == &atom!(":-moz-viewport") { return Some(PseudoElement::Viewport); } if atom == &atom!(":-moz-viewport-scroll") { return Some(PseudoElement::ViewportScroll); } if atom == &atom!(":-moz-anonymous-flex-item") { return Some(PseudoElement::AnonymousFlexItem); } if atom == &atom!(":-moz-anonymous-grid-item") { return Some(PseudoElement::AnonymousGridItem); } if atom == &atom!(":-moz-ruby") { return Some(PseudoElement::Ruby); } if atom == &atom!(":-moz-ruby-base") { return Some(PseudoElement::RubyBase); } if atom == &atom!(":-moz-ruby-base-container") { return Some(PseudoElement::RubyBaseContainer); } if atom == &atom!(":-moz-ruby-text") { return Some(PseudoElement::RubyText); } if atom == &atom!(":-moz-ruby-text-container") { return Some(PseudoElement::RubyTextContainer); } // We cannot generate PseudoElement::MozTreeColumn(..) from just an atom. // We cannot generate PseudoElement::MozTreeRow(..) from just an atom. // We cannot generate PseudoElement::MozTreeSeparator(..) from just an atom. // We cannot generate PseudoElement::MozTreeCell(..) from just an atom. // We cannot generate PseudoElement::MozTreeIndentation(..) from just an atom. // We cannot generate PseudoElement::MozTreeLine(..) from just an atom. // We cannot generate PseudoElement::MozTreeTwisty(..) from just an atom. // We cannot generate PseudoElement::MozTreeImage(..) from just an atom. // We cannot generate PseudoElement::MozTreeCellText(..) from just an atom. // We cannot generate PseudoElement::MozTreeCheckbox(..) from just an atom. // We cannot generate PseudoElement::MozTreeProgressmeter(..) from just an atom. // We cannot generate PseudoElement::MozTreeDropFeedback(..) from just an atom. if atom == &atom!(":-moz-svg-marker-anon-child") { return Some(PseudoElement::MozSVGMarkerAnonChild); } if atom == &atom!(":-moz-svg-outer-svg-anon-child") { return Some(PseudoElement::MozSVGOuterSVGAnonChild); } if atom == &atom!(":-moz-svg-foreign-content") { return Some(PseudoElement::MozSVGForeignContent); } if atom == &atom!(":-moz-svg-text") { return Some(PseudoElement::MozSVGText); } None } /// Construct a tree pseudo-element from atom and args. #[inline] pub fn from_tree_pseudo_atom(atom: &Atom, args: Box<[Atom]>) -> Option<Self> { if atom == &atom!(":-moz-tree-column") { return Some(PseudoElement::MozTreeColumn(args)); } if atom == &atom!(":-moz-tree-row") { return Some(PseudoElement::MozTreeRow(args)); } if atom == &atom!(":-moz-tree-separator") { return Some(PseudoElement::MozTreeSeparator(args)); } if atom == &atom!(":-moz-tree-cell") { return Some(PseudoElement::MozTreeCell(args)); } if atom == &atom!(":-moz-tree-indentation") { return Some(PseudoElement::MozTreeIndentation(args)); } if atom == &atom!(":-moz-tree-line") { return Some(PseudoElement::MozTreeLine(args)); } if atom == &atom!(":-moz-tree-twisty") { return Some(PseudoElement::MozTreeTwisty(args)); } if atom == &atom!(":-moz-tree-image") { return Some(PseudoElement::MozTreeImage(args)); } if atom == &atom!(":-moz-tree-cell-text") { return Some(PseudoElement::MozTreeCellText(args)); } if atom == &atom!(":-moz-tree-checkbox") { return Some(PseudoElement::MozTreeCheckbox(args)); } if atom == &atom!(":-moz-tree-progressmeter") { return Some(PseudoElement::MozTreeProgressmeter(args)); } if atom == &atom!(":-moz-tree-drop-feedback") { return Some(PseudoElement::MozTreeDropFeedback(args)); } None } /// Constructs an atom from a string of text, and whether we're in a /// user-agent stylesheet. /// /// If we're not in a user-agent stylesheet, we will never parse anonymous /// box pseudo-elements. /// /// Returns `None` if the pseudo-element is not recognised. #[inline] pub fn from_slice(s: &str, in_ua_stylesheet: bool) -> Option<Self> { #[allow(unused_imports)] use std::ascii::AsciiExt; // We don't need to support tree pseudos because functional // pseudo-elements needs arguments, and thus should be created // via other methods. if in_ua_stylesheet || PseudoElement::After.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("after") { return Some(PseudoElement::After); } } if in_ua_stylesheet || PseudoElement::Before.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("before") { return Some(PseudoElement::Before); } } if in_ua_stylesheet || PseudoElement::Backdrop.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("backdrop") { return Some(PseudoElement::Backdrop); } } if in_ua_stylesheet || PseudoElement::Cue.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("cue") { return Some(PseudoElement::Cue); } } if in_ua_stylesheet || PseudoElement::FirstLetter.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("first-letter") { return Some(PseudoElement::FirstLetter); } } if in_ua_stylesheet || PseudoElement::FirstLine.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("first-line") { return Some(PseudoElement::FirstLine); } } if in_ua_stylesheet || PseudoElement::MozSelection.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-selection") { return Some(PseudoElement::MozSelection); } } if in_ua_stylesheet || PseudoElement::MozFocusInner.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-focus-inner") { return Some(PseudoElement::MozFocusInner); } } if in_ua_stylesheet || PseudoElement::MozFocusOuter.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-focus-outer") { return Some(PseudoElement::MozFocusOuter); } } if in_ua_stylesheet || PseudoElement::MozListBullet.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-list-bullet") { return Some(PseudoElement::MozListBullet); } } if in_ua_stylesheet || PseudoElement::MozListNumber.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-list-number") { return Some(PseudoElement::MozListNumber); } } if in_ua_stylesheet || PseudoElement::MozMathAnonymous.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-math-anonymous") { return Some(PseudoElement::MozMathAnonymous); } } if in_ua_stylesheet || PseudoElement::MozNumberWrapper.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-number-wrapper") { return Some(PseudoElement::MozNumberWrapper); } } if in_ua_stylesheet || PseudoElement::MozNumberText.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-number-text") { return Some(PseudoElement::MozNumberText); } } if in_ua_stylesheet || PseudoElement::MozNumberSpinBox.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-number-spin-box") { return Some(PseudoElement::MozNumberSpinBox); } } if in_ua_stylesheet || PseudoElement::MozNumberSpinUp.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-number-spin-up") { return Some(PseudoElement::MozNumberSpinUp); } } if in_ua_stylesheet || PseudoElement::MozNumberSpinDown.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-number-spin-down") { return Some(PseudoElement::MozNumberSpinDown); } } if in_ua_stylesheet || PseudoElement::MozProgressBar.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-progress-bar") { return Some(PseudoElement::MozProgressBar); } } if in_ua_stylesheet || PseudoElement::MozRangeTrack.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-range-track") { return Some(PseudoElement::MozRangeTrack); } } if in_ua_stylesheet || PseudoElement::MozRangeProgress.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-range-progress") { return Some(PseudoElement::MozRangeProgress); } } if in_ua_stylesheet || PseudoElement::MozRangeThumb.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-range-thumb") { return Some(PseudoElement::MozRangeThumb); } } if in_ua_stylesheet || PseudoElement::MozMeterBar.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-meter-bar") { return Some(PseudoElement::MozMeterBar); } } if in_ua_stylesheet || PseudoElement::MozPlaceholder.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-placeholder") { return Some(PseudoElement::MozPlaceholder); } } if in_ua_stylesheet || PseudoElement::Placeholder.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("placeholder") { return Some(PseudoElement::Placeholder); } } if in_ua_stylesheet || PseudoElement::MozColorSwatch.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-color-swatch") { return Some(PseudoElement::MozColorSwatch); } } if in_ua_stylesheet || PseudoElement::MozText.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-text") { return Some(PseudoElement::MozText); } } if in_ua_stylesheet || PseudoElement::OofPlaceholder.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-oof-placeholder") { return Some(PseudoElement::OofPlaceholder); } } if in_ua_stylesheet || PseudoElement::FirstLetterContinuation.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-first-letter-continuation") { return Some(PseudoElement::FirstLetterContinuation); } } if in_ua_stylesheet || PseudoElement::MozBlockInsideInlineWrapper.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-block-inside-inline-wrapper") { return Some(PseudoElement::MozBlockInsideInlineWrapper); } } if in_ua_stylesheet || PseudoElement::MozMathMLAnonymousBlock.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-mathml-anonymous-block") { return Some(PseudoElement::MozMathMLAnonymousBlock); } } if in_ua_stylesheet || PseudoElement::MozXULAnonymousBlock.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-xul-anonymous-block") { return Some(PseudoElement::MozXULAnonymousBlock); } } if in_ua_stylesheet || PseudoElement::HorizontalFramesetBorder.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-hframeset-border") { return Some(PseudoElement::HorizontalFramesetBorder); } } if in_ua_stylesheet || PseudoElement::VerticalFramesetBorder.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-vframeset-border") { return Some(PseudoElement::VerticalFramesetBorder); } } if in_ua_stylesheet || PseudoElement::MozLineFrame.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-line-frame") { return Some(PseudoElement::MozLineFrame); } } if in_ua_stylesheet || PseudoElement::ButtonContent.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-button-content") { return Some(PseudoElement::ButtonContent); } } if in_ua_stylesheet || PseudoElement::CellContent.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-cell-content") { return Some(PseudoElement::CellContent); } } if in_ua_stylesheet || PseudoElement::DropDownList.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-dropdown-list") { return Some(PseudoElement::DropDownList); } } if in_ua_stylesheet || PseudoElement::FieldsetContent.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-fieldset-content") { return Some(PseudoElement::FieldsetContent); } } if in_ua_stylesheet || PseudoElement::FramesetBlank.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-frameset-blank") { return Some(PseudoElement::FramesetBlank); } } if in_ua_stylesheet || PseudoElement::MozDisplayComboboxControlFrame.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-display-comboboxcontrol-frame") { return Some(PseudoElement::MozDisplayComboboxControlFrame); } } if in_ua_stylesheet || PseudoElement::HtmlCanvasContent.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-html-canvas-content") { return Some(PseudoElement::HtmlCanvasContent); } } if in_ua_stylesheet || PseudoElement::InlineTable.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-inline-table") { return Some(PseudoElement::InlineTable); } } if in_ua_stylesheet || PseudoElement::Table.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-table") { return Some(PseudoElement::Table); } } if in_ua_stylesheet || PseudoElement::TableCell.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-table-cell") { return Some(PseudoElement::TableCell); } } if in_ua_stylesheet || PseudoElement::TableColGroup.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-table-column-group") { return Some(PseudoElement::TableColGroup); } } if in_ua_stylesheet || PseudoElement::TableCol.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-table-column") { return Some(PseudoElement::TableCol); } } if in_ua_stylesheet || PseudoElement::TableWrapper.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-table-wrapper") { return Some(PseudoElement::TableWrapper); } } if in_ua_stylesheet || PseudoElement::TableRowGroup.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-table-row-group") { return Some(PseudoElement::TableRowGroup); } } if in_ua_stylesheet || PseudoElement::TableRow.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-table-row") { return Some(PseudoElement::TableRow); } } if in_ua_stylesheet || PseudoElement::Canvas.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-canvas") { return Some(PseudoElement::Canvas); } } if in_ua_stylesheet || PseudoElement::PageBreak.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-pagebreak") { return Some(PseudoElement::PageBreak); } } if in_ua_stylesheet || PseudoElement::Page.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-page") { return Some(PseudoElement::Page); } } if in_ua_stylesheet || PseudoElement::PageContent.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-pagecontent") { return Some(PseudoElement::PageContent); } } if in_ua_stylesheet || PseudoElement::PageSequence.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-page-sequence") { return Some(PseudoElement::PageSequence); } } if in_ua_stylesheet || PseudoElement::ScrolledContent.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-scrolled-content") { return Some(PseudoElement::ScrolledContent); } } if in_ua_stylesheet || PseudoElement::ScrolledCanvas.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-scrolled-canvas") { return Some(PseudoElement::ScrolledCanvas); } } if in_ua_stylesheet || PseudoElement::ScrolledPageSequence.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-scrolled-page-sequence") { return Some(PseudoElement::ScrolledPageSequence); } } if in_ua_stylesheet || PseudoElement::ColumnContent.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-column-content") { return Some(PseudoElement::ColumnContent); } } if in_ua_stylesheet || PseudoElement::Viewport.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-viewport") { return Some(PseudoElement::Viewport); } } if in_ua_stylesheet || PseudoElement::ViewportScroll.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-viewport-scroll") { return Some(PseudoElement::ViewportScroll); } } if in_ua_stylesheet || PseudoElement::AnonymousFlexItem.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-anonymous-flex-item") { return Some(PseudoElement::AnonymousFlexItem); } } if in_ua_stylesheet || PseudoElement::AnonymousGridItem.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-anonymous-grid-item") { return Some(PseudoElement::AnonymousGridItem); } } if in_ua_stylesheet || PseudoElement::Ruby.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-ruby") { return Some(PseudoElement::Ruby); } } if in_ua_stylesheet || PseudoElement::RubyBase.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-ruby-base") { return Some(PseudoElement::RubyBase); } } if in_ua_stylesheet || PseudoElement::RubyBaseContainer.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-ruby-base-container") { return Some(PseudoElement::RubyBaseContainer); } } if in_ua_stylesheet || PseudoElement::RubyText.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-ruby-text") { return Some(PseudoElement::RubyText); } } if in_ua_stylesheet || PseudoElement::RubyTextContainer.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-ruby-text-container") { return Some(PseudoElement::RubyTextContainer); } } if in_ua_stylesheet || PseudoElement::MozSVGMarkerAnonChild.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-svg-marker-anon-child") { return Some(PseudoElement::MozSVGMarkerAnonChild); } } if in_ua_stylesheet || PseudoElement::MozSVGOuterSVGAnonChild.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-svg-outer-svg-anon-child") { return Some(PseudoElement::MozSVGOuterSVGAnonChild); } } if in_ua_stylesheet || PseudoElement::MozSVGForeignContent.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-svg-foreign-content") { return Some(PseudoElement::MozSVGForeignContent); } } if in_ua_stylesheet || PseudoElement::MozSVGText.exposed_in_non_ua_sheets() { if s.eq_ignore_ascii_case("-moz-svg-text") { return Some(PseudoElement::MozSVGText); } } None } /// Constructs a tree pseudo-element from the given name and arguments. /// "name" must start with "-moz-tree-". /// /// Returns `None` if the pseudo-element is not recognized. #[inline] pub fn tree_pseudo_element(name: &str, args: Box<[Atom]>) -> Option<Self> { #[allow(unused_imports)] use std::ascii::AsciiExt; debug_assert!(name.starts_with("-moz-tree-")); let tree_part = &name[10..]; if tree_part.eq_ignore_ascii_case("column") { return Some(PseudoElement::MozTreeColumn(args)); } if tree_part.eq_ignore_ascii_case("row") { return Some(PseudoElement::MozTreeRow(args)); } if tree_part.eq_ignore_ascii_case("separator") { return Some(PseudoElement::MozTreeSeparator(args)); } if tree_part.eq_ignore_ascii_case("cell") { return Some(PseudoElement::MozTreeCell(args)); } if tree_part.eq_ignore_ascii_case("indentation") { return Some(PseudoElement::MozTreeIndentation(args)); } if tree_part.eq_ignore_ascii_case("line") { return Some(PseudoElement::MozTreeLine(args)); } if tree_part.eq_ignore_ascii_case("twisty") { return Some(PseudoElement::MozTreeTwisty(args)); } if tree_part.eq_ignore_ascii_case("image") { return Some(PseudoElement::MozTreeImage(args)); } if tree_part.eq_ignore_ascii_case("cell-text") { return Some(PseudoElement::MozTreeCellText(args)); } if tree_part.eq_ignore_ascii_case("checkbox") { return Some(PseudoElement::MozTreeCheckbox(args)); } if tree_part.eq_ignore_ascii_case("progressmeter") { return Some(PseudoElement::MozTreeProgressmeter(args)); } if tree_part.eq_ignore_ascii_case("drop-feedback") { return Some(PseudoElement::MozTreeDropFeedback(args)); } None } } impl ToCss for PseudoElement { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { dest.write_char(':')?; match *self { PseudoElement::After => dest.write_str(":after")?, PseudoElement::Before => dest.write_str(":before")?, PseudoElement::Backdrop => dest.write_str(":backdrop")?, PseudoElement::Cue => dest.write_str(":cue")?, PseudoElement::FirstLetter => dest.write_str(":first-letter")?, PseudoElement::FirstLine => dest.write_str(":first-line")?, PseudoElement::MozSelection => dest.write_str(":-moz-selection")?, PseudoElement::MozFocusInner => dest.write_str(":-moz-focus-inner")?, PseudoElement::MozFocusOuter => dest.write_str(":-moz-focus-outer")?, PseudoElement::MozListBullet => dest.write_str(":-moz-list-bullet")?, PseudoElement::MozListNumber => dest.write_str(":-moz-list-number")?, PseudoElement::MozMathAnonymous => dest.write_str(":-moz-math-anonymous")?, PseudoElement::MozNumberWrapper => dest.write_str(":-moz-number-wrapper")?, PseudoElement::MozNumberText => dest.write_str(":-moz-number-text")?, PseudoElement::MozNumberSpinBox => dest.write_str(":-moz-number-spin-box")?, PseudoElement::MozNumberSpinUp => dest.write_str(":-moz-number-spin-up")?, PseudoElement::MozNumberSpinDown => dest.write_str(":-moz-number-spin-down")?, PseudoElement::MozProgressBar => dest.write_str(":-moz-progress-bar")?, PseudoElement::MozRangeTrack => dest.write_str(":-moz-range-track")?, PseudoElement::MozRangeProgress => dest.write_str(":-moz-range-progress")?, PseudoElement::MozRangeThumb => dest.write_str(":-moz-range-thumb")?, PseudoElement::MozMeterBar => dest.write_str(":-moz-meter-bar")?, PseudoElement::MozPlaceholder => dest.write_str(":-moz-placeholder")?, PseudoElement::Placeholder => dest.write_str(":placeholder")?, PseudoElement::MozColorSwatch => dest.write_str(":-moz-color-swatch")?, PseudoElement::MozText => dest.write_str(":-moz-text")?, PseudoElement::OofPlaceholder => dest.write_str(":-moz-oof-placeholder")?, PseudoElement::FirstLetterContinuation => dest.write_str(":-moz-first-letter-continuation")?, PseudoElement::MozBlockInsideInlineWrapper => dest.write_str(":-moz-block-inside-inline-wrapper")?, PseudoElement::MozMathMLAnonymousBlock => dest.write_str(":-moz-mathml-anonymous-block")?, PseudoElement::MozXULAnonymousBlock => dest.write_str(":-moz-xul-anonymous-block")?, PseudoElement::HorizontalFramesetBorder => dest.write_str(":-moz-hframeset-border")?, PseudoElement::VerticalFramesetBorder => dest.write_str(":-moz-vframeset-border")?, PseudoElement::MozLineFrame => dest.write_str(":-moz-line-frame")?, PseudoElement::ButtonContent => dest.write_str(":-moz-button-content")?, PseudoElement::CellContent => dest.write_str(":-moz-cell-content")?, PseudoElement::DropDownList => dest.write_str(":-moz-dropdown-list")?, PseudoElement::FieldsetContent => dest.write_str(":-moz-fieldset-content")?, PseudoElement::FramesetBlank => dest.write_str(":-moz-frameset-blank")?, PseudoElement::MozDisplayComboboxControlFrame => dest.write_str(":-moz-display-comboboxcontrol-frame")?, PseudoElement::HtmlCanvasContent => dest.write_str(":-moz-html-canvas-content")?, PseudoElement::InlineTable => dest.write_str(":-moz-inline-table")?, PseudoElement::Table => dest.write_str(":-moz-table")?, PseudoElement::TableCell => dest.write_str(":-moz-table-cell")?, PseudoElement::TableColGroup => dest.write_str(":-moz-table-column-group")?, PseudoElement::TableCol => dest.write_str(":-moz-table-column")?, PseudoElement::TableWrapper => dest.write_str(":-moz-table-wrapper")?, PseudoElement::TableRowGroup => dest.write_str(":-moz-table-row-group")?, PseudoElement::TableRow => dest.write_str(":-moz-table-row")?, PseudoElement::Canvas => dest.write_str(":-moz-canvas")?, PseudoElement::PageBreak => dest.write_str(":-moz-pagebreak")?, PseudoElement::Page => dest.write_str(":-moz-page")?, PseudoElement::PageContent => dest.write_str(":-moz-pagecontent")?, PseudoElement::PageSequence => dest.write_str(":-moz-page-sequence")?, PseudoElement::ScrolledContent => dest.write_str(":-moz-scrolled-content")?, PseudoElement::ScrolledCanvas => dest.write_str(":-moz-scrolled-canvas")?, PseudoElement::ScrolledPageSequence => dest.write_str(":-moz-scrolled-page-sequence")?, PseudoElement::ColumnContent => dest.write_str(":-moz-column-content")?, PseudoElement::Viewport => dest.write_str(":-moz-viewport")?, PseudoElement::ViewportScroll => dest.write_str(":-moz-viewport-scroll")?, PseudoElement::AnonymousFlexItem => dest.write_str(":-moz-anonymous-flex-item")?, PseudoElement::AnonymousGridItem => dest.write_str(":-moz-anonymous-grid-item")?, PseudoElement::Ruby => dest.write_str(":-moz-ruby")?, PseudoElement::RubyBase => dest.write_str(":-moz-ruby-base")?, PseudoElement::RubyBaseContainer => dest.write_str(":-moz-ruby-base-container")?, PseudoElement::RubyText => dest.write_str(":-moz-ruby-text")?, PseudoElement::RubyTextContainer => dest.write_str(":-moz-ruby-text-container")?, PseudoElement::MozTreeColumn(..) => dest.write_str(":-moz-tree-column")?, PseudoElement::MozTreeRow(..) => dest.write_str(":-moz-tree-row")?, PseudoElement::MozTreeSeparator(..) => dest.write_str(":-moz-tree-separator")?, PseudoElement::MozTreeCell(..) => dest.write_str(":-moz-tree-cell")?, PseudoElement::MozTreeIndentation(..) => dest.write_str(":-moz-tree-indentation")?, PseudoElement::MozTreeLine(..) => dest.write_str(":-moz-tree-line")?, PseudoElement::MozTreeTwisty(..) => dest.write_str(":-moz-tree-twisty")?, PseudoElement::MozTreeImage(..) => dest.write_str(":-moz-tree-image")?, PseudoElement::MozTreeCellText(..) => dest.write_str(":-moz-tree-cell-text")?, PseudoElement::MozTreeCheckbox(..) => dest.write_str(":-moz-tree-checkbox")?, PseudoElement::MozTreeProgressmeter(..) => dest.write_str(":-moz-tree-progressmeter")?, PseudoElement::MozTreeDropFeedback(..) => dest.write_str(":-moz-tree-drop-feedback")?, PseudoElement::MozSVGMarkerAnonChild => dest.write_str(":-moz-svg-marker-anon-child")?, PseudoElement::MozSVGOuterSVGAnonChild => dest.write_str(":-moz-svg-outer-svg-anon-child")?, PseudoElement::MozSVGForeignContent => dest.write_str(":-moz-svg-foreign-content")?, PseudoElement::MozSVGText => dest.write_str(":-moz-svg-text")?, } if let Some(args) = self.tree_pseudo_args() { if !args.is_empty() { dest.write_char('(')?; let mut iter = args.iter(); if let Some(first) = iter.next() { serialize_identifier(&first.to_string(), dest)?; for item in iter { dest.write_str(", ")?; serialize_identifier(&item.to_string(), dest)?; } } dest.write_char(')')?; } } Ok(()) } }
{ "content_hash": "912d2877b7930da755bf2648f3deb254", "timestamp": "", "source": "github", "line_count": 1897, "max_line_length": 120, "avg_line_length": 50.10121244069583, "alnum_prop": 0.5310073441215463, "repo_name": "nrc/rustc-perf", "id": "4a18723ec854e66e3e04c75e94025ccde497259a", "size": "95042", "binary": false, "copies": "7", "ref": "refs/heads/master", "path": "collector/benchmarks/script-servo/components/style/gecko/generated/pseudo_element_definition.rs", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1954" }, { "name": "HTML", "bytes": "26683" }, { "name": "JavaScript", "bytes": "41635" }, { "name": "Shell", "bytes": "114" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "435aad42cd4c3dc96665c5fbf09be6cc", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "3070af5c1e1b6d8a8c9908d5d405b4afbeaf6aae", "size": "196", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Orchidaceae/Cynorkis/Cynorkis papillosa/ Syn. Helorchis filiformis/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<footer id="contentinfo" class="body"> <div class="wrapper-footer-inner"> <address id="about" class="vcard body"><em> Built with <a href="http://compass-style.org/">Compass</a>, <a href="http://zengrids.com/">Zen Grids</a> and <a href="http://ethanschoonover.com/solarized">Solarized</a> on the Python-powered <a href="http://getpelican.com/">Pelican</a>. {# Theme is <a href="#">zen-zen.</a>#} </em></address><!-- /#about --> </div> </footer><!-- /#contentinfo -->
{ "content_hash": "8a56bd856d1d5fc1ccc0b643815010a5", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 73, "avg_line_length": 42.916666666666664, "alnum_prop": 0.5902912621359223, "repo_name": "briandant/zen-zen-pelican", "id": "679a922498c2643167905432bd9d4bc3cfc15d22", "size": "515", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "templates/includes/footer.html", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "30460" }, { "name": "Ruby", "bytes": "872" } ], "symlink_target": "" }
<?php namespace J2t\Rewardpoints\Observer; use Magento\Framework\Event\ObserverInterface; class ProcessAdminConfiguration implements ObserverInterface { protected $request; protected $_storeInterface; protected $_scopeConfig; protected $_moduleList; protected $curl; protected $messageManager; public function __construct($eventManager = null) { $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $this->request = $objectManager->get('Magento\Framework\App\Request\Http'); $this->_storeInterface = $objectManager->get('Magento\Store\Model\StoreManagerInterface'); $this->_scopeConfig = $objectManager->get('Magento\Framework\Config\Scope'); $this->_moduleList = $objectManager->get('Magento\Framework\Module\ModuleList'); $this->curl = $objectManager->get('Magento\Framework\HTTP\Adapter\Curl'); $this->messageManager = $objectManager->get('Magento\Framework\Message\ManagerInterface'); } public function execute(\Magento\Framework\Event\Observer $observer) { return true; $event = $observer->getEvent(); if ($this->request->getParam('section') == 'rewardpoints' && $event->getData('config_data') && ($groups = $event->getData('config_data')->getData('groups')) && isset($groups['module_serial']) && isset($groups['module_serial']['fields']) && isset($groups['module_serial']['fields']['key']) && isset($groups['module_serial']['fields']['key']['inherit']) && $groups['module_serial']['fields']['key']['inherit'] == 1 ) { $website = $this->request->getParam('website'); $storeId = $this->_storeInterface->getStore()->getId(); $module_key = $this->_storeInterface->getStore()->getConfig('rewardpoints/module_serial/key'); $exceptions = array(); $exceptions[] = __(base64_decode("U2VyaWFsIHVzZWQgaW4gaW52YWxpZCwgdGhlcmVmb3JlLCB5b3VyIGNvbmZpZ3VyYXRpb24gY2Fubm90IGJlIHNhdmVkLg==")); $moduleDetails = $this->_moduleList->getOne('J2t_Rewardpoints'); $version = $moduleDetails['setup_version']; $version_array = explode('.', $version); $module_branch_version = $version_array[0] . '.' . $version_array[1]; $ser_name_code = 'verser'; $store_code = 'default'; $store = $this->_storeInterface->getStore(); if ($this->_storeInterface->getStore()->getCode()){ $store_code = $this->_storeInterface->getStore()->getCode(); } $url = parse_url($store->getBaseUrl()); $domain = $url['host']; $url = "http://www." . base64_decode("ajJ0LWRlc2lnbi5uZXQ=") . "/j2tmoduleintegrity/index/checkIntegrityNew/version/$module_branch_version/serial/$module_key/code/rewardpoints/domain/$domain"; $this->curl->setConfig(['timeout' => 20]); $this->curl->write('GET', $url); $data = $this->curl->read(); $fs = false; if ($data === false || $this->curl->getErrno()) { $exceptions[] = _(base64_decode("Q1VSTCBlcnJvciAlcw=="), "(#{$this->curl->getErrno()}) / " . $this->curl->getError()); $fs = true; } else { $exceptions[] = _(base64_decode("Tm8gQ1VSTCBhY2Nlc3MgZXJyb3Jz")); } $return_curl = preg_split('/^\r?$/m', $data, 2); $return_curl = trim($return_curl[1]); $this->curl->close(); if ($return_curl === "" && $return_curl !== "0" && $return_curl !== "1" && !$fs) { $return_curl = 1; } elseif ($return_curl != "1") { $return_curl = 0; } if (!$return_curl) { throw new \RuntimeException("\n" . implode("\n", $exceptions)); } else { $this->messageManager->addSuccess(_(base64_decode('W1tZb3VyIHNlcmlhbCBpcyB2YWxpZCBhbmQgY29uZmlndXJhdGlvbiBjYW4gYmUgc2F2ZWQuXV0='))); } } } }
{ "content_hash": "8e918d8ceb3b6a2e748c841e8ac68aa0", "timestamp": "", "source": "github", "line_count": 105, "max_line_length": 204, "avg_line_length": 40.91428571428571, "alnum_prop": 0.5500465549348231, "repo_name": "letunhatkong/tradebanner", "id": "c7eb6dc4341d822787679c2b1134ab7f5a582d3a", "size": "4397", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/code/J2t/Rewardpoints/Observer/ProcessAdminConfiguration.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "158924" }, { "name": "HTML", "bytes": "956313" }, { "name": "JavaScript", "bytes": "221669" }, { "name": "PHP", "bytes": "2473541" } ], "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_45) on Mon Nov 25 11:44:57 CST 2013 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> 类 com.baidu.mapapi.map.MapView.LayoutParams 的使用 </TITLE> <META NAME="date" CONTENT="2013-11-25"> <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="类 com.baidu.mapapi.map.MapView.LayoutParams 的使用"; } } </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="跳过导航链接"></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>概述</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../com/baidu/mapapi/map/MapView.LayoutParams.html" title="com.baidu.mapapi.map 中的类"><FONT CLASS="NavBarFont1"><B>类</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>使用</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;上一个&nbsp; &nbsp;下一个</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?com/baidu/mapapi/map//class-useMapView.LayoutParams.html" target="_top"><B>框架</B></A> &nbsp; &nbsp;<A HREF="MapView.LayoutParams.html" target="_top"><B>无框架</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>所有类</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>所有类</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>类 com.baidu.mapapi.map.MapView.LayoutParams<br>的使用</B></H2> </CENTER> 没有 com.baidu.mapapi.map.MapView.LayoutParams 的用法 <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="跳过导航链接"></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>概述</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../com/baidu/mapapi/map/MapView.LayoutParams.html" title="com.baidu.mapapi.map 中的类"><FONT CLASS="NavBarFont1"><B>类</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>使用</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;上一个&nbsp; &nbsp;下一个</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?com/baidu/mapapi/map//class-useMapView.LayoutParams.html" target="_top"><B>框架</B></A> &nbsp; &nbsp;<A HREF="MapView.LayoutParams.html" target="_top"><B>无框架</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>所有类</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>所有类</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
{ "content_hash": "6c7cf89be9904a076f0820a88d1efacb", "timestamp": "", "source": "github", "line_count": 145, "max_line_length": 209, "avg_line_length": 40.43448275862069, "alnum_prop": 0.6048098243220195, "repo_name": "rxwen/gps_clock", "id": "d96a9bf2db17707a55ccc0ea05882f921f318d10", "size": "6065", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "android/baidumap_sdk/doc/com/baidu/mapapi/map/class-use/MapView.LayoutParams.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1370" }, { "name": "Java", "bytes": "144796" } ], "symlink_target": "" }
package fiftyfive.wicket.js; import org.apache.wicket.markup.html.panel.Panel; public class IntegrationTestTemplatePanel extends Panel { public IntegrationTestTemplatePanel(String id) { super(id); add(new DomReadyTemplate(getClass())); } }
{ "content_hash": "af0def80a4115840e189ccfc1d4ece08", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 55, "avg_line_length": 20.846153846153847, "alnum_prop": 0.7195571955719557, "repo_name": "55minutes/fiftyfive-wicket-2.x", "id": "331539b73b5d5d0acf9fad527cbd04e03356dcdc", "size": "891", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "js/src/test/java/fiftyfive/wicket/js/IntegrationTestTemplatePanel.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "436165" }, { "name": "JavaScript", "bytes": "105189" }, { "name": "Shell", "bytes": "881" } ], "symlink_target": "" }
<?php namespace Google\AdsApi\Dfp\v201705; /** * This file was generated from WSDL. DO NOT EDIT. */ class updateCreativeWrappersResponse { /** * @var \Google\AdsApi\Dfp\v201705\CreativeWrapper[] $rval */ protected $rval = null; /** * @param \Google\AdsApi\Dfp\v201705\CreativeWrapper[] $rval */ public function __construct(array $rval = null) { $this->rval = $rval; } /** * @return \Google\AdsApi\Dfp\v201705\CreativeWrapper[] */ public function getRval() { return $this->rval; } /** * @param \Google\AdsApi\Dfp\v201705\CreativeWrapper[] $rval * @return \Google\AdsApi\Dfp\v201705\updateCreativeWrappersResponse */ public function setRval(array $rval) { $this->rval = $rval; return $this; } }
{ "content_hash": "93f2899dd6d8b3fac748507540949d57", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 72, "avg_line_length": 19.25581395348837, "alnum_prop": 0.5978260869565217, "repo_name": "jeraldfeller/jbenterprises", "id": "e7d94ada8ec0c2bd1c73e1d6897eb12fb1f3eef8", "size": "828", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "google-adwords/vendor/googleads/googleads-php-lib/src/Google/AdsApi/Dfp/v201705/updateCreativeWrappersResponse.php", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "137" }, { "name": "CSS", "bytes": "4465774" }, { "name": "CoffeeScript", "bytes": "83631" }, { "name": "HTML", "bytes": "2549782" }, { "name": "JavaScript", "bytes": "17552996" }, { "name": "PHP", "bytes": "3092947" }, { "name": "Shell", "bytes": "444" } ], "symlink_target": "" }
""" Django settings for billjobs project. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'develop.sqlite3', } } SECRET_KEY = 'vVj14cKNh76tO1gzFh5yXG3WnKb8BMWN' # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ ALLOWED_HOSTS = ['localhost', '127.0.0.1'] INTERNAL_IPS = ['127.0.0.1'] DEBUG = True # Application definition INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'billjobs', 'debug_toolbar', ) MIDDLEWARE = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.locale.LocaleMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware', ) ROOT_URLCONF = 'core.urls' WSGI_APPLICATION = 'core.wsgi.application' # Internationalization # https://docs.djangoproject.com/en/1.6/topics/i18n/ LANGUAGE_CODE = 'en-US' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True LOCALE_PATHS = ( os.path.join(BASE_DIR, 'locale'), ) # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.6/howto/static-files/ STATIC_URL = '/static/' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.debug', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages', ], } }, ] BILLJOBS_SLACK_TOKEN = os.environ.get('BILLJOBS_SLACK_TOKEN', False) BILLJOBS_SLACK_CHANNEL = os.environ.get('BILLJOBS_SLACK_CHANNEL')
{ "content_hash": "9af67debc1a45429db8bb954be7e6bc1", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 71, "avg_line_length": 26.89108910891089, "alnum_prop": 0.6804123711340206, "repo_name": "ioO/billjobs", "id": "7172736d930e6449b0b743cd4a838a3c73e2792f", "size": "2716", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "core/settings.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "24456" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DataStructures; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace DataStructuresTests { [TestClass] public class TrieTest { [TestMethod] public void Trie_Create() { new ITrieTest().Trie_Create(new Trie()); } [TestMethod] public void Trie_One() { new ITrieTest().Trie_One(new Trie()); } [TestMethod] public void Trie_Contains() { new ITrieTest().Trie_Contains(new Trie()); } [TestMethod] public void Trie_NotContainsUnrelated() { new ITrieTest().Trie_NotContainsUnrelated(new Trie()); } [TestMethod] public void Trie_Blank() { new ITrieTest().Trie_Blank(new Trie()); } [TestMethod] public void Trie_Empty() { new ITrieTest().Trie_Empty(new Trie()); } [TestMethod] public void Trie_AllContained() { new ITrieTest().Trie_AllContained(new Trie()); } [TestMethod] public void Trie_NotContains() { new ITrieTest().Trie_NotContains(new Trie()); } [TestMethod] public void Trie_SubstringNotContains() { new ITrieTest().Trie_SubstringNotContains(new Trie()); } [TestMethod] public void Trie_MultiNotContains() { new ITrieTest().Trie_MultiNotContains(new Trie()); } [ClassInitialize] public static void init(TestContext contextIgnored) { ITrieTest.init(); } [TestMethod] public void Trie_EnglishWordsPerf() { Trie trie = new Trie(); new ITrieTest().Trie_EnglishWordsPerf(trie); trie.Visit(); int breakHere = 1; } [TestMethod] public void Trie_SingleContained() { new ITrieTest().Trie_SingleContained(new Trie()); } [TestMethod] public void Trie_SingleContainedOppositeOrder() { new ITrieTest().Trie_SingleContainedOppositeOrder(new Trie()); } [TestMethod] public void Trie_ResultingResultsResultings() { new ITrieTest().Trie_ResultingResultsResultings(new Trie()); } [TestMethod] public void Trie_FooFonFondue() { new ITrieTest().Trie_FooFonFondue(new Trie()); } } }
{ "content_hash": "e0358bf76c86d8a3f542233e1c3aa63f", "timestamp": "", "source": "github", "line_count": 113, "max_line_length": 74, "avg_line_length": 23.575221238938052, "alnum_prop": 0.5382882882882883, "repo_name": "pmcculler/datastructures", "id": "f7715afae238a084e46b79a9b3147a23a71d74d6", "size": "2666", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "DataStructuresTests/TrieTest.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "192355" }, { "name": "Smalltalk", "bytes": "1374" } ], "symlink_target": "" }
require 'spec_helper' describe SnippetsController do let(:user) { create(:user) } describe 'GET #index' do let(:user) { create(:user) } context 'when username parameter is present' do it 'renders snippets of a user when username is present' do get :index, params: { username: user.username } expect(response).to render_template(:index) end end context 'when username parameter is not present' do it 'redirects to explore snippets page when user is not logged in' do get :index expect(response).to redirect_to(explore_snippets_path) end it 'redirects to snippets dashboard page when user is logged in' do sign_in(user) get :index expect(response).to redirect_to(dashboard_snippets_path) end end end describe 'GET #new' do context 'when signed in' do before do sign_in(user) end it 'responds with status 200' do get :new expect(response).to have_gitlab_http_status(200) end end context 'when not signed in' do it 'redirects to the sign in page' do get :new expect(response).to redirect_to(new_user_session_path) end end end describe 'GET #show' do context 'when the personal snippet is private' do let(:personal_snippet) { create(:personal_snippet, :private, author: user) } context 'when signed in' do before do sign_in(user) end context 'when signed in user is not the author' do let(:other_author) { create(:author) } let(:other_personal_snippet) { create(:personal_snippet, :private, author: other_author) } it 'responds with status 404' do get :show, params: { id: other_personal_snippet.to_param } expect(response).to have_gitlab_http_status(404) end end context 'when signed in user is the author' do it 'renders the snippet' do get :show, params: { id: personal_snippet.to_param } expect(assigns(:snippet)).to eq(personal_snippet) expect(response).to have_gitlab_http_status(200) end it 'responds with status 404 when embeddable content is requested' do get :show, params: { id: personal_snippet.to_param }, format: :js expect(response).to have_gitlab_http_status(404) end end end context 'when not signed in' do it 'redirects to the sign in page' do get :show, params: { id: personal_snippet.to_param } expect(response).to redirect_to(new_user_session_path) end end end context 'when the personal snippet is internal' do let(:personal_snippet) { create(:personal_snippet, :internal, author: user) } context 'when signed in' do before do sign_in(user) end it 'renders the snippet' do get :show, params: { id: personal_snippet.to_param } expect(assigns(:snippet)).to eq(personal_snippet) expect(response).to have_gitlab_http_status(200) end it 'responds with status 404 when embeddable content is requested' do get :show, params: { id: personal_snippet.to_param }, format: :js expect(response).to have_gitlab_http_status(404) end end context 'when not signed in' do it 'redirects to the sign in page' do get :show, params: { id: personal_snippet.to_param } expect(response).to redirect_to(new_user_session_path) end end end context 'when the personal snippet is public' do let(:personal_snippet) { create(:personal_snippet, :public, author: user) } context 'when signed in' do before do sign_in(user) end it 'renders the snippet' do get :show, params: { id: personal_snippet.to_param } expect(assigns(:snippet)).to eq(personal_snippet) expect(response).to have_gitlab_http_status(200) end it 'responds with status 200 when embeddable content is requested' do get :show, params: { id: personal_snippet.to_param }, format: :js expect(assigns(:snippet)).to eq(personal_snippet) expect(response).to have_gitlab_http_status(200) end end context 'when not signed in' do it 'renders the snippet' do get :show, params: { id: personal_snippet.to_param } expect(assigns(:snippet)).to eq(personal_snippet) expect(response).to have_gitlab_http_status(200) end end end context 'when the personal snippet does not exist' do context 'when signed in' do before do sign_in(user) end it 'responds with status 404' do get :show, params: { id: 'doesntexist' } expect(response).to have_gitlab_http_status(404) end end context 'when not signed in' do it 'responds with status 404' do get :show, params: { id: 'doesntexist' } expect(response).to redirect_to(new_user_session_path) end end end end describe 'POST #create' do def create_snippet(snippet_params = {}, additional_params = {}) sign_in(user) post :create, params: { personal_snippet: { title: 'Title', content: 'Content', description: 'Description' }.merge(snippet_params) }.merge(additional_params) Snippet.last end it 'creates the snippet correctly' do snippet = create_snippet(visibility_level: Snippet::PRIVATE) expect(snippet.title).to eq('Title') expect(snippet.content).to eq('Content') expect(snippet.description).to eq('Description') end context 'when the snippet description contains a file' do let(:picture_file) { '/-/system/temp/secret56/picture.jpg' } let(:text_file) { '/-/system/temp/secret78/text.txt' } let(:description) do "Description with picture: ![picture](/uploads#{picture_file}) and "\ "text: [text.txt](/uploads#{text_file})" end before do allow(FileUtils).to receive(:mkdir_p) allow(FileUtils).to receive(:move) end subject { create_snippet({ description: description }, { files: [picture_file, text_file] }) } it 'creates the snippet' do expect { subject }.to change { Snippet.count }.by(1) end it 'stores the snippet description correctly' do snippet = subject expected_description = "Description with picture: "\ "![picture](/uploads/-/system/personal_snippet/#{snippet.id}/secret56/picture.jpg) and "\ "text: [text.txt](/uploads/-/system/personal_snippet/#{snippet.id}/secret78/text.txt)" expect(snippet.description).to eq(expected_description) end end context 'when the snippet is spam' do before do allow_any_instance_of(AkismetService).to receive(:spam?).and_return(true) end context 'when the snippet is private' do it 'creates the snippet' do expect { create_snippet(visibility_level: Snippet::PRIVATE) } .to change { Snippet.count }.by(1) end end context 'when the snippet is public' do it 'rejects the shippet' do expect { create_snippet(visibility_level: Snippet::PUBLIC) } .not_to change { Snippet.count } end it 'creates a spam log' do expect { create_snippet(visibility_level: Snippet::PUBLIC) } .to change { SpamLog.count }.by(1) end it 'renders :new with recaptcha disabled' do stub_application_setting(recaptcha_enabled: false) create_snippet(visibility_level: Snippet::PUBLIC) expect(response).to render_template(:new) end context 'recaptcha enabled' do before do stub_application_setting(recaptcha_enabled: true) end it 'renders :verify with recaptcha enabled' do create_snippet(visibility_level: Snippet::PUBLIC) expect(response).to render_template(:verify) end it 'renders snippet page when recaptcha verified' do spammy_title = 'Whatever' spam_logs = create_list(:spam_log, 2, user: user, title: spammy_title) snippet = create_snippet({ title: spammy_title }, { spam_log_id: spam_logs.last.id, recaptcha_verification: true }) expect(response).to redirect_to(snippet_path(snippet)) end end end end end describe 'PUT #update' do let(:project) { create :project } let(:snippet) { create :personal_snippet, author: user, project: project, visibility_level: visibility_level } def update_snippet(snippet_params = {}, additional_params = {}) sign_in(user) put :update, params: { id: snippet.id, personal_snippet: { title: 'Title', content: 'Content' }.merge(snippet_params) }.merge(additional_params) snippet.reload end context 'when the snippet is spam' do before do allow_any_instance_of(AkismetService).to receive(:spam?).and_return(true) end context 'when the snippet is private' do let(:visibility_level) { Snippet::PRIVATE } it 'updates the snippet' do expect { update_snippet(title: 'Foo') } .to change { snippet.reload.title }.to('Foo') end end context 'when a private snippet is made public' do let(:visibility_level) { Snippet::PRIVATE } it 'rejects the snippet' do expect { update_snippet(title: 'Foo', visibility_level: Snippet::PUBLIC) } .not_to change { snippet.reload.title } end it 'creates a spam log' do expect { update_snippet(title: 'Foo', visibility_level: Snippet::PUBLIC) } .to change { SpamLog.count }.by(1) end it 'renders :edit with recaptcha disabled' do stub_application_setting(recaptcha_enabled: false) update_snippet(title: 'Foo', visibility_level: Snippet::PUBLIC) expect(response).to render_template(:edit) end context 'recaptcha enabled' do before do stub_application_setting(recaptcha_enabled: true) end it 'renders :verify with recaptcha enabled' do update_snippet(title: 'Foo', visibility_level: Snippet::PUBLIC) expect(response).to render_template(:verify) end it 'renders snippet page when recaptcha verified' do spammy_title = 'Whatever' spam_logs = create_list(:spam_log, 2, user: user, title: spammy_title) snippet = update_snippet({ title: spammy_title, visibility_level: Snippet::PUBLIC }, { spam_log_id: spam_logs.last.id, recaptcha_verification: true }) expect(response).to redirect_to(snippet_path(snippet)) end end end context 'when the snippet is public' do let(:visibility_level) { Snippet::PUBLIC } it 'rejects the shippet' do expect { update_snippet(title: 'Foo') } .not_to change { snippet.reload.title } end it 'creates a spam log' do expect { update_snippet(title: 'Foo') } .to change { SpamLog.count }.by(1) end it 'renders :edit with recaptcha disabled' do stub_application_setting(recaptcha_enabled: false) update_snippet(title: 'Foo') expect(response).to render_template(:edit) end context 'recaptcha enabled' do before do stub_application_setting(recaptcha_enabled: true) end it 'renders :verify with recaptcha enabled' do update_snippet(title: 'Foo') expect(response).to render_template(:verify) end it 'renders snippet page when recaptcha verified' do spammy_title = 'Whatever' spam_logs = create_list(:spam_log, 2, user: user, title: spammy_title) snippet = update_snippet({ title: spammy_title }, { spam_log_id: spam_logs.last.id, recaptcha_verification: true }) expect(response).to redirect_to(snippet_path(snippet)) end end end end end describe 'POST #mark_as_spam' do let(:snippet) { create(:personal_snippet, :public, author: user) } before do allow_any_instance_of(AkismetService).to receive_messages(submit_spam: true) stub_application_setting(akismet_enabled: true) end def mark_as_spam admin = create(:admin) create(:user_agent_detail, subject: snippet) sign_in(admin) post :mark_as_spam, params: { id: snippet.id } end it 'updates the snippet' do mark_as_spam expect(snippet.reload).not_to be_submittable_as_spam end end describe "GET #raw" do context 'when the personal snippet is private' do let(:personal_snippet) { create(:personal_snippet, :private, author: user) } context 'when signed in' do before do sign_in(user) end context 'when signed in user is not the author' do let(:other_author) { create(:author) } let(:other_personal_snippet) { create(:personal_snippet, :private, author: other_author) } it 'responds with status 404' do get :raw, params: { id: other_personal_snippet.to_param } expect(response).to have_gitlab_http_status(404) end end context 'when signed in user is the author' do before do get :raw, params: { id: personal_snippet.to_param } end it 'responds with status 200' do expect(assigns(:snippet)).to eq(personal_snippet) expect(response).to have_gitlab_http_status(200) end it 'has expected headers' do expect(response.header['Content-Type']).to eq('text/plain; charset=utf-8') expect(response.header['Content-Disposition']).to match(/inline/) end it "sets #{Gitlab::Workhorse::DETECT_HEADER} header" do expect(response).to have_gitlab_http_status(200) expect(response.header[Gitlab::Workhorse::DETECT_HEADER]).to eq "true" end end end context 'when not signed in' do it 'redirects to the sign in page' do get :raw, params: { id: personal_snippet.to_param } expect(response).to redirect_to(new_user_session_path) end end end context 'when the personal snippet is internal' do let(:personal_snippet) { create(:personal_snippet, :internal, author: user) } context 'when signed in' do before do sign_in(user) end it 'responds with status 200' do get :raw, params: { id: personal_snippet.to_param } expect(assigns(:snippet)).to eq(personal_snippet) expect(response).to have_gitlab_http_status(200) end end context 'when not signed in' do it 'redirects to the sign in page' do get :raw, params: { id: personal_snippet.to_param } expect(response).to redirect_to(new_user_session_path) end end end context 'when the personal snippet is public' do let(:personal_snippet) { create(:personal_snippet, :public, author: user) } context 'when signed in' do before do sign_in(user) end it 'responds with status 200' do get :raw, params: { id: personal_snippet.to_param } expect(assigns(:snippet)).to eq(personal_snippet) expect(response).to have_gitlab_http_status(200) end context 'CRLF line ending' do let(:personal_snippet) do create(:personal_snippet, :public, author: user, content: "first line\r\nsecond line\r\nthird line") end it 'returns LF line endings by default' do get :raw, params: { id: personal_snippet.to_param } expect(response.body).to eq("first line\nsecond line\nthird line") end it 'does not convert line endings when parameter present' do get :raw, params: { id: personal_snippet.to_param, line_ending: :raw } expect(response.body).to eq("first line\r\nsecond line\r\nthird line") end end end context 'when not signed in' do it 'responds with status 200' do get :raw, params: { id: personal_snippet.to_param } expect(assigns(:snippet)).to eq(personal_snippet) expect(response).to have_gitlab_http_status(200) end end end context 'when the personal snippet does not exist' do context 'when signed in' do before do sign_in(user) end it 'responds with status 404' do get :raw, params: { id: 'doesntexist' } expect(response).to have_gitlab_http_status(404) end end context 'when not signed in' do it 'redirects to the sign in path' do get :raw, params: { id: 'doesntexist' } expect(response).to redirect_to(new_user_session_path) end end end end context 'award emoji on snippets' do let(:personal_snippet) { create(:personal_snippet, :public, author: user) } let(:another_user) { create(:user) } before do sign_in(another_user) end describe 'POST #toggle_award_emoji' do it "toggles the award emoji" do expect do post(:toggle_award_emoji, params: { id: personal_snippet.to_param, name: "thumbsup" }) end.to change { personal_snippet.award_emoji.count }.from(0).to(1) expect(response.status).to eq(200) end it "removes the already awarded emoji" do post(:toggle_award_emoji, params: { id: personal_snippet.to_param, name: "thumbsup" }) expect do post(:toggle_award_emoji, params: { id: personal_snippet.to_param, name: "thumbsup" }) end.to change { personal_snippet.award_emoji.count }.from(1).to(0) expect(response.status).to eq(200) end end end describe 'POST #preview_markdown' do let(:snippet) { create(:personal_snippet, :public) } it 'renders json in a correct format' do sign_in(user) post :preview_markdown, params: { id: snippet, text: '*Markdown* text' } expect(JSON.parse(response.body).keys).to match_array(%w(body references)) end end end
{ "content_hash": "42393ee2efc5e001c7d4e3954a9746b3", "timestamp": "", "source": "github", "line_count": 622, "max_line_length": 114, "avg_line_length": 30.533762057877812, "alnum_prop": 0.5963037068239259, "repo_name": "axilleas/gitlabhq", "id": "5c6858dc7b2be5fbbfe394a273181bdfa3ead2c5", "size": "18992", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spec/controllers/snippets_controller_spec.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "683690" }, { "name": "Clojure", "bytes": "79" }, { "name": "Dockerfile", "bytes": "1907" }, { "name": "HTML", "bytes": "1340167" }, { "name": "JavaScript", "bytes": "4309733" }, { "name": "Ruby", "bytes": "19732082" }, { "name": "Shell", "bytes": "44575" }, { "name": "Vue", "bytes": "1040466" } ], "symlink_target": "" }
tags: politics layout: post title: "Not driven by polls, eh?" --- <a href="http://www.washingtonpost.com/wp-dyn/articles/A19483-2002Aug14.html">In S.D., Bush Faces Test of Fiscal Responsibility</a><br> So <b>now</b> Bush is for fiscal responsibility. I see. We can throw billions upon billions of dollars at a pie-in-the-sky scheme to blow up missiles from the sky, but people suffering from a drought don't get help due to fiscal responsibility. (Another note: why didn't the recent farm bill contain provisions for this sort of thing?)
{ "content_hash": "16e7499336eec4f58bbad1357503c241", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 335, "avg_line_length": 49.45454545454545, "alnum_prop": 0.7536764705882353, "repo_name": "cwinters/cwinters.github.io", "id": "c3f8c6a35f996cb604a8bb5aaba7f78eb4587c58", "size": "548", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/2002-08-15-not_driven_by_polls_eh.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "23817" }, { "name": "HTML", "bytes": "10025" }, { "name": "Ruby", "bytes": "102" } ], "symlink_target": "" }
[![build badge](https://github.com/xabgesagtx/telegram-spring-boot-starter/workflows/build/badge.svg)](https://github.com/xabgesagtx/telegram-spring-boot-starter/actions?query=workflow%3Abuild) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.xabgesagtx/telegram-spring-boot-starter/badge.svg)](https://mvnrepository.com/artifact/com.github.xabgesagtx/telegram-spring-boot-starter) [![Jitpack](https://jitpack.io/v/xabgesagtx/telegram-spring-boot-starter.svg)](https://jitpack.io/#xabgesagtx/telegram-spring-boot-starter) This is a starter pom for a spring boot application with the [TelegramBots Java API](https://github.com/rubenlagus/TelegramBots). The starter is available at maven central. Just add the following dependency to your pom: ```xml <dependency> <groupId>com.github.xabgesagtx</groupId> <artifactId>telegram-spring-boot-starter</artifactId> <version>0.26</version> </dependency> ``` For gradle users just add this to your dependencies: ```groovy compile('com.github.xabgesagtx:telegram-spring-boot-starter:0.26') ``` The only thing you need to do after adding the dependency is to create a bean for a bot. E.g.: ```java @Component public class Bot extends TelegramLongPollingBot { ... } ``` or for a webhook bot: ```java @Component public class Bot extends TelegramWebhookBot { ... } ``` if you want to overwrite a webhook for a specific bot: ```java @Component public class Bot extends CustomizableTelegramWebhookBot { ... } ``` The bot will then be registered for you automatically on startup. ## Configuration The following properties can be configured (none are mandatory): | property | description | available since | | -------- | ----------- | --------------- | | telegram.external-url | external base url for the webhook | 0.15 | | telegram.internal-url | internal base url for the webhook | 0.15 | | telegram.key-store | keystore for the server | 0.15 | | telegram.key-store-password | keystore password for the server | 0.15 | | telegram.path-to-certificate | full path for .pem public certificate keys | 0.15 | | telegram.proxy.type | type of proxy (NO_PROXY, HTTP, SOCKS4, SOCKS5) | 0.22 | | telegram.proxy.host | host of the proxy | 0.22 | | telegram.proxy.port | port of the proxy | 0.22 | | telegram.proxy.user | username for proxy authentication | 0.22 | | telegram.proxy.password | password for proxy authentication | 0.22 | ### Webhook support You need to configure at least `telegram.external-url` and `telegram.internal-url` for webhook support. This configuration leaves the HTTPS handling to a proxy. If you configure `telegram.key-store` for your HTTPS webhook bot, you need to configure `telegram.key-store-password` as well. Also, `telegram.path-to-certificate` will only be used, if you configure the keystore. ### Proxy support For proxy support you need to set all of the following properties: * `telegram.proxy.type` * `telegram.proxy.host` * `telegram.proxy.port` To enable authentication for a proxy you need to set `telegram.proxy.user` and `telegram.proxy.password`. ### General In a regular spring boot setting these properties can be set in your `application.properties` or `application.yml`. For more information on how these configuration options work, please refer to the [TelegramBots Java API](https://github.com/rubenlagus/TelegramBots). ## Example An [implementation example](https://github.com/xabgesagtx/telegram-spring-boot-starter-example) is available too.
{ "content_hash": "01e07e490dc2913550a4c8a7af55b8fd", "timestamp": "", "source": "github", "line_count": 92, "max_line_length": 550, "avg_line_length": 37.858695652173914, "alnum_prop": 0.7507895492391616, "repo_name": "xabgesagtx/telegram-spring-boot-starter", "id": "075d00a1cdee315beeaf32465ae19196ae457b97", "size": "3515", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Readme.md", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "15831" } ], "symlink_target": "" }
package ru.stqa.trainings.junit.simple1.sample3; import org.junit.After; import org.junit.Before; import org.junit.Test; public class MethodFixturesTest { private Object x = new Object(); @Before public void setUp() { System.out.println("setUp " + x); } @Test public void test1() { System.out.println("test1 " + x); } @Test public void test2() { System.out.println("test2 " + x); } @After public void tearDown() { System.out.println("tearDown " + x); } }
{ "content_hash": "9062a00850ece7ba3937e97ed3dbc269", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 48, "avg_line_length": 16.35483870967742, "alnum_prop": 0.6370808678500987, "repo_name": "barancev/junit_samples", "id": "54fd7a248d48549711b5b5b248c6ddc8cd25ecca", "size": "507", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/test/java/ru/stqa/trainings/junit/simple1/sample3/MethodFixturesTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "56988" } ], "symlink_target": "" }
from os.path import exists from threading import RLock from cachetools import LFUCache, cached class _FilePointerCache(LFUCache): """ A least-frequently-used file pointer cache class with an eviction method that closes open files. """ def popitem(self): """ Evict a cache item. @return: The C{str} name of the evicted file. """ _, (filename, fp) = super().popitem() fp.close() return filename def close(self): """ Close all open files in the cache. """ while self.currsize: self.popitem() class FilePointerCache(object): """ A file pointer cache class for simultaneously opening multiple files, without exceeeding the per-process operating system limit on open file handles. @param maxsize: The C{int} maximum size of the cache. @param openArgs: If not C{None}, a C{dict} of keyword arguments to pass to open when opening a new file. If C{None}, the file will be opened with the default mode ('rt'). @param reopenArgs: If not C{None}, a C{dict} of keyword arguments to pass to open when opening an already existing file. If C{None}, the file will be opened with the default mode ('rt'). """ def __init__(self, maxsize=32, openArgs=None, reopenArgs=None): self._openArgs = openArgs or {} self._reopenArgs = reopenArgs or {} self._filePointerCache = _FilePointerCache(maxsize=maxsize) self._lock = RLock() @cached(self._filePointerCache, lock=self._lock) def _open(filename): if exists(filename): fp = open(filename, **self._reopenArgs) else: fp = open(filename, **self._openArgs) return filename, fp self._open = _open def open(self, filename): return self._open(filename)[1] def close(self): with self._lock: self._filePointerCache.close() def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): self.close()
{ "content_hash": "d727c05c65abe86e0cd30a50041c7e63", "timestamp": "", "source": "github", "line_count": 70, "max_line_length": 78, "avg_line_length": 30.385714285714286, "alnum_prop": 0.6046074283027738, "repo_name": "terrycojones/dark-matter", "id": "1611afbe83ee5504a9416cfe88d456d1e7c56517", "size": "2127", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "dark/fpcache.py", "mode": "33188", "license": "mit", "language": [ { "name": "Makefile", "bytes": "3380" }, { "name": "Python", "bytes": "2143833" }, { "name": "Shell", "bytes": "10548" } ], "symlink_target": "" }
title: "Monétisation" description: "Découvrez comment optimiser vos revenus sur tous les appareils. Améliorez l'expérience des internautes et gagnez de l'argent." updated_on: 2014-05-29 --- {% comment %} Page content will be output by the section layout based on the article collection matching page.id {% endcomment %}
{ "content_hash": "e10ed87ea9ae32abb03097356f4fa18c", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 140, "avg_line_length": 32.3, "alnum_prop": 0.7708978328173375, "repo_name": "jeffposnick/WebFundamentals", "id": "5672b66edad35e8c781048ae3442688faad91cc6", "size": "331", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "src/content/fr/fundamentals/discovery-and-distribution/monetization/index.markdown", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "60738" }, { "name": "HTML", "bytes": "405678" }, { "name": "JavaScript", "bytes": "36830" }, { "name": "Liquid", "bytes": "61067" }, { "name": "Python", "bytes": "2386" }, { "name": "Ruby", "bytes": "103436" }, { "name": "Shell", "bytes": "4844" }, { "name": "Smarty", "bytes": "1487" } ], "symlink_target": "" }
import logging import django from django.conf import settings from django.contrib import auth from django.contrib.auth.decorators import login_required # noqa from django.contrib.auth import views as django_auth_views from django import shortcuts from django.utils import functional from django.utils import http from django.views.decorators.cache import never_cache # noqa from django.views.decorators.csrf import csrf_protect # noqa from django.views.decorators.debug import sensitive_post_parameters # noqa from keystoneclient import exceptions as keystone_exceptions from keystoneclient.v2_0 import client as keystone_client_v2 from nikola_auth import forms # This is historic and is added back in to not break older versions of # Horizon, fix to Horizon to remove this requirement was committed in # Juno from nikola_auth.forms import Login # noqa from nikola_auth import user as auth_user from nikola_auth import utils try: is_safe_url = http.is_safe_url except AttributeError: is_safe_url = utils.is_safe_url LOG = logging.getLogger(__name__) @sensitive_post_parameters() @csrf_protect @never_cache def login(request, template_name=None, extra_context=None, **kwargs): """Logs a user in using the :class:`~nikola_auth.forms.Login` form.""" # If the user is already authenticated, redirect them to the # dashboard straight away, unless the 'next' parameter is set as it # usually indicates requesting access to a page that requires different # permissions. if (request.user.is_authenticated() and auth.REDIRECT_FIELD_NAME not in request.GET and auth.REDIRECT_FIELD_NAME not in request.POST): return shortcuts.redirect(settings.LOGIN_REDIRECT_URL) # Get our initial region for the form. initial = {} current_region = request.session.get('region_endpoint', None) requested_region = request.GET.get('region', None) regions = dict(getattr(settings, "AVAILABLE_REGIONS", [])) if requested_region in regions and requested_region != current_region: initial.update({'region': requested_region}) if request.method == "POST": # NOTE(saschpe): Since https://code.djangoproject.com/ticket/15198, # the 'request' object is passed directly to AuthenticationForm in # django.contrib.auth.views#login: if django.VERSION >= (1, 6): form = functional.curry(forms.Login) else: form = functional.curry(forms.Login, request) else: form = functional.curry(forms.Login, initial=initial) if extra_context is None: extra_context = {'redirect_field_name': auth.REDIRECT_FIELD_NAME} if not template_name: if request.is_ajax(): template_name = 'auth/_login.html' extra_context['hide'] = True else: template_name = 'auth/login.html' res = django_auth_views.login(request, template_name=template_name, authentication_form=form, extra_context=extra_context, **kwargs) # Set the session data here because django's session key rotation # will erase it if we set it earlier. if request.user.is_authenticated(): auth_user.set_session_from_user(request, request.user) regions = dict(forms.Login.get_region_choices()) region = request.user.endpoint region_name = regions.get(region) request.session['region_endpoint'] = region request.session['region_name'] = region_name return res def logout(request, login_url=None, **kwargs): """Logs out the user if he is logged in. Then redirects to the log-in page. .. param:: login_url Once logged out, defines the URL where to redirect after login .. param:: kwargs see django.contrib.auth.views.logout_then_login extra parameters. """ msg = 'Logging out user "%(username)s".' % \ {'username': request.user.username} LOG.info(msg) endpoint = request.session.get('region_endpoint') token = request.session.get('token') if token and endpoint: delete_token(endpoint=endpoint, token_id=token.id) """ Securely logs a user out. """ return django_auth_views.logout_then_login(request, login_url=login_url, **kwargs) def delete_token(endpoint, token_id): """Delete a token.""" insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False) ca_cert = getattr(settings, "OPENSTACK_SSL_CACERT", None) utils.remove_project_cache(token_id) try: if utils.get_keystone_version() < 3: client = keystone_client_v2.Client( endpoint=endpoint, token=token_id, insecure=insecure, cacert=ca_cert, debug=settings.DEBUG ) client.tokens.delete(token=token_id) LOG.info('Deleted token %s' % token_id) else: # FIXME: KS-client does not have delete token available # Need to add this later when it is exposed. pass except keystone_exceptions.ClientException: LOG.info('Could not delete token') @login_required def switch(request, tenant_id, redirect_field_name=auth.REDIRECT_FIELD_NAME): """Switches an authenticated user from one project to another.""" LOG.debug('Switching to tenant %s for user "%s".' % (tenant_id, request.user.username)) insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False) ca_cert = getattr(settings, "OPENSTACK_SSL_CACERT", None) endpoint = request.user.endpoint try: if utils.get_keystone_version() >= 3: if not utils.has_in_url_path(endpoint, '/v3'): endpoint = utils.url_path_replace(endpoint, '/v2.0', '/v3', 1) client = utils.get_keystone_client().Client( tenant_id=tenant_id, token=request.user.token.id, auth_url=endpoint, insecure=insecure, cacert=ca_cert, debug=settings.DEBUG) auth_ref = client.auth_ref msg = 'Project switch successful for user "%(username)s".' % \ {'username': request.user.username} LOG.info(msg) except keystone_exceptions.ClientException: msg = 'Project switch failed for user "%(username)s".' % \ {'username': request.user.username} LOG.warning(msg) auth_ref = None LOG.exception('An error occurred while switching sessions.') # Ensure the user-originating redirection url is safe. # Taken from django.contrib.auth.views.login() redirect_to = request.REQUEST.get(redirect_field_name, '') if not is_safe_url(url=redirect_to, host=request.get_host()): redirect_to = settings.LOGIN_REDIRECT_URL if auth_ref: old_endpoint = request.session.get('region_endpoint') old_token = request.session.get('token') if old_token and old_endpoint and old_token.id != auth_ref.auth_token: delete_token(endpoint=old_endpoint, token_id=old_token.id) user = auth_user.create_user_from_token( request, auth_user.Token(auth_ref), endpoint) auth_user.set_session_from_user(request, user) return shortcuts.redirect(redirect_to) @login_required def switch_region(request, region_name, redirect_field_name=auth.REDIRECT_FIELD_NAME): """Switches the user's region for all services except Identity service. The region will be switched if the given region is one of the regions available for the scoped project. Otherwise the region is not switched. """ if region_name in request.user.available_services_regions: request.session['services_region'] = region_name LOG.debug('Switching services region to %s for user "%s".' % (region_name, request.user.username)) redirect_to = request.REQUEST.get(redirect_field_name, '') if not is_safe_url(url=redirect_to, host=request.get_host()): redirect_to = settings.LOGIN_REDIRECT_URL return shortcuts.redirect(redirect_to)
{ "content_hash": "10ab77a26b39da08f238756e9ab0cb39", "timestamp": "", "source": "github", "line_count": 207, "max_line_length": 79, "avg_line_length": 39.734299516908216, "alnum_prop": 0.6519148936170213, "repo_name": "AlexOugh/horizon", "id": "0f546a5d895bbcf30071ebe64326aa76c07ed578", "size": "8771", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "openstack_dashboard/nikola_auth/views.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1000458" }, { "name": "JavaScript", "bytes": "244031" }, { "name": "Makefile", "bytes": "6165" }, { "name": "Python", "bytes": "4545176" }, { "name": "Shell", "bytes": "18285" } ], "symlink_target": "" }
<resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="android:windowBackground">@color/windowBackground</item> </style> <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style> <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/> <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/> <style name="ToolBarWithNavigationBack"> <item name="navigationIcon">@drawable/ic_arrow_back_white_24dp</item> </style> </resources>
{ "content_hash": "77562a5759beea9f18eb2f8eba6b6b11", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 77, "avg_line_length": 33, "alnum_prop": 0.6509926854754441, "repo_name": "xu6148152/binea_project_for_android", "id": "18406471e2325fd60fa6087c06e9279ad8b52a7e", "size": "957", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "StickyHeaderRecycler/app/src/main/res/values/styles.xml", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "3815" }, { "name": "GLSL", "bytes": "11107" }, { "name": "Groovy", "bytes": "27954" }, { "name": "HTML", "bytes": "2058" }, { "name": "Java", "bytes": "7024420" }, { "name": "JavaScript", "bytes": "4850" }, { "name": "Kotlin", "bytes": "72294" }, { "name": "Protocol Buffer", "bytes": "1257" }, { "name": "Shell", "bytes": "397" } ], "symlink_target": "" }
module Listen module QueueOptimizer private def _smoosh_changes(changes) # TODO: adapter could be nil at this point (shutdown) if _adapter_class.local_fs? cookies = changes.group_by do |_, _, _, _, options| (options || {})[:cookie] end _squash_changes(_reinterpret_related_changes(cookies)) else smooshed = { modified: [], added: [], removed: [] } changes.each do |_, change, dir, rel_path, _| smooshed[change] << (dir + rel_path).to_s if smooshed.key?(change) end smooshed.tap { |s| s.each { |_, v| v.uniq! } } end end # groups changes into the expected structure expected by # clients def _squash_changes(changes) # We combine here for backward compatibility # Newer clients should receive dir and path separately changes = changes.map { |change, dir, path| [change, dir + path] } actions = changes.group_by(&:last).map do |path, action_list| [_logical_action_for(path, action_list.map(&:first)), path.to_s] end _log :info, "listen: raw changes: #{actions.inspect}" { modified: [], added: [], removed: [] }.tap do |squashed| actions.each do |type, path| squashed[type] << path unless type.nil? end _log :info, "listen: final changes: #{squashed.inspect}" end end def _logical_action_for(path, actions) actions << :added if actions.delete(:moved_to) actions << :removed if actions.delete(:moved_from) modified = actions.detect { |x| x == :modified } _calculate_add_remove_difference(actions, path, modified) end def _calculate_add_remove_difference(actions, path, default_if_exists) added = actions.count { |x| x == :added } removed = actions.count { |x| x == :removed } diff = added - removed # TODO: avoid checking if path exists and instead assume the events are # in order (if last is :removed, it doesn't exist, etc.) if path.exist? if diff > 0 :added elsif diff.zero? && added > 0 :modified else default_if_exists end else diff < 0 ? :removed : nil end end # remove extraneous rb-inotify events, keeping them only if it's a possible # editor rename() call (e.g. Kate and Sublime) def _reinterpret_related_changes(cookies) table = { moved_to: :added, moved_from: :removed } cookies.map do |_, changes| data = _detect_possible_editor_save(changes) if data to_dir, to_file = data [[:modified, to_dir, to_file]] else not_silenced = changes.reject do |type, _, _, path, _| _silenced?(Pathname(path), type) end not_silenced.map do |_, change, dir, path, _| [table.fetch(change, change), dir, path] end end end.flatten(1) end def _detect_possible_editor_save(changes) return unless changes.size == 2 from_type = from_change = from = nil to_type = to_change = to_dir = to = nil changes.each do |data| case data[1] when :moved_from from_type, from_change, _, from, _ = data when :moved_to to_type, to_change, to_dir, to, _ = data else return nil end end return unless from && to # Expect an ignored moved_from and non-ignored moved_to # to qualify as an "editor modify" return unless _silenced?(Pathname(from), from_type) _silenced?(Pathname(to), to_type) ? nil : [to_dir, to] end end end
{ "content_hash": "6bd09e7f7a2242f97a092842ae7fd022", "timestamp": "", "source": "github", "line_count": 114, "max_line_length": 79, "avg_line_length": 32.18421052631579, "alnum_prop": 0.5750885799945489, "repo_name": "yeldartoktasynov/app-landing-page", "id": "d01377c0053a4f8745c8a86a4e78c9a343ff2c8b", "size": "3669", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "vendor/bundle/ruby/2.2.0/gems/listen-2.10.1/lib/listen/queue_optimizer.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "4549" }, { "name": "HTML", "bytes": "6877" }, { "name": "Ruby", "bytes": "6332" } ], "symlink_target": "" }
<?php class Dropzone extends CInputWidget { const DOMAIN='Dropzone'; public function init() { $assets = Yii::app()->assetManager->publish(__DIR__); /** @var CClientScript $cs */ $cs = Yii::app()->clientScript; $cs->registerCoreScript('jquery'); $cs->registerScriptFile($assets . '/dropzone.js'); $cs->registerCssFile($assets . '/dropzone.css'); } public function run() { $url = $this->controller->createUrl("{$this->controller->id}/ajaxUpload"); $id=get_class($this->model) . '-' . $this->attribute; $script = '$(\'#'.$id.'\').dropzone({ url: "'.$url.'", paramName: "'.get_class($this->model).'['.$this->attribute.']"});'; Yii::app()->clientScript->registerScript(__FILE__, $script); echo '<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#dz-modal">'. Yii::t(self::DOMAIN,'Upload Files') .'</button>'; echo '<!-- Modal --> <div class="modal fade" id="dz-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" id="myModalLabel">'.Yii::t(self::DOMAIN,'Upload Files').'</h4> </div> <div class="modal-body" id="'.$id.'"> <h3>'.Yii::t(self::DOMAIN,'Drop Files Here.').'</h3> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">'.Yii::t(self::DOMAIN,'Close').'</button> </div> </div> </div> </div>'; // echo CHtml::activeFileField($this->model, $this->attribute, $this->htmlOptions); } }
{ "content_hash": "73b0e9709981219c844cb100b2fe0187", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 132, "avg_line_length": 41.82222222222222, "alnum_prop": 0.5706695005313497, "repo_name": "relbraun/fileUploader", "id": "6acaf2c5ee8cd23ec3a6e00a0b8f390aab06826f", "size": "1882", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "extensions/dropzone/Dropzone.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "366" }, { "name": "JavaScript", "bytes": "62820" }, { "name": "PHP", "bytes": "9522" } ], "symlink_target": "" }
namespace gfx { class GLImage; } namespace gpu { namespace gles2 { class Texture; class NativeImageBuffer : public base::RefCountedThreadSafe<NativeImageBuffer> { public: static scoped_refptr<NativeImageBuffer> Create(GLuint texture_id); virtual void AddClient(gfx::GLImage* client) = 0; virtual void RemoveClient(gfx::GLImage* client) = 0; virtual bool IsClient(gfx::GLImage* client) = 0; virtual void BindToTexture(GLenum target) const = 0; protected: friend class base::RefCountedThreadSafe<NativeImageBuffer>; NativeImageBuffer() {} virtual ~NativeImageBuffer() {} DISALLOW_COPY_AND_ASSIGN(NativeImageBuffer); }; class ScopedUpdateTexture { public: ScopedUpdateTexture(); ~ScopedUpdateTexture(); private: DISALLOW_COPY_AND_ASSIGN(ScopedUpdateTexture); }; // An immutable description that can be used to create a texture that shares // the underlying image buffer(s). class TextureDefinition { public: static void AvoidEGLTargetTextureReuse(); TextureDefinition(); TextureDefinition(Texture* texture, unsigned int version, const scoped_refptr<NativeImageBuffer>& image); virtual ~TextureDefinition(); Texture* CreateTexture() const; // Must be wrapped with ScopedUpdateTexture. void UpdateTexture(Texture* texture) const; unsigned int version() const { return version_; } bool IsOlderThan(unsigned int version) const { return (version - version_) < 0x80000000; } bool Matches(const Texture* texture) const; scoped_refptr<NativeImageBuffer> image() const { return image_buffer_; } private: bool SafeToRenderFrom() const; void UpdateTextureInternal(Texture* texture) const; struct LevelInfo { LevelInfo(); LevelInfo(GLenum target, GLenum internal_format, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, bool cleared); ~LevelInfo(); GLenum target; GLenum internal_format; GLsizei width; GLsizei height; GLsizei depth; GLint border; GLenum format; GLenum type; bool cleared; }; unsigned int version_; GLenum target_; scoped_refptr<NativeImageBuffer> image_buffer_; GLenum min_filter_; GLenum mag_filter_; GLenum wrap_s_; GLenum wrap_t_; GLenum usage_; bool immutable_; bool defined_; // Only support textures with one face and one level. LevelInfo level_info_; }; } // namespage gles2 } // namespace gpu #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_DEFINITION_H_
{ "content_hash": "e05f3d8d1729c04a201433a1233089c4", "timestamp": "", "source": "github", "line_count": 107, "max_line_length": 80, "avg_line_length": 24.44859813084112, "alnum_prop": 0.6903669724770642, "repo_name": "guorendong/iridium-browser-ubuntu", "id": "e5311846295239523be71a7b803a4776e24597a6", "size": "3003", "binary": false, "copies": "3", "ref": "refs/heads/ubuntu/precise", "path": "gpu/command_buffer/service/texture_definition.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "AppleScript", "bytes": "8402" }, { "name": "Assembly", "bytes": "256197" }, { "name": "Batchfile", "bytes": "34966" }, { "name": "C", "bytes": "15445429" }, { "name": "C++", "bytes": "276628399" }, { "name": "CMake", "bytes": "27829" }, { "name": "CSS", "bytes": "867238" }, { "name": "Emacs Lisp", "bytes": "3348" }, { "name": "Go", "bytes": "13628" }, { "name": "Groff", "bytes": "7777" }, { "name": "HTML", "bytes": "20250399" }, { "name": "Java", "bytes": "9950308" }, { "name": "JavaScript", "bytes": "13873772" }, { "name": "LLVM", "bytes": "1169" }, { "name": "Logos", "bytes": "6893" }, { "name": "Lua", "bytes": "16189" }, { "name": "Makefile", "bytes": "179129" }, { "name": "Objective-C", "bytes": "1871766" }, { "name": "Objective-C++", "bytes": "9674498" }, { "name": "PHP", "bytes": "42038" }, { "name": "PLpgSQL", "bytes": "163248" }, { "name": "Perl", "bytes": "63937" }, { "name": "Protocol Buffer", "bytes": "474121" }, { "name": "Python", "bytes": "11646662" }, { "name": "Ragel in Ruby Host", "bytes": "104923" }, { "name": "Scheme", "bytes": "10604" }, { "name": "Shell", "bytes": "1151673" }, { "name": "Standard ML", "bytes": "5034" }, { "name": "VimL", "bytes": "4075" }, { "name": "nesC", "bytes": "18347" } ], "symlink_target": "" }
You can use the [editor on GitHub](https://github.com/abedon/CodeRepo/edit/master/index.md) to maintain and preview the content for your website in Markdown files. Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files. ### Markdown Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for ```markdown Syntax highlighted code block # Header 1 ## Header 2 ### Header 3 - Bulleted - List 1. Numbered 2. List **Bold** and _Italic_ and `Code` text [Link](url) and ![Image](src) ``` For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/). ### Jekyll Themes Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/abedon/CodeRepo/settings). The name of this theme is saved in the Jekyll `_config.yml` configuration file. ### Support or Contact Having trouble with Pages? Check out our [documentation](https://help.github.com/categories/github-pages-basics/) or [contact support](https://github.com/contact) and we’ll help you sort it out.
{ "content_hash": "dcf206645d15d4962ac69a93c49b8461", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 242, "avg_line_length": 35.31428571428572, "alnum_prop": 0.7564724919093851, "repo_name": "abedon/EncoreCrawler", "id": "f5ce110d59364ce20886ba4fc39594cfa0c6016f", "size": "1266", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "index.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "266919" }, { "name": "CSS", "bytes": "1928" }, { "name": "HTML", "bytes": "13326" }, { "name": "JavaScript", "bytes": "754" }, { "name": "PowerShell", "bytes": "3888" } ], "symlink_target": "" }
import fetch from '../fetch' export const SET_CONTROLLED = 'SET_CONTROLLED' export const SET_CONTROLLED_SUCCESS = 'SET_CONTROLLED_SUCCESS' export const SET_CONTROLLED_ERROR = 'SET_CONTROLLED_ERROR' export function setControlled(controlled) { return dispatch => { dispatch({ type: SET_CONTROLLED }) return fetch('/api/state', { method: 'post', body: JSON.stringify({ controlled }) }) .then(res => res.json()) .then(() => { dispatch({ type: SET_CONTROLLED_SUCCESS, controlled }) }) .catch(() => { dispatch({ type: SET_CONTROLLED_ERROR, error: true }) }) } }
{ "content_hash": "3ddd257878697b96ba186a01234c2a53", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 62, "avg_line_length": 24.137931034482758, "alnum_prop": 0.5585714285714286, "repo_name": "akileh/fermtempctrl", "id": "c82f158c4164dc8cea36a7adf3fae86cd221cc65", "size": "700", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "client/actions/controlled.js", "mode": "33188", "license": "mit", "language": [ { "name": "Arduino", "bytes": "7691" }, { "name": "C++", "bytes": "79534" }, { "name": "HTML", "bytes": "687" }, { "name": "JavaScript", "bytes": "76612" } ], "symlink_target": "" }
<?php namespace api\modules\v1\controllers; use Yii; use yii\rest\ActiveController; use yii\web\Response; use api\modules\v1\models\Country; // use yii\helpers\Json; use api\util\DataService; use yii\httpclient\Client; // use yii\base\Object; class CountryController extends ActiveController { public $modelClass = 'api\modules\v1\models\Country'; private $appid = "10103"; private $appkey = "m2wCuSkTXkqZqMny"; public function actions() { // $actions = parent::actions(); // // //禁用""index,delete" 和 "create" 操作 // unset($actions['index'],$actions['delete'], $actions['create']); // return $actions; } public function behaviors() { $behaviors = parent::behaviors(); #定义返回格式是:JSON $behaviors['contentNegotiator']['formats']['text/html'] = Response::FORMAT_JSON; return $behaviors; } public function actionSearch(){ $post = Yii::$app->request->post(); // $one = null; // return $post; if (isset($post['name'])){ $one = Country::findOne(['code'=>$post['name']]); } // print_r(Json::decode($json, true));exit; return $one; } function _isAssocArray(array $var) { print_r(range(0, sizeof($var))); print_r($var); // return array_diff_assoc(array_keys($var), range(0, sizeof($var) -1)) ? TRUE : FALSE; return array_diff_key($var, range(0, sizeof($var)));// ? TRUE : FALSE; } public function actionTestApi(){ // $path = isset( $_SERVER ['REQUEST_URI'] ) ? $_SERVER ['REQUEST_URI'] : ''; // try { // $nonce = $_REQUEST["_nonce"]; // }catch (\Exception $e){ // $e->getCode(); // } // $nonce = $_REQUEST["_nonce"]; $dataService = new DataService($this->appid, $this->appkey); $value = ['name'=>'sdf','age'=>22]; $dataArr = [ 'id'=>'123', 'type'=>'adfaf', 'create_time'=>time(), 'data'=>'' ]; // return $dataArr; $data = '{"0":{"uid":110020,"did":"adfasdfa","key":"user","type":"user_info","value":"{"weight":70,"height":170,"gender":"male","birth":"1990-03"}","time":'.time().'}}'; $dataArr['data'] = json_decode($data,true); // $data['1'] = '{"uid":"123","did":"adfasdfa","key":"en","type":"read","value":"vvvvvv","time":1495771410}'; // $json = '{"0":{"name":"world_city","version":1,"lang":"en","operation":"read"},"1":{"name":"world_city","version":1,"lang":"en","operation":"read"},"2":{"name":"world_city","version":1,"lang":"en","operation":"read"}}'; // print_r(json_encode($data));exit(); $client = new Client(); $url = Yii::$app->urlManager->createAbsoluteUrl(['v1/userdevice/receivedata']);//v1/country/userdevicedata // $url = "http://116.62.135.143:8090/api/web/v1/userdevice/receivedata"; $params = $dataService->generateEncryptParams(json_encode($dataArr), $url, 'POST'); $response = $client->createRequest() ->setMethod('post') ->setUrl($url) ->setData($params) ->send(); // return $response->data; // print_r($response->data);exit; if ($response->isOk) { $res = $dataService->decryptData($response->data); $result = json_decode($res, true); // $rs1 = json_decode($result['result'], true); // if (is_array($rs1[0])){ // echo 'arr'; // } return $result; } // $response = new Response(); // // echo 'fff';exit(); // return $response->data = $result; return null; } /** * 解密接收的数据并加密返回 * @return string */ public function actionUserDeviceData(){ $request = Yii::$app->request; $path = isset( $_SERVER ['REQUEST_URI'] ) ? $_SERVER ['REQUEST_URI'] : ''; $nonce = $_REQUEST["_nonce"]; $method = $request->method; $dataStr = isset( $_REQUEST ['data'] ) ? $_REQUEST['data'] : ''; $didStr = isset( $_REQUEST ['did'] ) ? "&did={$_REQUEST['did']}" : ''; $signature = $_REQUEST['signature']; $dataService = new DataService($this->appid, $this->appkey); $jsonstr = $dataService->decrypt($_REQUEST['data'],$path,$signature,$nonce,$method,$didStr); $result = [ 'message'=>'ok', 'result'=>$jsonstr, 'code'=>'0' ]; return $dataService->encryptData(json_encode($result)); } //重写index的业务实现 // public function actionIndex() // { // //$modelClass = $this->modelClass; // echo "index here"; // exit; // } // public function actionView(){ // echo "view here"; // exit; // } }
{ "content_hash": "59801d97504dd61f38c4078911250de3", "timestamp": "", "source": "github", "line_count": 136, "max_line_length": 230, "avg_line_length": 35.963235294117645, "alnum_prop": 0.5152320588836639, "repo_name": "XingVenus/yii2-advanced", "id": "a6224a4b0c421f3dea32133b566b9430263329b4", "size": "4955", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "advanced2011/api/modules/v1/controllers/CountryController.php", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "1546" }, { "name": "CSS", "bytes": "25045" }, { "name": "HTML", "bytes": "348" }, { "name": "JavaScript", "bytes": "99687" }, { "name": "PHP", "bytes": "526288" }, { "name": "Ruby", "bytes": "2441" }, { "name": "Shell", "bytes": "4390" } ], "symlink_target": "" }
@import '../../core'; @import '../../../components/byline/byline'; @import '../../../components/carousel/carousel'; @import '../../../components/dropdown/dropdown'; @import '../../../components/footer/footer'; @import '../../../components/images/fullpage-hero'; @import '../../../components/images/images'; @import '../../../components/inputs/inputs'; @import '../../../components/navbar/navbar'; @import '../../../components/related-article/related-article'; @import '../../../components/related-section/related-section'; @import '../../../components/socialbox/socialbox'; @import '../../../components/social-follow/social-follow';
{ "content_hash": "d767a708588ecddf50b5f973a3486705", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 62, "avg_line_length": 42.333333333333336, "alnum_prop": 0.6456692913385826, "repo_name": "camelburrito/ampstart", "id": "ab879730f58d9b41f31610ac40839cb346d6fe0e", "size": "1263", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "css/templates/article/page.css", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "444812" }, { "name": "HTML", "bytes": "577266" }, { "name": "JavaScript", "bytes": "77062" } ], "symlink_target": "" }
FROM balenalib/hummingboard-debian:sid-run # remove several traces of debian python RUN apt-get purge -y python.* # http://bugs.python.org/issue19846 # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 # install python dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ netbase \ && rm -rf /var/lib/apt/lists/* # key 63C7CC90: public key "Simon McVittie <smcv@pseudorandom.co.uk>" imported # key 3372DCFA: public key "Donald Stufft (dstufft) <donald@stufft.io>" imported RUN gpg --batch --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \ && gpg --batch --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \ && gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059 ENV PYTHON_VERSION 3.8.9 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" ENV PYTHON_PIP_VERSION 21.0.1 ENV SETUPTOOLS_VERSION 56.0.0 RUN set -x \ && buildDeps=' \ curl \ ' \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ && curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-armv7hf-openssl1.1.tar.gz" \ && echo "c5b7c118af6ad28d1b978513451b47e5acca51e3fc469dfc95ccf0ee9036bd82 Python-$PYTHON_VERSION.linux-armv7hf-openssl1.1.tar.gz" | sha256sum -c - \ && tar -xzf "Python-$PYTHON_VERSION.linux-armv7hf-openssl1.1.tar.gz" --strip-components=1 \ && rm -rf "Python-$PYTHON_VERSION.linux-armv7hf-openssl1.1.tar.gz" \ && ldconfig \ && if [ ! -e /usr/local/bin/pip3 ]; then : \ && curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \ && echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \ && python3 get-pip.py \ && rm get-pip.py \ ; fi \ && pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \ && find /usr/local \ \( -type d -a -name test -o -name tests \) \ -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ -exec rm -rf '{}' + \ && cd / \ && rm -rf /usr/src/python ~/.cache # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ && ln -sf pip3 pip \ && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -sf idle3 idle \ && ln -sf pydoc3 pydoc \ && ln -sf python3 python \ && ln -sf python3-config python-config # set PYTHONPATH to point to dist-packages ENV PYTHONPATH /usr/lib/python3/dist-packages:$PYTHONPATH CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@python.sh" \ && echo "Running test-stack@python" \ && chmod +x test-stack@python.sh \ && bash test-stack@python.sh \ && rm -rf test-stack@python.sh RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Debian Sid \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.8.9, Pip v21.0.1, Setuptools v56.0.0 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
{ "content_hash": "55c81bfb162079025ef060bb74117cf2", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 705, "avg_line_length": 52.15384615384615, "alnum_prop": 0.7074729596853491, "repo_name": "nghiant2710/base-images", "id": "95a268957019d2636e988906a40de20cb5a0f847", "size": "4089", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "balena-base-images/python/hummingboard/debian/sid/3.8.9/run/Dockerfile", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "144558581" }, { "name": "JavaScript", "bytes": "16316" }, { "name": "Shell", "bytes": "368690" } ], "symlink_target": "" }
package modtweaker.mods.botania; import minetweaker.MineTweakerAPI; import modtweaker.mods.botania.handlers.*; import net.minecraft.item.ItemStack; import vazkii.botania.common.item.block.ItemBlockSpecialFlower; public class Botania { public Botania() { MineTweakerAPI.registerClass(Apothecary.class); MineTweakerAPI.registerClass(Brew.class); MineTweakerAPI.registerClass(ElvenTrade.class); MineTweakerAPI.registerClass(ManaInfusion.class); MineTweakerAPI.registerClass(Orechid.class); MineTweakerAPI.registerClass(PureDaisy.class); MineTweakerAPI.registerClass(RuneAltar.class); MineTweakerAPI.registerClass(Lexicon.class); } public static boolean isSubtile(ItemStack stack) { return stack.getItem() instanceof ItemBlockSpecialFlower; } public static boolean subtileMatches(ItemStack stack, ItemStack stack2) { return (ItemBlockSpecialFlower.getType(stack2).equals(ItemBlockSpecialFlower.getType(stack))); } }
{ "content_hash": "3e09ad13e206589847af89dee6b3f7d5", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 102, "avg_line_length": 37.77777777777778, "alnum_prop": 0.7558823529411764, "repo_name": "elucent/ModTweaker", "id": "340e241eb199d7944d3b8aa832f72ddc1a0478b1", "size": "1020", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/modtweaker/mods/botania/Botania.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "263853" } ], "symlink_target": "" }
if ($ENV:PROCESSOR_ARCHITEW6432 -eq 'AMD64') { try { &"$ENV:WINDIR\SysNative\WindowsPowershell\v1.0\PowerShell.exe" -File $PSCOMMANDPATH } catch { Throw ('Failed to start {0}' -f $PSCOMMANDPATH) } exit } #endregion ARM64Handling #region Check try { if (-not (Test-Path -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\F15576E8-98B7-4186-B944-EAFA664402D9')) { Exit 1 } if (-not (Test-Path -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Control\Power')) { Exit 1 } if (-not ((Get-ItemPropertyValue -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\F15576E8-98B7-4186-B944-EAFA664402D9' -Name 'Attributes' -ErrorAction SilentlyContinue) -eq 1)) { Exit 1 } if (-not ((Get-ItemPropertyValue -LiteralPath 'HKLM:\SYSTEM\CurrentControlSet\Control\Power' -Name 'EnforceDisconnectedStandby' -ErrorAction SilentlyContinue) -eq 0)) { Exit 1 } } catch { Exit 1 } Exit 0 #endregion Check
{ "content_hash": "33f53ae60057f730fe086473911f1b8e", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 205, "avg_line_length": 22.77777777777778, "alnum_prop": 0.6839024390243903, "repo_name": "jhochwald/PowerShell-collection", "id": "2ee36d0b374bc31f9e35ef96d7cb3956124b034f", "size": "1147", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "Intune/ProactiveRemediations/Detection-WOLSurfaceStudio2.ps1", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "232763" }, { "name": "PowerShell", "bytes": "2682849" } ], "symlink_target": "" }
package io.github.cloudiator.rest.converter; import com.google.common.base.Strings; import de.uniulm.omi.cloudiator.util.TwoWayConverter; import io.github.cloudiator.rest.model.Cloud; import org.cloudiator.messages.entities.IaasEntities; /** * Created by volker on 29.05.17. */ public class CloudToCloudConverter implements TwoWayConverter<Cloud, IaasEntities.Cloud> { private final ApiToApiConverter apiToApiConverter = new ApiToApiConverter(); private final CloudTypeConverter cloudTypeConverter = new CloudTypeConverter(); private final CloudCredentialConverter cloudCredentialConverter = new CloudCredentialConverter(); private final CloudConfigurationConverter cloudConfigurationConverter = new CloudConfigurationConverter(); private final CloudStateConverter cloudStateConverter = new CloudStateConverter(); @Override public Cloud applyBack(IaasEntities.Cloud cloud) { Cloud result = new Cloud(); result.setId(cloud.getId()); if (cloud.getEndpoint().equals("")) { result.setEndpoint(null); } else { result.setEndpoint(cloud.getEndpoint()); } result.setCloudType(cloudTypeConverter.applyBack(cloud.getCloudType())); result.setApi(apiToApiConverter.applyBack(cloud.getApi())); result.setCloudConfiguration(cloudConfigurationConverter.applyBack(cloud.getConfiguration())); result.setCredential(cloudCredentialConverter.applyBack(cloud.getCredential())); if (!Strings.isNullOrEmpty(cloud.getDiagnostic())) { result.setDiagnostic(cloud.getDiagnostic()); } result.setState(cloudStateConverter.apply(cloud.getState())); result.setOwner(cloud.getUserId()); return result; } @Override public IaasEntities.Cloud apply(Cloud cloud) { IaasEntities.Cloud.Builder builder = IaasEntities.Cloud.newBuilder(); builder.setId(cloud.getId()); builder.setUserId(cloud.getOwner()); if (cloud.getEndpoint() != null) { builder.setEndpoint(cloud.getEndpoint()); } else { builder.clearEndpoint(); } builder.setCloudType(cloudTypeConverter.apply(cloud.getCloudType())); builder.setApi(apiToApiConverter.apply(cloud.getApi())); if (cloud.getCloudConfiguration() != null) { builder.setConfiguration(cloudConfigurationConverter.apply(cloud.getCloudConfiguration())); } else { builder.clearConfiguration(); } builder.setCredential(cloudCredentialConverter.apply(cloud.getCredential())); builder.setState(cloudStateConverter.applyBack(cloud.getState())); if (cloud.getDiagnostic() != null) { builder.setDiagnostic(cloud.getDiagnostic()); } return builder.build(); } }
{ "content_hash": "495271fc7654050a44887eddb7462a84", "timestamp": "", "source": "github", "line_count": 70, "max_line_length": 108, "avg_line_length": 37.785714285714285, "alnum_prop": 0.7497164461247637, "repo_name": "cloudiator/rest-server", "id": "edd6a4c26649e43912bfbc4b5b2e65d17134d633", "size": "2645", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "model/src/main/java/io/github/cloudiator/rest/converter/CloudToCloudConverter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "143" }, { "name": "Java", "bytes": "814174" }, { "name": "Shell", "bytes": "3831" } ], "symlink_target": "" }
/* Include declarations. */ #include "MagickCore/studio.h" #include "MagickCore/channel.h" #include "MagickCore/color.h" #include "MagickCore/color-private.h" #include "MagickCore/colorspace-private.h" #include "MagickCore/composite.h" #include "MagickCore/composite-private.h" #include "MagickCore/draw.h" #include "MagickCore/draw-private.h" #include "MagickCore/exception.h" #include "MagickCore/exception-private.h" #include "MagickCore/gem.h" #include "MagickCore/gem-private.h" #include "MagickCore/monitor.h" #include "MagickCore/monitor-private.h" #include "MagickCore/paint.h" #include "MagickCore/pixel-accessor.h" #include "MagickCore/resource_.h" #include "MagickCore/statistic.h" #include "MagickCore/string_.h" #include "MagickCore/thread-private.h" /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % F l o o d f i l l P a i n t I m a g e % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % FloodfillPaintImage() changes the color value of any pixel that matches % target and is an immediate neighbor. If the method FillToBorderMethod is % specified, the color value is changed for any neighbor pixel that does not % match the bordercolor member of image. % % By default target must match a particular pixel color exactly. However, % in many cases two colors may differ by a small amount. The fuzz member of % image defines how much tolerance is acceptable to consider two colors as % the same. For example, set fuzz to 10 and the color red at intensities of % 100 and 102 respectively are now interpreted as the same color for the % purposes of the floodfill. % % The format of the FloodfillPaintImage method is: % % MagickBooleanType FloodfillPaintImage(Image *image, % const DrawInfo *draw_info,const PixelInfo target, % const ssize_t x_offset,const ssize_t y_offset, % const MagickBooleanType invert,ExceptionInfo *exception) % % A description of each parameter follows: % % o image: the image. % % o draw_info: the draw info. % % o target: the RGB value of the target color. % % o x_offset,y_offset: the starting location of the operation. % % o invert: paint any pixel that does not match the target color. % % o exception: return any errors or warnings in this structure. % */ MagickExport MagickBooleanType FloodfillPaintImage(Image *image, const DrawInfo *draw_info,const PixelInfo *target,const ssize_t x_offset, const ssize_t y_offset,const MagickBooleanType invert, ExceptionInfo *exception) { #define MaxStacksize 131072UL #define PushSegmentStack(up,left,right,delta) \ { \ if (s >= (segment_stack+MaxStacksize)) \ ThrowBinaryException(DrawError,"SegmentStackOverflow",image->filename) \ else \ { \ if ((((up)+(delta)) >= 0) && (((up)+(delta)) < (ssize_t) image->rows)) \ { \ s->x1=(double) (left); \ s->y1=(double) (up); \ s->x2=(double) (right); \ s->y2=(double) (delta); \ s++; \ } \ } \ } CacheView *floodplane_view, *image_view; Image *floodplane_image; MagickBooleanType skip, status; MemoryInfo *segment_info; PixelInfo fill_color, pixel; register SegmentInfo *s; SegmentInfo *segment_stack; ssize_t offset, start, x, x1, x2, y; /* Check boundary conditions. */ assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); assert(draw_info != (DrawInfo *) NULL); assert(draw_info->signature == MagickSignature); if ((x_offset < 0) || (x_offset >= (ssize_t) image->columns)) return(MagickFalse); if ((y_offset < 0) || (y_offset >= (ssize_t) image->rows)) return(MagickFalse); if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse) return(MagickFalse); if (IsGrayColorspace(image->colorspace) != MagickFalse) (void) SetImageColorspace(image,sRGBColorspace,exception); if ((image->alpha_trait != BlendPixelTrait) && (draw_info->fill.alpha_trait == BlendPixelTrait)) (void) SetImageAlpha(image,OpaqueAlpha,exception); /* Set floodfill state. */ floodplane_image=CloneImage(image,image->columns,image->rows,MagickTrue, exception); if (floodplane_image == (Image *) NULL) return(MagickFalse); floodplane_image->alpha_trait=UndefinedPixelTrait; floodplane_image->colorspace=GRAYColorspace; (void) QueryColorCompliance("#000",AllCompliance, &floodplane_image->background_color,exception); (void) SetImageBackgroundColor(floodplane_image,exception); segment_info=AcquireVirtualMemory(MaxStacksize,sizeof(*segment_stack)); if (segment_info == (MemoryInfo *) NULL) { floodplane_image=DestroyImage(floodplane_image); ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); } segment_stack=(SegmentInfo *) GetVirtualMemoryBlob(segment_info); /* Push initial segment on stack. */ status=MagickTrue; x=x_offset; y=y_offset; start=0; s=segment_stack; PushSegmentStack(y,x,x,1); PushSegmentStack(y+1,x,x,-1); GetPixelInfo(image,&pixel); image_view=AcquireVirtualCacheView(image,exception); floodplane_view=AcquireAuthenticCacheView(floodplane_image,exception); while (s > segment_stack) { register const Quantum *restrict p; register Quantum *restrict q; register ssize_t x; /* Pop segment off stack. */ s--; x1=(ssize_t) s->x1; x2=(ssize_t) s->x2; offset=(ssize_t) s->y2; y=(ssize_t) s->y1+offset; /* Recolor neighboring pixels. */ p=GetCacheViewVirtualPixels(image_view,0,y,(size_t) (x1+1),1,exception); q=GetCacheViewAuthenticPixels(floodplane_view,0,y,(size_t) (x1+1),1, exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) break; p+=x1*GetPixelChannels(image); q+=x1*GetPixelChannels(floodplane_image); for (x=x1; x >= 0; x--) { if (GetPixelGray(floodplane_image,q) != 0) break; GetPixelInfoPixel(image,p,&pixel); if (IsFuzzyEquivalencePixelInfo(&pixel,target) == invert) break; SetPixelGray(floodplane_image,QuantumRange,q); p-=GetPixelChannels(image); q-=GetPixelChannels(floodplane_image); } if (SyncCacheViewAuthenticPixels(floodplane_view,exception) == MagickFalse) break; skip=x >= x1 ? MagickTrue : MagickFalse; if (skip == MagickFalse) { start=x+1; if (start < x1) PushSegmentStack(y,start,x1-1,-offset); x=x1+1; } do { if (skip == MagickFalse) { if (x < (ssize_t) image->columns) { p=GetCacheViewVirtualPixels(image_view,x,y,image->columns-x,1, exception); q=GetCacheViewAuthenticPixels(floodplane_view,x,y,image->columns- x,1,exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) break; for ( ; x < (ssize_t) image->columns; x++) { if (GetPixelGray(floodplane_image,q) != 0) break; GetPixelInfoPixel(image,p,&pixel); if (IsFuzzyEquivalencePixelInfo(&pixel,target) == invert) break; SetPixelGray(floodplane_image,QuantumRange,q); p+=GetPixelChannels(image); q+=GetPixelChannels(floodplane_image); } status=SyncCacheViewAuthenticPixels(floodplane_view,exception); if (status == MagickFalse) break; } PushSegmentStack(y,start,x-1,offset); if (x > (x2+1)) PushSegmentStack(y,x2+1,x-1,-offset); } skip=MagickFalse; x++; if (x <= x2) { p=GetCacheViewVirtualPixels(image_view,x,y,(size_t) (x2-x+1),1, exception); q=GetCacheViewAuthenticPixels(floodplane_view,x,y,(size_t) (x2-x+1),1, exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) break; for ( ; x <= x2; x++) { if (GetPixelGray(floodplane_image,q) != 0) break; GetPixelInfoPixel(image,p,&pixel); if (IsFuzzyEquivalencePixelInfo(&pixel,target) != invert) break; p+=GetPixelChannels(image); q+=GetPixelChannels(floodplane_image); } } start=x; } while (x <= x2); } for (y=0; y < (ssize_t) image->rows; y++) { register const Quantum *restrict p; register Quantum *restrict q; register ssize_t x; /* Tile fill color onto floodplane. */ p=GetCacheViewVirtualPixels(floodplane_view,0,y,image->columns,1,exception); q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) break; for (x=0; x < (ssize_t) image->columns; x++) { if (GetPixelGray(floodplane_image,p) != 0) { (void) GetFillColor(draw_info,x,y,&fill_color,exception); SetPixelInfoPixel(image,&fill_color,q); } p+=GetPixelChannels(floodplane_image); q+=GetPixelChannels(image); } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) break; } floodplane_view=DestroyCacheView(floodplane_view); image_view=DestroyCacheView(image_view); segment_info=RelinquishVirtualMemory(segment_info); floodplane_image=DestroyImage(floodplane_image); return(y == (ssize_t) image->rows ? MagickTrue : MagickFalse); } /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % + G r a d i e n t I m a g e % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % GradientImage() applies a continuously smooth color transitions along a % vector from one color to another. % % Note, the interface of this method will change in the future to support % more than one transistion. % % The format of the GradientImage method is: % % MagickBooleanType GradientImage(Image *image,const GradientType type, % const SpreadMethod method,const PixelInfo *start_color, % const PixelInfo *stop_color,ExceptionInfo *exception) % % A description of each parameter follows: % % o image: the image. % % o type: the gradient type: linear or radial. % % o spread: the gradient spread meathod: pad, reflect, or repeat. % % o start_color: the start color. % % o stop_color: the stop color. % % o exception: return any errors or warnings in this structure. % */ static inline double MagickMax(const double x,const double y) { return(x > y ? x : y); } MagickExport MagickBooleanType GradientImage(Image *image, const GradientType type,const SpreadMethod method, const PixelInfo *start_color,const PixelInfo *stop_color, ExceptionInfo *exception) { DrawInfo *draw_info; GradientInfo *gradient; MagickBooleanType status; register ssize_t i; /* Set gradient start-stop end points. */ assert(image != (const Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); assert(start_color != (const PixelInfo *) NULL); assert(stop_color != (const PixelInfo *) NULL); draw_info=AcquireDrawInfo(); gradient=(&draw_info->gradient); gradient->type=type; gradient->bounding_box.width=image->columns; gradient->bounding_box.height=image->rows; gradient->gradient_vector.x2=(double) image->columns-1.0; gradient->gradient_vector.y2=(double) image->rows-1.0; if ((type == LinearGradient) && (gradient->gradient_vector.y2 != 0.0)) gradient->gradient_vector.x2=0.0; gradient->center.x=(double) gradient->gradient_vector.x2/2.0; gradient->center.y=(double) gradient->gradient_vector.y2/2.0; gradient->radius=MagickMax(gradient->center.x,gradient->center.y); gradient->spread=method; /* Define the gradient to fill between the stops. */ gradient->number_stops=2; gradient->stops=(StopInfo *) AcquireQuantumMemory(gradient->number_stops, sizeof(*gradient->stops)); if (gradient->stops == (StopInfo *) NULL) ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); (void) ResetMagickMemory(gradient->stops,0,gradient->number_stops* sizeof(*gradient->stops)); for (i=0; i < (ssize_t) gradient->number_stops; i++) GetPixelInfo(image,&gradient->stops[i].color); gradient->stops[0].color=(*start_color); gradient->stops[0].offset=0.0; gradient->stops[1].color=(*stop_color); gradient->stops[1].offset=1.0; /* Draw a gradient on the image. */ (void) SetImageColorspace(image,start_color->colorspace,exception); status=DrawGradientImage(image,draw_info,exception); draw_info=DestroyDrawInfo(draw_info); return(status); } /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % O i l P a i n t I m a g e % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % OilPaintImage() applies a special effect filter that simulates an oil % painting. Each pixel is replaced by the most frequent color occurring % in a circular region defined by radius. % % The format of the OilPaintImage method is: % % Image *OilPaintImage(const Image *image,const double radius, % const double sigma,ExceptionInfo *exception) % % A description of each parameter follows: % % o image: the image. % % o radius: the radius of the circular neighborhood. % % o sigma: the standard deviation of the Gaussian, in pixels. % % o exception: return any errors or warnings in this structure. % */ static size_t **DestroyHistogramThreadSet(size_t **histogram) { register ssize_t i; assert(histogram != (size_t **) NULL); for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++) if (histogram[i] != (size_t *) NULL) histogram[i]=(size_t *) RelinquishMagickMemory(histogram[i]); histogram=(size_t **) RelinquishMagickMemory(histogram); return(histogram); } static size_t **AcquireHistogramThreadSet(const size_t count) { register ssize_t i; size_t **histogram, number_threads; number_threads=(size_t) GetMagickResourceLimit(ThreadResource); histogram=(size_t **) AcquireQuantumMemory(number_threads,sizeof(*histogram)); if (histogram == (size_t **) NULL) return((size_t **) NULL); (void) ResetMagickMemory(histogram,0,number_threads*sizeof(*histogram)); for (i=0; i < (ssize_t) number_threads; i++) { histogram[i]=(size_t *) AcquireQuantumMemory(count,sizeof(**histogram)); if (histogram[i] == (size_t *) NULL) return(DestroyHistogramThreadSet(histogram)); } return(histogram); } MagickExport Image *OilPaintImage(const Image *image,const double radius, const double sigma,ExceptionInfo *exception) { #define NumberPaintBins 256 #define OilPaintImageTag "OilPaint/Image" CacheView *image_view, *paint_view; Image *linear_image, *paint_image; MagickBooleanType status; MagickOffsetType progress; size_t **histograms, width; ssize_t center, y; /* Initialize painted image attributes. */ assert(image != (const Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); width=GetOptimalKernelWidth2D(radius,sigma); linear_image=CloneImage(image,0,0,MagickTrue,exception); paint_image=CloneImage(image,image->columns,image->rows,MagickTrue,exception); if ((linear_image == (Image *) NULL) || (paint_image == (Image *) NULL)) { if (linear_image != (Image *) NULL) linear_image=DestroyImage(linear_image); if (paint_image != (Image *) NULL) linear_image=DestroyImage(paint_image); return((Image *) NULL); } if (SetImageStorageClass(paint_image,DirectClass,exception) == MagickFalse) { linear_image=DestroyImage(linear_image); paint_image=DestroyImage(paint_image); return((Image *) NULL); } histograms=AcquireHistogramThreadSet(NumberPaintBins); if (histograms == (size_t **) NULL) { linear_image=DestroyImage(linear_image); paint_image=DestroyImage(paint_image); ThrowImageException(ResourceLimitError,"MemoryAllocationFailed"); } /* Oil paint image. */ status=MagickTrue; progress=0; center=(ssize_t) GetPixelChannels(linear_image)*(linear_image->columns+width)* (width/2L)+GetPixelChannels(linear_image)*(width/2L); image_view=AcquireVirtualCacheView(linear_image,exception); paint_view=AcquireAuthenticCacheView(paint_image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static,4) shared(progress,status) \ magick_threads(linear_image,paint_image,linear_image->rows,1) #endif for (y=0; y < (ssize_t) linear_image->rows; y++) { register const Quantum *restrict p; register Quantum *restrict q; register size_t *histogram; register ssize_t x; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,-((ssize_t) width/2L),y-(ssize_t) (width/2L),linear_image->columns+width,width,exception); q=QueueCacheViewAuthenticPixels(paint_view,0,y,paint_image->columns,1, exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) { status=MagickFalse; continue; } histogram=histograms[GetOpenMPThreadId()]; for (x=0; x < (ssize_t) linear_image->columns; x++) { register ssize_t i, u; size_t count; ssize_t j, k, n, v; /* Assign most frequent color. */ k=0; j=0; count=0; (void) ResetMagickMemory(histogram,0,NumberPaintBins* sizeof(*histogram)); for (v=0; v < (ssize_t) width; v++) { for (u=0; u < (ssize_t) width; u++) { n=(ssize_t) ScaleQuantumToChar(ClampToQuantum(GetPixelIntensity( linear_image,p+GetPixelChannels(linear_image)*(u+k)))); histogram[n]++; if (histogram[n] > count) { j=k+u; count=histogram[n]; } } k+=(ssize_t) (linear_image->columns+width); } for (i=0; i < (ssize_t) GetPixelChannels(linear_image); i++) { PixelChannel channel=GetPixelChannelChannel(linear_image,i); PixelTrait traits=GetPixelChannelTraits(linear_image,channel); PixelTrait paint_traits=GetPixelChannelTraits(paint_image,channel); if ((traits == UndefinedPixelTrait) || (paint_traits == UndefinedPixelTrait)) continue; if (((paint_traits & CopyPixelTrait) != 0) || (GetPixelReadMask(linear_image,p) == 0)) { SetPixelChannel(paint_image,channel,p[center+i],q); continue; } SetPixelChannel(paint_image,channel,p[j*GetPixelChannels(linear_image)+ i],q); } p+=GetPixelChannels(linear_image); q+=GetPixelChannels(paint_image); } if (SyncCacheViewAuthenticPixels(paint_view,exception) == MagickFalse) status=MagickFalse; if (linear_image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp critical (MagickCore_OilPaintImage) #endif proceed=SetImageProgress(linear_image,OilPaintImageTag,progress++, linear_image->rows); if (proceed == MagickFalse) status=MagickFalse; } } paint_view=DestroyCacheView(paint_view); image_view=DestroyCacheView(image_view); histograms=DestroyHistogramThreadSet(histograms); linear_image=DestroyImage(linear_image); if (status == MagickFalse) paint_image=DestroyImage(paint_image); return(paint_image); } /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % O p a q u e P a i n t I m a g e % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % OpaquePaintImage() changes any pixel that matches color with the color % defined by fill. % % By default color must match a particular pixel color exactly. However, in % many cases two colors may differ by a small amount. Fuzz defines how much % tolerance is acceptable to consider two colors as the same. For example, % set fuzz to 10 and the color red at intensities of 100 and 102 respectively % are now interpreted as the same color. % % The format of the OpaquePaintImage method is: % % MagickBooleanType OpaquePaintImage(Image *image, % const PixelInfo *target,const PixelInfo *fill, % const MagickBooleanType invert,ExceptionInfo *exception) % % A description of each parameter follows: % % o image: the image. % % o target: the RGB value of the target color. % % o fill: the replacement color. % % o invert: paint any pixel that does not match the target color. % % o exception: return any errors or warnings in this structure. % */ MagickExport MagickBooleanType OpaquePaintImage(Image *image, const PixelInfo *target,const PixelInfo *fill,const MagickBooleanType invert, ExceptionInfo *exception) { #define OpaquePaintImageTag "Opaque/Image" CacheView *image_view; MagickBooleanType status; MagickOffsetType progress; PixelInfo zero; ssize_t y; assert(image != (Image *) NULL); assert(image->signature == MagickSignature); assert(target != (PixelInfo *) NULL); assert(fill != (PixelInfo *) NULL); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse) return(MagickFalse); if ((IsGrayColorspace(image->colorspace) != MagickFalse) && (IsPixelInfoGray(fill) == MagickFalse)) (void) SetImageColorspace(image,sRGBColorspace,exception); if ((fill->alpha_trait == BlendPixelTrait) && (image->alpha_trait != BlendPixelTrait)) (void) SetImageAlpha(image,OpaqueAlpha,exception); /* Make image color opaque. */ status=MagickTrue; progress=0; GetPixelInfo(image,&zero); image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static,4) shared(progress,status) \ magick_threads(image,image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { PixelInfo pixel; register Quantum *restrict q; register ssize_t x; if (status == MagickFalse) continue; q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) { status=MagickFalse; continue; } pixel=zero; for (x=0; x < (ssize_t) image->columns; x++) { GetPixelInfoPixel(image,q,&pixel); if (IsFuzzyEquivalencePixelInfo(&pixel,target) != invert) SetPixelInfoPixel(image,fill,q); q+=GetPixelChannels(image); } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp critical (MagickCore_OpaquePaintImage) #endif proceed=SetImageProgress(image,OpaquePaintImageTag,progress++, image->rows); if (proceed == MagickFalse) status=MagickFalse; } } image_view=DestroyCacheView(image_view); return(status); } /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % T r a n s p a r e n t P a i n t I m a g e % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % TransparentPaintImage() changes the opacity value associated with any pixel % that matches color to the value defined by opacity. % % By default color must match a particular pixel color exactly. However, in % many cases two colors may differ by a small amount. Fuzz defines how much % tolerance is acceptable to consider two colors as the same. For example, % set fuzz to 10 and the color red at intensities of 100 and 102 respectively % are now interpreted as the same color. % % The format of the TransparentPaintImage method is: % % MagickBooleanType TransparentPaintImage(Image *image, % const PixelInfo *target,const Quantum opacity, % const MagickBooleanType invert,ExceptionInfo *exception) % % A description of each parameter follows: % % o image: the image. % % o target: the target color. % % o opacity: the replacement opacity value. % % o invert: paint any pixel that does not match the target color. % % o exception: return any errors or warnings in this structure. % */ MagickExport MagickBooleanType TransparentPaintImage(Image *image, const PixelInfo *target,const Quantum opacity,const MagickBooleanType invert, ExceptionInfo *exception) { #define TransparentPaintImageTag "Transparent/Image" CacheView *image_view; MagickBooleanType status; MagickOffsetType progress; PixelInfo zero; ssize_t y; assert(image != (Image *) NULL); assert(image->signature == MagickSignature); assert(target != (PixelInfo *) NULL); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse) return(MagickFalse); if (image->alpha_trait != BlendPixelTrait) (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception); /* Make image color transparent. */ status=MagickTrue; progress=0; GetPixelInfo(image,&zero); image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static,4) shared(progress,status) \ magick_threads(image,image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { PixelInfo pixel; register ssize_t x; register Quantum *restrict q; if (status == MagickFalse) continue; q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) { status=MagickFalse; continue; } pixel=zero; for (x=0; x < (ssize_t) image->columns; x++) { GetPixelInfoPixel(image,q,&pixel); if (IsFuzzyEquivalencePixelInfo(&pixel,target) != invert) SetPixelAlpha(image,opacity,q); q+=GetPixelChannels(image); } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp critical (MagickCore_TransparentPaintImage) #endif proceed=SetImageProgress(image,TransparentPaintImageTag,progress++, image->rows); if (proceed == MagickFalse) status=MagickFalse; } } image_view=DestroyCacheView(image_view); return(status); } /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % T r a n s p a r e n t P a i n t I m a g e C h r o m a % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % TransparentPaintImageChroma() changes the opacity value associated with any % pixel that matches color to the value defined by opacity. % % As there is one fuzz value for the all the channels, TransparentPaintImage() % is not suitable for the operations like chroma, where the tolerance for % similarity of two color component (RGB) can be different. Thus we define % this method to take two target pixels (one low and one high) and all the % pixels of an image which are lying between these two pixels are made % transparent. % % The format of the TransparentPaintImageChroma method is: % % MagickBooleanType TransparentPaintImageChroma(Image *image, % const PixelInfo *low,const PixelInfo *high,const Quantum opacity, % const MagickBooleanType invert,ExceptionInfo *exception) % % A description of each parameter follows: % % o image: the image. % % o low: the low target color. % % o high: the high target color. % % o opacity: the replacement opacity value. % % o invert: paint any pixel that does not match the target color. % % o exception: return any errors or warnings in this structure. % */ MagickExport MagickBooleanType TransparentPaintImageChroma(Image *image, const PixelInfo *low,const PixelInfo *high,const Quantum opacity, const MagickBooleanType invert,ExceptionInfo *exception) { #define TransparentPaintImageTag "Transparent/Image" CacheView *image_view; MagickBooleanType status; MagickOffsetType progress; ssize_t y; assert(image != (Image *) NULL); assert(image->signature == MagickSignature); assert(high != (PixelInfo *) NULL); assert(low != (PixelInfo *) NULL); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse) return(MagickFalse); if (image->alpha_trait != BlendPixelTrait) (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception); /* Make image color transparent. */ status=MagickTrue; progress=0; image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static,4) shared(progress,status) \ magick_threads(image,image,image->rows,1) #endif for (y=0; y < (ssize_t) image->rows; y++) { MagickBooleanType match; PixelInfo pixel; register Quantum *restrict q; register ssize_t x; if (status == MagickFalse) continue; q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception); if (q == (Quantum *) NULL) { status=MagickFalse; continue; } GetPixelInfo(image,&pixel); for (x=0; x < (ssize_t) image->columns; x++) { GetPixelInfoPixel(image,q,&pixel); match=((pixel.red >= low->red) && (pixel.red <= high->red) && (pixel.green >= low->green) && (pixel.green <= high->green) && (pixel.blue >= low->blue) && (pixel.blue <= high->blue)) ? MagickTrue : MagickFalse; if (match != invert) SetPixelAlpha(image,opacity,q); q+=GetPixelChannels(image); } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp critical (MagickCore_TransparentPaintImageChroma) #endif proceed=SetImageProgress(image,TransparentPaintImageTag,progress++, image->rows); if (proceed == MagickFalse) status=MagickFalse; } } image_view=DestroyCacheView(image_view); return(status); }
{ "content_hash": "7a40929667b0e045808c3b2b86e52cd9", "timestamp": "", "source": "github", "line_count": 1081, "max_line_length": 80, "avg_line_length": 32.285846438482885, "alnum_prop": 0.584395862582734, "repo_name": "leoz/ImageMagick", "id": "175d42e4cd75a483dc1b7484819defdd2c21ce09", "size": "37550", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "MagickCore/paint.c", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "15853348" }, { "name": "C++", "bytes": "875653" }, { "name": "CSS", "bytes": "42710" }, { "name": "Objective-C", "bytes": "40877" }, { "name": "Perl", "bytes": "226253" }, { "name": "Racket", "bytes": "1107" }, { "name": "Shell", "bytes": "370448" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <manifest package="com.sampsonjoliver.firestarter" xmlns:android="http://schemas.android.com/apk/res/android"> <!-- To auto-complete the email text field in the login form with the user's emails --> <uses-permission android:name="android.permission.GET_ACCOUNTS"/> <uses-permission android:name="android.permission.READ_PROFILE"/> <uses-permission android:name="android.permission.READ_CONTACTS"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-feature android:name="android.hardware.camera" android:required="false" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" /> <application android:name=".FirestarterApplication" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/> <meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/maps_api_key"/> <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.sampsonjoliver.firestarter.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"/> </provider> <!-- FirebaseInstanceIdService performs security checks at runtime, no need for explicit permissions despite exported="true" --> <service android:name=".service.FirestarterInstanceIdService" android:exported="true"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/> </intent-filter> </service> <activity android:name=".LaunchActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".views.login.LoginActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar"> </activity> <activity android:name=".views.main.HomeActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar"> </activity> <activity android:name=".views.channel.ChannelActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar"> </activity> <activity android:name=".views.channel.create.CreateChannelActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar"> </activity> <activity android:name=".views.gallery.GalleryActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar"> </activity> <activity android:name="com.facebook.CustomTabActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="@string/fb_login_protocol_scheme" /> </intent-filter> </activity> </application> </manifest>
{ "content_hash": "e4672bda7868d83cef1a009dd9984df5", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 102, "avg_line_length": 40.39784946236559, "alnum_prop": 0.6811285600212936, "repo_name": "sampsonjoliver/Firestarter", "id": "b4966d023771a83c3de372b80c05b98f4e30f7c9", "size": "3757", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/AndroidManifest.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "34733" }, { "name": "Kotlin", "bytes": "124163" } ], "symlink_target": "" }
package com.squareup.otto; import java.lang.reflect.InvocationTargetException; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.CopyOnWriteArraySet; /** * Dispatches events to listeners, and provides ways for listeners to register themselves. * * <p>The Bus allows publish-subscribe-style communication between components without requiring the components to * explicitly register with one another (and thus be aware of each other). It is designed exclusively to replace * traditional Android in-process event distribution using explicit registration or listeners. It is <em>not</em> a * general-purpose publish-subscribe system, nor is it intended for interprocess communication. * * <h2>Receiving Events</h2> * To receive events, an object should: * <ol> * <li>Expose a public method, known as the <i>event handler</i>, which accepts a single argument of the type of event * desired;</li> * <li>Mark it with a {@link com.squareup.otto.Subscribe} annotation;</li> * <li>Pass itself to an Bus instance's {@link #register(Object)} method. * </li> * </ol> * * <h2>Posting Events</h2> * To post an event, simply provide the event object to the {@link #post(Object)} method. The Bus instance will * determine the type of event and route it to all registered listeners. * * <p>Events are routed based on their type &mdash; an event will be delivered to any handler for any type to which the * event is <em>assignable.</em> This includes implemented interfaces, all superclasses, and all interfaces implemented * by superclasses. * * <p>When {@code post} is called, all registered handlers for an event are run in sequence, so handlers should be * reasonably quick. If an event may trigger an extended process (such as a database load), spawn a thread or queue it * for later. * * <h2>Handler Methods</h2> * Event handler methods must accept only one argument: the event. * * <p>Handlers should not, in general, throw. If they do, the Bus will wrap the exception and * re-throw it. * * <p>The Bus by default enforces that all interactions occur on the main thread. You can provide an alternate * enforcement by passing a {@link ThreadEnforcer} to the constructor. * * <h2>Producer Methods</h2> * Producer methods should accept no arguments and return their event type. When a subscriber is registered for a type * that a producer is also already registered for, the subscriber will be called with the return value from the * producer. * * <h2>Dead Events</h2> * If an event is posted, but no registered handlers can accept it, it is considered "dead." To give the system a * second chance to handle dead events, they are wrapped in an instance of {@link com.squareup.otto.DeadEvent} and * reposted. * * <p>This class is safe for concurrent use. * * @author Cliff Biffle * @author Jake Wharton */ public class Bus { public static final String DEFAULT_IDENTIFIER = "default"; /** All registered event handlers, indexed by event type. */ private final ConcurrentMap<Class<?>, Set<EventHandler>> handlersByType = new ConcurrentHashMap<Class<?>, Set<EventHandler>>(); /** All registered event producers, index by event type. */ private final ConcurrentMap<Class<?>, EventProducer> producersByType = new ConcurrentHashMap<Class<?>, EventProducer>(); /** Identifier used to differentiate the event bus instance. */ private final String identifier; /** Thread enforcer for register, unregister, and posting events. */ private final ThreadEnforcer enforcer; /** Used to find handler methods in register and unregister. */ private final HandlerFinder handlerFinder; /** Queues of events for the current thread to dispatch. */ private final ThreadLocal<ConcurrentLinkedQueue<EventWithHandler>> eventsToDispatch = new ThreadLocal<ConcurrentLinkedQueue<EventWithHandler>>() { @Override protected ConcurrentLinkedQueue<EventWithHandler> initialValue() { return new ConcurrentLinkedQueue<EventWithHandler>(); } }; /** True if the current thread is currently dispatching an event. */ private final ThreadLocal<Boolean> isDispatching = new ThreadLocal<Boolean>() { @Override protected Boolean initialValue() { return false; } }; /** Creates a new Bus named "default" that enforces actions on the main thread. */ public Bus() { this(DEFAULT_IDENTIFIER); } /** * Creates a new Bus with the given {@code identifier} that enforces actions on the main thread. * * @param identifier a brief name for this bus, for debugging purposes. Should be a valid Java identifier. */ public Bus(String identifier) { this(ThreadEnforcer.MAIN, identifier); } /** * Creates a new Bus named "default" with the given {@code enforcer} for actions. * * @param enforcer Thread enforcer for register, unregister, and post actions. */ public Bus(ThreadEnforcer enforcer) { this(enforcer, DEFAULT_IDENTIFIER); } /** * Creates a new Bus with the given {@code enforcer} for actions and the given {@code identifier}. * * @param enforcer Thread enforcer for register, unregister, and post actions. * @param identifier A brief name for this bus, for debugging purposes. Should be a valid Java identifier. */ public Bus(ThreadEnforcer enforcer, String identifier) { this(enforcer, identifier, HandlerFinder.ANNOTATED); } /** * Test constructor which allows replacing the default {@code HandlerFinder}. * * @param enforcer Thread enforcer for register, unregister, and post actions. * @param identifier A brief name for this bus, for debugging purposes. Should be a valid Java identifier. * @param handlerFinder Used to discover event handlers and producers when registering/unregistering an object. */ Bus(ThreadEnforcer enforcer, String identifier, HandlerFinder handlerFinder) { this.enforcer = enforcer; this.identifier = identifier; this.handlerFinder = handlerFinder; } @Override public String toString() { return "[Bus \"" + identifier + "\"]"; } /** * Registers all handler methods on {@code object} to receive events and producer methods to provide events. * <p> * If any subscribers are registering for types which already have a producer they will be called immediately * with the result of calling that producer. * <p> * If any producers are registering for types which already have subscribers, each subscriber will be called with * the value from the result of calling the producer. * * @param object object whose handler methods should be registered. */ public void register(Object object) { enforcer.enforce(this); Map<Class<?>, EventProducer> foundProducers = handlerFinder.findAllProducers(object); for (Class<?> type : foundProducers.keySet()) { final EventProducer producer = foundProducers.get(type); EventProducer previousProducer = producersByType.putIfAbsent(type, producer); //checking if the previous producer existed if (previousProducer != null) { throw new IllegalArgumentException("Producer method for type " + type + " found on type " + producer.target.getClass() + ", but already registered by type " + previousProducer.target.getClass() + "."); } Set<EventHandler> handlers = handlersByType.get(type); if (handlers != null && !handlers.isEmpty()) { for (EventHandler handler : handlers) { dispatchProducerResultToHandler(handler, producer); } } } Map<Class<?>, Set<EventHandler>> foundHandlersMap = handlerFinder.findAllSubscribers(object); for (Class<?> type : foundHandlersMap.keySet()) { Set<EventHandler> handlers = handlersByType.get(type); if (handlers == null) { //concurrent put if absent Set<EventHandler> handlersCreation = new CopyOnWriteArraySet<EventHandler>(); handlers = handlersByType.putIfAbsent(type, handlersCreation); if (handlers == null) { handlers = handlersCreation; } } final Set<EventHandler> foundHandlers = foundHandlersMap.get(type); handlers.addAll(foundHandlers); } for (Map.Entry<Class<?>, Set<EventHandler>> entry : foundHandlersMap.entrySet()) { Class<?> type = entry.getKey(); EventProducer producer = producersByType.get(type); if (producer != null && producer.isValid()) { Set<EventHandler> foundHandlers = entry.getValue(); for (EventHandler foundHandler : foundHandlers) { if (!producer.isValid()) { break; } if (foundHandler.isValid()) { dispatchProducerResultToHandler(foundHandler, producer); } } } } } private void dispatchProducerResultToHandler(EventHandler handler, EventProducer producer) { Object event = null; try { event = producer.produceEvent(); } catch (InvocationTargetException e) { throwRuntimeException("Producer " + producer + " threw an exception.", e); } if (event == null) { return; } dispatch(event, handler); } /** * Unregisters all producer and handler methods on a registered {@code object}. * * @param object object whose producer and handler methods should be unregistered. * @throws IllegalArgumentException if the object was not previously registered. */ public void unregister(Object object) { enforcer.enforce(this); Map<Class<?>, EventProducer> producersInListener = handlerFinder.findAllProducers(object); for (Map.Entry<Class<?>, EventProducer> entry : producersInListener.entrySet()) { final Class<?> key = entry.getKey(); EventProducer producer = getProducerForEventType(key); EventProducer value = entry.getValue(); if (value == null || !value.equals(producer)) { throw new IllegalArgumentException( "Missing event producer for an annotated method. Is " + object.getClass() + " registered?"); } producersByType.remove(key).invalidate(); } Map<Class<?>, Set<EventHandler>> handlersInListener = handlerFinder.findAllSubscribers(object); for (Map.Entry<Class<?>, Set<EventHandler>> entry : handlersInListener.entrySet()) { Set<EventHandler> currentHandlers = getHandlersForEventType(entry.getKey()); Collection<EventHandler> eventMethodsInListener = entry.getValue(); if (currentHandlers == null || !currentHandlers.containsAll(eventMethodsInListener)) { throw new IllegalArgumentException( "Missing event handler for an annotated method. Is " + object.getClass() + " registered?"); } for (EventHandler handler : currentHandlers) { if (eventMethodsInListener.contains(handler)) { handler.invalidate(); } } currentHandlers.removeAll(eventMethodsInListener); } } /** * Posts an event to all registered handlers. This method will return successfully after the event has been posted to * all handlers, and regardless of any exceptions thrown by handlers. * * <p>If no handlers have been subscribed for {@code event}'s class, and {@code event} is not already a * {@link DeadEvent}, it will be wrapped in a DeadEvent and reposted. * * @param event event to post. */ public void post(Object event) { enforcer.enforce(this); Set<Class<?>> dispatchTypes = flattenHierarchy(event.getClass()); boolean dispatched = false; for (Class<?> eventType : dispatchTypes) { Set<EventHandler> wrappers = getHandlersForEventType(eventType); if (wrappers != null && !wrappers.isEmpty()) { dispatched = true; for (EventHandler wrapper : wrappers) { enqueueEvent(event, wrapper); } } } if (!dispatched && !(event instanceof DeadEvent)) { post(new DeadEvent(this, event)); } dispatchQueuedEvents(); } /** * Queue the {@code event} for dispatch during {@link #dispatchQueuedEvents()}. Events are queued in-order of * occurrence so they can be dispatched in the same order. */ protected void enqueueEvent(Object event, EventHandler handler) { eventsToDispatch.get().offer(new EventWithHandler(event, handler)); } /** * Drain the queue of events to be dispatched. As the queue is being drained, new events may be posted to the end of * the queue. */ protected void dispatchQueuedEvents() { // don't dispatch if we're already dispatching, that would allow reentrancy and out-of-order events. Instead, leave // the events to be dispatched after the in-progress dispatch is complete. if (isDispatching.get()) { return; } isDispatching.set(true); try { while (true) { EventWithHandler eventWithHandler = eventsToDispatch.get().poll(); if (eventWithHandler == null) { break; } if (eventWithHandler.handler.isValid()) { dispatch(eventWithHandler.event, eventWithHandler.handler); } } } finally { isDispatching.set(false); } } /** * Dispatches {@code event} to the handler in {@code wrapper}. This method is an appropriate override point for * subclasses that wish to make event delivery asynchronous. * * @param event event to dispatch. * @param wrapper wrapper that will call the handler. */ protected void dispatch(Object event, EventHandler wrapper) { try { wrapper.handleEvent(event); } catch (InvocationTargetException e) { throwRuntimeException( "Could not dispatch event: " + event.getClass() + " to handler " + wrapper, e); } } /** * Retrieves the currently registered producer for {@code type}. If no producer is currently registered for * {@code type}, this method will return {@code null}. * * @param type type of producer to retrieve. * @return currently registered producer, or {@code null}. */ EventProducer getProducerForEventType(Class<?> type) { return producersByType.get(type); } /** * Retrieves a mutable set of the currently registered handlers for {@code type}. If no handlers are currently * registered for {@code type}, this method may either return {@code null} or an empty set. * * @param type type of handlers to retrieve. * @return currently registered handlers, or {@code null}. */ Set<EventHandler> getHandlersForEventType(Class<?> type) { return handlersByType.get(type); } /** * Flattens a class's type hierarchy into a set of Class objects. The set will include all superclasses * (transitively), and all interfaces implemented by these superclasses. * * @param concreteClass class whose type hierarchy will be retrieved. * @return {@code concreteClass}'s complete type hierarchy, flattened and uniqued. */ Set<Class<?>> flattenHierarchy(Class<?> concreteClass) { Set<Class<?>> classes = flattenHierarchyCache.get(concreteClass); if (classes == null) { classes = getClassesFor(concreteClass); flattenHierarchyCache.put(concreteClass, classes); } return classes; } private Set<Class<?>> getClassesFor(Class<?> concreteClass) { List<Class<?>> parents = new LinkedList<Class<?>>(); Set<Class<?>> classes = new HashSet<Class<?>>(); parents.add(concreteClass); while (!parents.isEmpty()) { Class<?> clazz = parents.remove(0); classes.add(clazz); Class<?> parent = clazz.getSuperclass(); if (parent != null) { parents.add(parent); } } return classes; } /** * Throw a {@link RuntimeException} with given message and cause lifted from an {@link * InvocationTargetException}. If the specified {@link InvocationTargetException} does not have a * cause, neither will the {@link RuntimeException}. */ private static void throwRuntimeException(String msg, InvocationTargetException e) { Throwable cause = e.getCause(); if (cause != null) { throw new RuntimeException(msg, cause); } else { throw new RuntimeException(msg); } } private final Map<Class<?>, Set<Class<?>>> flattenHierarchyCache = new HashMap<Class<?>, Set<Class<?>>>(); /** Simple struct representing an event and its handler. */ static class EventWithHandler { final Object event; final EventHandler handler; public EventWithHandler(Object event, EventHandler handler) { this.event = event; this.handler = handler; } } }
{ "content_hash": "4a3e7953b5cde2c877753df70db557fe", "timestamp": "", "source": "github", "line_count": 448, "max_line_length": 120, "avg_line_length": 37.714285714285715, "alnum_prop": 0.6896898674242424, "repo_name": "adennie/otto", "id": "9a0746f0dcaa183e0304ce439df9ca2d219bf5e4", "size": "17531", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "library/src/main/java/com/squareup/otto/Bus.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "93345" }, { "name": "Shell", "bytes": "604" } ], "symlink_target": "" }
import numpy as np from scipy.stats import chi2 class NormalInverseWishartDistribution(object): def __init__(self, mu, lmbda, nu, psi): self.mu = mu self.lmbda = float(lmbda) self.nu = nu self.psi = psi self.inv_psi = np.linalg.inv(psi) self.cholesky = np.linalg.cholesky(self.inv_psi) def sample(self): sigma = np.linalg.inv(self.wishartrand()) return (np.random.multivariate_normal(self.mu, sigma / float(self.lmbda)), sigma) def wishartrand(self): dim = self.inv_psi.shape[0] foo = np.zeros((dim,dim)) for i in range(dim): for j in range(i+1): if i == j: foo[i,j] = np.sqrt(chi2.rvs(self.nu-(i+1)+1)) else: foo[i,j] = np.random.normal(0,1) return np.dot(self.cholesky, np.dot(foo, np.dot(foo.T, self.cholesky.T))) x = NormalInverseWishartDistribution(np.array([0,0])-3,1.,3.,np.eye(2)) samples = [x.sample() for _ in range(100000)] var_samples = np.array([variance for mean,variance in samples]) print 'mean: {0}'.format(np.mean(var_samples, axis=0))
{ "content_hash": "3b77dc48192afbea7e144e66e7fbfa73", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 89, "avg_line_length": 35.96875, "alnum_prop": 0.5855777584708949, "repo_name": "tansey/hbayes-rl", "id": "994139f6ee713653c8d6df6d1872d8b10cb1df39", "size": "1151", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test_randwishart.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "67462" } ], "symlink_target": "" }
Users want to be able to add tags to stories without using the Tags API and they should be searchable by subtype and able to be differentiated between different use cases, such as manual vs. automatic # Proposal We propose that the necessary subtype field in tags be included in the ANS schema so that users can search on it. ## Example ```json { "_id": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "type": "story", "version": "0.10.1", "taxonomy": { "tags": [{ "_id": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "text": "some text", "description": "some description", "slug": "some-slug", "subtype": "some subtype" }] } } ``` # Implementation Omar Khan of Platform Services will implement this and add to the schema if this proposal is accepted.
{ "content_hash": "d0cbb4f6c5232dcdf675b32c5a487cf9", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 200, "avg_line_length": 27.571428571428573, "alnum_prop": 0.6826424870466321, "repo_name": "washingtonpost/ans-schema", "id": "257f46a0cff35c77aa7700afb81466f15371431f", "size": "783", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/proposals/2019-05-13_Tags_Subtype.md", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "397908" } ], "symlink_target": "" }
import logging import sys import weakref from six import u, b import six import webob from wsme.exc import ClientSideError, UnknownFunction from wsme.protocol import getprotocol from wsme.rest import scan_api from wsme import spore import wsme.api import wsme.types log = logging.getLogger(__name__) html_body = u(""" <html> <head> <style type='text/css'> %(css)s </style> </head> <body> %(content)s </body> </html> """) def default_prepare_response_body(request, results): r = None sep = None for value in results: if sep is None: if isinstance(value, six.text_type): sep = u('\n') r = u('') else: sep = b('\n') r = b('') else: r += sep r += value return r class DummyTransaction: def commit(self): pass def abort(self): pass class WSRoot(object): """ Root controller for webservices. :param protocols: A list of protocols to enable (see :meth:`addprotocol`) :param webpath: The web path where the webservice is published. :type transaction: A `transaction <http://pypi.python.org/pypi/transaction>`_-like object or ``True``. :param transaction: If specified, a transaction will be created and handled on a per-call base. This option *can* be enabled along with `repoze.tm2 <http://pypi.python.org/pypi/repoze.tm2>`_ (it will only make it void). If ``True``, the default :mod:`transaction` module will be imported and used. """ __registry__ = wsme.types.registry def __init__(self, protocols=[], webpath='', transaction=None, scan_api=scan_api): self._debug = True self._webpath = webpath self.protocols = [] self._scan_api = scan_api self._transaction = transaction if self._transaction is True: import transaction self._transaction = transaction for protocol in protocols: self.addprotocol(protocol) self._api = None def wsgiapp(self): """Returns a wsgi application""" from webob.dec import wsgify return wsgify(self._handle_request) def begin(self): if self._transaction: return self._transaction.begin() else: return DummyTransaction() def addprotocol(self, protocol, **options): """ Enable a new protocol on the controller. :param protocol: A registered protocol name or an instance of a protocol. """ if isinstance(protocol, str): protocol = getprotocol(protocol, **options) self.protocols.append(protocol) protocol.root = weakref.proxy(self) def getapi(self): """ Returns the api description. :rtype: list of (path, :class:`FunctionDefinition`) """ if self._api is None: self._api = [ (path, f, f._wsme_definition, args) for path, f, args in self._scan_api(self) ] for path, f, fdef, args in self._api: fdef.resolve_types(self.__registry__) return [ (path, fdef) for path, f, fdef, args in self._api ] def _get_protocol(self, name): for protocol in self.protocols: if protocol.name == name: return protocol def _select_protocol(self, request): log.debug("Selecting a protocol for the following request :\n" "headers: %s\nbody: %s", request.headers.items(), request.content_length and ( request.content_length > 512 and request.body[:512] or request.body) or '') protocol = None error = ClientSideError(status_code=406) path = str(request.path) assert path.startswith(self._webpath) path = path[len(self._webpath) + 1:] if 'wsmeproto' in request.params: return self._get_protocol(request.params['wsmeproto']) else: for p in self.protocols: try: if p.accept(request): protocol = p break except ClientSideError as e: error = e # If we could not select a protocol, we raise the last exception # that we got, or the default one. if not protocol: raise error return protocol def _do_call(self, protocol, context): request = context.request request.calls.append(context) try: if context.path is None: context.path = protocol.extract_path(context) if context.path is None: raise ClientSideError(u( 'The %s protocol was unable to extract a function ' 'path from the request') % protocol.name) context.func, context.funcdef, args = \ self._lookup_function(context.path) kw = protocol.read_arguments(context) args = list(args) txn = self.begin() try: result = context.func(*args, **kw) txn.commit() except Exception: txn.abort() raise else: # TODO make sure result type == a._wsme_definition.return_type return protocol.encode_result(context, result) except Exception as e: infos = wsme.api.format_exception(sys.exc_info(), self._debug) if isinstance(e, ClientSideError): request.client_errorcount += 1 request.client_last_status_code = e.code else: request.server_errorcount += 1 return protocol.encode_error(context, infos) def find_route(self, path): for p in self.protocols: for routepath, func in p.iter_routes(): if path.startswith(routepath): return routepath, func return None, None def _handle_request(self, request): res = webob.Response() res_content_type = None path = request.path if path.startswith(self._webpath): path = path[len(self._webpath):] routepath, func = self.find_route(path) if routepath: content = func() if isinstance(content, six.text_type): res.text = content elif isinstance(content, six.binary_type): res.body = content res.content_type = func._cfg['content-type'] return res if request.path == self._webpath + '/api.spore': res.body = spore.getdesc(self, request.host_url) res.content_type = 'application/json' return res try: msg = None error_status = 500 protocol = self._select_protocol(request) except ClientSideError as e: error_status = e.code msg = e.faultstring protocol = None except Exception as e: msg = ("Unexpected error while selecting protocol: %s" % str(e)) log.exception(msg) protocol = None error_status = 500 if protocol is None: if not msg: msg = ("None of the following protocols can handle this " "request : %s" % ','.join(( p.name for p in self.protocols))) res.status = error_status res.content_type = 'text/plain' try: res.text = u(msg) except TypeError: res.text = msg log.error(msg) return res request.calls = [] request.client_errorcount = 0 request.client_last_status_code = None request.server_errorcount = 0 try: context = None if hasattr(protocol, 'prepare_response_body'): prepare_response_body = protocol.prepare_response_body else: prepare_response_body = default_prepare_response_body body = prepare_response_body(request, ( self._do_call(protocol, context) for context in protocol.iter_calls(request))) if isinstance(body, six.text_type): res.text = body else: res.body = body if len(request.calls) == 1: if hasattr(protocol, 'get_response_status'): res.status = protocol.get_response_status(request) else: if request.client_errorcount == 1: res.status = request.client_last_status_code elif request.client_errorcount: res.status = 400 elif request.server_errorcount: res.status = 500 else: res.status = 200 else: res.status = protocol.get_response_status(request) res_content_type = protocol.get_response_contenttype(request) except ClientSideError as e: request.server_errorcount += 1 res.status = e.code res.text = e.faultstring except Exception: infos = wsme.api.format_exception(sys.exc_info(), self._debug) request.server_errorcount += 1 res.text = protocol.encode_error(context, infos) res.status = 500 if res_content_type is None: # Attempt to correctly guess what content-type we should return. ctypes = [ct for ct in protocol.content_types if ct] if ctypes: res_content_type = request.accept.best_match(ctypes) # If not we will attempt to convert the body to an accepted # output format. if res_content_type is None: if "text/html" in request.accept: res.text = self._html_format(res.body, protocol.content_types) res_content_type = "text/html" # TODO should we consider the encoding asked by # the web browser ? res.headers['Content-Type'] = "%s; charset=UTF-8" % res_content_type return res def _lookup_function(self, path): if not self._api: self.getapi() for fpath, f, fdef, args in self._api: if path == fpath: return f, fdef, args raise UnknownFunction('/'.join(path)) def _html_format(self, content, content_types): try: from pygments import highlight from pygments.lexers import get_lexer_for_mimetype from pygments.formatters import HtmlFormatter lexer = None for ct in content_types: try: lexer = get_lexer_for_mimetype(ct) break except Exception: pass if lexer is None: raise ValueError("No lexer found") formatter = HtmlFormatter() return html_body % dict( css=formatter.get_style_defs(), content=highlight(content, lexer, formatter).encode('utf8')) except Exception as e: log.warning( "Could not pygment the content because of the following " "error :\n%s" % e) return html_body % dict( css='', content=u('<pre>%s</pre>') % content.replace(b('>'), b('&gt;')) .replace(b('<'), b('&lt;')))
{ "content_hash": "aa58df34178f777a0b6e4bc9560bde80", "timestamp": "", "source": "github", "line_count": 372, "max_line_length": 78, "avg_line_length": 32.373655913978496, "alnum_prop": 0.5230424312878851, "repo_name": "stackforge/wsme", "id": "e71f1f783863de112f06f5fca2df2d2399f9689d", "size": "12043", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "wsme/root.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "364717" } ], "symlink_target": "" }
Android-helper ============== my self created android helper class
{ "content_hash": "45d85f1808188e8f400ecf602cd56d7f", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 36, "avg_line_length": 17, "alnum_prop": 0.6470588235294118, "repo_name": "abangadit/Android-helper", "id": "6ab01f3ac0a970e74ccdd07b097dada9ba594c52", "size": "68", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
/** * http://plugins.jquery.com/project/query-object * jQuery.query - Query String Modification and Creation for jQuery * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com) * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/). * Date: 2009/8/13 * * @author Blair Mitchelmore * @version 2.1.7 * **/ new function(settings) { // Various Settings var $separator = settings.separator || '&'; var $spaces = settings.spaces === false ? false : true; var $suffix = settings.suffix === false ? '' : '[]'; var $prefix = settings.prefix === false ? false : true; var $hash = $prefix ? settings.hash === true ? "#" : "?" : ""; var $numbers = settings.numbers === false ? false : true; jQuery.query = new function() { var is = function(o, t) { return o != undefined && o !== null && (!!t ? o.constructor == t : true); }; var parse = function(path) { var m, rx = /\[([^[]*)\]/g, match = /^([^[]+)(\[.*\])?$/.exec(path), base = match[1], tokens = []; while (m = rx.exec(match[2])) tokens.push(m[1]); return [base, tokens]; }; var set = function(target, tokens, value) { var o, token = tokens.shift(); if (typeof target != 'object') target = null; if (token === "") { if (!target) target = []; if (is(target, Array)) { target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value)); } else if (is(target, Object)) { var i = 0; while (target[i++] != null); target[--i] = tokens.length == 0 ? value : set(target[i], tokens.slice(0), value); } else { target = []; target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value)); } } else if (token && token.match(/^\s*[0-9]+\s*$/)) { var index = parseInt(token, 10); if (!target) target = []; target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value); } else if (token) { var index = token.replace(/^\s*|\s*$/g, ""); if (!target) target = {}; if (is(target, Array)) { var temp = {}; for (var i = 0; i < target.length; ++i) { temp[i] = target[i]; } target = temp; } target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value); } else { return value; } return target; }; var queryObject = function(a) { var self = this; self.keys = {}; if (a.queryObject) { jQuery.each(a.get(), function(key, val) { self.SET(key, val); }); } else { jQuery.each(arguments, function() { var q = "" + this; q = q.replace(/^[?#]/,''); // remove any leading ? || # q = q.replace(/[;&]$/,''); // remove any trailing & || ; if ($spaces) q = q.replace(/[+]/g,' '); // replace +'s with spaces jQuery.each(q.split(/[&;]/), function(){ var key = decodeURIComponent(this.split('=')[0] || ""); var val = decodeURIComponent(this.split('=')[1] || ""); if (!key) return; if ($numbers) { if (/^[+-]?[0-9]+\.[0-9]*$/.test(val)) // simple float regex val = parseFloat(val); else if (/^[+-]?[0-9]+$/.test(val)) // simple int regex val = parseInt(val, 10); } val = (!val && val !== 0) ? true : val; if (val !== false && val !== true && typeof val != 'number') val = val; self.SET(key, val); }); }); } return self; }; queryObject.prototype = { queryObject: true, has: function(key, type) { var value = this.get(key); return is(value, type); }, GET: function(key) { if (!is(key)) return this.keys; var parsed = parse(key), base = parsed[0], tokens = parsed[1]; var target = this.keys[base]; while (target != null && tokens.length != 0) { target = target[tokens.shift()]; } return typeof target == 'number' ? target : target || ""; }, get: function(key) { var target = this.GET(key); if (is(target, Object)) return jQuery.extend(true, {}, target); else if (is(target, Array)) return target.slice(0); return target; }, SET: function(key, val) { var value = !is(val) ? null : val; var parsed = parse(key), base = parsed[0], tokens = parsed[1]; var target = this.keys[base]; this.keys[base] = set(target, tokens.slice(0), value); return this; }, set: function(key, val) { return this.copy().SET(key, val); }, REMOVE: function(key) { return this.SET(key, null).COMPACT(); }, remove: function(key) { return this.copy().REMOVE(key); }, EMPTY: function() { var self = this; jQuery.each(self.keys, function(key, value) { delete self.keys[key]; }); return self; }, load: function(url) { var hash = url.replace(/^.*?[#](.+?)(?:\?.+)?$/, "$1"); var search = url.replace(/^.*?[?](.+?)(?:#.+)?$/, "$1"); return new queryObject(url.length == search.length ? '' : search, url.length == hash.length ? '' : hash); }, empty: function() { return this.copy().EMPTY(); }, copy: function() { return new queryObject(this); }, COMPACT: function() { function build(orig) { var obj = typeof orig == "object" ? is(orig, Array) ? [] : {} : orig; if (typeof orig == 'object') { function add(o, key, value) { if (is(o, Array)) o.push(value); else o[key] = value; } jQuery.each(orig, function(key, value) { if (!is(value)) return true; add(obj, key, build(value)); }); } return obj; } this.keys = build(this.keys); return this; }, compact: function() { return this.copy().COMPACT(); }, toString: function() { var i = 0, queryString = [], chunks = [], self = this; var encode = function(str) { str = str + ""; if ($spaces) str = str.replace(/ /g, "+"); return encodeURIComponent(str); }; var addFields = function(arr, key, value) { if (!is(value) || value === false) return; var o = [encode(key)]; if (value !== true) { o.push("="); o.push(encode(value)); } arr.push(o.join("")); }; var build = function(obj, base) { var newKey = function(key) { return !base || base == "" ? [key].join("") : [base, "[", key, "]"].join(""); }; jQuery.each(obj, function(key, value) { if (typeof value == 'object') build(value, newKey(key)); else addFields(chunks, newKey(key), value); }); }; build(this.keys); if (chunks.length > 0) queryString.push($hash); queryString.push(chunks.join($separator)); return queryString.join(""); } }; return new queryObject(location.search, location.hash); }; }(jQuery.query || {}); // Pass in jQuery.query as settings object
{ "content_hash": "85a1d226a9dabeaa460e182c7357cf20", "timestamp": "", "source": "github", "line_count": 225, "max_line_length": 113, "avg_line_length": 33.56, "alnum_prop": 0.47967156667990996, "repo_name": "ArabellaTech/django-basic-cms", "id": "86d47df2cc173322d0ec6b8bd8d5b5552747b70c", "size": "7551", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "basic_cms/static/pages/javascript/jquery.query-2.1.7.js", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "240711" }, { "name": "HTML", "bytes": "90577" }, { "name": "JavaScript", "bytes": "2822498" }, { "name": "PHP", "bytes": "49698" }, { "name": "Python", "bytes": "272185" } ], "symlink_target": "" }
mvn install java -jar demo/target/steamside-demo-1.0-SNAPSHOT.jar
{ "content_hash": "e3bc89670b3cd08b17bf5373ed04fce8", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 53, "avg_line_length": 32.5, "alnum_prop": 0.8153846153846154, "repo_name": "arboliveira/steamside", "id": "9e9c1fb06442fca7bf9316223639af1aa33fff1a", "size": "65", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "demo.cmd", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "128" }, { "name": "CSS", "bytes": "24713" }, { "name": "HTML", "bytes": "61141" }, { "name": "Java", "bytes": "352249" }, { "name": "JavaScript", "bytes": "501090" }, { "name": "Shell", "bytes": "75" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> <context:component-scan base-package="cz.jiripinkas.example"> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" /> </context:component-scan> <context:property-placeholder location="classpath:db.properties,classpath:email.properties" /> <import resource="data.xml" /> <import resource="db.xml" /> <import resource="task.xml" /> <import resource="security.xml" /> <bean class="org.dozer.DozerBeanMapper" /> </beans>
{ "content_hash": "969bc10db97947999b265a1cd719cb35", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 125, "avg_line_length": 39.25, "alnum_prop": 0.7558386411889597, "repo_name": "jirkapinkas/example-mailer-spring", "id": "d179560ef0fa381c9c5306189a1b229d0f7bd401", "size": "942", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/webapp/WEB-INF/spring/root-context.xml", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "791" }, { "name": "Java", "bytes": "24917" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="generator" content="pandoc" /> <meta http-equiv="X-UA-Compatible" content="IE=EDGE" /> <title>Resources</title> <script src="site_libs/header-attrs-2.13/header-attrs.js"></script> <script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link href="site_libs/bootstrap-3.3.5/css/yeti.min.css" rel="stylesheet" /> <script src="site_libs/bootstrap-3.3.5/js/bootstrap.min.js"></script> <script src="site_libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script> <script src="site_libs/bootstrap-3.3.5/shim/respond.min.js"></script> <style>h1 {font-size: 34px;} h1.title {font-size: 38px;} h2 {font-size: 30px;} h3 {font-size: 24px;} h4 {font-size: 18px;} h5 {font-size: 16px;} h6 {font-size: 12px;} code {color: inherit; background-color: rgba(0, 0, 0, 0.04);} pre:not([class]) { background-color: white }</style> <script src="site_libs/jqueryui-1.11.4/jquery-ui.min.js"></script> <link href="site_libs/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" /> <script src="site_libs/tocify-1.9.1/jquery.tocify.js"></script> <script src="site_libs/navigation-1.1/tabsets.js"></script> <link href="site_libs/highlightjs-9.12.0/textmate.css" rel="stylesheet" /> <script src="site_libs/highlightjs-9.12.0/highlight.js"></script> <link href="site_libs/font-awesome-5.1.0/css/all.css" rel="stylesheet" /> <link href="site_libs/font-awesome-5.1.0/css/v4-shims.css" rel="stylesheet" /> <style type="text/css"> code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} span.underline{text-decoration: underline;} div.column{display: inline-block; vertical-align: top; width: 50%;} div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;} ul.task-list{list-style: none;} </style> <style type="text/css">code{white-space: pre;}</style> <script type="text/javascript"> if (window.hljs) { hljs.configure({languages: []}); hljs.initHighlightingOnLoad(); if (document.readyState && document.readyState === "complete") { window.setTimeout(function() { hljs.initHighlighting(); }, 0); } } </script> <link rel="stylesheet" href="alans.css" type="text/css" /> <style type = "text/css"> .main-container { max-width: 940px; margin-left: auto; margin-right: auto; } img { max-width:100%; } .tabbed-pane { padding-top: 12px; } .html-widget { margin-bottom: 20px; } button.code-folding-btn:focus { outline: none; } summary { display: list-item; } details > summary > p:only-child { display: inline; } pre code { padding: 0; } </style> <style type="text/css"> .dropdown-submenu { position: relative; } .dropdown-submenu>.dropdown-menu { top: 0; left: 100%; margin-top: -6px; margin-left: -1px; border-radius: 0 6px 6px 6px; } .dropdown-submenu:hover>.dropdown-menu { display: block; } .dropdown-submenu>a:after { display: block; content: " "; float: right; width: 0; height: 0; border-color: transparent; border-style: solid; border-width: 5px 0 5px 5px; border-left-color: #cccccc; margin-top: 5px; margin-right: -10px; } .dropdown-submenu:hover>a:after { border-left-color: #adb5bd; } .dropdown-submenu.pull-left { float: none; } .dropdown-submenu.pull-left>.dropdown-menu { left: -100%; margin-left: 10px; border-radius: 6px 0 6px 6px; } </style> <script type="text/javascript"> // manage active state of menu based on current page $(document).ready(function () { // active menu anchor href = window.location.pathname href = href.substr(href.lastIndexOf('/') + 1) if (href === "") href = "index.html"; var menuAnchor = $('a[href="' + href + '"]'); // mark it active menuAnchor.tab('show'); // if it's got a parent navbar menu mark it active as well menuAnchor.closest('li.dropdown').addClass('active'); // Navbar adjustments var navHeight = $(".navbar").first().height() + 15; var style = document.createElement('style'); var pt = "padding-top: " + navHeight + "px; "; var mt = "margin-top: -" + navHeight + "px; "; var css = ""; // offset scroll position for anchor links (for fixed navbar) for (var i = 1; i <= 6; i++) { css += ".section h" + i + "{ " + pt + mt + "}\n"; } style.innerHTML = "body {" + pt + "padding-bottom: 40px; }\n" + css; document.head.appendChild(style); }); </script> <!-- tabsets --> <style type="text/css"> .tabset-dropdown > .nav-tabs { display: inline-table; max-height: 500px; min-height: 44px; overflow-y: auto; border: 1px solid #ddd; border-radius: 4px; } .tabset-dropdown > .nav-tabs > li.active:before { content: ""; font-family: 'Glyphicons Halflings'; display: inline-block; padding: 10px; border-right: 1px solid #ddd; } .tabset-dropdown > .nav-tabs.nav-tabs-open > li.active:before { content: "&#xe258;"; border: none; } .tabset-dropdown > .nav-tabs.nav-tabs-open:before { content: ""; font-family: 'Glyphicons Halflings'; display: inline-block; padding: 10px; border-right: 1px solid #ddd; } .tabset-dropdown > .nav-tabs > li.active { display: block; } .tabset-dropdown > .nav-tabs > li > a, .tabset-dropdown > .nav-tabs > li > a:focus, .tabset-dropdown > .nav-tabs > li > a:hover { border: none; display: inline-block; border-radius: 4px; background-color: transparent; } .tabset-dropdown > .nav-tabs.nav-tabs-open > li { display: block; float: none; } .tabset-dropdown > .nav-tabs > li { display: none; } </style> <!-- code folding --> <style type="text/css"> #TOC { margin: 25px 0px 20px 0px; } @media (max-width: 768px) { #TOC { position: relative; width: 100%; } } @media print { .toc-content { /* see https://github.com/w3c/csswg-drafts/issues/4434 */ float: right; } } .toc-content { padding-left: 30px; padding-right: 40px; } div.main-container { max-width: 1200px; } div.tocify { width: 20%; max-width: 260px; max-height: 85%; } @media (min-width: 768px) and (max-width: 991px) { div.tocify { width: 25%; } } @media (max-width: 767px) { div.tocify { width: 100%; max-width: none; } } .tocify ul, .tocify li { line-height: 20px; } .tocify-subheader .tocify-item { font-size: 0.90em; } .tocify .list-group-item { border-radius: 0px; } .tocify-subheader { display: inline; } .tocify-subheader .tocify-item { font-size: 0.95em; } </style> </head> <body> <div class="container-fluid main-container"> <!-- setup 3col/9col grid for toc_float and main content --> <div class="row"> <div class="col-xs-12 col-sm-4 col-md-3"> <div id="TOC" class="tocify"> </div> </div> <div class="toc-content col-xs-12 col-sm-8 col-md-9"> <div class="navbar navbar-default navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-bs-toggle="collapse" data-target="#navbar" data-bs-target="#navbar"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="index.html">Alan T. Arnholt</a> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li> <a href="for-students.html">For Students</a> </li> <li> <a href="resources.html">Resources</a> </li> <li> <a href="teaching.html">Teaching</a> </li> <li> <a href="https://alanarnholt.github.io/GeneralStatistics/">Misc. Stats</a> </li> <li> <a href="software.html">Software</a> </li> <li> <a href="scholarship.html">Scholarship</a> </li> <li> <a href="coolstuff.html">Cool Stuff</a> </li> </ul> <ul class="nav navbar-nav navbar-right"> <li> <a href="about.html"> <span class="glyphicon glyphicon-info-sign"></span> </a> </li> <li> <a href="https://github.com/alanarnholt/alanarnholt.github.io/"> <span class="fa fa-github fa-lg"></span> </a> </li> </ul> </div><!--/.nav-collapse --> </div><!--/.container --> </div><!--/.navbar --> <div id="header"> <h1 class="title toc-ignore">Resources</h1> </div> <div id="r" class="section level3"> <h3><img src="images/r.png" width="64" /> R</h3> <ul> <li><a href="http://www.r-project.org/">R homepage</a></li> <li><a href="http://cran.r-project.org/">Download R</a></li> <li><a href="http://www.statmethods.net/index.html">Quick R (all types of examples)</a></li> <li><a href="http://cran.r-project.org/doc/manuals/r-release/R-intro.html">An Introduction to R</a></li> <li><a href="https://bookdown.org/rdpeng/rprogdatascience/"><em>R Programming for Data Science</em> by Roger D. Peng</a></li> <li><a href="https://bookdown.org/rdpeng/exdata/"><em>Exploratory Data Analysis with R</em> by Roger D. Peng</a></li> <li><a href="https://bookdown.org/csgillespie/efficientR/"><em>Efficient R programming</em> by Colin Gillespie and Robin Lovelace</a></li> <li><a href="http://adv-r.had.co.nz/"><em>Advanced R Development</em> by Hadley Wickham</a></li> <li><a href="https://bookdown.org/Tazinho/Advanced-R-Solutions/"><em>Advanced R Solutions</em> by Malte Grosser and Henning Bumann</a></li> <li><a href="http://www.brodrigues.co/fput/"><em>Functional Programming and Unit Testing for Data Munging with R</em></a></li> <li><a href="http://nathanieldphillips.com/thepiratesguidetor/">YaRrr! The Pirate’s Guide to R by Nathaniel D. Phillips</a></li> <li><a href="http://bit.ly/UC5UDc">Roger Peng’s Computing for Data Analysis Videos</a></li> <li><a href="http://flavioazevedo.com/stats-and-r-blog/2016/9/13/learning-r-on-youtube">Learning Statistics/R on youtube</a></li> <li><a href="https://www.datacamp.com/home">DataCamp</a></li> <li><a href="https://www.codeschool.com/courses/try-r">Free Code School intro R Course</a></li> <li><a href="http://swirlstats.com">swirl</a> “swirl teaches you R programming and data science interactively, at your own pace, and right in the R console”</li> <li><a href="https://www.opencpu.org/posts/opencpu-with-docker/">Why Use Docker with R?</a></li> </ul> </div> <div id="rstudio" class="section level3"> <h3><img src="images/rstudio.jpg" width="59" /> RStudio</h3> <ul> <li><a href="https://mathr.math.appstate.edu/">ASU RStudio Server</a></li> <li><a href="http://rstudio.org/">RStudio (IDE)</a></li> <li><a href="https://www.rstudio.com/ide/download/preview">RStudio (IDE) preview relase</a></li> <li><a href="https://support.rstudio.com/hc/en-us/categories/200035113-Documentation">RStudio Documentation</a></li> <li><a href="https://www.rstudio.com/resources/cheatsheets/">RStudio Cheat Sheets</a></li> <li><a href="https://www.rstudio.com/rviews/2016/11/11/easy-tricks-you-mightve-missed/">RStudio Easy Tricks for V1.0</a></li> </ul> </div> <div id="data-camp" class="section level3"> <h3><img src="images/DataCamp.png" width="55" /> Data Camp</h3> <ul> <li><a href="https://www.datacamp.com/courses/tech:r">Data Science Courses Using R</a></li> <li><a href="https://www.datacamp.com/courses/tech:python">Data Science Courses Using Python</a></li> </ul> </div> <div id="graphics" class="section level3"> <h3><img src="images/ggplot2.png" width="59" /> Graphics</h3> <ul> <li><a href="https://r-graphics.org/">R Graphics Cookbook, 2nd edition</a></li> <li><a href="http://www.r-graph-gallery.com/">The <code>R</code> Graph Gallery</a></li> <li><a href="http://docs.ggplot2.org/current/"><code>ggplot2</code> documentation</a></li> <li><a href="http://ggplot2.org/"><code>ggplot2</code> Main Page</a></li> <li><a href="http://ggplot2.org/book/"><code>ggplot2</code> Book</a></li> <li><a href="http://www.cookbook-r.com/Graphs/">Cookbook for R</a></li> <li><a href="http://lmdvr.r-forge.r-project.org/figures/figures.html">Lattice: Multivariate Data Visualization with R - Figures and code</a></li> <li><a href="http://shinyapps.stat.ubc.ca/r-graph-catalog/">Graph Catalog <code>ggplot2</code></a></li> <li><a href="https://www.rstudio.com/resources/webinars/the-grammar-and-graphics-of-data-science/">The Grammar and Graphics of Data Science (Video)</a> (58:50)</li> <li><a href="https://cpsievert.github.io/plotly_book/"><code>plotly</code> for R</a></li> <li><a href="https://www.datacamp.com/community/open-courses/plotly-tutorial-plotly-and-r">Plotly tutorial: Plotly and R</a></li> <li><a href="https://bookdown.org/paulcbauer/idv2/"><em>Interactive Data Visualization (2nd Day)</em> by Paul C. Bauer and Richard Traunmüller</a></li> <li><a href="http://rich-iannone.github.io/DiagrammeR/">DiagrammeR</a></li> </ul> </div> <div id="shiny-apps" class="section level3"> <h3><img src="images/shiny.png" width="59" /> Shiny Apps</h3> <ul> <li><a href="http://shiny.rstudio.com/">Shiny</a></li> <li><a href="https://shinyapps.io">shinyapps.io server</a></li> <li><a href="https://plotly-r.com/">Interactive web-based data visualization with R, plotly, and shiny</a></li> <li><a href="http://docs.rstudio.com/shinyapps.io/">Shiny Apps Documentation</a></li> <li><a href="https://www.rstudio.com/resources/cheatsheets/">Shiny Cheatsheet</a></li> <li><a href="http://stat545.com/shiny01_activity.html">Building Shiny Apps</a></li> <li><a href="https://alanarnholt.shinyapps.io/CISIMG">Simulating Confidence Intervals (running on RStudio Shiny Apps server)</a></li> <li><a href="https://mathr.math.appstate.edu/shiny/NormApp3/">Normal Distribution Calculator (running on Appalachian’s Shiny server)</a></li> <li><a href="https://alanarnholt.shinyapps.io/norm_area2/">Normal Distribution Calculator (running on RStudio Shiny Apps server)</a></li> <li><a href="http://alanarnholt.com/shiny/NormalApp/">Normal Distribution Calculator (running on Alan’s Droplet)</a></li> <li><a href="http://alanarnholt.com/shiny/NormApp3/">Normal Distribution Calculator (with more features running on Alan’s Droplet)</a></li> <li><a href="http://alanarnholt.com/shiny/SamplingDist/">Sampling Distributions (running on Alan’s Droplet)</a></li> <li><a href="http://deanattali.com/2015/05/09/setup-rstudio-shiny-server-digital-ocean/">How to get your very own RStudio Server and Shiny Server with DigitalOcean</a></li> </ul> </div> <div id="r-package-building" class="section level3"> <h3><img src="images/devtools.png" width="60" /> R Package Building</h3> <ul> <li><a href="http://r-pkgs.had.co.nz/"><em>R Packages</em> by Hadley Wickham</a></li> <li><a href="https://bookdown.org/rdpeng/RProgDA/"><em>Mastering Software Development in R</em> by Roger D. Peng, Sean Kross, and Brooke Anderson</a></li> <li><a href="http://hafen.github.io/packagedocs/"><code>packagedocs</code></a></li> <li><a href="https://hadley.github.io/pkgdown/"><code>pkgdown</code></a></li> </ul> </div> <div id="using-dplyr" class="section level3"> <h3><img src="images/dplyr.png" width="59" /> Using <a href="https://cran.r-project.org/web/packages/dplyr/index.html"><code>dplyr</code></a></h3> <ul> <li><a href="https://cran.r-project.org/web/packages/dplyr/vignettes/dplyr.html">Introduction to <code>dplyr</code> vignette</a></li> <li><a href="http://www.dataschool.io/dplyr-tutorial-for-faster-data-manipulation-in-r/"><code>dplyr</code> video1-tutorial</a></li> <li><a href="http://www.dataschool.io/dplyr-tutorial-part-2/"><code>dplyr</code> video2-tutorial</a></li> </ul> </div> <div id="reproducible-analysis" class="section level3"> <h3><img src="images/knitr.png" width="59" />Reproducible Analysis</h3> <ul> <li><a href="http://yihui.name/knitr/"><code>knitr</code> Homepage</a></li> <li><a href="https://github.com/yihui/knitr"><code>knitr</code> Package Development on GitHub</a></li> <li><a href="https://bookdown.org/yihui/bookdown/"><em>Bookdown: Authoring Books with R Markdown</em> by Yihui Xie</a></li> <li><a href="https://github.com/christophergandrud/Rep-Res-Book"><em>Reproducible Research with</em> R/RStudio Development on GitHub</a></li> <li><a href="http://cran.r-project.org/web/views/ReproducibleResearch.html">CRAN views of Reproducible Analysis</a></li> <li><a href="https://www.rstudio.com/resources/webinars/reproducible-reporting/">Reproducible Reporting (Video)</a> (58:03)</li> <li><a href="https://ismayc.github.io/rbasics-book/"><em>Getting used to R, RStudio, and R Markdown</em> by Chester Ismay</a></li> <li><a href="https://ismayc.github.io/thesisdown_book/index.html"><em>My Final College Paper</em> by Chester Ismay</a></li> <li><a href="http://www.britishecologicalsociety.org/wp-content/uploads/2017/12/guide-to-reproducible-code.pdf"><em>A Guide to Reproducible Code in Ecology and Evolution</em></a></li> <li><a href="http://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1005510"><em>Good enough practices in scientific computing</em></a></li> </ul> </div> <div id="r-markdown" class="section level3"> <h3><img src="images/rmarkdown.png" width="59" /> R Markdown</h3> <ul> <li><a href="https://bookdown.org/yihui/rmarkdown/"><em>R Markdown: The Definitive Guide</em> by Yihui Xie, J. J. Allaire, and Garrett Grolemund</a></li> <li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/">R Markdown Cookbook</a></li> <li><a href="http://rmarkdown.rstudio.com">R Markdown V2</a></li> <li><a href="https://support.rstudio.com/hc/en-us/sections/200149716-R-Markdown">Using R Markdown</a></li> <li><a href="https://www.rstudio.com/resources/webinars/getting-started-with-r-markdown/">Getting started with R Markdown (Video)</a> (1:02:44)</li> <li><a href="http://daringfireball.net/projects/markdown/">Markdown</a></li> </ul> </div> <div id="creating-slides-with-r" class="section level3"> <h3><img src="images/rmarkdown.png" width="59" /> Creating Slides with R</h3> <ul> <li><a href="http://rmarkdown.rstudio.com/ioslides_presentation_format.html#overview">R Markdown - ioslides, reveal.js, Slidy, and Beamer</a></li> <li><a href="https://github.com/yihui/xaringan"><code>xaringan</code></a></li> <li><a href="https://support.rstudio.com/hc/en-us/sections/200130218-R-Presentations">R Presentations</a></li> </ul> </div> <div id="git" class="section level3"> <h3><img src="images/git.jpg" width="64" /> Git</h3> <ul> <li><a href="http://happygitwithr.com/"><em>Happy Git and GitHub for the useR</em> by Jenny Bryan and the STAT 545 TAs</a></li> <li><a href="http://git-scm.com">Download Git</a></li> <li><a href="https://help.github.com/">GitHub Help Page</a></li> <li><a href="https://www.atlassian.com/git/tutorial">Git Tutorials (bitbucket)</a></li> <li><a href="http://gitimmersion.com/lab_03.html">Create a Project</a></li> <li><a href="http://www.ndpsoftware.com/git-cheatsheet.html">Git Cheatsheet</a></li> <li><a href="https://www.codeschool.com/courses/try-git">Free Code School Intro to Git</a></li> <li><a href="http://git-scm.com/book">Pro Git Book</a></li> <li><a href="http://try.github.io/levels/1/challenges/1">Try Git on GitHub</a></li> <li><a href="http://www.pgbovine.net/git-tutorial.htm">Phillip Guo’s Basic Git and Github tutorials (Three tutorials about 10 minutes each)</a></li> <li><a href="https://www.youtube.com/watch?v=YxZ8J2rqhEM">Clone a GitHub Repo with RStudio (Video)</a> (5:05)</li> <li><a href="https://github.com/alanarnholt/Homework-Examples/blob/master/Slides/ForkCloneRStudio.pdf">Clone a GitHub Repo with RStudio (Slides)</a></li> <li><a href="https://www.rstudio.com/resources/webinars/collaboration-and-time-travel-version-control-with-git-github-and-rstudio/">Collaboration and time travel: version control with git, github and RStudio (Video)</a> (48:56)</li> </ul> </div> <div id="using-unix-like-commands" class="section level3"> <h3><img src="images/linux2.png" width="61" /> Using Unix Like Commands</h3> <ul> <li><a href="http://web.mit.edu/mprat/Public/web/Terminus/Web/main.html">Play Terminus to learn basics of the shell</a></li> <li><a href="http://www.pgbovine.net/command-line-tutorial.htm">Phillip Guo’s Unix-like command line tutorials (Four tutorials about 10 minutes each)</a></li> <li><a href="http://www.ee.surrey.ac.uk/Teaching/Unix/">Michael Stonebank’s Unix Tutorial for Beginners</a></li> </ul> </div> <div id="data-science" class="section level3"> <h3>Data Science</h3> <ul> <li><a href="http://r4ds.had.co.nz/"><em>R for Data Science</em> by Garrett Grolemund and Hadley Wickham</a></li> <li><a href="https://moderndive.com/"><em>MODERN DIVE: An Introduction to Statistical and Data Sciences via R</em> by Chester Ismay and Albert Y. Kim</a></li> <li><a href="https://scientistcafe.com/ids/"><em>Introduction to Data Science</em> by Hui Lin and Ming Li</a></li> <li><a href="https://ubc-dsci.github.io/introduction-to-datascience/"><em>Introduction to Data Science</em> by Tiffany-Anne Timbers, Trevor Campbell and Melissa Lee</a></li> <li><a href="http://topepo.github.io/caret/index.html">The <strong>caret</strong> Package</a></li> <li><a href="http://www.feat.engineering/"><em>Feature Engineering and Selection: A Practical Approach for Predictive Models</em> by Max Kuhn and Kjell Johnson</a></li> <li><a href="https://www.tidymodels.org/">Tidymodels</a></li> <li><a href="http://tidytextmining.com/"><em>Tidy Text Mining with R</em> by Julia Silge and David Robinson</a></li> <li><a href="http://togaware.com/onepager/">OnePageR</a></li> <li><a href="https://christophm.github.io/interpretable-ml-book/"><em>Interpretable Machine Learning</em> by Christoph Molnar</a></li> <li><a href="https://bookdown.org/roback/bookdown-BeyondMLR/"><em>Beyond Multiple Linear Regression</em></a></li> <li><a href="https://community.cloud.databricks.com/"><em>Databricks</em>—Databricks Community Edition</a></li> </ul> </div> <div id="latex" class="section level3"> <h3><span class="math inline">\(\LaTeX\)</span></h3> <ul> <li><a href="http://tug.org/mactex/">Download LaTeX for Macs (TeXLive)</a></li> <li><a href="http://miktex.org/">Download LaTeX for Windows (MikTeX)</a></li> <li><a href="http://www.ctan.org/pkg/math-into-latex-4">More Math into LaTeX</a></li> <li><a href="http://www.tug.org/begin.html">Getting started with LaTeX</a></li> <li><a href="http://en.wikipedia.org/wiki/LaTeX">LaTeX Wikipedia</a></li> <li><a href="http://detexify.kirelabs.org/classify.html">Clever help finding LaTeX symbols</a></li> </ul> </div> <div id="zotero" class="section level3"> <h3>Zotero</h3> <ul> <li><a href="https://stat-ata-asu.github.io/STT2810HonorsClassRepo/RMarkdown/ZoteroInClass.html">Using Zotero</a></li> </ul> </div> <div id="other-interesting-stuff" class="section level3"> <h3>Other Interesting Stuff</h3> <ul> <li><a href="http://r-bloggers.com">R-bloggers</a></li> <li><a href="http://blog.revolutionanalytics.com/2014/01/john-chambers-recounts-the-history-of-s-and-r.html">John Chambers recounts the history of S and R</a></li> </ul> <hr /> </div> <div id="footer"> <p><strong>Alan T. Arnholt,</strong> Ph.D. </br> Professor of Statistics </br> <a href="mailto:arnholtat@appstate.edu"> arnholtat@appstate.edu</a> </br> <img src="images/asu-logo-white-600.png" style="background-color:black; width:180px; float:left;" width = /> </p> <p><strong>Office Hours</strong> </br> <a href="https://calendar.google.com/calendar/u/0/selfsched?sstoken=UUtZb3I1Z1pFczdjfGRlZmF1bHR8MTZjOTU5MGY0ZTFlOTA2MmExNzhlYWQ5MGIzZWQ0OGM"> Click for Availability</a> </br> </p> <p> <strong>Mailing Address</strong><br /> <a href = "http://www.appstate.edu/"> Appalachian State University</a><br /> <a href= "https://mathsci.appstate.edu/"> Department of Mathematical Sciences</a><br /> Walker Hall 237<br /> 121 Bodenheimer Dr<br /> Boone, NC 28608 </p> </div> </div> </div> </div> <script> // add bootstrap table styles to pandoc tables function bootstrapStylePandocTables() { $('tr.odd').parent('tbody').parent('table').addClass('table table-condensed'); } $(document).ready(function () { bootstrapStylePandocTables(); }); </script> <!-- tabsets --> <script> $(document).ready(function () { window.buildTabsets("TOC"); }); $(document).ready(function () { $('.tabset-dropdown > .nav-tabs > li').click(function () { $(this).parent().toggleClass('nav-tabs-open'); }); }); </script> <!-- code folding --> <script> $(document).ready(function () { // temporarily add toc-ignore selector to headers for the consistency with Pandoc $('.unlisted.unnumbered').addClass('toc-ignore') // move toc-ignore selectors from section div to header $('div.section.toc-ignore') .removeClass('toc-ignore') .children('h1,h2,h3,h4,h5').addClass('toc-ignore'); // establish options var options = { selectors: "h1,h2,h3", theme: "bootstrap3", context: '.toc-content', hashGenerator: function (text) { return text.replace(/[.\\/?&!#<>]/g, '').replace(/\s/g, '_'); }, ignoreSelector: ".toc-ignore", scrollTo: 0 }; options.showAndHide = false; options.smoothScroll = true; // tocify var toc = $("#TOC").tocify(options).data("toc-tocify"); }); </script> <!-- dynamically load mathjax for compatibility with self-contained --> <script> (function () { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; document.getElementsByTagName("head")[0].appendChild(script); })(); </script> </body> </html>
{ "content_hash": "456992838694a625a39ec0606e388e8b", "timestamp": "", "source": "github", "line_count": 678, "max_line_length": 232, "avg_line_length": 37.52654867256637, "alnum_prop": 0.6765711590614314, "repo_name": "alanarnholt/alanarnholt.github.io", "id": "b78718c3693d802f049fde0d83070097a5d8c79e", "size": "25472", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "resources.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "107113" }, { "name": "HTML", "bytes": "132138" }, { "name": "JavaScript", "bytes": "1423875" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using Elasticsearch.Net; namespace Nest { using GetIndexResponseConverter = Func<IElasticsearchResponse, Stream, GetIndexResponse>; public partial class ElasticClient { /// <inheritdoc /> public IGetIndexResponse GetIndex(Func<GetIndexDescriptor, GetIndexDescriptor> getIndexSelector) { return this.Dispatch<GetIndexDescriptor, GetIndexRequestParameters, GetIndexResponse>( getIndexSelector, (p, d) => this.RawDispatch.IndicesGetDispatch<GetIndexResponse>( p.DeserializationState(new GetIndexResponseConverter(this.DeserializeGetIndexResponse)) ) ); } /// <inheritdoc /> public IGetIndexResponse GetIndex(IGetIndexRequest createIndexRequest) { return this.Dispatch<IGetIndexRequest, GetIndexRequestParameters, GetIndexResponse>( createIndexRequest, (p, d) => this.RawDispatch.IndicesGetDispatch<GetIndexResponse>( p.DeserializationState(new GetIndexResponseConverter(this.DeserializeGetIndexResponse)) ) ); } /// <inheritdoc /> public Task<IGetIndexResponse> GetIndexAsync(Func<GetIndexDescriptor, GetIndexDescriptor> getIndexSelector) { return this.DispatchAsync<GetIndexDescriptor, GetIndexRequestParameters, GetIndexResponse, IGetIndexResponse>( getIndexSelector, (p, d) => this.RawDispatch.IndicesGetDispatchAsync<GetIndexResponse>( p.DeserializationState(new GetIndexResponseConverter(this.DeserializeGetIndexResponse)) ) ); } /// <inheritdoc /> public Task<IGetIndexResponse> GetIndexAsync(IGetIndexRequest createIndexRequest) { return this.DispatchAsync<IGetIndexRequest, GetIndexRequestParameters, GetIndexResponse, IGetIndexResponse>( createIndexRequest, (p, d) => this.RawDispatch.IndicesGetDispatchAsync<GetIndexResponse>( p.DeserializationState(new GetIndexResponseConverter(this.DeserializeGetIndexResponse)) ) ); } private GetIndexResponse DeserializeGetIndexResponse(IElasticsearchResponse response, Stream stream) { return new GetIndexResponse { Indices = this.Serializer.Deserialize<Dictionary<string, IndexSettings>>(stream) }; } } }
{ "content_hash": "54720152a522ce921467f12fffece0a1", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 113, "avg_line_length": 33.134328358208954, "alnum_prop": 0.7801801801801802, "repo_name": "amyzheng424/elasticsearch-net", "id": "9fa4741bc4adce109f84acdb6f74c9ba703a3de2", "size": "2222", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "src/Nest/ElasticClient-GetIndex.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "9015358" }, { "name": "F#", "bytes": "17125" }, { "name": "HTML", "bytes": "225136" }, { "name": "Pascal", "bytes": "85615" }, { "name": "PowerShell", "bytes": "90477" }, { "name": "Shell", "bytes": "5058" } ], "symlink_target": "" }
<?php namespace IPCApplicationBundle\DataFixtures\PHPCR; use Doctrine\Common\DataFixtures\FixtureInterface; use Doctrine\Common\DataFixtures\OrderedFixtureInterface; use Doctrine\Common\Persistence\ObjectManager; use Doctrine\ODM\PHPCR\DocumentManager; use Symfony\Cmf\Bundle\ContentBundle\Doctrine\Phpcr\StaticContent; use Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\Menu; use Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\MenuNode; use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route; /** * @author Maximilian Berghoff <Maximilian.Berghoff@mayflower.de> */ class LoadAdvancedExample implements FixtureInterface, OrderedFixtureInterface { /** * Load data fixtures with the passed EntityManager * * @param ObjectManager|DocumentManager $manager */ public function load(ObjectManager $manager) { $contentParent = $manager->find(null, '/cms/content'); $routeParent = $manager->find(null, '/cms/routes'); $menuBase = $manager->find(null, '/cms/menu'); $enRoute = new Route(); $enRoute->setPosition($routeParent, 'en'); $manager->persist($enRoute); $deRoute = new Route(); $deRoute->setPosition($routeParent, 'de'); $manager->persist($deRoute); $enServiceRoute = new Route(); $enServiceRoute->setPosition($enRoute, 'services'); $manager->persist($enServiceRoute); $deServiceRoute = new Route(); $deServiceRoute->setPosition($deRoute, 'dienstleistungen'); $manager->persist($deServiceRoute); $content = new StaticContent(); $content->setParentDocument($contentParent); $content->setName('symfony-service'); $manager->persist($content); $content->setTitle('Symfony Service'); $content->setBody('A page about Symfony service'); $manager->bindTranslation($content, 'en'); $contentRoute = new Route(); $contentRoute->setPosition($enServiceRoute, 'symfony-service'); $contentRoute->setContent($content); $manager->persist($contentRoute); $content->setTitle('Symfony Dienstleistungen'); $content->setBody('Eine Seite über Symfony Dienstleistungen'); $manager->bindTranslation($content, 'de'); $contentRoute = new Route(); $contentRoute->setPosition($deServiceRoute, 'symfony-dienstleistungen'); $contentRoute->setContent($content); $manager->persist($contentRoute); $menu = new Menu(); $menu->setPosition($menuBase, 'footer'); $manager->persist($menu); $menuNode = new MenuNode(); $menuNode->setParentDocument($menu); $menuNode->setContent($content); $menuNode->setName('symfony-service'); $manager->persist($menuNode); $menuNode->setLabel('Symfony Services'); $manager->bindTranslation($menuNode, 'en'); $menuNode->setLabel('Symfony Dienstleistungen'); $manager->bindTranslation($menuNode, 'de'); $manager->flush(); } /** * Get the order of this fixture * * @return integer */ public function getOrder() { return 3; } }
{ "content_hash": "0ade44d38fd396d4a2ff2f230f2376cf", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 80, "avg_line_length": 34.236559139784944, "alnum_prop": 0.652324120603015, "repo_name": "ElectricMaxxx/ipc-cmf-example-application", "id": "e6f86dffd693ff19a655ba8ae6519d4c780ff508", "size": "3185", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/IPCApplicationBundle/DataFixtures/PHPCR/LoadAdvancedExample.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "2907" }, { "name": "CSS", "bytes": "225" }, { "name": "HTML", "bytes": "3032" }, { "name": "PHP", "bytes": "23857" } ], "symlink_target": "" }
@interface PodsDummy_Reindeer : NSObject @end @implementation PodsDummy_Reindeer @end
{ "content_hash": "b69e3987e287c272efcc63f618e0763e", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 40, "avg_line_length": 21.5, "alnum_prop": 0.8255813953488372, "repo_name": "Evilcome/Reindeer", "id": "0cd05e03e18a14e67c1191ea514faf40b7c95d73", "size": "120", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Example/Pods/Target Support Files/Reindeer/Reindeer-dummy.m", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "2754" }, { "name": "Ruby", "bytes": "1782" }, { "name": "Shell", "bytes": "17405" }, { "name": "Swift", "bytes": "232249" } ], "symlink_target": "" }
package org.jboss.seam.faces.test.weld.projectstage; public class NoStageRestrictionBean { }
{ "content_hash": "2022e22f05b21ff6e76e2ee8f6189b42", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 52, "avg_line_length": 19, "alnum_prop": 0.8105263157894737, "repo_name": "Purushottam2005/faces", "id": "30931c7ea675fa5f4d7f84abab1f1afb93f3cf8e", "size": "95", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "testsuite/src/test/java/org/jboss/seam/faces/test/weld/projectstage/NoStageRestrictionBean.java", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }