The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code: DatasetGenerationError
Exception: TypeError
Message: Couldn't cast array of type
struct<content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, symlink_target: string>
to
{'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}
Traceback: Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2011, in _prepare_split_single
writer.write_table(table)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/arrow_writer.py", line 585, in write_table
pa_table = table_cast(pa_table, self._schema)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2302, in table_cast
return cast_table_to_schema(table, schema)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2261, in cast_table_to_schema
arrays = [cast_array_to_feature(table[name], feature) for name, feature in features.items()]
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2261, in <listcomp>
arrays = [cast_array_to_feature(table[name], feature) for name, feature in features.items()]
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 1802, in wrapper
return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 1802, in <listcomp>
return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2122, in cast_array_to_feature
raise TypeError(f"Couldn't cast array of type\n{_short_str(array.type)}\nto\n{_short_str(feature)}")
TypeError: Couldn't cast array of type
struct<content_hash: string, timestamp: string, source: string, line_count: int64, max_line_length: int64, avg_line_length: double, alnum_prop: double, repo_name: string, id: string, size: string, binary: bool, copies: string, ref: string, path: string, mode: string, license: string, language: list<item: struct<name: string, bytes: string>>, symlink_target: string>
to
{'content_hash': Value(dtype='string', id=None), 'timestamp': Value(dtype='string', id=None), 'source': Value(dtype='string', id=None), 'line_count': Value(dtype='int64', id=None), 'max_line_length': Value(dtype='int64', id=None), 'avg_line_length': Value(dtype='float64', id=None), 'alnum_prop': Value(dtype='float64', id=None), 'repo_name': Value(dtype='string', id=None), 'id': Value(dtype='string', id=None), 'size': Value(dtype='string', id=None), 'binary': Value(dtype='bool', id=None), 'copies': Value(dtype='string', id=None), 'ref': Value(dtype='string', id=None), 'path': Value(dtype='string', id=None), 'mode': Value(dtype='string', id=None), 'license': Value(dtype='string', id=None), 'language': [{'name': Value(dtype='string', id=None), 'bytes': Value(dtype='string', id=None)}]}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
builder.download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
self._download_and_prepare(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
text
string | meta
dict |
|---|---|
<?xml version="1.0"?>
<config>
<modules>
<Bitbull_Soisy>
<version>0.6.2</version>
</Bitbull_Soisy>
</modules>
<global>
<models>
<soisy>
<class>Bitbull_Soisy_Model</class>
</soisy>
</models>
<blocks>
<soisy>
<class>Bitbull_Soisy_Block</class>
</soisy>
</blocks>
<helpers>
<soisy>
<class>Bitbull_Soisy_Helper</class>
</soisy>
</helpers>
<resources>
<soisy_setup>
<setup>
<module>Bitbull_Soisy</module>
<class>Bitbull_Soisy_Model_Resource_Setup</class>
</setup>
</soisy_setup>
</resources>
</global>
<frontend>
<layout>
<updates>
<soisy>
<file>soisy.xml</file>
</soisy>
</updates>
</layout>
<events>
<checkout_onepage_controller_success_action>
<observers>
<soisy_redirect>
<class>soisy/observer</class>
<method>setOrdersIds</method>
</soisy_redirect>
</observers>
</checkout_onepage_controller_success_action>
</events>
<routers>
<soisy>
<use>standard</use>
<args>
<frontName>soisy</frontName>
<module>Bitbull_Soisy</module>
</args>
</soisy>
</routers>
<translate>
<modules>
<Bitbull_Soisy>
<files>
<default>Bitbull_Soisy.csv</default>
</files>
</Bitbull_Soisy>
</modules>
</translate>
</frontend>
<adminhtml>
<translate>
<modules>
<Bitbull_Soisy>
<files>
<default>Bitbull_Soisy.csv</default>
</files>
</Bitbull_Soisy>
</modules>
</translate>
</adminhtml>
<default>
<payment>
<soisy>
<active>0</active>
<model>soisy/soisy</model>
<percentage>100</percentage>
<order_status>pending</order_status>
<title>Finanziamento con Soisy</title>
<terms_and_conditions>https://www.soisy.it/privacy-policy/</terms_and_conditions>
<allowspecific>0</allowspecific>
<group>offline</group>
<instalments>12</instalments>
<zero_interest>0</zero_interest>
<min_order_total>250</min_order_total>
<max_order_total>20000</max_order_total>
<loan_quote_placement>price-box</loan_quote_placement>
<checkout_loan_quote_placement>checkout-review-table</checkout_loan_quote_placement>
<cart_loan_quote_placement>cart-totals #shopping-cart-totals-table</cart_loan_quote_placement>
<information_about_loan>min</information_about_loan>
<loan_quote_text_checkout>You can also pay instalments, eg {INSTALMENT_AMOUNT}, in {INSTALMENT_PERIOD} months, with a total cost of {TOTAL_REPAID} and TAEG {TAEG}. Just choose "Pay with Soisy" when choosing the payment method</loan_quote_text_checkout>
<loan_quote_text_cart>You can also pay instalments, eg {INSTALMENT_AMOUNT}, in {INSTALMENT_PERIOD} months, with a total cost of {TOTAL_REPAID} and TAEG {TAEG}. Just choose "Pay with Soisy" when choosing the payment method</loan_quote_text_cart>
<loan_quote_text_product>You can also pay instalments, eg {INSTALMENT_AMOUNT}, in {INSTALMENT_PERIOD} months, with a total cost of {TOTAL_REPAID} and TAEG {TAEG}. Just choose "Pay with Soisy" when choosing the payment method</loan_quote_text_product>
<sandbox_mode>0</sandbox_mode>
</soisy>
</payment>
</default>
</config>
|
{
"content_hash": "f21f4a1511f6b7030c9292a79128d368",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 257,
"avg_line_length": 29.425925925925927,
"alnum_prop": 0.6633102580239144,
"repo_name": "soisy/soisy-magento-plugin",
"id": "8be021df795d8d8e50e2050d72d0637de5470c4c",
"size": "3178",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/code/community/Bitbull/Soisy/etc/config.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "15604"
},
{
"name": "JavaScript",
"bytes": "3179"
},
{
"name": "PHP",
"bytes": "40561"
},
{
"name": "Shell",
"bytes": "667"
}
]
}
|
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR;
using OnTheRoad.Logic.Contracts;
namespace OnTheRoad.MVC.Hubs
{
public class ChatHub : Hub
{
private readonly IConversationService conversationService;
public ChatHub(IConversationService conversationService)
{
this.conversationService = conversationService;
}
public void SendMessage(string toUsername, string text)
{
var fromUsername = this.Context.User.Identity.Name;
this.conversationService.SendMessage(text, fromUsername, toUsername);
this.Clients.Group(toUsername).addMessage(text, fromUsername);
this.Clients.Group(fromUsername).addMessage(text, fromUsername);
}
public override Task OnConnected()
{
string name = this.Context.User.Identity.Name;
this.Groups.Add(this.Context.ConnectionId, name);
return base.OnConnected();
}
}
}
|
{
"content_hash": "15620c4e14be84b3ac8b46c0d2602d2c",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 81,
"avg_line_length": 29.323529411764707,
"alnum_prop": 0.6579739217652959,
"repo_name": "george-georgiev/on-the-road",
"id": "396f211509052fb63663fcfc4061661b32ca2f41",
"size": "999",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "OnTheRoad/OnTheRoad.MVC/Hubs/ChatHub.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "104"
},
{
"name": "C#",
"bytes": "687975"
},
{
"name": "CSS",
"bytes": "82143"
},
{
"name": "HTML",
"bytes": "6676"
},
{
"name": "JavaScript",
"bytes": "231298"
}
]
}
|
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ScalaProjectSettings">
<option name="ignorePerformance" value="true" />
</component>
</project>
|
{
"content_hash": "0a18a96c0a121e220477fb4c926621f3",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 52,
"avg_line_length": 30.166666666666668,
"alnum_prop": 0.6850828729281768,
"repo_name": "laxmanjangley/FFrame",
"id": "348d2d79d0fc970335f248671a2b52f3cc80a086",
"size": "181",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": ".idea/scala_settings.xml",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "1187"
},
{
"name": "Java",
"bytes": "5690"
},
{
"name": "Python",
"bytes": "311"
},
{
"name": "Scala",
"bytes": "29357"
}
]
}
|
package org.usfirst.frc.team2791.practicebotSubsystems;
import edu.wpi.first.wpilibj.AnalogInput;
import edu.wpi.first.wpilibj.CANTalon;
import edu.wpi.first.wpilibj.Servo;
import org.usfirst.frc.team2791.abstractSubsystems.AbstractShakerShooterWheels;
/**
* Created by Akhil on 4/10/2016.
* This class is used for the practice robot which utilizes different ports
* electronics(solenoids) and ports than the competiton robot
*/
public class PracticeShakerShooterWheels extends AbstractShakerShooterWheels {
public PracticeShakerShooterWheels() {
super();
leftShooterTalon = new CANTalon(PracticebotPorts.SHOOTER_TALON_LEFT_PORT);
rightShooterTalon = new CANTalon(PracticebotPorts.SHOOTER_TALON_RIGHT_PORT);
// servo
servo = new Servo(PracticebotPorts.BALL_AID_SERVO_PORT);
// analog sensor
distanceSensor = new AnalogInput(PracticebotPorts.BALL_DISTANCE_SENSOR_PORT);
init();
}
}
|
{
"content_hash": "53af8b7e1f4fa01a5555052931342f07",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 85,
"avg_line_length": 39.958333333333336,
"alnum_prop": 0.7518248175182481,
"repo_name": "akhilcjacob/Robot_2016_Ver2.0",
"id": "9f93e54798dbac55c3d3a07577f291724f58db6a",
"size": "959",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/org/usfirst/frc/team2791/practicebotSubsystems/PracticeShakerShooterWheels.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "187102"
}
]
}
|
package com.mbrlabs.mundus.commons.scene3d;
import com.badlogic.gdx.utils.Array;
/**
*
* @author Marcus Brummer
* @version 22-06-2016
*/
public abstract class BaseNode<T extends BaseNode> implements Node<T> {
public final int id;
protected Array<T> children;
protected T parent;
public BaseNode(int id) {
this.id = id;
}
@Override
public void initChildrenArray() {
this.children = new Array<T>();
}
@Override
public void addChild(T child) {
if (children == null) children = new Array<T>();
children.add(child);
child.setParent(this);
}
@Override
public boolean isChildOf(GameObject other) {
for (GameObject go : other) {
if (go.id == this.id) return true;
}
return false;
}
@Override
public Array<T> getChildren() {
return this.children;
}
@Override
public T getParent() {
return this.parent;
}
@Override
public void setParent(T parent) {
this.parent = parent;
}
@Override
public void remove() {
if (parent != null) {
parent.getChildren().removeValue(this, true);
this.parent = null;
}
}
}
|
{
"content_hash": "1c80add85652d6e56eda3cdde57470d6",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 71,
"avg_line_length": 18.71641791044776,
"alnum_prop": 0.5717703349282297,
"repo_name": "mbrlabs/Mundus",
"id": "589819fb92883c50930ed08cdd8173f9753d0641",
"size": "1860",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "commons/src/main/com/mbrlabs/mundus/commons/scene3d/BaseNode.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "GLSL",
"bytes": "12998"
},
{
"name": "Java",
"bytes": "446745"
},
{
"name": "Kotlin",
"bytes": "334799"
}
]
}
|
$(function () {
// Prevent demo form submission
$('#demo-validation').submit (function (e) {
e.preventDefault ()
})
})
|
{
"content_hash": "f055cbc8a50b00dc4f20c698d98c4380",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 46,
"avg_line_length": 17.25,
"alnum_prop": 0.5579710144927537,
"repo_name": "goodtune/vitriolic",
"id": "dbd88dd043de3960143a286e5a508fe495b6b660",
"size": "138",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "touchtechnology/admin/static/js/demos/validation.js",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "307509"
},
{
"name": "HTML",
"bytes": "273967"
},
{
"name": "JavaScript",
"bytes": "626908"
},
{
"name": "Less",
"bytes": "1373"
},
{
"name": "Makefile",
"bytes": "369"
},
{
"name": "Python",
"bytes": "962353"
},
{
"name": "Shell",
"bytes": "1490"
},
{
"name": "XSLT",
"bytes": "3510"
}
]
}
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Table::getColumnCount() \ Language (API) \ Processing 2+</title>
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Author" content="Casey Reas & Ben Fry" />
<meta name="Publisher" content="Processing" />
<meta name="Keywords" content="Processing, Processing, Interactive Media, Electronic Arts, Programming, Java, Ben Fry, Casey Reas" />
<meta name="Description" content="Processing is an electronic sketchbook for developing
ideas. It is a context for learning fundamentals of computer programming
within the context of the electronic arts." />
<meta name="Copyright" content="All contents copyright Ben Fry, Casey Reas, MIT Media Laboratory" />
<script src="javascript/modernizr-2.6.2.touch.js" type="text/javascript"></script>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body id="Langauge-en" onload="" >
<!-- ==================================== PAGE ============================ -->
<div id="container">
<!-- ==================================== HEADER ============================ -->
<div id="header">
<a href="/" title="Back to the Processing cover."><div class="processing-logo no-cover" alt="Processing cover"></div></a>
<form name="search" method="get" action="http://www.google.com/search">
<p><input type="hidden" name="as_sitesearch" value="processing.org" />
<input type="text" name="as_q" value="" size="20" class="text" />
<input type="submit" value=" " /></p>
</form>
</div>
<a id="TOP" name="TOP"></a>
<div id="navigation">
<div class="navBar" id="mainnav">
<a href="index.html" class='active'>Language</a><br>
<a href="libraries/index.html" >Libraries</a><br>
<a href="tools/index.html">Tools</a><br>
<a href="environment/index.html">Environment</a><br>
</div>
<script> document.querySelectorAll(".processing-logo")[0].className = "processing-logo"; </script>
</div>
<!-- ==================================== CONTENT - Headers ============================ -->
<div class="content">
<p class="ref-notice">This reference is for Processing 2.0+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, <a href="https://github.com/processing/processing-web/issues?state=open">please let us know</a>. If you prefer a more technical reference, visit the <a href="http://processing.org/reference/javadoc/core/">Processing Javadoc</a>.</p>
<table cellpadding="0" cellspacing="0" border="0" class="ref-item">
<tr class=""><th scope="row">Class</th><td><p><a href="Table.html">Table</a></p></td></tr>
<tr class="name-row">
<th scope="row">Name</th>
<td><h3>getColumnCount()</h3></td>
</tr>
<tr class="">
<tr class=""><th scope="row">Examples</th><td><div class="example"><pre >
Table table;
void setup() {
table = new Table();
println(table.getColumnCount()); // Prints 0
table.addColumn("name");
println(table.getColumnCount()); // Prints 1
table.addColumn("type");
println(table.getColumnCount()); // Prints 2
}
</pre></div>
</td></tr>
<tr class="">
<th scope="row">Description</th>
<td>
Returns the total number of columns in a table.
</td>
</tr>
<tr class=""><th scope="row">Syntax</th><td><pre><kbd></kbd>.getColumnCount()</pre></td></tr>
<tr class=""><th scope="row">Returns</th><td class="code">int</td></tr>
<tr class=""><th scope="row">Related</th><td><a class="code" href="Table_getRowCount_.html">getRowCount()</a><br /></td></tr>
</table>
Updated on May 19, 2014 05:30:04pm PDT<br /><br />
<!-- Creative Commons License -->
<div class="license">
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/2.0/"><img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights20.gif" /></a>
</div>
<!--
<rdf:RDF xmlns="http://web.resource.org/cc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
<dc:title>Processing.org Reference</dc:title>
<dc:date>2004</dc:date>
<dc:description>Reference for the Processing.org programming environment and language.</dc:description>
<dc:creator><Agent>
<dc:title>Casey Reas et al.</dc:title>
</Agent></dc:creator>
<dc:rights><Agent>
<dc:title>Casey Reas</dc:title>
</Agent></dc:rights>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/Text" />
<license rdf:resource="http://creativecommons.org/licenses/by-nc-sa/2.0/" />
</Work>
<License rdf:about="http://creativecommons.org/licenses/by-nc-sa/2.0/">
<permits rdf:resource="http://web.resource.org/cc/Reproduction" />
<permits rdf:resource="http://web.resource.org/cc/Distribution" />
<requires rdf:resource="http://web.resource.org/cc/Notice" />
<requires rdf:resource="http://web.resource.org/cc/Attribution" />
<prohibits rdf:resource="http://web.resource.org/cc/CommercialUse" />
<permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
<requires rdf:resource="http://web.resource.org/cc/ShareAlike" />
</License>
</rdf:RDF>
-->
</div>
<!-- ==================================== FOOTER ============================ -->
<div id="footer">
<div id="copyright">Processing is an open project intiated by <a href="http://benfry.com/">Ben Fry</a> and <a href="http://reas.com">Casey Reas</a>. It is developed by a <a href="http://processing.org/about/people/">small team of volunteers</a>.</div>
<div id="colophon">
<a href="copyright.html">© Info</a> \
<span>Site hosted by <a href="http://www.mediatemple.net">Media Temple</a>.</span>
</div>
</div>
</div>
<script src="javascript/jquery-1.9.1.min.js"></script>
<script src="javascript/site.js" type="text/javascript"></script>
</body>
</html>
|
{
"content_hash": "19b9fe590553f52bb71f8564930e5350",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 419,
"avg_line_length": 39.32484076433121,
"alnum_prop": 0.6245545837382572,
"repo_name": "davielong86/processing",
"id": "793b189e7e44020f4b5330525cbd46f68f221392",
"size": "6174",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "processing-2.2.1/modes/java/reference/Table_getColumnCount_.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Arduino",
"bytes": "259"
},
{
"name": "CSS",
"bytes": "40867"
},
{
"name": "GLSL",
"bytes": "30960"
},
{
"name": "HTML",
"bytes": "4834011"
},
{
"name": "Java",
"bytes": "487162"
},
{
"name": "JavaScript",
"bytes": "6567"
},
{
"name": "Perl",
"bytes": "956"
},
{
"name": "Processing",
"bytes": "924904"
}
]
}
|
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "867de78fbda4154f6a040c7eaa379c3d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "1e75f795ef408422a71c59df1de88f1f78d9d72d",
"size": "181",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Vitales/Vitaceae/Tetrastigma/Tetrastigma retinervium/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
package edu.snu.csne.csne2543.methods;
/**
* @author Brent Eskridge
*/
public class OverloadedMethodExample
{
public static void main( String[] args )
{
gitRDone( 42 );
gitRDone( 55L );
gitRDone( 3.14159f );
}
// Signature: gitRDone( int )
public static void gitRDone( int value )
{
System.out.println( "Integer method called..." );
}
// Signature: gitRDone( long )
public static void gitRDone( long value )
{
System.out.println( "Long method called..." );
}
// Signature: gitRDone( float )
public static void gitRDone( float value )
{
System.out.println( "Float method called..." );
}
}
|
{
"content_hash": "19ae488afa12118b5ffb5c624ad73e05",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 57,
"avg_line_length": 21.666666666666668,
"alnum_prop": 0.5776223776223777,
"repo_name": "snucsne/CSNE-Course-Source-Code",
"id": "c16d438d515f330fb5030968a7cd0a78fda715b4",
"size": "1927",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CSNE2543-Intro-to-CS-II/src/edu/snu/csne/csne2543/methods/OverloadedMethodExample.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "214115"
},
{
"name": "Jupyter Notebook",
"bytes": "162816"
},
{
"name": "Python",
"bytes": "10637"
},
{
"name": "Shell",
"bytes": "30834"
}
]
}
|
<!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 -->
<title>CommandLine.IModelTransformer (picocli 4.7.0 API)</title>
<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="CommandLine.IModelTransformer (picocli 4.7.0 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract 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="../picocli/package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li><a href="../index-all.html">Index</a></li>
<li><a href="../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../picocli/CommandLine.IHelpSectionRenderer.html" title="interface in picocli"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../picocli/CommandLine.INegatableOptionTransformer.html" title="interface in picocli"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?picocli/CommandLine.IModelTransformer.html" target="_top">Frames</a></li>
<li><a href="CommandLine.IModelTransformer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </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">picocli</div>
<h2 title="Interface CommandLine.IModelTransformer" class="title">Interface CommandLine.IModelTransformer</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>Enclosing class:</dt>
<dd><a href="../picocli/CommandLine.html" title="class in picocli">CommandLine</a></dd>
</dl>
<hr>
<br>
<pre>public static interface <span class="typeNameLabel">CommandLine.IModelTransformer</span></pre>
<div class="block">Provides a way to modify how the command model is built.
This is useful for applications that need to modify the model dynamically depending on the runtime environment.
<p>
Commands may configure a model transformer using the
<a href="../picocli/CommandLine.Command.html#modelTransformer--"><code>CommandLine.Command.modelTransformer()</code></a> annotation attribute, or via the
<code>CommandSpec#modelTransformer(IModelTransformer)</code> programmatic API.
<p>
Model transformers are invoked only once, after the full command hierarchy is constructed.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>4.6</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== 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"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </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><a href="../picocli/CommandLine.Model.CommandSpec.html" title="class in picocli">CommandLine.Model.CommandSpec</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../picocli/CommandLine.IModelTransformer.html#transform-picocli.CommandLine.Model.CommandSpec-">transform</a></span>(<a href="../picocli/CommandLine.Model.CommandSpec.html" title="class in picocli">CommandLine.Model.CommandSpec</a> commandSpec)</code>
<div class="block">Given an original CommandSpec, return the object that should be used
instead.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="transform-picocli.CommandLine.Model.CommandSpec-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>transform</h4>
<pre><a href="../picocli/CommandLine.Model.CommandSpec.html" title="class in picocli">CommandLine.Model.CommandSpec</a> transform(<a href="../picocli/CommandLine.Model.CommandSpec.html" title="class in picocli">CommandLine.Model.CommandSpec</a> commandSpec)</pre>
<div class="block">Given an original CommandSpec, return the object that should be used
instead. Implementors may modify the specified CommandSpec and return it,
or create a full or partial copy of the specified CommandSpec, and return
that, or even return a completely new CommandSpec.
<p>
Implementors are free to add or remove options, positional parameters,
subcommands or modify the command in any other way.
</p><p>
This method is called once, after the full command hierarchy is
constructed, and before any command line arguments are parsed.
</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the CommandSpec to use instead of the specified one</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="../picocli/package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li><a href="../index-all.html">Index</a></li>
<li><a href="../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../picocli/CommandLine.IHelpSectionRenderer.html" title="interface in picocli"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../picocli/CommandLine.INegatableOptionTransformer.html" title="interface in picocli"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?picocli/CommandLine.IModelTransformer.html" target="_top">Frames</a></li>
<li><a href="CommandLine.IModelTransformer.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </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": "375736a2052d3420e0cc858ea099e211",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 391,
"avg_line_length": 37.1468253968254,
"alnum_prop": 0.672898194637325,
"repo_name": "remkop/picocli",
"id": "a3ea33d64852b3ec597ef576e07888bc4341ef92",
"size": "9361",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "docs/apidocs/picocli/CommandLine.IModelTransformer.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "76794"
},
{
"name": "HTML",
"bytes": "2925"
},
{
"name": "Java",
"bytes": "4411912"
},
{
"name": "Kotlin",
"bytes": "25214"
},
{
"name": "Scala",
"bytes": "6012"
},
{
"name": "Shell",
"bytes": "89133"
}
]
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Diagnostics;
namespace SymbolicAlgebra
{
public partial class SymbolicVariable
{
/// <summary>
/// Derive one pure term.
/// </summary>
/// <param name="sv"></param>
/// <param name="parameter"></param>
private static SymbolicVariable DiffTerm(SymbolicVariable term, string parameter)
{
var sv = term.Clone();
bool symbolpowercontainParameter = false;
if (sv._SymbolPowerTerm != null)
{
if (sv._SymbolPowerTerm.InvolvedSymbols.Contains(parameter, StringComparer.OrdinalIgnoreCase))
{
symbolpowercontainParameter = true;
}
else
{
int prcount = sv._SymbolPowerTerm.FusedSymbols.Count(p => p.Key.Equals(parameter, StringComparison.OrdinalIgnoreCase));
symbolpowercontainParameter = prcount > 0;
}
}
bool cc = false;
if(sv.BaseVariable!=null) cc = sv.BaseVariable.InvolvedSymbols.Contains(parameter, StringComparer.OrdinalIgnoreCase); // case of base variable
else if (sv.IsFunction && symbolpowercontainParameter == true)
{
// search if a parameter contains the same parameter
foreach (var pf in sv._FunctionParameters)
if (pf.Symbol.Equals(parameter, StringComparison.OrdinalIgnoreCase))
{
cc = true;
break;
}
}
else
{
cc = sv.Symbol.Equals(parameter, StringComparison.OrdinalIgnoreCase);
}
// x^3*y^2*z^5 , diff to x;
if (cc)
{
if (sv._SymbolPowerTerm == null)
{
sv.Coeffecient *= sv._SymbolPower;
sv._SymbolPower -= 1;
if (sv._SymbolPower == 0) sv._Symbol = "";
}
else
{
if (symbolpowercontainParameter)
{
// here is the case when base and power are the same with the parameter we are differentiating with
// i.e. x^x|x
// Logarithmic Differentiation
var lnterm = new SymbolicVariable($"{FunctionOperation.LnText}(" + sv.ToString() + ")");
var dlnterm = lnterm.Differentiate(parameter);
sv = Multiply(sv, dlnterm);
}
else
{
// symbol power term exist
SymbolicVariable oldPower = sv._SymbolPowerTerm;
sv._SymbolPowerTerm = Subtract(sv._SymbolPowerTerm, One);
sv = Multiply(sv, oldPower);
}
}
}
else if (symbolpowercontainParameter)
{
// this case is when the power term is the same
var log = new SymbolicVariable(FunctionOperation.LnText + "(" + sv.Symbol + ")");
var dp = sv._SymbolPowerTerm.Differentiate(parameter);
sv = SymbolicVariable.Multiply(log, SymbolicVariable.Multiply(dp, sv));
}
else
{
// try in the fused variables
HybridVariable hv;
if (sv.FusedSymbols.TryGetValue(parameter, out hv))
{
if (hv.SymbolicVariable == null)
{
sv.Coeffecient *= hv.NumericalVariable;
hv.NumericalVariable -= 1;
if (hv.NumericalVariable == 0)
sv._FusedSymbols.Remove(parameter);
else
sv._FusedSymbols[parameter] = hv;
}
else
{
// symbol power term exist
SymbolicVariable oldPower = hv.SymbolicVariable;
hv.SymbolicVariable = Subtract(hv.SymbolicVariable, One);
sv._FusedSymbols[parameter] = hv;
sv = Multiply(sv, oldPower);
}
}
else
{
if (sv.IsFunction)
{
var fv = sv.Clone();
// remove the power term in this copied function term
fv._SymbolPowerTerm = null;
fv.SymbolPower = 1.0;
fv.Coeffecient = 1.0;
if (fv.FunctionName.Equals(FunctionOperation.ExpText, StringComparison.OrdinalIgnoreCase))
{
if (fv._FunctionParameters.Length != 1) throw new SymbolicException("Exp function must have one parameter for differentiation to be done.");
// d/dx e^x = e^x
// d/dx e^(x^2) = 2*x*e^(x^2)
var pa = fv._FunctionParameters[0];
var presult = pa.Differentiate(parameter);
fv = SymbolicVariable.Multiply(presult, fv);
}
else if (fv.FunctionName.Equals(FunctionOperation.LnText, StringComparison.OrdinalIgnoreCase))
{
if (fv._FunctionParameters.Length != 1) throw new SymbolicException("Log function must have one parameter for differentiation to be done.");
// d/dx ( ln( g(x) ) ) = g'(x)/g(x)
var pa = fv._FunctionParameters[0];
var dpa = pa.Differentiate(parameter);
fv = SymbolicVariable.Divide(dpa, pa);
}
else if(fv.FunctionName.Equals(FunctionOperation.SqrtText, StringComparison.OrdinalIgnoreCase))
{
// d/dx ( sqrt( g(x) ) ) = g'(x) / 2* sqrt(g(x))
if (fv._FunctionParameters.Length != 1) throw new SymbolicException("Sqrt function must have one parameter for differentiation to be done.");
var pa = fv._FunctionParameters[0];
var dpa = pa.Differentiate(parameter);
var den = Multiply(Two, fv);
fv = Divide(dpa, den);
}
else if (FunctionOperation.InversedTrigFunctions.Contains(fv.FunctionName, StringComparer.OrdinalIgnoreCase))
{
fv = FunctionOperation.DiffInversedTrigFunction(fv, parameter);
}
else if (FunctionOperation.TrigFunctions.Contains(fv.FunctionName, StringComparer.OrdinalIgnoreCase))
{
// triogonometric functions
bool IsNegativeResult;
string[] newfuntions = FunctionOperation.DiffTrigFunction(fv, out IsNegativeResult);
if (newfuntions != null)
{
//if(IsNegative)
// get the parameters in the function and differentiate them
if (fv._FunctionParameters.Length == 0)
{
throw new SymbolicException("Special function without any parameters is not suitable for differentiation");
}
else if (fv._FunctionParameters.Length == 1)
{
var pa = fv._FunctionParameters[0];
var presult = pa.Differentiate(parameter);
fv.SetFunctionName(newfuntions);
if (IsNegativeResult)
fv = SymbolicVariable.Multiply(presult, SymbolicAlgebra.SymbolicVariable.NegativeOne * fv);
else
fv = SymbolicVariable.Multiply(presult, fv);
}
else
{
throw new SymbolicException("more than one parameter is not normal for this special function");
}
}
}
else
{
// the function is not a special function like sin, cos, and log.
// search for the function in the running context.
var extendedFunction = Functions.Keys.FirstOrDefault(c => c.StartsWith(fv.FunctionName, StringComparison.OrdinalIgnoreCase));
if (!string.IsNullOrEmpty(extendedFunction))
{
string[] fps = extendedFunction.Substring(extendedFunction.IndexOf("(")).TrimStart('(').TrimEnd(')').Split(',');
if(fps.Length != fv._RawFunctionParameters.Length) throw new SymbolicException("Insufficient function parameters");
// replace parameters
var dsf = Functions[extendedFunction].ToString();
for(int ipxf=0; ipxf < fps.Length ;ipxf++)
{
dsf = dsf.Replace(fps[ipxf], fv._RawFunctionParameters[ipxf]);
}
fv = SymbolicVariable.Parse(dsf).Differentiate(parameter);
}
else
{
throw new SymbolicException("This function is not a special function, and it is not being defined before .. to define a user function write f(x):= x^2 or h(u,v):=u-v^2");
}
}
// second treat the function normally as if it is one big symbol
if (sv._SymbolPowerTerm == null)
{
sv.Coeffecient *= sv._SymbolPower;
sv._SymbolPower -= 1;
if (sv._SymbolPower == 0) sv._Symbol = "";
}
else
{
// symbol power term exist
SymbolicVariable oldPower = sv._SymbolPowerTerm;
sv._SymbolPowerTerm = Subtract(sv._SymbolPowerTerm, One);
sv = Multiply(sv, oldPower);
}
sv = SymbolicVariable.Multiply(fv, sv);
}
else if (sv.IsCoeffecientOnly && sv._CoeffecientPowerTerm != null)
{
// hint: the coeffecient only term has power of 1 or symbolic power should exist in case of raise to symbolic power
// get log(coeffeniect)
var log = new SymbolicVariable(FunctionOperation.LnText + "(" + sv.Coeffecient.ToString(CultureInfo.InvariantCulture) + ")");
var dp = sv._CoeffecientPowerTerm.Differentiate(parameter);
sv = SymbolicVariable.Multiply(log, SymbolicVariable.Multiply(dp, sv));
}
else
{
// the whole term will be converted to zero.
// empty everything :)
sv._SymbolPowerTerm = null;
sv._CoeffecientPowerTerm = null;
sv._SymbolPower = 1;
sv.Coeffecient = 0;
//sv._DividedTerm = null;
sv._BaseVariable = null;
sv._Symbol = string.Empty;
if (sv._SymbolPowerTerm != null)
{
sv._FusedSymbols.Clear();
sv._FusedSymbols = null;
}
}
}
}
return sv;
}
private static SymbolicVariable DiffBigTerm(SymbolicVariable sv, string parameter)
{
// now result contains only one term
// -----------------------------------
// we need to differentiate multiplied terms in this ONE TERM
// every term is differentiated and multiplied by other terms if x*y*z then == dx*y*z+x*dy+z+x*y*dz
SymbolicVariable SvDividedTerm = sv.DividedTerm; // here we isolate the divided term for later calculations
sv.DividedTerm = One;
var MultipliedTerms = DeConstruct(sv);
List<SymbolicVariable> CalculatedDiffs = new List<SymbolicVariable>(MultipliedTerms.Count);
// get all differentials of all terms // x*y*z ==> dx dy dz
for (int ix = 0; ix < MultipliedTerms.Count; ix++)
{
CalculatedDiffs.Add(DiffTerm(MultipliedTerms[ix].Term, parameter));
}
// what about divided term ??
if (!SvDividedTerm.IsOne)
{
/*
* diff(f(x)*g(x)/h(x),x);
* -(f(x)*g(x)*('diff(h(x),x,1)))/h(x)^2 <== notice the negative sign here and the squared denominator
* +(f(x)*('diff(g(x),x,1)))/h(x)
* +(g(x)*('diff(f(x),x,1)))/h(x)
*/
var dvr = Subtract(Zero, SvDividedTerm.Differentiate(parameter)); //differential of divided takes minus sign because it wil
CalculatedDiffs.Add(dvr);
// add the divided term but in negative value because it is divided and in differentiation it will have -ve power
MultipliedTerms.Add(new MultipliedTerm(SvDividedTerm, true));
}
// every result of calculated differentials should be multiplied by the other terms.
for (int ix = 0; ix < CalculatedDiffs.Count; ix++)
{
var term = CalculatedDiffs[ix];
if (term.IsZero) continue;
var mt = One;
int mltc = MultipliedTerms.Count;
//if (!SvDividedTerm.IsOne) mltc++;
for (int iy = 0; iy < mltc; iy++)
{
if (iy == ix) continue;
if (MultipliedTerms[iy].Divided)
mt = SymbolicVariable.Divide(mt, MultipliedTerms[iy].Term);
else
mt = SymbolicVariable.Multiply(mt, MultipliedTerms[iy].Term);
}
// term *mt
CalculatedDiffs[ix] = SymbolicVariable.Multiply(mt, term);
}
// dx*y*z dy*x*z dz*x*y
var total = Zero;
foreach (var cc in CalculatedDiffs)
{
if (cc.IsZero) continue;
total = SymbolicVariable.Add(total, cc);
}
if (!SvDividedTerm.IsOne) total.DividedTerm = Multiply(SvDividedTerm, SvDividedTerm);
return total;
}
/// <summary>
/// Differentiate the whole term based on the needed variables ... you know what I mean :)
/// </summary>
/// <param name="variable"></param>
/// <returns></returns>
public SymbolicVariable Differentiate(string parameter)
{
SymbolicVariable result = this.Clone();
Dictionary<string, SymbolicVariable> OtherAddedTerms = result._AddedTerms;
result._AddedTerms = null;
List<ExtraTerm> OtherExtraTerms = result._ExtraTerms;
result._ExtraTerms = null;
result = DiffBigTerm(result, parameter);
// take the rest terms
if (OtherAddedTerms != null)
{
for (int ix = 0; ix < OtherAddedTerms.Count; ix++)
{
var term = OtherAddedTerms.Values.ElementAt(ix);
term = DiffBigTerm(term, parameter);
result = Add(result, term);
}
}
if (OtherExtraTerms != null)
{
for (int ix = 0; ix < OtherExtraTerms.Count; ix++)
{
var term = OtherExtraTerms[ix].Term;
term = DiffBigTerm(term, parameter);
result = Add(result, term);
}
}
AdjustSpecialFunctions(ref result);
AdjustZeroPowerTerms(result);
AdjustZeroCoeffecientTerms(ref result);
return result;
}
}
}
|
{
"content_hash": "95f0a0565f9306724eeefe338c6ae1f8",
"timestamp": "",
"source": "github",
"line_count": 410,
"max_line_length": 203,
"avg_line_length": 43.13170731707317,
"alnum_prop": 0.45199049988690343,
"repo_name": "ibluesun/SymbolicAlgebra",
"id": "a83323985603dcfaaff150f2decead41bc1ad78b",
"size": "17686",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SymbolicAlgebra/SymbolicVariable_Differentiation.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "378863"
}
]
}
|
package io.github.mzmine.gui.framework.strokechooser;
import java.awt.BasicStroke;
import java.awt.Graphics2D;
public class SettingsBasicStroke {
/**
*
*/
private static final long serialVersionUID = 1L;
private float w, miterlimit, dashphase;
private int cap, join;
private float[] array;
private transient BasicStroke stroke;
public SettingsBasicStroke() {
resetAll();
}
public SettingsBasicStroke(float w, int cap, int join, float miterlimit, float[] array,
float dashphase) {
this();
setAll(w, cap, join, miterlimit, array, dashphase);
}
public SettingsBasicStroke(float w, int cap, int join, float miter) {
this();
setAll(w, cap, join, miter, new float[] {10.f}, 0);
}
public SettingsBasicStroke(float w) {
this();
setAll(w, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 2, new float[] {10.f}, 0);
}
public SettingsBasicStroke(BasicStroke s) {
this();
setStroke(s);
}
public void setAll(float w, int cap, int join, float miterlimit, float[] array, float dashphase) {
setLineWidth(w);
setMiterlimit(miterlimit);
setDashArray(array);
setDashphase(dashphase);
setCap(cap);
setJoin(join);
}
public void setLineWidth(float w) {
if (Math.abs(this.w - w) > 0.001) {
this.w = w;
stroke = null;
}
}
public void setMiterlimit(float miterlimit) {
if (Math.abs(this.miterlimit - miterlimit) > 0.00001) {
this.miterlimit = miterlimit;
stroke = null;
}
}
public void setDashphase(float dashphase) {
if (Math.abs(this.dashphase - dashphase) > 0.00001) {
this.dashphase = dashphase;
stroke = null;
}
}
public void setCap(int cap) {
if (this.cap != cap) {
this.cap = cap;
stroke = null;
}
}
public void setJoin(int join) {
if (this.join != join) {
this.join = join;
stroke = null;
}
}
public void setDashArray(float[] array) {
if (!this.array.equals(array)) {
this.array = array;
stroke = null;
}
}
public void resetAll() {
this.w = 1.5f;
this.miterlimit = 2.f;
this.dashphase = 0;
this.cap = BasicStroke.CAP_ROUND;
this.join = BasicStroke.JOIN_MITER;
this.array = new float[] {10.f};
stroke = null;
}
public BasicStroke getStroke() {
if (stroke == null) {
stroke = new BasicStroke(w, cap, join, miterlimit, array, dashphase);
}
return stroke;
}
public float[] getDashArray() {
return array;
}
public float getDashPhase() {
// TODO Auto-generated method stub
return dashphase;
}
/**
* Returns the line width. Line width is represented in user space, which is the
* default-coordinate space used by Java 2D. See the <code>Graphics2D</code> class comments for
* more information on the user space coordinate system.
*
* @return the line width of this <code>BasicStroke</code>.
* @see Graphics2D
*/
public float getLineWidth() {
return w;
}
/**
* Returns the end cap style.
*
* @return the end cap style of this <code>BasicStroke</code> as one of the static
* <code>int</code> values that define possible end cap styles.
*/
public int getEndCap() {
return cap;
}
/**
* Returns the line join style.
*
* @return the line join style of the <code>BasicStroke</code> as one of the static
* <code>int</code> values that define possible line join styles.
*/
public int getLineJoin() {
return join;
}
/**
* Returns the limit of miter joins.
*
* @return the limit of miter joins of the <code>BasicStroke</code>.
*/
public float getMiterLimit() {
return miterlimit;
}
public void setStroke(BasicStroke s) {
setAll(s.getLineWidth(), s.getEndCap(), s.getLineJoin(), s.getMiterLimit(), s.getDashArray(),
s.getDashPhase());
stroke = s;
}
}
|
{
"content_hash": "e033adc4b98e2843e5066863d0bc96fa",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 100,
"avg_line_length": 23,
"alnum_prop": 0.6281329923273657,
"repo_name": "mzmine/mzmine3",
"id": "50f60e923bbd7e5a13dbd57c2f0b4b74e76bb67b",
"size": "5055",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/io/github/mzmine/gui/framework/strokechooser/SettingsBasicStroke.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "24537"
},
{
"name": "HTML",
"bytes": "206954"
},
{
"name": "Java",
"bytes": "12683356"
}
]
}
|
require 'friendly_id'
require 'kramdown'
module Engrave
class Engine < ::Rails::Engine
end
end
|
{
"content_hash": "a04ac6907e1f19ec435f77c275daeb73",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 32,
"avg_line_length": 14.285714285714286,
"alnum_prop": 0.73,
"repo_name": "jeffmcfadden/engrave",
"id": "ec431ad2a117c1418894e8e02e661cd3ceabe0d3",
"size": "100",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "lib/engrave/engine.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1082"
},
{
"name": "Ruby",
"bytes": "21564"
}
]
}
|
//-----------------------------------------------
//
// This file is part of the Siv3D Engine.
//
// Copyright (c) 2008-2019 Ryo Suzuki
// Copyright (c) 2016-2019 OpenSiv3D Project
//
// Licensed under the MIT License.
//
//-----------------------------------------------
# pragma once
# include <Siv3D/ParticleSystem2D.hpp>
# include <Siv3D/Particle2D.hpp>
# include <Siv3D/Texture.hpp>
namespace s3d
{
class ParticleSystem2D::ParticleSystem2DDetail
{
private:
Array<Particle2D> m_particles;
double m_remainingTime = 0.0;
Vec2 m_position = Vec2(0, 0);
Vec2 m_force = Vec2(0, 0);
ParticleSystem2DParameters m_parameters;
std::unique_ptr<IEmitter2D> m_emitter;
Texture m_particleTexture;
void updateCurrentparticles(float deltaTime);
void addParticles(const ParticleSystem2DParameters& params);
void drawParticle() const;
void drawTexturedParticle() const;
void drawDebugParticle() const;
public:
ParticleSystem2DDetail();
ParticleSystem2DDetail(const Vec2& position, const Vec2& force);
ParticleSystem2DDetail(const Vec2& position, const Vec2& force, std::unique_ptr<IEmitter2D>&& emitter,
const ParticleSystem2DParameters& parameters, const Texture& texture);
~ParticleSystem2DDetail();
void setPosition(const Vec2& position) noexcept;
void setForce(const Vec2& force) noexcept;
void setEmitter(std::unique_ptr<IEmitter2D>&& emitter);
void setParameters(const ParticleSystem2DParameters& parameters);
void setTexture(const Texture& texture) noexcept;
size_t num_particles() const noexcept;
void prewarm();
void update(double deltaTime);
void draw() const;
void drawDebug() const;
};
}
|
{
"content_hash": "81802b85839311679d52f225abc66cc8",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 104,
"avg_line_length": 22.594594594594593,
"alnum_prop": 0.6973684210526315,
"repo_name": "wynd2608/OpenSiv3D",
"id": "34cb52a1c6a4d6089703fe77a655e4a3d55f5898",
"size": "1674",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Siv3D/src/Siv3D/ParticleSystem2D/ParticleSystem2DDetail.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "5607967"
},
{
"name": "CMake",
"bytes": "32983"
},
{
"name": "GLSL",
"bytes": "6897"
},
{
"name": "HLSL",
"bytes": "4869"
},
{
"name": "Objective-C++",
"bytes": "63587"
}
]
}
|
package descriptor
import (
"fmt"
"strings"
"github.com/gengo/grpc-gateway/internal"
"github.com/gengo/grpc-gateway/protoc-gen-grpc-gateway/httprule"
descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor"
)
// GoPackage represents a golang package
type GoPackage struct {
// Path is the package path to the package.
Path string
// Name is the package name of the package
Name string
// Alias is an alias of the package unique within the current invokation of grpc-gateway generator.
Alias string
}
// Standard returns whether the import is a golang standard pacakge.
func (p GoPackage) Standard() bool {
return !strings.Contains(p.Path, ".")
}
// String returns a string representation of this package in the form of import line in golang.
func (p GoPackage) String() string {
if p.Alias == "" {
return fmt.Sprintf("%q", p.Path)
}
return fmt.Sprintf("%s %q", p.Alias, p.Path)
}
// File wraps descriptor.FileDescriptorProto for richer features.
type File struct {
*descriptor.FileDescriptorProto
// GoPkg is the go package of the go file generated from this file..
GoPkg GoPackage
// Messages is the list of messages defined in this file.
Messages []*Message
// Services is the list of services defined in this file.
Services []*Service
}
// proto2 determines if the syntax of the file is proto2.
func (f *File) proto2() bool {
return f.Syntax == nil || f.GetSyntax() == "proto2"
}
// Message describes a protocol buffer message types
type Message struct {
// File is the file where the message is defined
File *File
// Outers is a list of outer messages if this message is a nested type.
Outers []string
*descriptor.DescriptorProto
Fields []*Field
}
// FQMN returns a fully qualified message name of this message.
func (m *Message) FQMN() string {
components := []string{""}
if m.File.Package != nil {
components = append(components, m.File.GetPackage())
}
components = append(components, m.Outers...)
components = append(components, m.GetName())
return strings.Join(components, ".")
}
// GoType returns a go type name for the message type.
// It prefixes the type name with the package alias if
// its belonging package is not "currentPackage".
func (m *Message) GoType(currentPackage string) string {
var components []string
components = append(components, m.Outers...)
components = append(components, m.GetName())
name := strings.Join(components, "_")
if m.File.GoPkg.Path == currentPackage {
return name
}
pkg := m.File.GoPkg.Name
if alias := m.File.GoPkg.Alias; alias != "" {
pkg = alias
}
return fmt.Sprintf("%s.%s", pkg, name)
}
// Service wraps descriptor.ServiceDescriptorProto for richer features.
type Service struct {
// File is the file where this service is defined.
File *File
*descriptor.ServiceDescriptorProto
// Methods is the list of methods defined in this service.
Methods []*Method
}
// Method wraps descriptor.MethodDescriptorProto for richer features.
type Method struct {
// Service is the service which this method belongs to.
Service *Service
*descriptor.MethodDescriptorProto
// RequestType is the message type of requests to this method.
RequestType *Message
// ResponseType is the message type of responses from this method.
ResponseType *Message
Bindings []*Binding
}
// Binding describes how an HTTP endpoint is bound to a gRPC method.
type Binding struct {
// Method is the method which the endpoint is bound to.
Method *Method
// Index is a zero-origin index of the binding in the target method
Index int
// PathTmpl is path template where this method is mapped to.
PathTmpl httprule.Template
// HTTPMethod is the HTTP method which this method is mapped to.
HTTPMethod string
// PathParams is the list of parameters provided in HTTP request paths.
PathParams []Parameter
// Body describes parameters provided in HTTP request body.
Body *Body
}
// ExplicitParams returns a list of explicitly bound parameters of "b",
// i.e. a union of field path for body and field paths for path parameters.
func (b *Binding) ExplicitParams() []string {
var result []string
if b.Body != nil {
result = append(result, b.Body.FieldPath.String())
}
for _, p := range b.PathParams {
result = append(result, p.FieldPath.String())
}
return result
}
// Field wraps descriptor.FieldDescriptorProto for richer features.
type Field struct {
// Message is the message type which this field belongs to.
Message *Message
*descriptor.FieldDescriptorProto
}
// Parameter is a parameter provided in http requests
type Parameter struct {
// FieldPath is a path to a proto field which this parameter is mapped to.
FieldPath
// Target is the proto field which this parameter is mapped to.
Target *Field
// Method is the method which this parameter is used for.
Method *Method
}
// ConvertFuncExpr returns a go expression of a converter function.
// The converter function converts a string into a value for the parameter.
func (p Parameter) ConvertFuncExpr() (string, error) {
tbl := proto3ConvertFuncs
if p.Target.Message.File.proto2() {
tbl = proto2ConvertFuncs
}
typ := p.Target.GetType()
conv, ok := tbl[typ]
if !ok {
return "", fmt.Errorf("unsupported field type %s of parameter %s in %s.%s", typ, p.FieldPath, p.Method.Service.GetName(), p.Method.GetName())
}
return conv, nil
}
// Body describes a http requtest body to be sent to the method.
type Body struct {
// FieldPath is a path to a proto field which the request body is mapped to.
// The request body is mapped to the request type itself if FieldPath is empty.
FieldPath FieldPath
}
// RHS returns a right-hand-side expression in go to be used to initialize method request object.
// It starts with "msgExpr", which is the go expression of the method request object.
func (b Body) RHS(msgExpr string) string {
return b.FieldPath.RHS(msgExpr)
}
// FieldPath is a path to a field from a request message.
type FieldPath []FieldPathComponent
// String returns a string representation of the field path.
func (p FieldPath) String() string {
var components []string
for _, c := range p {
components = append(components, c.Name)
}
return strings.Join(components, ".")
}
// IsNestedProto3 indicates whether the FieldPath is a nested Proto3 path.
func (p FieldPath) IsNestedProto3() bool {
if len(p) > 1 && !p[0].Target.Message.File.proto2() {
return true
}
return false
}
// RHS is a right-hand-side expression in go to be used to assign a value to the target field.
// It starts with "msgExpr", which is the go expression of the method request object.
func (p FieldPath) RHS(msgExpr string) string {
l := len(p)
if l == 0 {
return msgExpr
}
components := []string{msgExpr}
for i, c := range p {
if i == l-1 {
components = append(components, c.RHS())
continue
}
components = append(components, c.LHS())
}
return strings.Join(components, ".")
}
// FieldPathComponent is a path component in FieldPath
type FieldPathComponent struct {
// Name is a name of the proto field which this component corresponds to.
// TODO(yugui) is this necessary?
Name string
// Target is the proto field which this component corresponds to.
Target *Field
}
// RHS returns a right-hand-side expression in go for this field.
func (c FieldPathComponent) RHS() string {
return internal.PascalFromSnake(c.Name)
}
// LHS returns a left-hand-side expression in go for this field.
func (c FieldPathComponent) LHS() string {
if c.Target.Message.File.proto2() {
return fmt.Sprintf("Get%s()", internal.PascalFromSnake(c.Name))
}
return internal.PascalFromSnake(c.Name)
}
var (
proto3ConvertFuncs = map[descriptor.FieldDescriptorProto_Type]string{
descriptor.FieldDescriptorProto_TYPE_DOUBLE: "runtime.Float64",
descriptor.FieldDescriptorProto_TYPE_FLOAT: "runtime.Float32",
descriptor.FieldDescriptorProto_TYPE_INT64: "runtime.Int64",
descriptor.FieldDescriptorProto_TYPE_UINT64: "runtime.Uint64",
descriptor.FieldDescriptorProto_TYPE_INT32: "runtime.Int32",
descriptor.FieldDescriptorProto_TYPE_FIXED64: "runtime.Uint64",
descriptor.FieldDescriptorProto_TYPE_FIXED32: "runtime.Uint32",
descriptor.FieldDescriptorProto_TYPE_BOOL: "runtime.Bool",
descriptor.FieldDescriptorProto_TYPE_STRING: "runtime.String",
// FieldDescriptorProto_TYPE_GROUP
// FieldDescriptorProto_TYPE_MESSAGE
// FieldDescriptorProto_TYPE_BYTES
// TODO(yugui) Handle bytes
descriptor.FieldDescriptorProto_TYPE_UINT32: "runtime.Uint32",
// FieldDescriptorProto_TYPE_ENUM
// TODO(yugui) Handle Enum
descriptor.FieldDescriptorProto_TYPE_SFIXED32: "runtime.Int32",
descriptor.FieldDescriptorProto_TYPE_SFIXED64: "runtime.Int64",
descriptor.FieldDescriptorProto_TYPE_SINT32: "runtime.Int32",
descriptor.FieldDescriptorProto_TYPE_SINT64: "runtime.Int64",
}
proto2ConvertFuncs = map[descriptor.FieldDescriptorProto_Type]string{
descriptor.FieldDescriptorProto_TYPE_DOUBLE: "runtime.Float64P",
descriptor.FieldDescriptorProto_TYPE_FLOAT: "runtime.Float32P",
descriptor.FieldDescriptorProto_TYPE_INT64: "runtime.Int64P",
descriptor.FieldDescriptorProto_TYPE_UINT64: "runtime.Uint64P",
descriptor.FieldDescriptorProto_TYPE_INT32: "runtime.Int32P",
descriptor.FieldDescriptorProto_TYPE_FIXED64: "runtime.Uint64P",
descriptor.FieldDescriptorProto_TYPE_FIXED32: "runtime.Uint32P",
descriptor.FieldDescriptorProto_TYPE_BOOL: "runtime.BoolP",
descriptor.FieldDescriptorProto_TYPE_STRING: "runtime.StringP",
// FieldDescriptorProto_TYPE_GROUP
// FieldDescriptorProto_TYPE_MESSAGE
// FieldDescriptorProto_TYPE_BYTES
// TODO(yugui) Handle bytes
descriptor.FieldDescriptorProto_TYPE_UINT32: "runtime.Uint32P",
// FieldDescriptorProto_TYPE_ENUM
// TODO(yugui) Handle Enum
descriptor.FieldDescriptorProto_TYPE_SFIXED32: "runtime.Int32P",
descriptor.FieldDescriptorProto_TYPE_SFIXED64: "runtime.Int64P",
descriptor.FieldDescriptorProto_TYPE_SINT32: "runtime.Int32P",
descriptor.FieldDescriptorProto_TYPE_SINT64: "runtime.Int64P",
}
)
|
{
"content_hash": "9eca863e615f173ffff57f8e93d95ec3",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 143,
"avg_line_length": 34.20136518771331,
"alnum_prop": 0.7466320726474404,
"repo_name": "DarkDNA/grpc-gateway",
"id": "e9fb6e1b9d3e576788a9cce64916ba5a74ba031c",
"size": "10021",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "protoc-gen-grpc-gateway/descriptor/types.go",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Go",
"bytes": "191096"
},
{
"name": "Makefile",
"bytes": "2550"
},
{
"name": "Protocol Buffer",
"bytes": "4099"
}
]
}
|
$Clients = @(
"CHI-W10PEER-001" # Hyper-V VM
"DELL-3120-001"
"DELL-3300-001"
"DELL-3310-001"
"DELL-5320-001"
"DELL-7040-001"
"DELL-7050-001"
)
$ScriptPath = "E:\HealthCheck\Scripts"
$ClearCacheScript = "ClearConfigMgrAndBranchCacheCaches.ps1"
$PackageInstallScript = "Install-LegacyPackages.ps1"
$CancelDownloadScript = "Cancel-Downloads.ps1"
$StifleRClientUsageScript = "Invoke-StifleRClientCPUUsage.ps1"
$AutologonEXE = "E:\Setup\Sysinternals\SysinternalsSuite\Autologon.exe"
$NumberOfClients = ($Clients | Measure-Object).Count
Write-Host "Total Number of active clients is: $NumberOfClients"
# Copy the scripts to all clients
Foreach ($Client in $Clients){
$ComputerName = $Client
Write-Host "Working on $ComputerName, copying the various scripts"
Copy-Item -Path "$ScriptPath\$PackageInstallScript" -Destination "\\$ComputerName\C`$\Windows\Temp" -Force
Copy-Item -Path "$ScriptPath\$CancelDownloadScript" -Destination "\\$ComputerName\C`$\Windows\Temp" -Force
Copy-Item -Path "$ScriptPath\$StifleRClientUsageScript" -Destination "\\$ComputerName\C`$\Windows\Temp" -Force
Copy-Item -Path "$ScriptPath\$ClearCacheScript" -Destination "\\$ComputerName\C`$\Windows\Temp" -Force
}
# Copy Autologon to all clients
Foreach ($Client in $Clients){
$ComputerName = $Client
Write-Host "Working on $ComputerName, copying Autologon.exe"
Copy-Item -Path $AutologonEXE -Destination "\\$ComputerName\C`$\Windows\System32" -Force
}
$PackageInstallScriptBlock = [scriptblock]::Create("C:\Windows\Temp\$PackageInstallScript")
$CancelDownloadScriptBlock = [scriptblock]::Create("C:\Windows\Temp\$CancelDownloadScript")
$StifleRClientUsageScriptBlock = [scriptblock]::Create("C:\Windows\Temp\$StifleRClientUsageScript")
$ClearCacheScriptBlock = [scriptblock]::Create("C:\Windows\Temp\$ClearCacheScript")
# ---------------------------------------
# Reset Test Environment
# ---------------------------------------
# Cancel any downloads
Foreach ($Client in $Clients){
$ComputerName = $Client
Write-Host "Working on $ComputerName"
Invoke-Command -ComputerName $ComputerName -ScriptBlock $CancelDownloadScriptBlock -AsJob | Out-Null
}
# Clear any results
Foreach ($Client in $Clients){
$ComputerName = $Client
If (Test-Path "\\$ComputerName\C`$\Windows\Temp\StiflerClientUsage.txt"){
Remove-Item -Path "\\$ComputerName\C`$\Windows\Temp\StiflerClientUsage.txt" -Force
}
}
# Run the Clear caches script on each client
$ClearCacheScriptBlock = [scriptblock]::Create("C:\Windows\Temp\$ClearCacheScript")
Foreach ($Client in $Clients){
$ComputerName = $Client
Write-Host "Working on $ComputerName"
Invoke-Command -ComputerName $ComputerName -ScriptBlock $ClearCacheScriptBlock -AsJob | Out-Null
}
Start-Sleep -Seconds 60
# Verify that the caches are empty
Foreach ($Client in $Clients){
$ComputerName = $Client
Write-Host "Working on $ComputerName"
Invoke-Command -ComputerName $ComputerName -ScriptBlock {
$UIResourceMgr = new-object -com "UIResource.UIResourceMgr"
$CMCacheInfo = $UIResourceMgr.GetCacheInfo()
$CMCacheFreeInGB = [math]::Round(($CMCacheInfo.FreeSize)/1024,2) # Original value in MB
$CMCacheTotalInGB = [math]::Round(($CMCacheInfo.TotalSize)/1024,2) # Original value in MB
$CMCacheUsedInGB = [math]::Round($CMCacheTotalInGB - $CMCacheFreeInGB,2)
Write-host "ConfigMgr Client used cache size is: $([math]::Round($CMCacheTotalInGB - $CMCacheFreeInGB,2))"
}
Invoke-Command -ComputerName $ComputerName -ScriptBlock {
Write-host "BranchCache active cache size is: $([math]::Round(((Get-BCDataCache).CurrentActiveCacheSize/1GB),2))"
}
Write-Host ""
}
# Check status of jobs
Get-Job
# -----------------------------------------------------------
# Start Mass Deployment
# -----------------------------------------------------------
# Run the scripts on each client, one client at the time
Foreach ($Client in $Clients){
$ComputerName = $Client
Write-Host "Working on $ComputerName, Running the $PackageInstallScript script"
Invoke-Command -ComputerName $ComputerName -ScriptBlock $PackageInstallScriptBlock -AsJob | Out-Null
Write-Host "Waiting 2 minutes... making sure the download is running"
Start-Sleep -seconds 120
Write-Host "Running the $StifleRClientUsageScript script"
Invoke-Command -ComputerName $ComputerName -ScriptBlock $StifleRClientUsageScriptBlock -AsJob | Out-Null
Write-Host "Waiting 12 minutes... Giving the 10 minute usage script extra time to complete "
Start-Sleep -Seconds 720
$Result = Get-Content -Path "\\$ComputerName\C`$\Windows\Temp\StiflerClientUsage.txt"
Write-Host "StifleR Client CPU Usage on $ComputerName is $Result%"
#Read-host -Prompt "Verify usage output, then press <Enter> to continue to next computer"
Write-Host "Cancelling the download"
Invoke-Command -ComputerName $ComputerName -ScriptBlock $CancelDownloadScriptBlock -AsJob | Out-Null
Start-Sleep -Seconds 30
#Read-host -Prompt "Verify downloaded cancelled, then press <Enter> to continue to next computer"
#Write-Host "Clearing cache and move on to next computer"
Invoke-Command -ComputerName $ComputerName -ScriptBlock $ClearCacheScriptBlock -AsJob | Out-Null
}
Start-Sleep -Seconds 300
# Collect the results
Foreach ($Client in $Clients){
$ComputerName = $Client
If (Test-Path "\\$ComputerName\C`$\Windows\Temp\StiflerClientUsage.txt"){
$Result = Get-Content -Path "\\$ComputerName\C`$\Windows\Temp\StiflerClientUsage.txt"
Write-Host "StifleR Client CPU Usage on $ComputerName is $Result%"
}
}
|
{
"content_hash": "4d31298f88f99e14787ceba959a7c9b4",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 121,
"avg_line_length": 41.20863309352518,
"alnum_prop": 0.7016410614525139,
"repo_name": "DeploymentResearch/DRFiles",
"id": "50cdff4b18d65d44e1d5d5a0dfd73249a8ac525c",
"size": "5730",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Scripts/CPU-PerProcessBenchmarking/Invoke-StifleRClientCPUMassBenchmarking.ps1",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "5127"
},
{
"name": "PowerShell",
"bytes": "386702"
},
{
"name": "TSQL",
"bytes": "1801"
},
{
"name": "VBScript",
"bytes": "9570"
}
]
}
|
class Python3 < Formula
desc "Interpreted, interactive, object-oriented programming language"
homepage "https://www.python.org/"
revision 2
head "https://hg.python.org/cpython", :using => :hg
stable do
url "https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz"
sha256 "0010f56100b9b74259ebcd5d4b295a32324b58b517403a10d1a2aa7cb22bca40"
# Patch for pyport.h macro issue
# https://bugs.python.org/issue10910
# https://trac.macports.org/ticket/44288
patch do
url "https://bugs.python.org/file30805/issue10910-workaround.txt"
sha256 "c075353337f9ff3ccf8091693d278782fcdff62c113245d8de43c5c7acc57daf"
end
end
bottle do
sha256 "848f9ef6f09b2f9e28e4ad29bc2f85d843ae0e2c174f83aedc530b5ba670c704" => :sierra
sha256 "33300aca2ef4703fb8dfc1a7f6520c2cde6e912f983c3779f8d0d285dade572c" => :el_capitan
sha256 "3e3cdeaa764bf24ca00d34c3d54b00142de6ae6c1f9e57c014d0a99ea7a583b0" => :yosemite
end
devel do
url "https://www.python.org/ftp/python/3.6.0/Python-3.6.0b1.tar.xz"
sha256 "a83b094a8abf8a1fba7c548a5e8dd0aabe87a87a6ebd87c97f4a5a2527a74d42"
end
option :universal
option "with-tcl-tk", "Use Homebrew's Tk instead of OS X Tk (has optional Cocoa and threads support)"
option "with-quicktest", "Run `make quicktest` after the build"
option "with-sphinx-doc", "Build HTML documentation"
deprecated_option "quicktest" => "with-quicktest"
deprecated_option "with-brewed-tk" => "with-tcl-tk"
depends_on "pkg-config" => :build
depends_on "readline" => :recommended
depends_on "sqlite" => :recommended
depends_on "gdbm" => :recommended
depends_on "openssl"
depends_on "xz" => :recommended # for the lzma module added in 3.3
depends_on "homebrew/dupes/tcl-tk" => :optional
depends_on :x11 if build.with?("tcl-tk") && Tab.for_name("homebrew/dupes/tcl-tk").with?("x11")
depends_on "sphinx-doc" => [:build, :optional]
skip_clean "bin/pip3", "bin/pip-3.4", "bin/pip-3.5"
skip_clean "bin/easy_install3", "bin/easy_install-3.4", "bin/easy_install-3.5"
resource "setuptools" do
url "https://files.pythonhosted.org/packages/9f/32/81c324675725d78e7f6da777483a3453611a427db0145dfb878940469692/setuptools-25.2.0.tar.gz"
sha256 "b2757ddac2c41173140b111e246d200768f6dd314110e1e40661d0ecf9b4d6a6"
end
resource "pip" do
url "https://pypi.python.org/packages/e7/a8/7556133689add8d1a54c0b14aeff0acb03c64707ce100ecd53934da1aa13/pip-8.1.2.tar.gz"
sha256 "4d24b03ffa67638a3fa931c09fd9e0273ffa904e95ebebe7d4b1a54c93d7b732"
end
resource "wheel" do
url "https://pypi.python.org/packages/source/w/wheel/wheel-0.29.0.tar.gz"
sha256 "1ebb8ad7e26b448e9caa4773d2357849bf80ff9e313964bcaf79cbf0201a1648"
end
fails_with :clang do
build 425
cause "https://bugs.python.org/issue24844"
end
# Homebrew's tcl-tk is built in a standard unix fashion (due to link errors)
# so we have to stop python from searching for frameworks and linking against
# X11.
patch :DATA if build.with? "tcl-tk"
def lib_cellar
prefix/"Frameworks/Python.framework/Versions/#{xy}/lib/python#{xy}"
end
def site_packages_cellar
lib_cellar/"site-packages"
end
# The HOMEBREW_PREFIX location of site-packages.
def site_packages
HOMEBREW_PREFIX/"lib/python#{xy}/site-packages"
end
fails_with :llvm do
build 2336
cause <<-EOS.undent
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
python.exe(14122) malloc: *** mmap(size=7310873954244194304) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Could not import runpy module
make: *** [pybuilddir.txt] Segmentation fault: 11
EOS
end
# setuptools remembers the build flags python is built with and uses them to
# build packages later. Xcode-only systems need different flags.
pour_bottle? do
reason <<-EOS.undent
The bottle needs the Apple Command Line Tools to be installed.
You can install them, if desired, with:
xcode-select --install
EOS
satisfy { MacOS::CLT.installed? }
end
def install
ENV.permit_weak_imports
# Unset these so that installing pip and setuptools puts them where we want
# and not into some other Python the user has installed.
ENV["PYTHONHOME"] = nil
ENV["PYTHONPATH"] = nil
args = %W[
--prefix=#{prefix}
--enable-ipv6
--datarootdir=#{share}
--datadir=#{share}
--enable-framework=#{frameworks}
--without-ensurepip
]
args << "--without-gcc" if ENV.compiler == :clang
args << "--enable-loadable-sqlite-extensions" if build.with?("sqlite")
cflags = []
ldflags = []
cppflags = []
unless MacOS::CLT.installed?
# Help Python's build system (setuptools/pip) to build things on Xcode-only systems
# The setup.py looks at "-isysroot" to get the sysroot (and not at --sysroot)
cflags << "-isysroot #{MacOS.sdk_path}"
ldflags << "-isysroot #{MacOS.sdk_path}"
cppflags << "-I#{MacOS.sdk_path}/usr/include" # find zlib
# For the Xlib.h, Python needs this header dir with the system Tk
if build.without? "tcl-tk"
cflags << "-I#{MacOS.sdk_path}/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers"
end
end
# Avoid linking to libgcc https://mail.python.org/pipermail/python-dev/2012-February/116205.html
args << "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}"
# We want our readline and openssl! This is just to outsmart the detection code,
# superenv makes cc always find includes/libs!
inreplace "setup.py" do |s|
s.gsub! "do_readline = self.compiler.find_library_file(lib_dirs, 'readline')",
"do_readline = '#{Formula["readline"].opt_lib}/libhistory.dylib'"
s.gsub! "/usr/local/ssl", Formula["openssl"].opt_prefix
end
if build.universal?
ENV.universal_binary
args << "--enable-universalsdk" << "--with-universal-archs=intel"
end
if build.with? "sqlite"
inreplace "setup.py" do |s|
s.gsub! "sqlite_setup_debug = False", "sqlite_setup_debug = True"
s.gsub! "for d_ in inc_dirs + sqlite_inc_paths:",
"for d_ in ['#{Formula["sqlite"].opt_include}']:"
end
end
# Allow python modules to use ctypes.find_library to find homebrew's stuff
# even if homebrew is not a /usr/local/lib. Try this with:
# `brew install enchant && pip install pyenchant`
inreplace "./Lib/ctypes/macholib/dyld.py" do |f|
f.gsub! "DEFAULT_LIBRARY_FALLBACK = [", "DEFAULT_LIBRARY_FALLBACK = [ '#{HOMEBREW_PREFIX}/lib',"
f.gsub! "DEFAULT_FRAMEWORK_FALLBACK = [", "DEFAULT_FRAMEWORK_FALLBACK = [ '#{HOMEBREW_PREFIX}/Frameworks',"
end
if build.with? "tcl-tk"
tcl_tk = Formula["tcl-tk"].opt_prefix
cppflags << "-I#{tcl_tk}/include"
ldflags << "-L#{tcl_tk}/lib"
end
args << "CFLAGS=#{cflags.join(" ")}" unless cflags.empty?
args << "LDFLAGS=#{ldflags.join(" ")}" unless ldflags.empty?
args << "CPPFLAGS=#{cppflags.join(" ")}" unless cppflags.empty?
system "./configure", *args
system "make"
ENV.deparallelize # Installs must be serialized
# Tell Python not to install into /Applications (default for framework builds)
system "make", "install", "PYTHONAPPSDIR=#{prefix}"
# Demos and Tools
system "make", "frameworkinstallextras", "PYTHONAPPSDIR=#{pkgshare}"
system "make", "quicktest" if build.with? "quicktest"
# Any .app get a " 3" attached, so it does not conflict with python 2.x.
Dir.glob("#{prefix}/*.app") { |app| mv app, app.sub(/\.app$/, " 3.app") }
# A fix, because python and python3 both want to install Python.framework
# and therefore we can't link both into HOMEBREW_PREFIX/Frameworks
# https://github.com/Homebrew/homebrew/issues/15943
["Headers", "Python", "Resources"].each { |f| rm(prefix/"Frameworks/Python.framework/#{f}") }
rm prefix/"Frameworks/Python.framework/Versions/Current"
# Symlink the pkgconfig files into HOMEBREW_PREFIX so they're accessible.
(lib/"pkgconfig").install_symlink Dir["#{frameworks}/Python.framework/Versions/#{xy}/lib/pkgconfig/*"]
# Remove 2to3 because python2 also installs it
rm bin/"2to3"
# Remove the site-packages that Python created in its Cellar.
site_packages_cellar.rmtree
# These makevars are available through distutils.sysconfig at runtime and
# some third-party software packages depend on them
inreplace Dir.glob(frameworks/"Python.framework/Versions/#{xy}/lib/python#{xy}/config-#{xy}*/Makefile") do |s|
s.change_make_var! "LINKFORSHARED",
"#{opt_prefix}/Frameworks/Python.framework/Versions/#{xy}/Python"
end
%w[setuptools pip wheel].each do |r|
(libexec/r).install resource(r)
end
if build.with? "sphinx-doc"
cd "Doc" do
system "make", "html"
doc.install Dir["build/html/*"]
end
end
end
def post_install
# Fix up the site-packages so that user-installed Python software survives
# minor updates, such as going from 3.3.2 to 3.3.3:
# Create a site-packages in HOMEBREW_PREFIX/lib/python#{xy}/site-packages
site_packages.mkpath
# Symlink the prefix site-packages into the cellar.
site_packages_cellar.unlink if site_packages_cellar.exist?
site_packages_cellar.parent.install_symlink site_packages
# Write our sitecustomize.py
rm_rf Dir["#{site_packages}/sitecustomize.py[co]"]
(site_packages/"sitecustomize.py").atomic_write(sitecustomize)
# Remove old setuptools installations that may still fly around and be
# listed in the easy_install.pth. This can break setuptools build with
# zipimport.ZipImportError: bad local file header
# setuptools-0.9.8-py3.3.egg
rm_rf Dir["#{site_packages}/setuptools*"]
rm_rf Dir["#{site_packages}/distribute*"]
rm_rf Dir["#{site_packages}/pip[-_.][0-9]*", "#{site_packages}/pip"]
%w[setuptools pip wheel].each do |pkg|
(libexec/pkg).cd do
system bin/"python3", "-s", "setup.py", "--no-user-cfg", "install",
"--force", "--verbose", "--install-scripts=#{bin}",
"--install-lib=#{site_packages}",
"--single-version-externally-managed",
"--record=installed.txt"
end
end
rm_rf [bin/"pip", bin/"easy_install"]
mv bin/"wheel", bin/"wheel3"
# post_install happens after link
%W[pip3 pip#{xy} easy_install-#{xy} wheel3].each do |e|
(HOMEBREW_PREFIX/"bin").install_symlink bin/e
end
# Help distutils find brewed stuff when building extensions
include_dirs = [HOMEBREW_PREFIX/"include", Formula["openssl"].opt_include]
library_dirs = [HOMEBREW_PREFIX/"lib", Formula["openssl"].opt_lib]
if build.with? "sqlite"
include_dirs << Formula["sqlite"].opt_include
library_dirs << Formula["sqlite"].opt_lib
end
if build.with? "tcl-tk"
include_dirs << Formula["homebrew/dupes/tcl-tk"].opt_include
library_dirs << Formula["homebrew/dupes/tcl-tk"].opt_lib
end
cfg = lib_cellar/"distutils/distutils.cfg"
cfg.atomic_write <<-EOF.undent
[install]
prefix=#{HOMEBREW_PREFIX}
[build_ext]
include_dirs=#{include_dirs.join ":"}
library_dirs=#{library_dirs.join ":"}
EOF
end
def xy
version.to_s.slice(/(3\.\d)/) || "3.6"
end
def sitecustomize
<<-EOF.undent
# This file is created by Homebrew and is executed on each python startup.
# Don't print from here, or else python command line scripts may fail!
# <https://github.com/Homebrew/brew/blob/master/docs/Homebrew-and-Python.md>
import re
import os
import sys
if sys.version_info[0] != 3:
# This can only happen if the user has set the PYTHONPATH for 3.x and run Python 2.x or vice versa.
# Every Python looks at the PYTHONPATH variable and we can't fix it here in sitecustomize.py,
# because the PYTHONPATH is evaluated after the sitecustomize.py. Many modules (e.g. PyQt4) are
# built only for a specific version of Python and will fail with cryptic error messages.
# In the end this means: Don't set the PYTHONPATH permanently if you use different Python versions.
exit('Your PYTHONPATH points to a site-packages dir for Python 3.x but you are running Python ' +
str(sys.version_info[0]) + '.x!\\n PYTHONPATH is currently: "' + str(os.environ['PYTHONPATH']) + '"\\n' +
' You should `unset PYTHONPATH` to fix this.')
# Only do this for a brewed python:
if os.path.realpath(sys.executable).startswith('#{rack}'):
# Shuffle /Library site-packages to the end of sys.path
library_site = '/Library/Python/#{xy}/site-packages'
library_packages = [p for p in sys.path if p.startswith(library_site)]
sys.path = [p for p in sys.path if not p.startswith(library_site)]
# .pth files have already been processed so don't use addsitedir
sys.path.extend(library_packages)
# the Cellar site-packages is a symlink to the HOMEBREW_PREFIX
# site_packages; prefer the shorter paths
long_prefix = re.compile(r'#{rack}/[0-9\._abrc]+/Frameworks/Python\.framework/Versions/#{xy}/lib/python#{xy}/site-packages')
sys.path = [long_prefix.sub('#{site_packages}', p) for p in sys.path]
# Set the sys.executable to use the opt_prefix
sys.executable = '#{opt_bin}/python#{xy}'
EOF
end
def caveats
text = <<-EOS.undent
Pip, setuptools, and wheel have been installed. To update them
pip3 install --upgrade pip setuptools wheel
You can install Python packages with
pip3 install <package>
They will install into the site-package directory
#{site_packages}
See: https://github.com/Homebrew/brew/blob/master/docs/Homebrew-and-Python.md
EOS
# Tk warning only for 10.6
tk_caveats = <<-EOS.undent
Apple's Tcl/Tk is not recommended for use with Python on Mac OS X 10.6.
For more information see: https://www.python.org/download/mac/tcltk/
EOS
text += tk_caveats unless MacOS.version >= :lion
text
end
test do
# Check if sqlite is ok, because we build with --enable-loadable-sqlite-extensions
# and it can occur that building sqlite silently fails if OSX's sqlite is used.
system "#{bin}/python#{xy}", "-c", "import sqlite3"
# Check if some other modules import. Then the linked libs are working.
system "#{bin}/python#{xy}", "-c", "import tkinter; root = tkinter.Tk()"
system bin/"pip3", "list"
end
end
__END__
diff --git a/setup.py b/setup.py
index 2779658..902d0eb 100644
--- a/setup.py
+++ b/setup.py
@@ -1699,9 +1699,6 @@ class PyBuildExt(build_ext):
# Rather than complicate the code below, detecting and building
# AquaTk is a separate method. Only one Tkinter will be built on
# Darwin - either AquaTk, if it is found, or X11 based Tk.
- if (host_platform == 'darwin' and
- self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
- return
# Assume we haven't found any of the libraries or include files
# The versions with dots are used on Unix, and the versions without
@@ -1747,22 +1744,6 @@ class PyBuildExt(build_ext):
if dir not in include_dirs:
include_dirs.append(dir)
- # Check for various platform-specific directories
- if host_platform == 'sunos5':
- include_dirs.append('/usr/openwin/include')
- added_lib_dirs.append('/usr/openwin/lib')
- elif os.path.exists('/usr/X11R6/include'):
- include_dirs.append('/usr/X11R6/include')
- added_lib_dirs.append('/usr/X11R6/lib64')
- added_lib_dirs.append('/usr/X11R6/lib')
- elif os.path.exists('/usr/X11R5/include'):
- include_dirs.append('/usr/X11R5/include')
- added_lib_dirs.append('/usr/X11R5/lib')
- else:
- # Assume default location for X11
- include_dirs.append('/usr/X11/include')
- added_lib_dirs.append('/usr/X11/lib')
-
# If Cygwin, then verify that X is installed before proceeding
if host_platform == 'cygwin':
x11_inc = find_file('X11/Xlib.h', [], include_dirs)
@@ -1786,10 +1767,6 @@ class PyBuildExt(build_ext):
if host_platform in ['aix3', 'aix4']:
libs.append('ld')
- # Finally, link with the X11 libraries (not appropriate on cygwin)
- if host_platform != "cygwin":
- libs.append('X11')
-
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
define_macros=[('WITH_APPINIT', 1)] + defs,
include_dirs = include_dirs,
|
{
"content_hash": "b21c1aa21e0624272e99de60a7288c09",
"timestamp": "",
"source": "github",
"line_count": 431,
"max_line_length": 141,
"avg_line_length": 39.461716937354986,
"alnum_prop": 0.6572201317027281,
"repo_name": "lasote/homebrew-core",
"id": "aec6d9cd1ae2ff19bf0eeb666a784d37baea7b7c",
"size": "17008",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Formula/python3.rb",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Perl",
"bytes": "628"
},
{
"name": "Ruby",
"bytes": "5834139"
}
]
}
|
package com.github.jnthnclt.os.lab.io.filer;
import java.io.IOException;
import java.io.OutputStream;
/**
*
* @author jonathan.colt
*/
public class FilerOutputStream implements IWriteableBytes {
private final OutputStream outputStream;
public FilerOutputStream(OutputStream outputStream) {
this.outputStream = outputStream;
}
public void write(byte b) throws IOException {
outputStream.write(b);
}
@Override
public void write(byte[] b, int _offset, int _len) throws IOException {
outputStream.write(b, _offset, _len);
}
@Override
public void flush(boolean fsync) throws IOException {
outputStream.flush();
}
@Override
public void close() throws IOException {
outputStream.close();
}
@Override
public Object lock() {
return outputStream;
}
@Override
public void seek(long position) throws IOException {
throw new UnsupportedOperationException("Not supported.");
}
@Override
public long length() throws IOException {
throw new UnsupportedOperationException("Not supported.");
}
@Override
public long getFilePointer() throws IOException {
throw new UnsupportedOperationException("Not supported.");
}
}
|
{
"content_hash": "a2b65f2f1a013194254aee65ab0de8b5",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 75,
"avg_line_length": 22.649122807017545,
"alnum_prop": 0.6684740511231604,
"repo_name": "jnthnclt/lab",
"id": "5b130da90f64c99293f9920d12d4959699fa0d30",
"size": "1291",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lab-base/src/main/java/com/github/jnthnclt/os/lab/io/filer/FilerOutputStream.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1292000"
},
{
"name": "Shell",
"bytes": "161"
}
]
}
|
#include "csv_parser.hpp"
#include <fstream>
#include <list>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "constant_mappings.hpp"
#include "hyrise.hpp"
#include "import_export/csv/csv_converter.hpp"
#include "import_export/csv/csv_meta.hpp"
#include "resolve_type.hpp"
#include "scheduler/job_task.hpp"
#include "storage/table.hpp"
#include "utils/assert.hpp"
#include "utils/load_table.hpp"
namespace hyrise {
std::shared_ptr<Table> CsvParser::parse(const std::string& filename, const ChunkOffset chunk_size,
const std::optional<CsvMeta>& csv_meta) {
// If no meta info is given as a parameter, look for a json file
CsvMeta meta;
if (csv_meta == std::nullopt) {
meta = process_csv_meta_file(filename + CsvMeta::META_FILE_EXTENSION);
} else {
meta = *csv_meta;
}
auto escaped_linebreak = std::string(1, meta.config.delimiter_escape) + std::string(1, meta.config.delimiter);
auto table = _create_table_from_meta(chunk_size, meta);
std::ifstream csvfile{filename};
// return empty table if input file is empty
if (!csvfile || csvfile.peek() == EOF || csvfile.peek() == '\r' || csvfile.peek() == '\n') {
return table;
}
{
std::string line;
std::getline(csvfile, line);
Assert(line.find('\r') == std::string::npos, "Windows encoding is not supported, use dos2unix");
}
/**
* Load the whole file(!) into a std::string using the, hopefully, fastest method to do so.
* TODO(anybody) Maybe use mmap() in the future. The current approach needs to have the entire file in RAM, mmap might
* be cleverer, dunno.
*/
csvfile.seekg(0, std::ios::end);
const auto csvfile_size = csvfile.tellg();
std::string content(csvfile_size, ' ');
csvfile.seekg(0);
csvfile.read(content.data(), csvfile_size);
// make sure content ends with a delimiter for better row processing later
if (content.back() != meta.config.delimiter) {
content.push_back(meta.config.delimiter);
}
std::string_view content_view{content.c_str(), content.size()};
// Save chunks in list to avoid memory relocation
std::list<Segments> segments_by_chunks;
std::vector<std::shared_ptr<AbstractTask>> tasks;
std::vector<size_t> field_ends;
std::mutex append_chunk_mutex;
while (_find_fields_in_chunk(content_view, *table, field_ends, meta)) {
// create empty chunk
segments_by_chunks.emplace_back();
auto& segments = segments_by_chunks.back();
// Only pass the part of the string that is actually needed to the parsing task
std::string_view relevant_content = content_view.substr(0, field_ends.back());
// Remove processed part of the csv content
content_view = content_view.substr(field_ends.back() + 1);
// create and start parsing task to fill chunk
tasks.emplace_back(std::make_shared<JobTask>([relevant_content, field_ends, &table, &segments, &meta,
&escaped_linebreak, &append_chunk_mutex]() {
_parse_into_chunk(relevant_content, field_ends, *table, segments, meta, escaped_linebreak, append_chunk_mutex);
}));
tasks.back()->schedule();
}
Hyrise::get().scheduler()->wait_for_tasks(tasks);
for (auto& segments : segments_by_chunks) {
DebugAssert(!segments.empty(), "Empty chunks shouldn't occur when importing CSV");
const auto mvcc_data = std::make_shared<MvccData>(segments.front()->size(), CommitID{0});
table->append_chunk(segments, mvcc_data);
table->last_chunk()->finalize();
}
return table;
}
std::shared_ptr<Table> CsvParser::create_table_from_meta_file(const std::string& filename,
const ChunkOffset chunk_size) {
const auto meta = process_csv_meta_file(filename);
return _create_table_from_meta(chunk_size, meta);
}
std::shared_ptr<Table> CsvParser::_create_table_from_meta(const ChunkOffset chunk_size, const CsvMeta& meta) {
TableColumnDefinitions column_definitions;
for (const auto& column_meta : meta.columns) {
auto column_name = column_meta.name;
BaseCsvConverter::unescape(column_name);
auto column_type = column_meta.type;
BaseCsvConverter::unescape(column_type);
const auto data_type = data_type_to_string.right.at(column_type);
column_definitions.emplace_back(column_name, data_type, column_meta.nullable);
}
return std::make_shared<Table>(column_definitions, TableType::Data, chunk_size, UseMvcc::Yes);
}
bool CsvParser::_find_fields_in_chunk(std::string_view csv_content, const Table& table, std::vector<size_t>& field_ends,
const CsvMeta& meta) {
field_ends.clear();
if (csv_content.empty()) {
return false;
}
std::string search_for{meta.config.separator, meta.config.delimiter, meta.config.quote};
size_t from = 0;
unsigned int rows = 0;
unsigned int field_count = 1;
bool in_quotes = false;
while (rows < table.target_chunk_size()) {
// Find either of row separator, column delimiter, quote identifier
auto pos = csv_content.find_first_of(search_for, from);
if (std::string::npos == pos) {
break;
}
from = pos + 1;
const char elem = csv_content[pos];
// Make sure to "toggle" in_quotes ONLY if the quotes are not part of the string (i.e. escaped)
if (elem == meta.config.quote) {
bool quote_is_escaped = false;
if (meta.config.quote != meta.config.escape) {
quote_is_escaped = pos != 0 && csv_content[pos - 1] == meta.config.escape;
}
if (!quote_is_escaped) {
in_quotes = !in_quotes;
}
}
// Determine if delimiter marks end of row or is part of the (string) value
if (elem == meta.config.delimiter && !in_quotes) {
DebugAssert(field_count == static_cast<size_t>(table.column_count()),
"Number of CSV fields does not match number of columns.");
++rows;
field_count = 0;
}
// Determine if separator marks end of field or is part of the (string) value
if (in_quotes || elem == meta.config.quote) {
continue;
}
++field_count;
field_ends.push_back(pos);
}
return true;
}
size_t CsvParser::_parse_into_chunk(std::string_view csv_chunk, const std::vector<size_t>& field_ends,
const Table& table, Segments& segments, const CsvMeta& meta,
const std::string& escaped_linebreak, std::mutex& append_chunk_mutex) {
// For each csv column, create a CsvConverter which builds up a ValueSegment
const auto column_count = table.column_count();
const auto row_count = ChunkOffset{static_cast<ChunkOffset::base_type>(field_ends.size() / column_count)};
std::vector<std::unique_ptr<BaseCsvConverter>> converters;
for (auto column_id = ColumnID{0}; column_id < column_count; ++column_id) {
const auto is_nullable = table.column_is_nullable(column_id);
const auto column_type = table.column_data_type(column_id);
resolve_data_type(column_type, [&](const auto type) {
using ColumnDataType = typename decltype(type)::type;
converters.emplace_back(std::make_unique<CsvConverter<ColumnDataType>>(row_count, meta.config, is_nullable));
});
}
Assert(field_ends.size() == static_cast<size_t>(row_count) * column_count, "Unexpected number of fields");
size_t start = 0;
size_t row_id = 0;
size_t field_idx = 0;
ColumnID column_id{0};
try {
for (; row_id < row_count; ++row_id) {
for (column_id = ColumnID{0}; column_id < column_count; ++column_id, ++field_idx) {
const auto end = field_ends[field_idx];
auto field = std::string{csv_chunk.substr(start, end - start)};
start = end + 1;
if (!meta.config.rfc_mode) {
// CSV fields not following RFC 4810 might need some preprocessing
_sanitize_field(field, meta, escaped_linebreak);
}
converters[column_id]->insert(field, static_cast<ChunkOffset>(row_id));
}
}
} catch (const std::exception& exception) {
throw std::logic_error("Exception while parsing CSV, row " + std::to_string(row_id) + ", column " +
std::to_string(column_id) + ":\n" + exception.what());
}
// Transform the field_offsets to segments and add segments to chunk.
{
std::lock_guard<std::mutex> lock(append_chunk_mutex);
for (auto& converter : converters) {
segments.push_back(converter->finish());
}
}
return row_count;
}
void CsvParser::_sanitize_field(std::string& field, const CsvMeta& meta, const std::string& escaped_linebreak) {
std::string::size_type pos = 0;
while ((pos = field.find(escaped_linebreak, pos)) != std::string::npos) {
field.replace(pos, escaped_linebreak.size(), 1, meta.config.delimiter);
++pos;
}
}
} // namespace hyrise
|
{
"content_hash": "70c9d6bc4da267f95131f4c2308a59a1",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 120,
"avg_line_length": 36.260162601626014,
"alnum_prop": 0.6497757847533633,
"repo_name": "hyrise/hyrise",
"id": "ed0509869fd1fd066a5c2f9ad20390b3cf49901c",
"size": "8920",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/lib/import_export/csv/csv_parser.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "5907952"
},
{
"name": "CMake",
"bytes": "76722"
},
{
"name": "Dockerfile",
"bytes": "1345"
},
{
"name": "PLpgSQL",
"bytes": "30508"
},
{
"name": "Python",
"bytes": "110241"
},
{
"name": "Shell",
"bytes": "30173"
}
]
}
|
use std::boxed::FnBox;
use std::sync::{Arc, Mutex};
use std::thread::{self, JoinHandle, spawn};
use util::SourceLocation;
use std::fmt::{Display, Formatter, Error};
use world_state;
pub type ExampleResult = Result<ExampleMetadata, ExampleMetadata>;
pub type ExampleRecoveryBlock = Box<FnBox() -> thread::Result<()> + Send + 'static>;
pub struct ExampleMetadata {
pub description: String,
pub source_location: SourceLocation,
}
impl Display for ExampleMetadata {
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
write!(f, "`{}` at {}", self.description, self.source_location)
}
}
pub struct Example {
block: ExampleRecoveryBlock,
metadata: ExampleMetadata,
}
impl Example {
pub fn new(description: String, source_location: SourceLocation, block: ExampleRecoveryBlock) -> Example {
Example {
block: block,
metadata: ExampleMetadata {
description: description,
source_location: source_location,
}
}
}
pub fn spawn(self, state: Arc<Mutex<world_state::WorldState>>) -> JoinHandle<ExampleResult> {
spawn(move || self.run(state))
}
fn run(self, state: Arc<Mutex<world_state::WorldState>>) -> ExampleResult {
let block_result = (self.block)();
let result = match block_result {
Err(_) => Err(self.metadata),
Ok(_) => Ok(self.metadata),
};
Example::report_result(&result, state);
result
}
fn report_result(result: &ExampleResult, state: Arc<Mutex<world_state::WorldState>>) {
let ref reporter = state.lock().unwrap().reporter;
let reporting_result = if result.is_err() {
reporter.example_failed()
} else {
reporter.example_passed()
};
if reporting_result.is_err() {
panic!("work out what to do here");
}
}
}
|
{
"content_hash": "a2fccb0bd2cc2e9456599c743114cfb5",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 110,
"avg_line_length": 27.884057971014492,
"alnum_prop": 0.6029106029106029,
"repo_name": "samphippen/descriptor",
"id": "a0af90eb80536624696c0ec32f9426acf606f917",
"size": "1924",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/example.rs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Rust",
"bytes": "13345"
}
]
}
|
package com.dremio.exec.store.deltalake;
/**
* DeltaLake specific keywords and conventions
*/
public final class DeltaConstants {
private DeltaConstants() {
// Not to be instantiated
}
public static final String DELTA_FIELD_JOINER = "_";
public static final String DELTA_LOG_DIR = "_delta_log";
public static final String DELTA_LAST_CHECKPOINT = "_last_checkpoint";
public static final String DELTA_FIELD_COMMIT_INFO = "commitInfo";
public static final String DELTA_FIELD_PROTOCOL = "protocol";
public static final String DELTA_FIELD_METADATA = "metaData";
public static final String DELTA_FIELD_ADD = "add";
public static final String DELTA_FIELD_REMOVE = "remove";
public static final String DELTA_FIELD_METADATA_SCHEMA_STRING = "schemaString";
public static final String DELTA_FIELD_METADATA_PARTITION_COLS = "partitionColumns";
public static final String SCHEMA_STRING_FIELDS = "fields";
public static final String SCHEMA_STRING_FIELDS_NAME = "name";
public static final String SCHEMA_STRING_FIELDS_TYPE = "type";
public static final String SCHEMA_STRING_FIELDS_NULLABLE = "nullable";
public static final String SCHEMA_STRING_FIELDS_ARR_ELEMENT_TYPE = "elementType";
public static final String SCHEMA_STRING_MAP_KEY_TYPE = "keyType";
public static final String SCHEMA_STRING_MAP_VALUE_TYPE = "valueType";
public static final String SCHEMA_STRING_MAP_VALUE_CONTAINS_NULL = "valueContainsNull";
public static final String SCHEMA_STRING_FIELDS_ARR_CONTAINS_NULL = "containsNull";
public static final String DELTA_FIELD_ADD_SIZE = "size";
public static final String DELTA_FIELD_ADD_STATS_PARSED = "stats_parsed";
public static final String DELTA_FIELD_ADD_PATH = "path";
public static final String STATS_PARSED_NUM_RECORDS = "numRecords";
public static final String DELTA_STRUCT = "struct";
public static final String DELTA_ENTRIES = "entries";
public static final String DELTA_ARRAY = "array";
public static final String DELTA_MAP = "map";
public static final String DELTA_BYTE = "byte";
public static final String DELTA_SHORT = "short";
public static final String DELTA_INT = "integer";
public static final String DELTA_LONG = "long";
public static final String DELTA_FLOAT = "float";
public static final String DELTA_DOUBLE = "double";
public static final String DELTA_BOOL = "boolean";
public static final String DELTA_STRING = "string";
public static final String DELTA_BINARY = "binary";
public static final String DELTA_TIMESTAMP = "timestamp";
public static final String DELTA_DATE = "date";
public static final String DELTA_DECIMAL = "decimal";
public static final String OP = "operation";
public static final String OP_METRICS = "operationMetrics";
public static final String OP_NUM_FILES = "numFiles";
public static final String OP_NUM_ADDED_FILES = "numAddedFiles";
public static final String OP_NUM_REMOVED_FILES = "numRemovedFiles";
public static final String OP_NUM_OUTPUT_ROWS = "numOutputRows";
public static final String OP_NUM_OUTPUT_BYTES = "numOutputBytes";
public static final String OP_NUM_ADDED_BYTES = "numAddedBytes";
public static final String OP_NUM_REMOVED_BYTES = "numRemovedBytes";
public static final String OP_NUM_DELETED_ROWS = "numDeletedRows";
public static final String PROTOCOL_MIN_READER_VERSION = "minReaderVersion";
public static final String SCHEMA_PATH = "path";
public static final String SCHEMA_KEY = "key";
public static final String SCHEMA_VALUE = "value";
public static final String SCHEMA_KEY_VALUE = "key_value";
public static final String SCHEMA_PARTITION_VALUES = "partitionValues";
public static final String SCHEMA_SIZE = "size";
public static final String SCHEMA_MODIFICATION_TIME = "modificationTime";
public static final String SCHEMA_DATA_CHANGE = "dataChange";
public static final String SCHEMA_TAGS = "tags";
public static final String SCHEMA_STATS = "stats";
public static final String SCHEMA_PARTITION_VALUES_PARSED = "partitionValues_parsed";
public static final String SCHEMA_MIN_VALUES = "minValues";
public static final String SCHEMA_MAX_VALUES = "maxValues";
public static final String SCHEMA_NULL_COUNT = "nullCount";
public static final String SCHEMA_NUM_RECORDS = "numRecords";
public static final String SCHEMA_STATS_PARSED = "stats_parsed";
public static final String SCHEMA_DELETION_TIMESTAMP = "deletionTimestamp";
public static final String VERSION = "version";
public static final String SCHEMA_ADD_PATH = DELTA_FIELD_ADD + DELTA_FIELD_JOINER + SCHEMA_PATH;
public static final String SCHEMA_REMOVE_PATH = DELTA_FIELD_REMOVE + DELTA_FIELD_JOINER + SCHEMA_PATH;
public static final String SCHEMA_ADD_VERSION = DELTA_FIELD_ADD + DELTA_FIELD_JOINER + VERSION;
public static final String SCHEMA_REMOVE_VERSION = DELTA_FIELD_REMOVE + DELTA_FIELD_JOINER + VERSION;
public static final String SCHMEA_ADD_DATACHANGE = DELTA_FIELD_ADD + DELTA_FIELD_JOINER + SCHEMA_DATA_CHANGE;
public static final String SCHEMA_ADD_SIZE = DELTA_FIELD_ADD + DELTA_FIELD_JOINER + SCHEMA_SIZE;
public static final String SCHEMA_ADD_MODIFICATION_TIME = DELTA_FIELD_ADD + DELTA_FIELD_JOINER + SCHEMA_MODIFICATION_TIME;
// Suffix for partition column names as we want to avoid any clashes with non-partition column names.
public static final String PARTITION_NAME_SUFFIX = "_val";
}
|
{
"content_hash": "0d631e15a8878d71894867f6987988eb",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 126,
"avg_line_length": 55.68,
"alnum_prop": 0.7350933908045977,
"repo_name": "dremio/dremio-oss",
"id": "d562166d4def0abf403d0372ad4f07941f5db4b4",
"size": "6178",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sabot/kernel/src/main/java/com/dremio/exec/store/deltalake/DeltaConstants.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "47376"
},
{
"name": "Dockerfile",
"bytes": "1668"
},
{
"name": "FreeMarker",
"bytes": "132156"
},
{
"name": "GAP",
"bytes": "15936"
},
{
"name": "HTML",
"bytes": "6544"
},
{
"name": "Java",
"bytes": "39679012"
},
{
"name": "JavaScript",
"bytes": "5439822"
},
{
"name": "Less",
"bytes": "547002"
},
{
"name": "SCSS",
"bytes": "95688"
},
{
"name": "Shell",
"bytes": "16063"
},
{
"name": "TypeScript",
"bytes": "887739"
}
]
}
|
package com.bortbort.arduino.Model.Core.PinTypes;
import com.bortbort.arduino.FiloFirmata.Firmata;
import com.bortbort.arduino.FiloFirmata.MessageListener;
import com.bortbort.arduino.FiloFirmata.Messages.AnalogMessage;
import com.bortbort.arduino.FiloFirmata.Messages.ReportAnalogPinMessage;
import com.bortbort.arduino.FiloFirmata.PinCapability;
import com.bortbort.arduino.Model.Core.AnalogPinMapper;
import com.bortbort.arduino.Model.Core.Pin;
import com.bortbort.arduino.Model.Core.PinEventManager;
import com.bortbort.arduino.Model.Core.PinEvents.AnalogValueEvent;
import com.bortbort.arduino.Model.Core.PinEvents.ReportAnalogEvent;
import com.bortbort.arduino.Model.Core.PinResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Created by chuck on 3/4/2016.
*/
public class AnalogPin extends Pin {
private static final Logger log = LoggerFactory.getLogger(AnalogPin.class);
private Integer analogPinID;
private Integer currentValueInt = null;
private Byte currentValueByte = null;
private Boolean pinEventing = false;
private MessageListener<AnalogMessage> analogListener = MessageListener.from(message -> {
// Remove when stable
if (!message.getChannelInt().equals(analogPinID)) {
log.error("Listener hit for pin {} but is really for pin {}!",
analogPinID, message.getChannelInt());
throw new RuntimeException("Coding error. Listener firing wrong pin.");
}
Integer previousValueInt = currentValueInt;
Byte previousValueByte = currentValueByte;
currentValueInt = message.getAnalogValue();
currentValueByte = message.getAnalogValueByte();
fireEvent(new AnalogValueEvent(previousValueInt, previousValueByte, currentValueInt, currentValueByte));
});
public AnalogPin(Firmata firmata, PinEventManager eventManager, PinResource pinResource, Integer pinIdentifier) {
super(firmata, eventManager, pinResource, pinIdentifier, PinCapability.ANALOG);
analogPinID = AnalogPinMapper.getAnalogPinIdentifier(pinIdentifier);
}
public void togglePinEventing(Boolean enable) {
if (pinEventing == enable) {
return;
}
pinEventing = enable;
fireEvent(new ReportAnalogEvent(enable));
firmata.sendMessage(new ReportAnalogPinMessage(analogPinID, enable));
}
@Override
protected Boolean startup() {
firmata.addMessageListener(analogPinID, analogListener);
return true;
}
@Override
protected void shutdown() {
togglePinEventing(false);
firmata.removeMessageListener(analogPinID, analogListener);
}
public Integer getCurrentValueInt() {
return currentValueInt;
}
public Byte getCurrentValueByte() {
return currentValueByte;
}
public Integer getAnalogPinID() {
return analogPinID;
}
}
|
{
"content_hash": "6dc51cb981bfe0708dab5ef71be58538",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 117,
"avg_line_length": 33.666666666666664,
"alnum_prop": 0.7258449982929327,
"repo_name": "reapzor/ArduinoModel-Core",
"id": "d301915ac4070ca804c9efac485d048a036040b2",
"size": "2929",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/Java/com/bortbort/arduino/Model/Core/PinTypes/AnalogPin.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "46648"
}
]
}
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Test;
import Graph.Graph;
import Relation.WeightedEdge;
import Vertex.Vertex;
import java.util.ArrayList;
import java.util.LinkedList;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author Luming Wu
*/
public class JUnit {
public JUnit() {
}
@Test
public void parseVerticesTest(){
LinkedList<WeightedEdge<String>> edges = new LinkedList<WeightedEdge<String>>();
edges.add(new WeightedEdge<String>("A", "B", 3));
edges.add(new WeightedEdge<String>("B", "C", 2));
edges.add(new WeightedEdge<String>("A", "C", 1));
ArrayList<Vertex> vertices = Graph.parseVertices(edges);
LinkedList<Integer> check = new LinkedList<Integer>();
if(!((Vertex)vertices.get(0)).toString().equals("A")){
check.add(0);
}
if(!((Vertex)vertices.get(1)).toString().equals("B")){
check.add(1);
}
if(!vertices.get(2).toString().equals("C")){
check.add(2);
}
if(!vertices.get(0).adjacencies().get(0).target().toString().equals("B")){
check.add(3);
}
if(!vertices.get(0).adjacencies().get(1).target().toString().equals("C")){
check.add(4);
}
if(!vertices.get(1).adjacencies().get(0).target().toString().equals("A")){
check.add(5);
}
if(!vertices.get(1).adjacencies().get(1).target().toString().equals("C")){
check.add(6);
}
if(!vertices.get(2).adjacencies().get(0).target().toString().equals("B")){
check.add(7);
}
if(!vertices.get(2).adjacencies().get(1).target().toString().equals("A")){
check.add(8);
}
if(vertices.get(0).adjacencies().get(0).weight() != 3){
check.add(9);
}
if(vertices.get(0).adjacencies().get(1).weight() != 1){
check.add(10);
}
if(vertices.get(1).adjacencies().get(0).weight() != 3){
check.add(11);
}
if(vertices.get(1).adjacencies().get(1).weight() != 2){
check.add(12);
}
if(vertices.get(2).adjacencies().get(0).weight() != 2){
check.add(13);
}
if(vertices.get(2).adjacencies().get(1).weight() != 1){
check.add(14);
}
assertTrue("The list: " + check, check.isEmpty());
}
}
|
{
"content_hash": "12343b03cfde478f918631b202592d7e",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 88,
"avg_line_length": 32.35,
"alnum_prop": 0.5440494590417311,
"repo_name": "LumingWu/Java-Graph",
"id": "637530b4a03d0534b6d7c8db28c93126338a3c83",
"size": "2588",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Graph/test/Test/JUnit.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "11019"
}
]
}
|
"""
`Unit tests for cargo.expressions.BaseLogic`
--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--
2016 Jared Lunde © The MIT License (MIT)
http://github.com/jaredlunde
"""
from cargo.expressions import *
from cargo.fields import Field
from unit_tests import configure
from unit_tests.configure import new_field
class TestBaseLogic(configure.LogicTestCase):
def setUp(self):
self.base = Field()
self.base.field_name = 'test'
self.base.table = 'tester'
def test_asc(self):
expr = self.base.asc()
self.validate_expression(expr, self.base, 'ASC', _empty, {})
def test_desc(self):
expr = self.base.desc()
self.validate_expression(expr, self.base, 'DESC', _empty, {})
def test___and__(self):
for x in ['string', 1234]:
expr = (self.base & x)
self.validate_expression(expr, self.base, 'AND', x, values=[x])
for x in [Function('now'), self.base.asc(), self.base.in_(1, 2, 3)]:
expr = (self.base & x)
self.validate_expression(expr, self.base, 'AND', x, x.params)
def test_in_(self):
for x in [['sting', 'string2', 'string3'], [1, 2, 3, 4, 5, 6]]:
expr = (self.base.in_(*x))
self.validate_expression(
expr, self.base, 'IN', tuple(x), values=[tuple(x)])
def test_not_in(self):
for x in [['sting', 'string2', 'string3'], [1, 2, 3, 4, 5, 6]]:
expr = (self.base.not_in(*x))
self.validate_expression(
expr, self.base, 'NOT IN', tuple(x), values=[tuple(x)])
def test_is_null(self):
self.validate_expression(
self.base.is_null(),
self.base,
'IS NULL',
_empty,
{})
def test_not_null(self):
self.validate_expression(
self.base.is_not_null(),
self.base,
'IS NOT NULL',
_empty,
{})
def test_nullif(self):
for val in ['some_value', 12345, new_field()]:
self.validate_function(
self.base.nullif(val),
'NULLIF',
[self.base, val])
for val in ['some_value', 12345, new_field()]:
func = self.base.nullif(val, alias='foo')
self.validate_function(
func,
'NULLIF',
[self.base, val],
alias='foo')
def test_distinct_from(self):
other_field = new_field()
self.validate_expression(
self.base.distinct_from(other_field),
self.base,
'IS DISTINCT FROM',
other_field,
{})
def test_not_distinct_from(self):
other_field = new_field()
self.validate_expression(
self.base.not_distinct_from(other_field),
self.base,
'IS NOT DISTINCT FROM',
other_field,
{})
def test_distinct_on(self):
self.validate_function(
self.base.distinct_on(),
'DISTINCT ON',
[self.base]
)
self.validate_function(
self.base.distinct_on(alias='test'),
'DISTINCT ON',
[self.base],
alias='test'
)
def test_distinct(self):
self.validate_function(
self.base.distinct(),
'distinct',
[self.base]
)
self.validate_function(
self.base.distinct(alias='test'),
'distinct',
[self.base],
alias='test'
)
def test_count(self):
field = new_field()
self.validate_function(
self.base.count(),
'count',
[self.base]
)
self.validate_function(
self.base.count(alias='test'),
'count',
[self.base],
alias='test'
)
def test_using(self):
field = new_field()
self.validate_function(
self.base.using(field),
'USING',
[self.base, field]
)
self.validate_function(
self.base.using(field, alias='test'),
'USING',
[self.base, field],
alias='test'
)
def test_lag(self):
field = new_field(table='foo', name='bar')
func = field.lag()
string = 'lag(foo.bar) OVER ()'
self.assertEqual(func.string % func.params, string)
func = field.lag('w')
string = 'lag(foo.bar) OVER w'
self.assertEqual(func.string % func.params, string)
func = field.lag(order_by=field.desc())
string = 'lag(foo.bar) OVER (ORDER BY foo.bar DESC)'
self.assertEqual(func.string % func.params, string)
func = field.lag(partition_by=field)
string = 'lag(foo.bar) OVER (PARTITION BY foo.bar)'
self.assertEqual(func.string % func.params, string)
func = field.lag(Clause('ORDER BY', field))
string = 'lag(foo.bar) OVER (ORDER BY foo.bar)'
self.assertEqual(func.string % func.params, string)
func = field.lag(Clause('ORDER BY', field), alias='foo_alias')
string = 'lag(foo.bar) OVER (ORDER BY foo.bar) foo_alias'
self.assertEqual(func.string % func.params, string)
def test_lead(self):
field = new_field(table='foo', name='bar')
func = field.lead()
string = 'lead(foo.bar) OVER ()'
self.assertEqual(func.string % func.params, string)
func = field.lead('w')
string = 'lead(foo.bar) OVER w'
self.assertEqual(func.string % func.params, string)
func = field.lead(order_by=field.desc())
string = 'lead(foo.bar) OVER (ORDER BY foo.bar DESC)'
self.assertEqual(func.string % func.params, string)
func = field.lead(partition_by=field)
string = 'lead(foo.bar) OVER (PARTITION BY foo.bar)'
self.assertEqual(func.string % func.params, string)
func = field.lead(Clause('ORDER BY', field))
string = 'lead(foo.bar) OVER (ORDER BY foo.bar)'
self.assertEqual(func.string % func.params, string)
func = field.lead(Clause('ORDER BY', field), alias='foo_alias')
string = 'lead(foo.bar) OVER (ORDER BY foo.bar) foo_alias'
self.assertEqual(func.string % func.params, string)
def test_first_value(self):
field = new_field(table='foo', name='bar')
func = field.first_value()
string = 'first_value(foo.bar) OVER ()'
self.assertEqual(func.string % func.params, string)
func = field.first_value('w')
string = 'first_value(foo.bar) OVER w'
self.assertEqual(func.string % func.params, string)
func = field.first_value(order_by=field.desc())
string = 'first_value(foo.bar) OVER (ORDER BY foo.bar DESC)'
self.assertEqual(func.string % func.params, string)
func = field.first_value(partition_by=field)
string = 'first_value(foo.bar) OVER (PARTITION BY foo.bar)'
self.assertEqual(func.string % func.params, string)
func = field.first_value(Clause('ORDER BY', field))
string = 'first_value(foo.bar) OVER (ORDER BY foo.bar)'
self.assertEqual(func.string % func.params, string)
func = field.first_value(Clause('ORDER BY', field), alias='foo_alias')
string = 'first_value(foo.bar) OVER (ORDER BY foo.bar) foo_alias'
self.assertEqual(func.string % func.params, string)
def test_last_value(self):
field = new_field(table='foo', name='bar')
func = field.last_value()
string = 'last_value(foo.bar) OVER ()'
self.assertEqual(func.string % func.params, string)
func = field.last_value('w')
string = 'last_value(foo.bar) OVER w'
self.assertEqual(func.string % func.params, string)
func = field.last_value(order_by=field.desc())
string = 'last_value(foo.bar) OVER (ORDER BY foo.bar DESC)'
self.assertEqual(func.string % func.params, string)
func = field.last_value(partition_by=field)
string = 'last_value(foo.bar) OVER (PARTITION BY foo.bar)'
self.assertEqual(func.string % func.params, string)
func = field.last_value(Clause('ORDER BY', field))
string = 'last_value(foo.bar) OVER (ORDER BY foo.bar)'
self.assertEqual(func.string % func.params, string)
func = field.last_value(Clause('ORDER BY', field), alias='foo_alias')
string = 'last_value(foo.bar) OVER (ORDER BY foo.bar) foo_alias'
self.assertEqual(func.string % func.params, string)
def test_nth_value(self):
field = new_field(table='foo', name='bar')
func = field.nth_value(5)
string = 'nth_value(foo.bar, 5) OVER ()'
self.assertEqual(func.string % func.params, string)
func = field.nth_value(5, 'w')
string = 'nth_value(foo.bar, 5) OVER w'
self.assertEqual(func.string % func.params, string)
func = field.nth_value(5, order_by=field.desc())
string = 'nth_value(foo.bar, 5) OVER (ORDER BY foo.bar DESC)'
self.assertEqual(func.string % func.params, string)
func = field.nth_value(5, partition_by=field)
string = 'nth_value(foo.bar, 5) OVER (PARTITION BY foo.bar)'
self.assertEqual(func.string % func.params, string)
func = field.nth_value(5, Clause('ORDER BY', field))
string = 'nth_value(foo.bar, 5) OVER (ORDER BY foo.bar)'
self.assertEqual(func.string % func.params, string)
func = field.nth_value(5, Clause('ORDER BY', field), alias='foo_alias')
string = 'nth_value(foo.bar, 5) OVER (ORDER BY foo.bar) foo_alias'
self.assertEqual(func.string % func.params, string)
def test_func(self):
field = new_field(table='foo', name='bar')
for x in ['json_encode', 'json_decode', 'find_first']:
self.validate_function(
self.base.func(x, field),
x,
[self.base, field]
)
self.validate_function(
self.base.func(x, field, alias='test'),
x,
[self.base, field],
alias='test'
)
if __name__ == '__main__':
# Unit test
configure.run_tests(TestBaseLogic, failfast=True, verbosity=2)
|
{
"content_hash": "758b357474e1bd601f2a09b8cb2a257b",
"timestamp": "",
"source": "github",
"line_count": 299,
"max_line_length": 80,
"avg_line_length": 34.779264214046826,
"alnum_prop": 0.552072314645639,
"repo_name": "jaredlunde/cargo-orm",
"id": "fd491ad855a8cd6861dc616da33b7645269c149b",
"size": "10472",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "unit_tests/logic/BaseLogic.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "1155740"
},
{
"name": "Shell",
"bytes": "288"
}
]
}
|
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Documents.Serialization;
using System.Windows.Input;
using AutoReservation.Common.DataTransferObjects;
using AutoReservation.Common.Extensions;
using AutoReservation.Ui.Factory;
using Ninject;
namespace AutoReservation.Ui.ViewModels
{
public class AutoViewModel : ViewModelBase
{
private readonly List<AutoDto> autosOriginal = new List<AutoDto>();
private readonly ObservableCollection<AutoDto> autos = new ObservableCollection<AutoDto>();
public AutoViewModel(IServiceFactory factory) : base(factory)
{
}
public ObservableCollection<AutoDto> Autos
{
get { return autos; }
}
private AutoDto selectedAuto;
public AutoDto SelectedAuto
{
get { return selectedAuto; }
set
{
if (selectedAuto == value)
{
return;
}
selectedAuto = value;
this.OnPropertyChanged(p => p.SelectedAuto);
}
}
#region Load-Command
private RelayCommand loadCommand;
public ICommand LoadCommand
{
get
{
return loadCommand ?? (loadCommand = new RelayCommand(param => Load(), param => CanLoad()));
}
}
protected override void Load()
{
Autos.Clear();
autosOriginal.Clear();
foreach (var auto in Service.GetAutos())
{
Autos.Add(auto);
autosOriginal.Add(auto.Clone());
}
SelectedAuto = Autos.FirstOrDefault();
}
private bool CanLoad()
{
return ServiceExists;
}
#endregion
#region Save-Command
private RelayCommand saveCommand;
public ICommand SaveCommand
{
get
{
return saveCommand ?? (saveCommand = new RelayCommand(param => SaveData(), param => CanSaveData()));
}
}
private void SaveData()
{
foreach (var auto in Autos)
{
if (auto.Id == default(int))
{
Service.AddAuto(auto);
}
else
{
var original = autosOriginal.FirstOrDefault(ao => ao.Id == auto.Id);
Service.UpdateAuto(auto, original);
}
}
Load();
}
private bool CanSaveData()
{
if (!ServiceExists)
{
return false;
}
return Validate(Autos);
}
#endregion
#region New-Command
private RelayCommand newCommand;
public ICommand NewCommand
{
get
{
return newCommand ?? (newCommand = new RelayCommand(param => New(), param => CanNew()));
}
}
private void New()
{
Autos.Add(new AutoDto());
}
private bool CanNew()
{
return ServiceExists;
}
#endregion
#region Delete-Command
private RelayCommand deleteCommand;
public ICommand DeleteCommand
{
get
{
return deleteCommand ?? (deleteCommand = new RelayCommand(param => Delete(), param => CanDelete()));
}
}
private void Delete()
{
Service.DeleteAuto(SelectedAuto);
Load();
}
private bool CanDelete()
{
return
ServiceExists &&
SelectedAuto != null &&
SelectedAuto.Id != default(int);
}
#endregion
}
}
|
{
"content_hash": "1c656c41fd37065d393a3d7664d15d8d",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 116,
"avg_line_length": 24.589285714285715,
"alnum_prop": 0.47058823529411764,
"repo_name": "LePhil/DotNetMiniProj",
"id": "902bd6667b4ce312d74dbed9dd2a48c9cf25203d",
"size": "4133",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "AutoReservation.Ui/ViewModels/AutoViewModel.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "99151"
}
]
}
|
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Bull. Soc. mycol. Fr. 30(3): 270 (1914)
#### Original name
Odontia queletii Bourdot & Galzin, 1914
### Remarks
null
|
{
"content_hash": "fe107f48924bf3defa1de07931267e8f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 15.615384615384615,
"alnum_prop": 0.6896551724137931,
"repo_name": "mdoering/backbone",
"id": "4b5907f7ba5e1a8b31b6ca2fcfbfb672d522a014",
"size": "266",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Basidiomycota/Agaricomycetes/Polyporales/Meruliaceae/Cabalodontia/Cabalodontia queletii/ Syn. Odontia queletii/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
using System.Threading.Tasks;
namespace CSharpFunctionalExtensions.Examples.ResultExtensions
{
public class ExampleWithTapErrorMethod
{
public string TapError_non_async(int customerId, decimal moneyAmount)
{
var paymentGateway = new PaymentGateway();
var database = new Database();
return GetById(customerId)
.ToResult("Customer with such Id is not found: " + customerId)
.Tap(customer => customer.AddBalance(moneyAmount))
.Check(customer => paymentGateway.ChargePayment(customer, moneyAmount))
.Bind(
customer => database.Save(customer)
.TapError(() => paymentGateway.RollbackLastTransaction()))
.Finally(result => result.IsSuccess ? "OK" : result.Error);
}
private Maybe<Customer> GetById(long id)
{
return new Customer();
}
private class Customer
{
public void AddBalance(decimal moneyAmount)
{
}
}
private class PaymentGateway
{
public Result ChargePayment(Customer customer, decimal moneyAmount)
{
return Result.Success();
}
public void RollbackLastTransaction()
{
}
public Task RollbackLastTransactionAsync()
{
return Task.FromResult(1);
}
}
private class Database
{
public Result Save(Customer customer)
{
return Result.Success();
}
}
}
}
|
{
"content_hash": "bccf5a7c1c5b359e2c2b2c2997872f2a",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 87,
"avg_line_length": 27.672131147540984,
"alnum_prop": 0.5308056872037915,
"repo_name": "vkhorikov/CSharpFunctionalExtensions",
"id": "2693dc2152b7aee6818a85a66ffe05994d7f5411",
"size": "1688",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CSharpFunctionalExtensions.Examples/ResultExtensions/ExampleWithOnFailureMethod.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1923667"
},
{
"name": "Dockerfile",
"bytes": "1196"
}
]
}
|
redirect_from: /docs/5-forms.html
---
# Forms
Active Admin gives you complete control over the output of the form by creating
a thin DSL on top of [Formtastic](https://github.com/justinfrench/formtastic):
```ruby
ActiveAdmin.register Post do
form title: 'A custom title' do |f|
inputs 'Details' do
input :title
input :published_at, label: "Publish Post At"
li "Created at #{f.object.created_at}" unless f.object.new_record?
input :category
end
panel 'Markup' do
"The following can be used in the content below..."
end
inputs 'Content', :body
para "Press cancel to return to the list without saving."
actions
end
end
```
For more details, please see [Formtastic's documentation](https://github.com/justinfrench/formtastic/wiki).
## Default
Resources come with a default form defined as such:
```ruby
form do |f|
f.semantic_errors # shows errors on :base
f.inputs # builds an input field for every attribute
f.actions # adds the 'Submit' and 'Cancel' buttons
end
```
## Partials
If you want to split a custom form into a separate partial use:
```ruby
ActiveAdmin.register Post do
form partial: 'form'
end
```
Which looks for something like this:
```ruby
# app/views/admin/posts/_form.html.arb
insert_tag active_admin_form_for resource do |f|
inputs :title, :body
actions
end
```
This is a regular Rails partial so any template engine may be used.
You can also use the `ActiveAdmin::FormBuilder` as builder in your Formtastic
Form for use the same helpers are used in the admin file:
```ruby
= semantic_form_for [:admin, @post], builder: ActiveAdmin::FormBuilder do |f|
= f.inputs "Details" do
= f.input :title
- f.has_many :taggings, sortable: :position, sortable_start: 1 do |t|
- t.input :tag
= f.actions
```
## Nested Resources
You can create forms with nested models using the `has_many` method, even if
your model uses `has_one`:
```ruby
ActiveAdmin.register Post do
permit_params :title,
:published_at,
:body,
categories_attributes: [:id, :title, :_destroy],
taggings_attributes: [:id, :tag],
comment_attributes: [:id, :body, :_destroy]
form do |f|
f.inputs 'Details' do
f.input :title
f.input :published_at, label: 'Publish Post At'
end
f.inputs 'Content', :body
f.inputs do
f.has_many :categories, heading: 'Themes',
allow_destroy: true,
new_record: false do |a|
a.input :title
end
end
f.inputs do
f.has_many :taggings, sortable: :position, sortable_start: 1 do |t|
t.input :tag
end
end
f.inputs do
f.has_many :comment,
new_record: 'Leave Comment',
allow_destroy: -> (c) { c.author?(current_admin_user) } do |b|
b.input :body
end
end
f.actions
end
end
```
*NOTE: In addition to using `has_many` as illustrated above, you'll need to add
`accepts_nested_attributes` to your parent model and [configure strong parameters](https://activeadmin.info/2-resource-customization.html)*
The `:allow_destroy` option adds a checkbox to the end of the nested form allowing
removal of the child object upon submission. Be sure to set `allow_destroy: true`
on the association to use this option. It is possible to associate
`:allow_destroy` with a string or a symbol, corresponding to the name of a child
object's method that will get called, or with a Proc object. The Proc object
receives the child object as a parameter and should return either true or false.
The `:heading` option adds a custom heading. You can hide it entirely by passing
`false`.
The `:new_record` option controls the visibility of the new record button (shown
by default). If you pass a string, it will be used as the text for the new
record button.
The `:sortable` option adds a hidden field and will enable drag & drop sorting
of the children. It expects the name of the column that will store the index of
each child.
The `:sortable_start` option sets the value (0 by default) of the first position
in the list.
## Datepicker
ActiveAdmin offers the `datepicker` input, which uses the [jQuery UI
datepicker](http://jqueryui.com/datepicker/). The datepicker input accepts any
of the options available to the standard jQueryUI Datepicker. For example:
```ruby
form do |f|
f.input :starts_at, as: :datepicker,
datepicker_options: {
min_date: "2013-10-8",
max_date: "+3D"
}
f.input :ends_at, as: :datepicker,
datepicker_options: {
min_date: 3.days.ago.to_date,
max_date: "+1W +5D"
}
end
```
Datepicker also accepts the `:label` option as a string or proc to display.
If it's a proc, it will be called each time the datepicker is rendered.
## Displaying Errors
To display a list of all validation errors:
```ruby
form do |f|
f.semantic_errors *f.object.errors.keys
# ...
end
```
This is particularly useful to display errors on virtual or hidden attributes.
# Tabs
You can arrange content in tabs as shown below:
```ruby
form do |f|
tabs do
tab 'Basic' do
f.inputs 'Basic Details' do
f.input :email
f.input :password
f.input :password_confirmation
end
end
tab 'Advanced', html_options: { class: 'specific_css_class' } do
f.inputs 'Advanced Details' do
f.input :role
end
end
end
f.actions
end
```
`html_options` allows you set additional html params for tab's menu item.
# Customize the Create Another checkbox
In order to simplify creating multiple resources you may enable ActiveAdmin to
show nice "Create Another" checkbox alongside of Create Model button. It may be
enabled for the whole application:
```ruby
ActiveAdmin.setup do |config|
config.create_another = true
end
```
or for the particular resource:
```ruby
ActiveAdmin.register Post do
config.create_another = true
end
```
|
{
"content_hash": "10404bc963c5be334387e7114cf03cb1",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 139,
"avg_line_length": 26.991304347826087,
"alnum_prop": 0.6572164948453608,
"repo_name": "varyonic/activeadmin",
"id": "dc4fd6041d98247cbcdc19d5da4f16180c659166",
"size": "6212",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/5-forms.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "19434"
},
{
"name": "Gherkin",
"bytes": "138079"
},
{
"name": "HTML",
"bytes": "24419"
},
{
"name": "JavaScript",
"bytes": "165"
},
{
"name": "Ruby",
"bytes": "701108"
},
{
"name": "SCSS",
"bytes": "46162"
}
]
}
|
namespace Google.Cloud.Compute.V1.Snippets
{
// [START compute_v1_generated_RegionCommitments_Insert_async_flattened]
using Google.Cloud.Compute.V1;
using System.Threading.Tasks;
using lro = Google.LongRunning;
public sealed partial class GeneratedRegionCommitmentsClientSnippets
{
/// <summary>Snippet for InsertAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task InsertAsync()
{
// Create client
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string region = "";
Commitment commitmentResource = new Commitment();
// Make the request
lro::Operation<Operation, Operation> response = await regionCommitmentsClient.InsertAsync(project, region, commitmentResource);
// Poll until the returned long-running operation is complete
lro::Operation<Operation, Operation> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Operation result = completedResponse.Result;
// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
lro::Operation<Operation, Operation> retrievedResponse = await regionCommitmentsClient.PollOnceInsertAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Operation retrievedResult = retrievedResponse.Result;
}
}
}
// [END compute_v1_generated_RegionCommitments_Insert_async_flattened]
}
|
{
"content_hash": "9f44554ff28e19d8fbf434d1ca25f3d9",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 139,
"avg_line_length": 50.4468085106383,
"alnum_prop": 0.6668072543230704,
"repo_name": "googleapis/google-cloud-dotnet",
"id": "880d73afe606bf72b9338a84b6be0ae13f26edfa",
"size": "3025",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "apis/Google.Cloud.Compute.V1/Google.Cloud.Compute.V1.GeneratedSnippets/RegionCommitmentsClient.InsertAsyncSnippet.g.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "767"
},
{
"name": "C#",
"bytes": "319820004"
},
{
"name": "Dockerfile",
"bytes": "3415"
},
{
"name": "PowerShell",
"bytes": "3303"
},
{
"name": "Python",
"bytes": "2744"
},
{
"name": "Shell",
"bytes": "65881"
}
]
}
|
<?php
namespace ITE\DemoBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* BundleRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class BundleRepository extends EntityRepository
{
}
|
{
"content_hash": "64c548559e90fc2b415b9e54d46f55f2",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 68,
"avg_line_length": 17.2,
"alnum_prop": 0.7596899224806202,
"repo_name": "itedev/symfony2-demo-project",
"id": "04045935bd154e97dc471ea5dff8cf246b1b8496",
"size": "258",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/ITE/DemoBundle/Entity/BundleRepository.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3392"
},
{
"name": "CSS",
"bytes": "286321"
},
{
"name": "CoffeeScript",
"bytes": "15787"
},
{
"name": "Go",
"bytes": "6808"
},
{
"name": "HTML",
"bytes": "1321138"
},
{
"name": "JavaScript",
"bytes": "7021092"
},
{
"name": "Makefile",
"bytes": "5561"
},
{
"name": "PHP",
"bytes": "224937"
},
{
"name": "PowerShell",
"bytes": "838"
},
{
"name": "Python",
"bytes": "26489"
},
{
"name": "Ruby",
"bytes": "1009"
},
{
"name": "Shell",
"bytes": "1231"
}
]
}
|
<!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.5.0_06) on Mon Aug 11 15:54:39 CST 2008 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
类 tot.util.DateUtil 的使用
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="类 tot.util.DateUtil 的使用";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= 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> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../tot/util/DateUtil.html" title="tot.util 中的类"><FONT CLASS="NavBarFont1"><B>类</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>使用</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
上一个
下一个</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?tot/util/\class-useDateUtil.html" target="_top"><B>框架</B></A>
<A HREF="DateUtil.html" target="_top"><B>无框架</B></A>
<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>类 tot.util.DateUtil<br>的使用</B></H2>
</CENTER>
没有 tot.util.DateUtil 的用法
<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> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>软件包</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../tot/util/DateUtil.html" title="tot.util 中的类"><FONT CLASS="NavBarFont1"><B>类</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>使用</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-tree.html"><FONT CLASS="NavBarFont1"><B>树</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>已过时</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>索引</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>帮助</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
上一个
下一个</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?tot/util/\class-useDateUtil.html" target="_top"><B>框架</B></A>
<A HREF="DateUtil.html" target="_top"><B>无框架</B></A>
<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": "e757186538885dd6e820313bb6f7fa68",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 167,
"avg_line_length": 38.262411347517734,
"alnum_prop": 0.6063021316033365,
"repo_name": "xfmysql/xfwdata",
"id": "2ce0f63449a26bc09a214f3a1329e8eacd2c61bc",
"size": "5597",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "totcms/web/javadoc/tot/util/class-use/DateUtil.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "70814"
},
{
"name": "ActionScript",
"bytes": "23271"
},
{
"name": "C++",
"bytes": "8269"
},
{
"name": "CSS",
"bytes": "466210"
},
{
"name": "ColdFusion",
"bytes": "54148"
},
{
"name": "HTML",
"bytes": "1063086"
},
{
"name": "Java",
"bytes": "4467336"
},
{
"name": "JavaScript",
"bytes": "3353617"
},
{
"name": "Lasso",
"bytes": "42172"
},
{
"name": "PHP",
"bytes": "54696"
},
{
"name": "Perl",
"bytes": "34630"
},
{
"name": "Perl 6",
"bytes": "34760"
},
{
"name": "Python",
"bytes": "43370"
}
]
}
|
Git is a revision control system. It provides us with a way to track the full
lifecycle of a text-based document (primarily Ruby code files) one change at a time.
## How do you track revisions to a text file?
Say you have a twenty line text file and someone wants to make a copy edit to a single word
in line three. They can make that change on their machine and then "commit" the change via git
with an informative message like 'corrected spelling of banana'. That commit can then be shared with
the rest of the team (often by being reshared through GitHub) so that everyone else can apply that
change and see the updated file on their machines.
The interesting thing about how Git works is that you don't have to send a full copy of the file
along with each change, you just send the change itself and Git stitches it together to show the difference.
I'll need to update this with a lot more information some day.
### What does that look like?
Let's use wikipedia as an accessible example. Say there's a wikipedia page out there with 500 lines and you decide to add one more line to it. How does wikipedia track the addition of that one line? How can editors review the edit history of the document? Here's a picture of the actual wikipedia version comparison screen. It's fairly git-like:

## What's a pull request?
TBD
|
{
"content_hash": "8fca511fae3ee95f82276811d9807be9",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 350,
"avg_line_length": 63,
"alnum_prop": 0.7741702741702742,
"repo_name": "railsdog/tech-training",
"id": "1fc0b443c1410eb5f1cc20b3de6893436a0f3634",
"size": "1402",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "development/git.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "32"
}
]
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>buchberger: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.7.0 / buchberger - 8.10.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
buchberger
<small>
8.10.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-07-19 01:29:24 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-07-19 01:29:24 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.7.0 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.03.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.03.0 Official 4.03.0 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "Hugo.Herbelin@inria.fr"
homepage: "https://github.com/coq-contribs/buchberger"
license: "LGPL 2.1"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/Buchberger"]
depends: [
"ocaml"
"coq" {>= "8.10" & < "8.11~"}
]
tags: [
"keyword: Grobner basis"
"keyword: polynomial ideal"
"keyword: Buchberger's algorithm"
"category: Mathematics/Algebra"
"category: Miscellaneous/Extracted Programs/Combinatorics"
"date: 1998"
]
authors: [
"Laurent Théry"
"Henrik Persson"
]
bug-reports: "https://github.com/coq-contribs/buchberger/issues"
dev-repo: "git+https://github.com/coq-contribs/buchberger.git"
synopsis: "Proof of Buchberger's algorithm"
description: """
A machine-checked implementation of Buchberger's.
It computes the Grobner basis associated to a
polynomial ideal."""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/buchberger/archive/v8.10.0.tar.gz"
checksum: "md5=aba39580d30105b8aad8b737d3746088"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-buchberger.8.10.0 coq.8.7.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.7.0).
The following dependencies couldn't be met:
- coq-buchberger -> coq >= 8.10 -> ocaml >= 4.05.0
base of this switch (use `--unlock-base' to force)
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-buchberger.8.10.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
|
{
"content_hash": "01291430815e178a6a4fc5dcdb765a75",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 159,
"avg_line_length": 40.26704545454545,
"alnum_prop": 0.5448003386482292,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "9976e4199a57bdc6651c2a14d84ca4269a565b82",
"size": "7113",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.03.0-2.0.5/released/8.7.0/buchberger/8.10.0.html",
"mode": "33188",
"license": "mit",
"language": []
}
|
Creating a Pie Chart using Angular2 (deprecated, replaced with "Angular") and d3.js (Version 3) Library
This is an [angular-quickstart](https://github.com/angular/quickstart) based code from [this tutorial](http://www.palador.com/2017/02/28/create-a-pie-chart-with-dynamic-data-using-d3-js-angular-2/). Download this repository and type below commands to start the app.
```
npm install
npm run d3-typings
npm start
```
You can also see the app live on [this Plunker](https://embed.plnkr.co/EoOdyCFGZZVHAFhYRA18/)
|
{
"content_hash": "494c4779ae87dbd0813028fb1c691675",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 265,
"avg_line_length": 57.111111111111114,
"alnum_prop": 0.7684824902723736,
"repo_name": "samuelalvin/pie-chart-in-angular2",
"id": "cfe7b26f4d4e23b68f51acd11b87b8661218d7ec",
"size": "538",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "86"
},
{
"name": "HTML",
"bytes": "2259"
},
{
"name": "JavaScript",
"bytes": "14063"
},
{
"name": "TypeScript",
"bytes": "6684"
}
]
}
|
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">AIProject</string>
</resources>
|
{
"content_hash": "611176bfc7232e7b35901980f1f6b703",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 46,
"avg_line_length": 27.75,
"alnum_prop": 0.6666666666666666,
"repo_name": "lastcolour/AIProject",
"id": "e0102963c91a8925beb6c374e188b6d427233ad3",
"size": "111",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Platform/Android/app/src/main/res/values/strings.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "366856"
},
{
"name": "CMake",
"bytes": "16395"
},
{
"name": "GLSL",
"bytes": "323"
},
{
"name": "Python",
"bytes": "29636"
}
]
}
|
package io.datakernel.dataflow.dataset.impl;
import io.datakernel.dataflow.dataset.Dataset;
import io.datakernel.dataflow.dataset.LocallySortedDataset;
import io.datakernel.dataflow.graph.DataflowContext;
import io.datakernel.dataflow.graph.Partition;
import io.datakernel.dataflow.graph.StreamId;
import io.datakernel.datastream.processor.StreamReducers.Reducer;
import java.util.List;
import static io.datakernel.dataflow.dataset.impl.DatasetUtils.repartitionAndReduce;
public final class DatasetRepartitionReduce<K, I, O> extends Dataset<O> {
private final LocallySortedDataset<K, I> input;
private final Reducer<K, I, O, ?> reducer;
private final List<Partition> partitions;
public DatasetRepartitionReduce(LocallySortedDataset<K, I> input, Reducer<K, I, O, ?> reducer,
Class<O> resultType) {
this(input, reducer, resultType, null);
}
public DatasetRepartitionReduce(LocallySortedDataset<K, I> input, Reducer<K, I, O, ?> reducer,
Class<O> resultType, List<Partition> partitions) {
super(resultType);
this.input = input;
this.reducer = reducer;
this.partitions = partitions;
}
@Override
public List<StreamId> channels(DataflowContext context) {
List<Partition> ps = partitions != null && !partitions.isEmpty() ?
partitions :
context.getGraph().getAvailablePartitions();
return repartitionAndReduce(context, input, reducer, ps);
}
}
|
{
"content_hash": "45cb94f0300142c1a9bc22ab72f755c5",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 95,
"avg_line_length": 33.707317073170735,
"alnum_prop": 0.7727930535455861,
"repo_name": "softindex/datakernel",
"id": "aae80478b8509842bd14fcdc32d629192f7d13a8",
"size": "1979",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cloud-dataflow/src/main/java/io/datakernel/dataflow/dataset/impl/DatasetRepartitionReduce.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "438"
},
{
"name": "HTML",
"bytes": "1244"
},
{
"name": "Java",
"bytes": "5078460"
},
{
"name": "Shell",
"bytes": "55"
},
{
"name": "TSQL",
"bytes": "1305"
}
]
}
|
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>programming languages on Il y a du thé renversé au bord de la table !</title>
<link>https://yoric.github.io/tags/programming-languages/</link>
<description>Recent content in programming languages on Il y a du thé renversé au bord de la table !</description>
<generator>Hugo -- gohugo.io</generator>
<language>en</language>
<copyright>© This post is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License,please give source if you wish to quote or reproduce.</copyright>
<lastBuildDate>Sat, 08 Aug 2020 08:46:22 +0200</lastBuildDate><atom:link href="https://yoric.github.io/tags/programming-languages/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Possibly one step towards named arguments in Rust</title>
<link>https://yoric.github.io/post/rust-named-arguments/</link>
<pubDate>Sat, 08 Aug 2020 08:46:22 +0200</pubDate>
<guid>https://yoric.github.io/post/rust-named-arguments/</guid>
<description><p>A number of programming languages offer a feature called &ldquo;Named Arguments&rdquo; or &ldquo;Labeled Arguments&rdquo;, which
makes some function calls much more readable and safer.</p>
<p>Let&rsquo;s see how hard it would be to add these in Rust.</p></description>
</item>
<item>
<title>Typestates in Rust</title>
<link>https://yoric.github.io/post/rust-typestate/</link>
<pubDate>Thu, 22 Feb 2018 15:15:55 +0100</pubDate>
<guid>https://yoric.github.io/post/rust-typestate/</guid>
<description><p>A long time ago, the Rust language was a language with typestate. Officially, typestates were dropped long before Rust 1.0. In this entry, I’ll get you in on the worst kept secret of the Rust community: Rust still has typestates.</p></description>
</item>
</channel>
</rss>
|
{
"content_hash": "eeaf8b51704acca256b3d5adabaa3869",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 281,
"avg_line_length": 63.96875,
"alnum_prop": 0.7059110893991206,
"repo_name": "Yoric/yoric.github.io",
"id": "72ccc39440749b115ea3d16ebfff9c5d1de461d6",
"size": "2056",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tags/programming-languages/index.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "19269"
},
{
"name": "HTML",
"bytes": "1377261"
},
{
"name": "JavaScript",
"bytes": "3132"
},
{
"name": "XSLT",
"bytes": "3885"
}
]
}
|
export const firebase = {
apiKey: 'AIzaSyDt6e0X6aHNNPEZzeDV9sjPni54JUG6Ek8',
authDomain: 'bmimaterial-6c6b9.firebaseapp.com',
databaseURL: 'https://bmimaterial-6c6b9.firebaseio.com',
storageBucket: 'bmimaterial-6c6b9.appspot.com'
}
// Config for react-redux-firebase
// For more details, visit https://prescottprue.gitbooks.io/react-redux-firebase/content/config.html
export const reduxFirebase = {
userProfile: 'users', // root that user profiles are written to
enableLogging: false, // enable/disable Firebase Database Logging
updateProfileOnLogin: false // enable/disable updating of profile on login
// profileDecorator: (userData) => ({ email: userData.email }) // customize format of user profile
}
export const env = 'development'
export default { firebase, reduxFirebase, env }
|
{
"content_hash": "4edc8ca3f7c91726fd83c5fc2674ca4c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 100,
"avg_line_length": 42.36842105263158,
"alnum_prop": 0.7652173913043478,
"repo_name": "mduncan2020/bmimaterial",
"id": "89211ad550f797b5455f7ef163b2d4fd3daf9ca9",
"size": "949",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/config.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "9055"
},
{
"name": "HTML",
"bytes": "607"
},
{
"name": "JavaScript",
"bytes": "70552"
}
]
}
|
require 'http'
class CreateVerifiedAccount
def initialize(config)
@config = config
end
def call(username:, email:, password:)
response = HTTP.post("#{@config.API_URL}/account/",
json: { username: username,
email: email,
password: password })
response.code == 201 ? true : false
end
end
|
{
"content_hash": "dcc489bba2752ff51a111af8d423241d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 55,
"avg_line_length": 26.6,
"alnum_prop": 0.5263157894736842,
"repo_name": "SS-X-Ray/Xchedule-APP",
"id": "b31634fa7c7a37dc2d92e7a5ab45a2b5afb2f485",
"size": "399",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "services/create_verified_account.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "156"
},
{
"name": "HTML",
"bytes": "13929"
},
{
"name": "Ruby",
"bytes": "36570"
}
]
}
|
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "175e2625c4c101a85dc4ba803f925252",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "ba659ed853e093819e517cd439bf8e515412731e",
"size": "216",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Scorzoneroides/Scorzoneroides microcephala/ Syn. Leontodon autumnalis microcephalus/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
package com.jmelzer.jitty.model.dto;
import com.jmelzer.jitty.model.TablePos;
import java.util.ArrayList;
import java.util.List;
/**
* Created by J. Melzer on 31.10.2017.
*/
public class TableSettingsDTO {
Integer tableCount;
List<TablePos> tablePositions = new ArrayList<>();
public Integer getTableCount() {
return tableCount;
}
public void setTableCount(Integer tableCount) {
this.tableCount = tableCount;
}
public void addPos(short col, short row) {
tablePositions.add(new TablePos(col, row));
}
public List<TablePos> getTablePositions() {
return tablePositions;
}
}
|
{
"content_hash": "9ad1b637a6dad40a86c6f748e7aed17a",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 54,
"avg_line_length": 19.848484848484848,
"alnum_prop": 0.6717557251908397,
"repo_name": "chokdee/jitty",
"id": "558bda6560a72263bc79d72f938f9aca032a17dc",
"size": "697",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "data/src/main/java/com/jmelzer/jitty/model/dto/TableSettingsDTO.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "69124"
},
{
"name": "HTML",
"bytes": "74550"
},
{
"name": "Java",
"bytes": "568388"
},
{
"name": "JavaScript",
"bytes": "1193947"
},
{
"name": "Roff",
"bytes": "203"
},
{
"name": "Shell",
"bytes": "2905"
}
]
}
|
using CloudFoundry.CloudController.V2.Interfaces;
using Newtonsoft.Json;
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
namespace CloudFoundry.CloudController.V2.Client.Data
{
/// <summary>
/// Data class used for deserializing the "CloudFoundry.CloudController.V2.Client.EventsEndpoint.ListAllEvents()" Response
/// <para>For usage information, see online documentation at "http://apidocs.cloudfoundry.org/195/events/list_all_events.html"</para>
/// </summary>
[GeneratedCodeAttribute("cf-sdk-builder", "1.0.0.0")]
public partial class ListAllEventsResponse : CloudFoundry.CloudController.V2.Client.Data.Base.AbstractListAllEventsResponse
{
}
}
namespace CloudFoundry.CloudController.V2.Client.Data.Base
{
/// <summary>
/// Base abstract data class used for deserializing the "CloudFoundry.CloudController.V2.Client.EventsEndpoint.ListAllEvents()" Response
/// <para>For usage information, see online documentation at "http://apidocs.cloudfoundry.org/195/events/list_all_events.html"</para>
/// </summary>
[GeneratedCodeAttribute("cf-sdk-builder", "1.0.0.0")]
public abstract class AbstractListAllEventsResponse : IResponse
{
/// <summary>
/// Contains the Metadata for this Entity
/// </summary>
public Metadata EntityMetadata
{
get;
set;
}
/// <summary>
/// <para>The Type</para>
/// </summary>
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
public string Type
{
get;
set;
}
/// <summary>
/// <para>The Actor</para>
/// </summary>
[JsonProperty("actor", NullValueHandling = NullValueHandling.Ignore)]
public string Actor
{
get;
set;
}
/// <summary>
/// <para>The Actor Type</para>
/// </summary>
[JsonProperty("actor_type", NullValueHandling = NullValueHandling.Ignore)]
public string ActorType
{
get;
set;
}
/// <summary>
/// <para>The Actor Name</para>
/// </summary>
[JsonProperty("actor_name", NullValueHandling = NullValueHandling.Ignore)]
public string ActorName
{
get;
set;
}
/// <summary>
/// <para>The Actee</para>
/// </summary>
[JsonProperty("actee", NullValueHandling = NullValueHandling.Ignore)]
public string Actee
{
get;
set;
}
/// <summary>
/// <para>The Actee Type</para>
/// </summary>
[JsonProperty("actee_type", NullValueHandling = NullValueHandling.Ignore)]
public string ActeeType
{
get;
set;
}
/// <summary>
/// <para>The Actee Name</para>
/// </summary>
[JsonProperty("actee_name", NullValueHandling = NullValueHandling.Ignore)]
public string ActeeName
{
get;
set;
}
/// <summary>
/// <para>The Timestamp</para>
/// </summary>
[JsonProperty("timestamp", NullValueHandling = NullValueHandling.Ignore)]
public string Timestamp
{
get;
set;
}
/// <summary>
/// <para>The Metadata</para>
/// </summary>
[JsonProperty("metadata", NullValueHandling = NullValueHandling.Ignore)]
public Dictionary<dynamic, dynamic> Metadata
{
get;
set;
}
/// <summary>
/// <para>The Space Guid</para>
/// </summary>
[JsonProperty("space_guid", NullValueHandling = NullValueHandling.Ignore)]
public Guid? SpaceGuid
{
get;
set;
}
/// <summary>
/// <para>The Organization Guid</para>
/// </summary>
[JsonProperty("organization_guid", NullValueHandling = NullValueHandling.Ignore)]
public Guid? OrganizationGuid
{
get;
set;
}
}
}
|
{
"content_hash": "dba7c5e37353ac638bcc2bd0321c7d91",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 140,
"avg_line_length": 28.714285714285715,
"alnum_prop": 0.5538971807628524,
"repo_name": "adasescu/cf-dotnet-sdk",
"id": "908436f4fbd7c76ab87e5014d4ca57258bdaa485",
"size": "4643",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/CloudFoundry.CloudController.V2.Client/Client/Data/DC_ListAllEventsResponse.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "2527168"
}
]
}
|
var _R = typeof require === 'function' ? require('./lib/reflect-helpers.js') : (typeof window !== 'undefined' ? window._R : null);
describe('_R.makeGeneric', function(){
it('Checks if Array#slice is properly extracted', function(){
var func = _R.makeGeneric([].slice);
expect(JSON.stringify(func('abcd'))).toEqual(JSON.stringify('abcd'.split('')));
});
it('Checks if Object#toString is properly extracted', function(){
var func = _R.makeGeneric(Object.prototype.toString);
expect(func('xd'))
.toEqual(({}).toString.call('xd'));
});
});
describe('_R.makeMethod', function(){
function createProperty(what) {
what[Math.random()] = null;
}
it('Checks simple function', function(){
var what = Object.create(null);
what.createProperty = _R.makeMethod(createProperty);
what.createProperty();
expect(Object.keys(what).length).toEqual(2);
});
});
|
{
"content_hash": "dbd8aea187e1e17acd55337304b25ff5",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 130,
"avg_line_length": 33.10344827586207,
"alnum_prop": 0.6072916666666667,
"repo_name": "Ginden/reflect-helpers",
"id": "9444f6b0e6cff861a3f21434940d6ae0ce807223",
"size": "960",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/make_generic.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "38525"
}
]
}
|
package gov.va.med.lom.vistabroker.lists.dao;
import gov.va.med.lom.javaUtils.misc.StringUtils;
import gov.va.med.lom.vistabroker.dao.BaseDao;
import gov.va.med.lom.vistabroker.lists.data.ListItem;
import java.util.ArrayList;
import java.util.List;
public class LabTestTypesDao extends BaseDao {
// CONSTRUCTORS
public LabTestTypesDao() {
super();
}
public LabTestTypesDao(BaseDao baseDao) {
super(baseDao);
}
// RPC API
public synchronized List<ListItem> getAtomicTests(String startFrom, int direction) throws Exception {
setDefaultContext("OR CPRS GUI CHART");
setDefaultRpcName("ORWLRR ATOMICS");
Object[] params = {startFrom, String.valueOf(direction)};
List<String> list = lCall(params);
return getList(list);
}
public synchronized List<ListItem> getSpecimens(String startFrom, int direction) throws Exception {
setDefaultContext("OR CPRS GUI CHART");
setDefaultRpcName("ORWLRR SPEC");
Object[] params = {startFrom, String.valueOf(direction)};
List<String> list = lCall(params);
return getList(list);
}
public synchronized List<ListItem> getAllTests(String startFrom, int direction) throws Exception {
setDefaultContext("OR CPRS GUI CHART");
setDefaultRpcName("ORWLRR ALLTESTS");
Object[] params = {startFrom, String.valueOf(direction)};
List<String> list = lCall(params);
return getList(list);
}
public synchronized List<ListItem> getChemTests(String startFrom, int direction) throws Exception {
setDefaultContext("OR CPRS GUI CHART");
setDefaultRpcName("ORWLRR CHEMTEST");
Object[] params = {startFrom, String.valueOf(direction)};
List<String> list = lCall(params);
return getList(list);
}
public synchronized List<ListItem> getLabUsers(String startFrom, int direction) throws Exception {
setDefaultContext("OR CPRS GUI CHART");
setDefaultRpcName("ORWLRR USERS");
Object[] params = {startFrom, String.valueOf(direction)};
List<String> list = lCall(params);
return getList(list);
}
public synchronized List<ListItem> getTestGroupsForLabUser(String userDuz) throws Exception {
setDefaultContext("OR CPRS GUI CHART");
setDefaultRpcName("ORWLRR TG");
List<String> list = lCall(userDuz);
return getList(list);
}
public synchronized List<ListItem> getATest(String testIen) throws Exception {
setDefaultContext("OR CPRS GUI CHART");
setDefaultRpcName("ORWLRR ATESTS");
List<String> list = lCall(testIen);
return getList(list);
}
public synchronized List<ListItem> getATestGroup(String testGroupIen, String userDuz) throws Exception {
setDefaultContext("OR CPRS GUI CHART");
setDefaultRpcName("ORWLRR ATG");
Object[] params = {testGroupIen, userDuz};
List<String> list = lCall(params);
return getList(list);
}
public synchronized String getTestInfo(String testIen) throws Exception {
setDefaultContext("OR CPRS GUI CHART");
setDefaultRpcName("ORWLRR INFO");
return sCall(testIen);
}
public synchronized List<ListItem> getLabReportLists() throws Exception {
setDefaultContext("OR CPRS GUI CHART");
setDefaultRpcName("ORWRP LAB REPORT LISTS");
List<String> list = lCall();
String[] results = StringUtils.extractSection(list, "[LAB REPORT LIST]", true);
List<ListItem> labReports = new ArrayList<ListItem>();
for(int i = 0; i < results.length; i++) {
ListItem listItem = new ListItem();
listItem.setIen(StringUtils.piece(results[i], 1));
listItem.setName(StringUtils.piece(results[i], 2));
listItem.setValue(StringUtils.piece(results[i], 6));
listItem.setRpcResult(results[i]);
labReports.add(listItem);
}
return labReports;
}
private synchronized List<ListItem> getList(List<String> list) {
List<ListItem> listItems = new ArrayList<ListItem>();
for(int i = 0; i < list.size(); i++) {
String x = (String)list.get(i);
ListItem listItem = new ListItem();
listItem.setIen(StringUtils.piece(x, 1));
listItem.setName(StringUtils.piece(x, 2));
listItem.setValue(StringUtils.piece(x, 3));
listItem.setRpcResult(x);
listItems.add(listItem);
}
return listItems;
}
}
|
{
"content_hash": "2951408ebc162f47bacd0f465e944b54",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 106,
"avg_line_length": 36.17213114754098,
"alnum_prop": 0.6764106050305915,
"repo_name": "VHAINNOVATIONS/AVS",
"id": "e0b0718739b6bae1eb54365d0ac5712275a5962b",
"size": "4413",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ll-vistaBroker/ll-vistabroker-ejb3/src/main/java/gov/va/med/lom/vistabroker/lists/dao/LabTestTypesDao.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "97314"
},
{
"name": "Elixir",
"bytes": "758"
},
{
"name": "Java",
"bytes": "3765290"
},
{
"name": "JavaScript",
"bytes": "5395171"
},
{
"name": "Pascal",
"bytes": "17829"
},
{
"name": "Shell",
"bytes": "10984"
}
]
}
|
End of preview.