Dataset Preview
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 |
|---|---|
package us.grahn.trojanow.presentation.feed;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import us.grahn.trojanow.R;
/**
* An interface to display to display the default feed for the user. This will contain posts which
* are made by pals and posts which are made by strangers.
*
* @us.grahn.class FeedInterface
* @us.grahn.component FeedInterface
* @us.grahn.tier Presentation
*/
public class FeedActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feed);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_feed, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
|
{
"content_hash": "edfd3b7cc65cbf7b02d104c7aa7e47c0",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 98,
"avg_line_length": 30.041666666666668,
"alnum_prop": 0.6914008321775312,
"repo_name": "dgrahn/csci578",
"id": "ed589bb19004cfa6baf4242c6bd9a055ae147872",
"size": "1442",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/app/src/main/java/us/grahn/trojanow/presentation/feed/FeedActivity.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3489"
},
{
"name": "CoffeeScript",
"bytes": "1688"
},
{
"name": "HTML",
"bytes": "29049"
},
{
"name": "Java",
"bytes": "92852"
},
{
"name": "JavaScript",
"bytes": "664"
},
{
"name": "Ruby",
"bytes": "73525"
}
]
}
|
package com.amazonaws.services.simpleemail.model.transform;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.amazonaws.AmazonClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.simpleemail.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.StringUtils;
/**
* ListReceiptRuleSetsRequest Marshaller
*/
public class ListReceiptRuleSetsRequestMarshaller
implements
Marshaller<Request<ListReceiptRuleSetsRequest>, ListReceiptRuleSetsRequest> {
public Request<ListReceiptRuleSetsRequest> marshall(
ListReceiptRuleSetsRequest listReceiptRuleSetsRequest) {
if (listReceiptRuleSetsRequest == null) {
throw new AmazonClientException(
"Invalid argument passed to marshall(...)");
}
Request<ListReceiptRuleSetsRequest> request = new DefaultRequest<ListReceiptRuleSetsRequest>(
listReceiptRuleSetsRequest, "AmazonSimpleEmailService");
request.addParameter("Action", "ListReceiptRuleSets");
request.addParameter("Version", "2010-12-01");
request.setHttpMethod(HttpMethodName.POST);
if (listReceiptRuleSetsRequest.getNextToken() != null) {
request.addParameter("NextToken", StringUtils
.fromString(listReceiptRuleSetsRequest.getNextToken()));
}
return request;
}
}
|
{
"content_hash": "879bffd50134a4b42bd4c1ce1f36de85",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 101,
"avg_line_length": 32.255319148936174,
"alnum_prop": 0.7242744063324539,
"repo_name": "trasa/aws-sdk-java",
"id": "2da6440cc63fd1e01fea8f029bdb641e81e00bff",
"size": "2100",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-java-sdk-ses/src/main/java/com/amazonaws/services/simpleemail/model/transform/ListReceiptRuleSetsRequestMarshaller.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "100011199"
},
{
"name": "Scilab",
"bytes": "2354"
}
]
}
|
var helper = require('./util/helper'),
constants = require('./util/constants'),
LiveNodeList = require('./LiveNodeList'),
QueryStrategyFactory = require('./domQueries/QueryStrategyFactory');
/**
* @module watched/DomElement
*/
/**
* Object used as prototype for new DomElement instances.
* Should be used as a prototype for new `DomElement` instances
*
* @namespace module:watched/DomElement~DomElement
*/
var DomElement = {
__name__: 'DomElement'
};
/**
* Add all available queries to the DomElement's prototype
*/
constants.AVAILABLE_QUERIES.forEach(function (queryType) {
DomElement[queryType] = function (selector) {
// TODO tiny query factory, better do some error handling?
var queryStrategy = QueryStrategyFactory.create(queryType, this.el, selector);
return LiveNodeList(queryStrategy);
};
});
/**
* See [`querySelectorAll`](http://devdocs.io/dom/document.queryselectorall) for details.
*
* @function querySelectorAll
* @memberof module:watched/DomElement~DomElement
* @param {String} selector
* @instance
* @returns {module:watched/LiveNodeList~LiveNodeList}
*/
/**
* See [`querySelector`](http://devdocs.io/dom/document.queryselector) for details. The returned object will be always
* a `LiveNodeList`, not a single element as in the native `querySelector`.
*
* @function querySelector
* @memberof module:watched/DomElement~DomElement
* @param element
* @instance
* @returns {module:watched/LiveNodeList~LiveNodeList}
*/
/**
* See [`getElementsByTagName`](http://devdocs.io/dom/element.getelementsbytagname) for details. Should be faster than
* the query selectors, as **watched.js** uses the native live nodelist internally to get the elements you want.
*
* @function getElementsByTagName
* @memberof module:watched/DomElement~DomElement
* @param {String} selector
* @instance
* @returns {module:watched/LiveNodeList~LiveNodeList}
*/
/**
* See [`getElementsByClassName`](http://devdocs.io/dom/document.getelementsbyclassname) for details. Should be faster
* than the query selectors, as **watched.js** uses the native live nodelist internally to get the elements you want.
*
* @function getElementsByClassName
* @memberof module:watched/DomElement~DomElement
* @param {String} selector
* @instance
* @returns {module:watched/LiveNodeList~LiveNodeList}
*/
/**
* factory method to create new `DomElement` instances
*
* @param {HTMLElement} element the HTMLElement used as root for all queries
* @returns {module:watched/DomElement~DomElement}
* @throws {Error|TypeError}
* @example
* var DomElement = require('./DomElement');
* var domElement = DomElement(document);
* var nodeList = domElement.querySelectorAll('.foo');
*/
module.exports = function(element){
if (this instanceof module.exports) {
throw new Error('The DomElement is a factory function, not a constructor. Don\'t use the new keyword with it');
}
if (helper.isInvalidDomElement(element)) {
throw new TypeError('The element to watch has to be a HTMLElement! The type of the given element is ' + typeof element );
}
var domElement = Object.create(DomElement, {
el : {
value: element
}
});
return domElement;
};
|
{
"content_hash": "fb3f7a932fee5d9b431b0ce02b8311bb",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 123,
"avg_line_length": 29.747663551401867,
"alnum_prop": 0.7326421614828778,
"repo_name": "grmlin/watched",
"id": "5254ea0e89ed7be151faa4da54ee56e5eba89ac3",
"size": "3183",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/DomElement.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "3244"
},
{
"name": "JavaScript",
"bytes": "218329"
},
{
"name": "Smarty",
"bytes": "150"
}
]
}
|
<?php
/**
* Mindmap
* @link https://github.com/jyruzicka/dugong
*/
namespace MarkNotes\Plugins\Page\HTML;
defined('_MARKNOTES') or die('No direct access allowed');
class MindMap extends \MarkNotes\Plugins\Page\HTML\Plugin
{
protected static $me = __CLASS__;
protected static $json_settings = 'plugins.page.html.mindmap';
protected static $json_options = 'plugins.options.page.html.mindmap';
/**
* Provide additional javascript
*/
public static function addJS(&$js = null) : bool
{
$aeFunctions = \MarkNotes\Functions::getInstance();
$url = rtrim($aeFunctions->getCurrentURL(), '/') . '/';
$url .= 'marknotes/plugins/page/html/mindmap/';
$script = '<script ' .
'src="' . $url . 'assets/dugong-min.js">' .
"</script>\n" .
"<script>\n" .
"Dugong.populate('MN_mindmap');\n" .
"$('.MN_mindmap').show();\n" .
"</script>\n";
$js .= $aeFunctions->addJavascriptInline($script);
return true;
}
/**
* Provide additional stylesheets
*/
public static function addCSS(&$css = null) : bool
{
$aeFunctions = \MarkNotes\Functions::getInstance();
$url = rtrim($aeFunctions->getCurrentURL(), '/') . '/';
$url .= 'marknotes/plugins/page/html/mindmap/';
$script = '<link media="screen" rel="stylesheet" type="text/css" ' .
'href="' . $url . "assets/dugong.css\" />\n";
$css .= $aeFunctions->addStyleInline($script);
return true;
}
/**
* Add/modify the HTML content
*/
public static function doIt(&$html = null) : bool
{
return true;
}
}
|
{
"content_hash": "0ee695f33d2f77645f504fa49f58c7cd",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 70,
"avg_line_length": 23.184615384615384,
"alnum_prop": 0.6337093563370936,
"repo_name": "cavo789/marknotes",
"id": "3e8d81eff76084e472bff5bff204fee1e7038bd6",
"size": "1507",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/marknotes/plugins/page/html/mindmap.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "45596"
},
{
"name": "C",
"bytes": "8656"
},
{
"name": "CSS",
"bytes": "611146"
},
{
"name": "Dockerfile",
"bytes": "315"
},
{
"name": "HTML",
"bytes": "86141"
},
{
"name": "Hack",
"bytes": "18933"
},
{
"name": "JavaScript",
"bytes": "6201160"
},
{
"name": "M4",
"bytes": "2250"
},
{
"name": "PHP",
"bytes": "11092049"
},
{
"name": "SCSS",
"bytes": "65612"
},
{
"name": "Shell",
"bytes": "231"
},
{
"name": "VBA",
"bytes": "45352"
}
]
}
|
local gradeTiers = {
Grade_Tier01 = 0,
Grade_Tier02 = 1,
Grade_Tier03 = 2,
Grade_Tier04 = 3,
Grade_Tier05 = 4,
Grade_Tier06 = 5,
Grade_Tier07 = 6,
Grade_Tier08 = 7,
Grade_Tier09 = 8,
Grade_Tier10 = 9,
Grade_Tier11 = 10,
Grade_Tier12 = 11,
Grade_Tier13 = 12,
Grade_Tier14 = 13,
Grade_Tier15 = 14,
Grade_Tier16 = 15,
Grade_Tier17 = 16,
Grade_Tier18 = 17,
Grade_Tier19 = 18,
Grade_Tier20 = 19,
Grade_Failed = 20
}
local scoreWeight = { -- Score Weights for DP score (MAX2)
TapNoteScore_W1 = 2,--PREFSMAN:GetPreference("GradeWeightW1"), -- 2
TapNoteScore_W2 = 2,--PREFSMAN:GetPreference("GradeWeightW2"), -- 2
TapNoteScore_W3 = 1,--PREFSMAN:GetPreference("GradeWeightW3"), -- 1
TapNoteScore_W4 = 0,--PREFSMAN:GetPreference("GradeWeightW4"), -- 0
TapNoteScore_W5 = -4,--PREFSMAN:GetPreference("GradeWeightW5"), -- -4
TapNoteScore_Miss = -8,--PREFSMAN:GetPreference("GradeWeightMiss"), -- -8
HoldNoteScore_Held = 6,--PREFSMAN:GetPreference("GradeWeightHeld"), -- 6
TapNoteScore_HitMine = -8,--PREFSMAN:GetPreference("GradeWeightHitMine"), -- -8
HoldNoteScore_LetGo = 0,--PREFSMAN:GetPreference("GradeWeightLetGo"), -- 0
HoldNoteScore_MissedHold = 0,
TapNoteScore_AvoidMine = 0,
TapNoteScore_CheckpointHit = 0,--PREFSMAN:GetPreference("GradeWeightCheckpointHit"), -- 0
TapNoteScore_CheckpointMiss = 0--PREFSMAN:GetPreference("GradeWeightCheckpointMiss"), -- 0
}
local psWeight = { -- Score Weights for percentage scores (EX oni)
TapNoteScore_W1 = 3,--PREFSMAN:GetPreference("PercentScoreWeightW1"),
TapNoteScore_W2 = 2,--PREFSMAN:GetPreference("PercentScoreWeightW2"),
TapNoteScore_W3 = 1,--PREFSMAN:GetPreference("PercentScoreWeightW3"),
TapNoteScore_W4 = 0,--PREFSMAN:GetPreference("PercentScoreWeightW4"),
TapNoteScore_W5 = 0,--PREFSMAN:GetPreference("PercentScoreWeightW5"),
TapNoteScore_Miss = 0,--PREFSMAN:GetPreference("PercentScoreWeightMiss"),
HoldNoteScore_Held = 3,--PREFSMAN:GetPreference("PercentScoreWeightHeld"),
TapNoteScore_HitMine = -2,--(0 or -2?) PREFSMAN:GetPreference("PercentScoreWeightHitMine"),
HoldNoteScore_LetGo = 0,--PREFSMAN:GetPreference("PercentScoreWeightLetGo"),
HoldNoteScore_MissedHold = 0,
TapNoteScore_AvoidMine = 0,
TapNoteScore_CheckpointHit = 0,--PREFSMAN:GetPreference("PercentScoreWeightCheckpointHit"),
TapNoteScore_CheckpointMiss = 0--PREFSMAN:GetPreference("PercentScoreWeightCheckpointMiss"),
}
local migsWeight = { -- Score Weights for MIGS score
TapNoteScore_W1 = 3,
TapNoteScore_W2 = 2,
TapNoteScore_W3 = 1,
TapNoteScore_W4 = 0,
TapNoteScore_W5 = -4,
TapNoteScore_Miss = -8,
HoldNoteScore_Held = 6,
TapNoteScore_HitMine = -8,
HoldNoteScore_LetGo = 0,
HoldNoteScore_MissedHold = 0,
TapNoteScore_AvoidMine = 0,
TapNoteScore_CheckpointHit = 0,
TapNoteScore_CheckpointMiss = 0
}
function getScoreList(pn)
local song = GAMESTATE:GetCurrentSong()
local profile
local steps
if GAMESTATE:IsPlayerEnabled(pn) then
profile = GetPlayerOrMachineProfile(pn)
steps = GAMESTATE:GetCurrentSteps(pn)
if profile ~= nil and steps ~= nil and song ~= nil then
return profile:GetHighScoreList(song,steps):GetHighScores()
end
end
return nil
end
function getScoreFromTable(hsTable,index)
return hsTable[index]
end
function getScoreFromPn(pn,index)
local hsTable = getScoreList(pn)
return getScore(hsTable,index)
end
function getMaxNotes(pn)
local song = GAMESTATE:GetCurrentSong()
local steps
if GAMESTATE:IsPlayerEnabled(pn) then
steps = GAMESTATE:GetCurrentSteps(pn)
if steps ~= nil then
if GAMESTATE:GetCurrentGame():CountNotesSeparately() then
return steps:GetRadarValues(pn):GetValue("RadarCategory_Notes") or 0
else
return steps:GetRadarValues(pn):GetValue("RadarCategory_TapsAndHolds") or 0
end
end
end
return 0
end
function getMaxHolds(pn)
local song = GAMESTATE:GetCurrentSong()
local steps
if GAMESTATE:IsPlayerEnabled(pn) then
steps = GAMESTATE:GetCurrentSteps(pn)
if steps ~= nil then
return (steps:GetRadarValues(pn):GetValue("RadarCategory_Holds") + steps:GetRadarValues(pn):GetValue("RadarCategory_Rolls")) or 0
end
end
return 0
end
--Gets the highest score possible for the scoretype
function getMaxScore(pn,scoreType) -- dp, ps, migs = 1,2,3 respectively, 0 reverts to default
local maxNotes = getMaxNotes(pn)
local maxHolds = getMaxHolds(pn)
if scoreType == 0 or scoreType == nil then
scoreType = themeConfig:get_data().global.DefaultScoreType
end;
if scoreType == 1 then
return (maxNotes*scoreWeight["TapNoteScore_W1"]+maxHolds*scoreWeight["HoldNoteScore_Held"])-- maximum DP
elseif scoreType == 2 then
return (maxNotes*psWeight["TapNoteScore_W1"]+maxHolds*psWeight["HoldNoteScore_Held"]) -- maximum %score DP
elseif scoreType == 3 then
return (maxNotes*migsWeight["TapNoteScore_W1"]+maxHolds*migsWeight["HoldNoteScore_Held"])
else
return "????"
end
end
function getGradeThreshold(pn,grade)
local maxScore = getMaxScore(pn,1)
if grade == "Grade_Failed" then
return 0
else
return math.ceil(maxScore*THEME:GetMetric("PlayerStageStats",grade:gsub("Grade_","GradePercent")))
end
end
function getNearbyGrade(pn,DPScore,grade)
local nextGrade
local gradeScore = 0
local nextGradeScore = 0
if grade == "Grade_Tier01" or grade == "Grade_Tier02" then
return grade,0
elseif grade == "Grade_Failed" then
return "Grade_Tier07",DPScore
elseif grade == "Grade_None" then
return "Grade_Tier07",0
else
nextGrade = string.format("Grade_Tier%02d",(tonumber(grade:sub(-2))-1))
gradeScore = getGradeThreshold(pn,grade)
nextGradeScore = getGradeThreshold(pn,nextGrade)
curGradeDiff = DPScore - gradeScore
nextGradeDiff = DPScore - nextGradeScore
if math.abs(curGradeDiff) < math.abs(nextGradeDiff) then
return grade,curGradeDiff
else
return nextGrade,nextGradeDiff
end
end
end
function getScoreGrade(score)
if score ~= nil then
return score:GetGrade()
else
return "Grade_None"
end
end
function getScoreMaxCombo(score)
if score ~= nil then
return score:GetMaxCombo()
else
return 0
end
end
function getScoreDate(score)
if score ~= nil then
return score:GetDate()
else
return ""
end
end
function getScoreTapNoteScore(score,tns)
if score ~= nil then
return score:GetTapNoteScore(tns)
else
return 0
end
end
function getScoreHoldNoteScore(score,tns)
if score ~= nil then
return score:GetHoldNoteScore(tns)
else
return 0
end
end
function getScoreMissCount(score)
return getScoreTapNoteScore(score,"TapNoteScore_Miss") + getScoreTapNoteScore(score,"TapNoteScore_W5") + getScoreTapNoteScore(score,"TapNoteScore_W4")
end
function getScore(score,scoreType)
if scoreType == 0 or scoreType == nil then
scoreType = themeConfig:get_data().global.DefaultScoreType
end
if scoreType == 1 then
return
getScoreTapNoteScore(score,"TapNoteScore_W1")*scoreWeight["TapNoteScore_W1"]+
getScoreTapNoteScore(score,"TapNoteScore_W2")*scoreWeight["TapNoteScore_W2"]+
getScoreTapNoteScore(score,"TapNoteScore_W3")*scoreWeight["TapNoteScore_W3"]+
getScoreTapNoteScore(score,"TapNoteScore_W4")*scoreWeight["TapNoteScore_W4"]+
getScoreTapNoteScore(score,"TapNoteScore_W5")*scoreWeight["TapNoteScore_W5"]+
getScoreTapNoteScore(score,"TapNoteScore_Miss")*scoreWeight["TapNoteScore_Miss"]+
getScoreTapNoteScore(score,"TapNoteScore_CheckpointHit")*scoreWeight["TapNoteScore_CheckpointHit"]+
getScoreTapNoteScore(score,"TapNoteScore_CheckpointMiss")*scoreWeight["TapNoteScore_CheckpointMiss"]+
getScoreTapNoteScore(score,"TapNoteScore_HitMine")*scoreWeight["TapNoteScore_HitMine"]+
getScoreTapNoteScore(score,"TapNoteScore_AvoidMine")*scoreWeight["TapNoteScore_AvoidMine"]+
getScoreHoldNoteScore(score,"HoldNoteScore_LetGo")*scoreWeight["HoldNoteScore_LetGo"]+
getScoreHoldNoteScore(score,"HoldNoteScore_Held")*scoreWeight["HoldNoteScore_Held"]+
getScoreHoldNoteScore(score,"HoldNoteScore_MissedHold")*scoreWeight["HoldNoteScore_MissedHold"]
elseif scoreType == 2 then
return
getScoreTapNoteScore(score,"TapNoteScore_W1")*psWeight["TapNoteScore_W1"]+
getScoreTapNoteScore(score,"TapNoteScore_W2")*psWeight["TapNoteScore_W2"]+
getScoreTapNoteScore(score,"TapNoteScore_W3")*psWeight["TapNoteScore_W3"]+
getScoreTapNoteScore(score,"TapNoteScore_W4")*psWeight["TapNoteScore_W4"]+
getScoreTapNoteScore(score,"TapNoteScore_W5")*psWeight["TapNoteScore_W5"]+
getScoreTapNoteScore(score,"TapNoteScore_Miss")*psWeight["TapNoteScore_Miss"]+
getScoreTapNoteScore(score,"TapNoteScore_CheckpointHit")*psWeight["TapNoteScore_CheckpointHit"]+
getScoreTapNoteScore(score,"TapNoteScore_CheckpointMiss")*psWeight["TapNoteScore_CheckpointMiss"]+
getScoreTapNoteScore(score,"TapNoteScore_HitMine")*psWeight["TapNoteScore_HitMine"]+
getScoreTapNoteScore(score,"TapNoteScore_AvoidMine")*psWeight["TapNoteScore_AvoidMine"]+
getScoreHoldNoteScore(score,"HoldNoteScore_LetGo")*psWeight["HoldNoteScore_LetGo"]+
getScoreHoldNoteScore(score,"HoldNoteScore_Held")*psWeight["HoldNoteScore_Held"]+
getScoreHoldNoteScore(score,"HoldNoteScore_MissedHold")*psWeight["HoldNoteScore_MissedHold"]
elseif scoreType == 3 then
return
getScoreTapNoteScore(score,"TapNoteScore_W1")*migsWeight["TapNoteScore_W1"]+
getScoreTapNoteScore(score,"TapNoteScore_W2")*migsWeight["TapNoteScore_W2"]+
getScoreTapNoteScore(score,"TapNoteScore_W3")*migsWeight["TapNoteScore_W3"]+
getScoreTapNoteScore(score,"TapNoteScore_W4")*migsWeight["TapNoteScore_W4"]+
getScoreTapNoteScore(score,"TapNoteScore_W5")*migsWeight["TapNoteScore_W5"]+
getScoreTapNoteScore(score,"TapNoteScore_Miss")*migsWeight["TapNoteScore_Miss"]+
getScoreTapNoteScore(score,"TapNoteScore_CheckpointHit")*migsWeight["TapNoteScore_CheckpointHit"]+
getScoreTapNoteScore(score,"TapNoteScore_CheckpointMiss")*migsWeight["TapNoteScore_CheckpointMiss"]+
getScoreTapNoteScore(score,"TapNoteScore_HitMine")*migsWeight["TapNoteScore_HitMine"]+
getScoreTapNoteScore(score,"TapNoteScore_AvoidMine")*migsWeight["TapNoteScore_AvoidMine"]+
getScoreHoldNoteScore(score,"HoldNoteScore_LetGo")*migsWeight["HoldNoteScore_LetGo"]+
getScoreHoldNoteScore(score,"HoldNoteScore_Held")*migsWeight["HoldNoteScore_Held"]+
getScoreHoldNoteScore(score,"HoldNoteScore_MissedHold")*migsWeight["HoldNoteScore_MissedHold"]
else
return 0
end
end
------------------------------------------------
-- Rate filter stuff --
local sortScoreType = 0
local function scoreComparator(scoreA,scoreB)
return getScore(scoreA,sortScoreType) > getScore(scoreB,sortScoreType)
end
-- returns a sorted table based on the criteria given by the
-- scoreComparator() function.
function sortScore(hsTable,scoreType)
sortScoreType = scoreType
table.sort(hsTable,scoreComparator)
return hsTable
end
-- returns a string corresponding to the rate mod used in the highscore.
function getRate(score)
-- gets the rate mod used in highscore. doesn't work if ratemod has a different name
local mods = score:GetModifiers()
if string.find(mods,"Haste") ~= nil then
return 'Haste'
elseif string.find(mods,"xMusic") == nil then
return '1.0x'
else
return (string.match(mods,"%d+%.%d+xMusic")):sub(1,-6)
end
end
function getCurRate()
local mods = GAMESTATE:GetSongOptionsString()
if string.find(mods,"Haste") ~= nil then
return 'Haste'
elseif string.find(mods,"xMusic") == nil then
return '1.0x'
else
return (string.match(mods,"%d+%.%d+xMusic")):sub(1,-6)
end
end
-- returns the index of the highscore in a given highscore table.
function getHighScoreIndex(hsTable,score)
for k,v in ipairs(hsTable) do
if v:GetDate() == score:GetDate() then
return k
end
end
return 0
end
-- Returns a table containing tables containing scores for each ratemod used.
function getRateTable(hsTable)
local rtTable = {}
local rate
if hsTable ~= nil then
for k,v in ipairs(hsTable) do
if themeConfig:get_data().global.RateSort then
rate = getRate(v)
else
rate = "All"
end
if tableContains(rtTable,rate) then
rtTable[rate][#rtTable[rate]+1] = v
else
rtTable[rate] = {}
rtTable[rate][#rtTable[rate]+1] = v
end
end
for k,v in pairs(rtTable) do
rtTable[k] = sortScore(rtTable[k],0)
end
return rtTable
else
return nil
end
end
function getUsedRates(rtTable)
local rates = {}
local initIndex = 1
if rtTable ~= nil then
for k,v in pairs(rtTable) do
rates[#rates+1] = k
end;
table.sort(rates,function(a,b) a=a:gsub("x","") b=b:gsub("x","") return a<b end)
for i=1,#rates do
if rates[i] == "1.0x" or rates[i] == "All" then
initIndex = i
end
end
end
return rates,initIndex
end
----------------------------------------------------
-- Grabs the highest grade available from all currently saved scores.
-- Ignore parameter will ignore the score at that index.
function getBestGrade(pn,ignore)
local highest = 21
local indexScore
local grade = "Grade_None"
local temp = 0
local i = 0
local steps = GAMESTATE:GetCurrentSteps(pn)
local hsTable = getScoreList(pn)
if hsTable ~= nil and #hsTable >= 1 then
while i <= #hsTable do
if i ~= ignore then
indexScore = hsTable[i]
if indexScore ~= nil then
temp = gradeTiers[indexScore:GetGrade()] or 21
if temp <= highest and isScoreValid(pn,steps,indexScore) then
grade = getScoreGrade(indexScore)
highest = temp
end
end
end
i = i+1
end
end
return grade
end
-- Grabs the highest max combo from all currently saved scores.
-- Ignore parameter will ignore the score at that index.
function getBestMaxCombo(pn,ignore)
local highest = 0
local indexScore
local i = 0
local hsTable = getScoreList(pn)
local steps = GAMESTATE:GetCurrentSteps(pn)
if hsTable ~= nil and #hsTable >= 1 then
while i <= #hsTable do
if i ~= ignore then
indexScore = hsTable[i]
if indexScore ~= nil then
temp = getScoreMaxCombo(indexScore)
if isScoreValid(pn,steps,indexScore) then
highest = math.max(temp,highest)
end
end
end
i = i+1
end
end
return highest
end
-- Grabs the lowest misscount from all currently saved scores.
-- Ignore parameter will ignore the score at that index.
function getBestMissCount(pn,ignore)
local lowest = math.huge
local temp
local indexScore
local i = 0
local hsTable = getScoreList(pn)
local steps = GAMESTATE:GetCurrentSteps(pn)
if hsTable ~= nil and #hsTable >= 1 then
while i <= #hsTable do
if i ~= ignore then
indexScore = hsTable[i]
if indexScore ~= nil then
if indexScore:GetGrade() ~= "Grade_Failed" and isScoreValid(pn,steps,indexScore) then
temp = getScoreMissCount(indexScore)
lowest = math.min(lowest,temp)
end
end
end
i = i+1
end;
end;
if lowest == math.huge then
lowest = nil
end;
return lowest
end;
function getBestScore(pn,ignore,scoreType)
local highest = 0
if scoreType == 0 or scoreType == nil then
scoreType = themeConfig:get_data().global.DefaultScoreType
end
local indexScore
local hsTable = getScoreList(pn)
local steps = GAMESTATE:GetCurrentSteps(pn)
if hsTable ~= nil and #hsTable >= 1 then
for k,v in ipairs(hsTable) do
if k ~= ignore then
indexScore = hsTable[k]
if indexScore ~= nil then
if isScoreValid(pn,steps,indexScore) then
highest = math.max(highest,getScore(indexScore,scoreType))
end
end
end
end
end
return highest
end
|
{
"content_hash": "83200adb82b76406c2e1136a83dda93a",
"timestamp": "",
"source": "github",
"line_count": 491,
"max_line_length": 151,
"avg_line_length": 31.39918533604888,
"alnum_prop": 0.7363948887591619,
"repo_name": "MinaciousGrace/Transcendence",
"id": "87382c985c078f2de01c63d976cf55a165c9eb9b",
"size": "15418",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Scripts/Scores.lua",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Lua",
"bytes": "450486"
}
]
}
|
import { IFrozenRepository } from "core/generics";
import { IOptions } from "core/configuration";
export abstract class Options implements IOptions {
protected section: string;
config: IFrozenRepository;
constructor(config: IFrozenRepository, section: string) {
this.config = config;
this.section = (section.length > 0) ? section + '.' : '';
}
get<T>(key: string): T {
return this.config.get(`${this.section}${key}`);
}
defrost(): void {
this.config.defrost();
}
}
|
{
"content_hash": "23c16ec13bb99c95280ab164b6078a8e",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 61,
"avg_line_length": 21.869565217391305,
"alnum_prop": 0.6620278330019881,
"repo_name": "pflannery/vscode-versionlens",
"id": "7d3fe13284efcc0d0107ed372068b6ae19ce0824",
"size": "503",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/core/configuration/options.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "101777"
},
{
"name": "TypeScript",
"bytes": "3852"
}
]
}
|
exports.db = "mongodb://admin:giraffe@kahana.mongohq.com:10075/pileup";
|
{
"content_hash": "11df1ffef0e4062504f8a0b1e6b96d41",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 71,
"avg_line_length": 71,
"alnum_prop": 0.7746478873239436,
"repo_name": "jtmarmon/TrayWeigh",
"id": "959e3136151e9594f64d6f530ec3a0fb10f4cc4c",
"size": "71",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "config.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "15324"
},
{
"name": "JavaScript",
"bytes": "15172"
},
{
"name": "Ruby",
"bytes": "872"
}
]
}
|
module.exports = {
AppBar: require('./js/app-bar.jsx'),
AppCanvas: require('./js/app-canvas.jsx'),
Checkbox: require('./js/checkbox.jsx'),
Dialog: require('./js/dialog.jsx'),
DropDownIcon: require('./js/drop-down-icon.jsx'),
DropDownMenu: require('./js/drop-down-menu.jsx'),
IconButton: require('./js/icon-button.jsx'),
Icon: require('./js/icon.jsx'),
Input: require('./js/input.jsx'),
LeftNav: require('./js/left-nav.jsx'),
MenuItem: require('./js/menu-item.jsx'),
Menu: require('./js/menu.jsx'),
Mixins: {
Classable: require('./js/mixins/classable.js'),
ClickAwayable: require('./js/mixins/click-awayable.js')
},
PaperButton: require('./js/paper-button.jsx'),
Paper: require('./js/paper.jsx'),
RadioButton: require('./js/radio-button.jsx'),
Ripple: require('./js/ripple.jsx'),
Toggle: require('./js/toggle.jsx'),
Toast: require('./js/toast.jsx'),
Toolbar: require('./js/toolbar.jsx'),
ToolbarGroup: require('./js/toolbar-group.jsx'),
Utils: {
CssEvent: require('./js/utils/css-event.js'),
Dom: require('./js/utils/dom.js'),
Events: require('./js/utils/events.js'),
KeyLine: require('./js/utils/key-line.js')
}
};
|
{
"content_hash": "9d0ac651cadd791b6e48a691fd9ff778",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 59,
"avg_line_length": 37.09375,
"alnum_prop": 0.6419545071609098,
"repo_name": "baiyanghese/material-ui",
"id": "1775f27afdc30aeb93972a60fcafb4c3d762ceb8",
"size": "1187",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "129672"
},
{
"name": "JavaScript",
"bytes": "139170"
}
]
}
|
#ifndef EX_DDL_H
#define EX_DDL_H
/* -*-C++-*-
*****************************************************************************
*
* File: ex_ddl.h
* Description: DDL statements (get executed in mxcmp)
*
*
* Created: 7/10/95
* Language: C++
*
*
*
*
*****************************************************************************
*/
// forward
class ex_expr;
#include "ComTdbDDL.h"
#include "ComVersionDefs.h"
#include "ex_exe_stmt_globals.h"
// -----------------------------------------------------------------------
// Classes defined in this file
// -----------------------------------------------------------------------
class ExDDLTdb;
// -----------------------------------------------------------------------
// Classes referenced in this file
// -----------------------------------------------------------------------
class ex_tcb;
// -----------------------------------------------------------------------
// ExDDLTdb
// -----------------------------------------------------------------------
class ExDDLTdb : public ComTdbDDL
{
public:
// ---------------------------------------------------------------------
// Constructor is only called to instantiate an object used for
// retrieval of the virtual table function pointer of the class while
// unpacking. An empty constructor is enough.
// ---------------------------------------------------------------------
ExDDLTdb()
{}
virtual ~ExDDLTdb()
{}
// ---------------------------------------------------------------------
// Build a TCB for this TDB. Redefined in the Executor project.
// ---------------------------------------------------------------------
virtual ex_tcb *build(ex_globals *globals);
private:
// ---------------------------------------------------------------------
// !!!!!!! IMPORTANT -- NO DATA MEMBERS ALLOWED IN EXECUTOR TDB !!!!!!!!
// *********************************************************************
// The Executor TDB's are only used for the sole purpose of providing a
// way to supplement the Compiler TDB's (in comexe) with methods whose
// implementation depends on Executor objects. This is done so as to
// decouple the Compiler from linking in Executor objects unnecessarily.
//
// When a Compiler generated TDB arrives at the Executor, the same data
// image is "cast" as an Executor TDB after unpacking. Therefore, it is
// a requirement that a Compiler TDB has the same object layout as its
// corresponding Executor TDB. As a result of this, all Executor TDB's
// must have absolutely NO data members, but only member functions. So,
// if you reach here with an intention to add data members to a TDB, ask
// yourself two questions:
//
// 1. Are those data members Compiler-generated?
// If yes, put them in the ComTdbDLL instead.
// If no, they should probably belong to someplace else (like TCB).
//
// 2. Are the classes those data members belong defined in the executor
// project?
// If your answer to both questions is yes, you might need to move
// the classes to the comexe project.
// ---------------------------------------------------------------------
};
// -----------------------------------------------------------------------
// ExDDLwithStatusTdb
// -----------------------------------------------------------------------
class ExDDLwithStatusTdb : public ComTdbDDLwithStatus
{
public:
// ---------------------------------------------------------------------
// Constructor is only called to instantiate an object used for
// retrieval of the virtual table function pointer of the class while
// unpacking. An empty constructor is enough.
// ---------------------------------------------------------------------
ExDDLwithStatusTdb()
{}
virtual ~ExDDLwithStatusTdb()
{}
// ---------------------------------------------------------------------
// Build a TCB for this TDB. Redefined in the Executor project.
// ---------------------------------------------------------------------
virtual ex_tcb *build(ex_globals *globals);
private:
// ---------------------------------------------------------------------
// !!!!!!! IMPORTANT -- NO DATA MEMBERS ALLOWED IN EXECUTOR TDB !!!!!!!!
// *********************************************************************
// The Executor TDB's are only used for the sole purpose of providing a
// way to supplement the Compiler TDB's (in comexe) with methods whose
// implementation depends on Executor objects. This is done so as to
// decouple the Compiler from linking in Executor objects unnecessarily.
//
// When a Compiler generated TDB arrives at the Executor, the same data
// image is "cast" as an Executor TDB after unpacking. Therefore, it is
// a requirement that a Compiler TDB has the same object layout as its
// corresponding Executor TDB. As a result of this, all Executor TDB's
// must have absolutely NO data members, but only member functions. So,
// if you reach here with an intention to add data members to a TDB, ask
// yourself two questions:
//
// 1. Are those data members Compiler-generated?
// If yes, put them in the ComTdbDLL instead.
// If no, they should probably belong to someplace else (like TCB).
//
// 2. Are the classes those data members belong defined in the executor
// project?
// If your answer to both questions is yes, you might need to move
// the classes to the comexe project.
// ---------------------------------------------------------------------
};
//
// Task control block
//
class ExDDLTcb : public ex_tcb
{
friend class ExDDLTdb;
friend class ExDDLPrivateState;
public:
enum Step
{
EMPTY_,
REQUEST_SENT_,
RETURNING_DATA_,
DONE_,
HANDLE_ERROR_,
CANCELLED_,
RETURNING_LEAKS_
};
// Constructor
ExDDLTcb(const ComTdbDDL & ddl_tdb,
ex_globals * glob = 0);
~ExDDLTcb();
virtual short work();
ex_queue_pair getParentQueue() const;
Int32 orderedQueueProtocol() const;
void freeResources();
Int32 numChildren() const;
const ex_tcb* getChild(Int32 pos) const;
protected:
void handleErrors(ex_queue_entry *pentry_down, ComDiagsArea *da, Int32 error);
ex_queue_pair qparent_;
unsigned short tcbFlags_;
atp_struct * workAtp_;
// VO, plan versioning support
// Some operations, like showshape, may require a downrev compiler.
// This is not detected until execution time though.
COM_VERSION compilerVersion_;
const inline COM_VERSION getCompilerVersion (void) const { return compilerVersion_; };
inline void setCompilerVersion (COM_VERSION version) { compilerVersion_ = version; };
ExSqlComp * getArkcmp (void);
// Return the CLI context
ContextCli * currContext (void)
{ return getGlobals()->castToExExeStmtGlobals()->castToExMasterStmtGlobals()->getCliGlobals()->currContext(); };
inline ExDDLTdb & ddlTdb() const{return (ExDDLTdb &) tdb;};
};
//
// Task control block
//
class ExDDLwithStatusTcb : public ExDDLTcb
{
friend class ExDDLTdb;
friend class ExDDLPrivateState;
public:
enum Step
{
NOT_STARTED_,
SETUP_INITIAL_REQ_,
CALL_EMBEDDED_CMP_,
SEND_REQ_TO_CMP_,
PROCESS_REPLY_,
SETUP_NEXT_STEP_,
RETURN_STATUS_,
RETURN_DETAILS_,
RETURN_STATUS_END_STEP_,
DONE_,
HANDLE_ERROR_,
CANCELLED_
};
// Constructor
ExDDLwithStatusTcb(const ComTdbDDL & ddl_tdb,
ex_globals * glob = 0);
~ExDDLwithStatusTcb()
{}
virtual short work();
ComDiagsArea * getDiagsArea() { return diagsArea_; }
inline ExDDLwithStatusTdb & ddlTdb() const{return (ExDDLwithStatusTdb &) tdb;};
private:
Step step_;
Lng32 ddlStep_;
Lng32 ddlSubstep_;
char * upgdMsg_;
ExSqlComp * cmp_;
char * replyBuf_;
ULng32 replyBufLen_;
CmpDDLwithStatusInfo * mdi_;
CmpDDLwithStatusInfo * replyDWS_;
Int64 startTime_;
Int64 endTime_;
char * data_;
size_t dataLen_;
NABoolean callEmbeddedCmp_;
Int32 numEntries_;
Int32 currEntry_;
char * currPtr_;
ComDiagsArea * diagsArea_;
};
class ExDDLPrivateState : public ex_tcb_private_state
{
friend class ExDDLTcb;
friend class ExDDLwithStatusTcb;
friend class ExDescribeTcb;
public:
ExDDLPrivateState(const ExDDLTcb * tcb); //constructor
~ExDDLPrivateState(); // destructor
ex_tcb_private_state * allocate_new(const ex_tcb * tcb);
protected:
void init();
ExDDLTcb::Step step_;
Int64 matches_;
// the request and reply objects used to send and receive
// data from arkcmp.
void * request_;
void * reply_;
char * dataPtr_;
ULng32 dataLen_;
ULng32 currLen_;
};
////////////////////////////////////////////////////////////////////
// classes ExDescribeTdb, ExDescribeTcb, ExDescribePrivateState
////////////////////////////////////////////////////////////////////
#include "ComTdbDDL.h"
// -----------------------------------------------------------------------
// Classes defined in this file
// -----------------------------------------------------------------------
class ExDescribeTdb;
// -----------------------------------------------------------------------
// Classes referenced in this file
// -----------------------------------------------------------------------
class ex_tcb;
// -----------------------------------------------------------------------
// ExDescribeTdb
// -----------------------------------------------------------------------
class ExDescribeTdb : public ComTdbDescribe
{
public:
// ---------------------------------------------------------------------
// Constructor is only called to instantiate an object used for
// retrieval of the virtual table function pointer of the class while
// unpacking. An empty constructor is enough.
// ---------------------------------------------------------------------
ExDescribeTdb()
{}
virtual ~ExDescribeTdb()
{}
// ---------------------------------------------------------------------
// Build a TCB for this TDB. Redefined in the Executor project.
// ---------------------------------------------------------------------
virtual ex_tcb *build(ex_globals *globals);
private:
// ---------------------------------------------------------------------
// !!!!!!! IMPORTANT -- NO DATA MEMBERS ALLOWED IN EXECUTOR TDB !!!!!!!!
// *********************************************************************
// The Executor TDB's are only used for the sole purpose of providing a
// way to supplement the Compiler TDB's (in comexe) with methods whose
// implementation depends on Executor objects. This is done so as to
// decouple the Compiler from linking in Executor objects unnecessarily.
//
// When a Compiler generated TDB arrives at the Executor, the same data
// image is "cast" as an Executor TDB after unpacking. Therefore, it is
// a requirement that a Compiler TDB has the same object layout as its
// corresponding Executor TDB. As a result of this, all Executor TDB's
// must have absolutely NO data members, but only member functions. So,
// if you reach here with an intention to add data members to a TDB, ask
// yourself two questions:
//
// 1. Are those data members Compiler-generated?
// If yes, put them in the ComTdbDescribe instead.
// If no, they should probably belong to someplace else (like TCB).
//
// 2. Are the classes those data members belong defined in the executor
// project?
// If your answer to both questions is yes, you might need to move
// the classes to the comexe project.
// ---------------------------------------------------------------------
};
class ExDescribeTcb : public ExDDLTcb
{
public:
ExDescribeTcb(const ExDescribeTdb & describe_tdb,
ex_globals * glob = 0);
short work();
private:
inline ExDescribeTdb & describeTdb() const{return (ExDescribeTdb &) tdb;};
Lng32 returnLeaks(short &error);
};
///////////////////////////////////////////////////////////////////
// This work method is defined in ex_control.cpp, alongwith other
// SHOWSET stmt methods.
///////////////////////////////////////////////////////////////////
class ExShowEnvvarsTcb : public ExDescribeTcb
{
public:
ExShowEnvvarsTcb(const ExDescribeTdb & describe_tdb,
ex_globals * glob = 0);
virtual short work();
protected:
enum Step
{
EMPTY_,
RETURN_HEADER_,
RETURNING_VALUE_,
DONE_,
HANDLE_ERROR_,
CANCELLED_
};
inline ExDescribeTdb & showTdb() const{return (ExDescribeTdb &) tdb;};
short moveRowToUpQueue(Lng32 tuppIndex,
const char * row,
Lng32 len = 0,
short * rc = NULL);
private:
Step step_;
Lng32 currEnvvar_;
};
// -----------------------------------------------------------------------
// ExProcessVolatileTableTdb
// -----------------------------------------------------------------------
class ExProcessVolatileTableTdb : public ComTdbProcessVolatileTable
{
public:
// ---------------------------------------------------------------------
// Constructor is only called to instantiate an object used for
// retrieval of the virtual table function pointer of the class while
// unpacking. An empty constructor is enough.
// ---------------------------------------------------------------------
ExProcessVolatileTableTdb()
{}
virtual ~ExProcessVolatileTableTdb()
{}
// ---------------------------------------------------------------------
// Build a TCB for this TDB. Redefined in the Executor project.
// ---------------------------------------------------------------------
virtual ex_tcb *build(ex_globals *globals);
private:
// ---------------------------------------------------------------------
// !!!!!!! IMPORTANT -- NO DATA MEMBERS ALLOWED IN EXECUTOR TDB !!!!!!!!
// *********************************************************************
// The Executor TDB's are only used for the sole purpose of providing a
// way to supplement the Compiler TDB's (in comexe) with methods whose
// implementation depends on Executor objects. This is done so as to
// decouple the Compiler from linking in Executor objects unnecessarily.
//
// When a Compiler generated TDB arrives at the Executor, the same data
// image is "cast" as an Executor TDB after unpacking. Therefore, it is
// a requirement that a Compiler TDB has the same object layout as its
// corresponding Executor TDB. As a result of this, all Executor TDB's
// must have absolutely NO data members, but only member functions. So,
// if you reach here with an intention to add data members to a TDB, ask
// yourself two questions:
//
// 1. Are those data members Compiler-generated?
// If yes, put them in the ComTdbDLL instead.
// If no, they should probably belong to someplace else (like TCB).
//
// 2. Are the classes those data members belong defined in the executor
// project?
// If your answer to both questions is yes, you might need to move
// the classes to the comexe project.
// ---------------------------------------------------------------------
};
class ExProcessVolatileTableTcb : public ExDDLTcb
{
friend class ExProcessVolatileTableTdb;
friend class ExExeUtilPrivateState;
public:
// Constructor
ExProcessVolatileTableTcb(const ComTdbProcessVolatileTable & exe_util_tdb,
ex_globals * glob = 0);
virtual short work();
ExProcessVolatileTableTdb & pvtTdb() const
{
return (ExProcessVolatileTableTdb &) tdb;
};
virtual ex_tcb_private_state * allocatePstates(
Lng32 &numElems, // inout, desired/actual elements
Lng32 &pstateLength); // out, length of one element
private:
enum Step
{
INITIAL_,
SEND_DDL_EXPR_,
ADD_TO_VOL_TAB_LIST_,
REMOVE_FROM_VOL_TAB_LIST_,
CREATE_VOLATILE_SCHEMA_,
SET_VOLATILE_SCHEMA_USAGE_CQD_,
RESET_VOLATILE_SCHEMA_USAGE_CQD_,
ERROR_,
DONE_
};
Step step_;
};
class ExProcessVolatileTablePrivateState : public ex_tcb_private_state
{
friend class ExProcessVolatileTableTcb;
public:
ExProcessVolatileTablePrivateState();
~ExProcessVolatileTablePrivateState(); // destructor
protected:
};
//////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------
// ExProcessInMemoryTableTdb
// -----------------------------------------------------------------------
class ExProcessInMemoryTableTdb : public ComTdbProcessInMemoryTable
{
public:
// ---------------------------------------------------------------------
// Constructor is only called to instantiate an object used for
// retrieval of the virtual table function pointer of the class while
// unpacking. An empty constructor is enough.
// ---------------------------------------------------------------------
ExProcessInMemoryTableTdb()
{}
virtual ~ExProcessInMemoryTableTdb()
{}
// ---------------------------------------------------------------------
// Build a TCB for this TDB. Redefined in the Executor project.
// ---------------------------------------------------------------------
virtual ex_tcb *build(ex_globals *globals);
private:
// ---------------------------------------------------------------------
// !!!!!!! IMPORTANT -- NO DATA MEMBERS ALLOWED IN EXECUTOR TDB !!!!!!!!
// *********************************************************************
// The Executor TDB's are only used for the sole purpose of providing a
// way to supplement the Compiler TDB's (in comexe) with methods whose
// implementation depends on Executor objects. This is done so as to
// decouple the Compiler from linking in Executor objects unnecessarily.
//
// When a Compiler generated TDB arrives at the Executor, the same data
// image is "cast" as an Executor TDB after unpacking. Therefore, it is
// a requirement that a Compiler TDB has the same object layout as its
// corresponding Executor TDB. As a result of this, all Executor TDB's
// must have absolutely NO data members, but only member functions. So,
// if you reach here with an intention to add data members to a TDB, ask
// yourself two questions:
//
// 1. Are those data members Compiler-generated?
// If yes, put them in the ComTdbDLL instead.
// If no, they should probably belong to someplace else (like TCB).
//
// 2. Are the classes those data members belong defined in the executor
// project?
// If your answer to both questions is yes, you might need to move
// the classes to the comexe project.
// ---------------------------------------------------------------------
};
class ExProcessInMemoryTableTcb : public ExDDLTcb
{
friend class ExProcessInMemoryTableTdb;
friend class ExExeUtilPrivateState;
public:
// Constructor
ExProcessInMemoryTableTcb(const ComTdbProcessInMemoryTable & exe_util_tdb,
ex_globals * glob = 0);
virtual short work();
ExProcessInMemoryTableTdb & pimtTdb() const
{
return (ExProcessInMemoryTableTdb &) tdb;
};
virtual ex_tcb_private_state * allocatePstates(
Lng32 &numElems, // inout, desired/actual elements
Lng32 &pstateLength); // out, length of one element
private:
enum Step
{
INITIAL_,
CREATE_VOLATILE_SCHEMA_,
SET_VOLATILE_SCHEMA_USAGE_CQD_,
TURN_QUERY_CACHE_OFF_,
SEND_DDL_EXPR_,
DROP_,
ERROR_,
DONE_
};
Step step_;
NABoolean volSchCreatedHere_;
};
class ExProcessInMemoryTablePrivateState : public ex_tcb_private_state
{
friend class ExProcessInMemoryTableTcb;
public:
ExProcessInMemoryTablePrivateState();
~ExProcessInMemoryTablePrivateState(); // destructor
protected:
};
#endif
|
{
"content_hash": "f7d3f52f48069cf08324b0a5fcb06902",
"timestamp": "",
"source": "github",
"line_count": 620,
"max_line_length": 116,
"avg_line_length": 31.861290322580643,
"alnum_prop": 0.5421686746987951,
"repo_name": "mashengchen/incubator-trafodion",
"id": "efb3eac4111819645543771a6f69ba59c54a88b1",
"size": "20756",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/sql/executor/ex_ddl.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "1C Enterprise",
"bytes": "27762"
},
{
"name": "Awk",
"bytes": "20971"
},
{
"name": "Batchfile",
"bytes": "27013"
},
{
"name": "C",
"bytes": "18877152"
},
{
"name": "C++",
"bytes": "68786466"
},
{
"name": "CSS",
"bytes": "99092"
},
{
"name": "GDB",
"bytes": "62692"
},
{
"name": "Groff",
"bytes": "46673"
},
{
"name": "HTML",
"bytes": "4618"
},
{
"name": "Inno Setup",
"bytes": "14579"
},
{
"name": "Java",
"bytes": "12232679"
},
{
"name": "JavaScript",
"bytes": "883279"
},
{
"name": "LLVM",
"bytes": "42952"
},
{
"name": "Makefile",
"bytes": "321639"
},
{
"name": "Objective-C",
"bytes": "637659"
},
{
"name": "PHP",
"bytes": "8438"
},
{
"name": "PLpgSQL",
"bytes": "197622"
},
{
"name": "Perl",
"bytes": "549860"
},
{
"name": "Protocol Buffer",
"bytes": "121282"
},
{
"name": "Python",
"bytes": "330201"
},
{
"name": "QMake",
"bytes": "3622"
},
{
"name": "Ruby",
"bytes": "8053"
},
{
"name": "SQLPL",
"bytes": "60330"
},
{
"name": "Shell",
"bytes": "1999068"
},
{
"name": "Tcl",
"bytes": "2763"
},
{
"name": "XSLT",
"bytes": "6100"
},
{
"name": "Yacc",
"bytes": "1368077"
}
]
}
|
package org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
/**
* Handles tracking and enforcement for user and queue maxRunningApps
* constraints.
*/
public class CSMaxRunningAppsEnforcer {
private static final Logger LOG = LoggerFactory.getLogger(
CSMaxRunningAppsEnforcer.class);
private final CapacityScheduler scheduler;
// Tracks the number of running applications by user.
private final Map<String, Integer> usersNumRunnableApps;
private final ListMultimap<String, FiCaSchedulerApp> usersNonRunnableApps;
public CSMaxRunningAppsEnforcer(CapacityScheduler scheduler) {
this.scheduler = scheduler;
this.usersNumRunnableApps = new HashMap<String, Integer>();
this.usersNonRunnableApps = ArrayListMultimap.create();
}
/**
* Checks whether making the application runnable would exceed any
* maxRunningApps limits. Also sets the "runnable" flag on the
* attempt.
*
* @param attempt the app attempt being checked
* @return true if the application is runnable; false otherwise
*/
public boolean checkRunnabilityWithUpdate(
FiCaSchedulerApp attempt) {
boolean attemptCanRun = !exceedUserMaxParallelApps(attempt.getUser())
&& !exceedQueueMaxParallelApps(attempt.getCSLeafQueue());
attempt.setRunnable(attemptCanRun);
return attemptCanRun;
}
/**
* Checks whether the number of user runnable apps exceeds the limitation.
*
* @param user the user name
* @return true if the number hits the limit; false otherwise
*/
private boolean exceedUserMaxParallelApps(String user) {
Integer userNumRunnable = usersNumRunnableApps.get(user);
if (userNumRunnable == null) {
userNumRunnable = 0;
}
if (userNumRunnable >= getUserMaxParallelApps(user)) {
LOG.info("Maximum runnable apps exceeded for user {}", user);
return true;
}
return false;
}
/**
* Recursively checks whether the number of queue runnable apps exceeds the
* limitation.
*
* @param queue the current queue
* @return true if the number hits the limit; false otherwise
*/
private boolean exceedQueueMaxParallelApps(AbstractCSQueue queue) {
// Check queue and all parent queues
while (queue != null) {
if (queue.getNumRunnableApps() >= queue.getMaxParallelApps()) {
LOG.info("Maximum runnable apps exceeded for queue {}",
queue.getQueuePath());
return true;
}
queue = (AbstractCSQueue) queue.getParent();
}
return false;
}
public void trackApp(FiCaSchedulerApp app) {
if (app.isRunnable()) {
trackRunnableApp(app);
} else {
trackNonRunnableApp(app);
}
}
/**
* Tracks the given new runnable app for purposes of maintaining max running
* app limits.
*/
private void trackRunnableApp(FiCaSchedulerApp app) {
String user = app.getUser();
AbstractCSQueue queue = (AbstractCSQueue) app.getQueue();
// Increment running counts for all parent queues
ParentQueue parent = (ParentQueue) queue.getParent();
while (parent != null) {
parent.incrementRunnableApps();
parent = (ParentQueue) parent.getParent();
}
Integer userNumRunnable = usersNumRunnableApps.get(user);
usersNumRunnableApps.put(user, (userNumRunnable == null ? 0
: userNumRunnable) + 1);
}
/**
* Tracks the given new non runnable app so that it can be made runnable when
* it would not violate max running app limits.
*/
private void trackNonRunnableApp(FiCaSchedulerApp app) {
String user = app.getUser();
usersNonRunnableApps.put(user, app);
}
/**
* This is called after reloading the allocation configuration when the
* scheduler is reinitialized
*
* Checks to see whether any non-runnable applications become runnable
* now that the max running apps of given queue has been changed
*
* Runs in O(n) where n is the number of apps that are non-runnable and in
* the queues that went from having no slack to having slack.
*/
public void updateRunnabilityOnReload() {
ParentQueue rootQueue = (ParentQueue) scheduler.getRootQueue();
List<List<FiCaSchedulerApp>> appsNowMaybeRunnable =
new ArrayList<List<FiCaSchedulerApp>>();
gatherPossiblyRunnableAppLists(rootQueue, appsNowMaybeRunnable);
updateAppsRunnability(appsNowMaybeRunnable, Integer.MAX_VALUE);
}
/**
* Checks to see whether any other applications runnable now that the given
* application has been removed from the given queue. And makes them so.
*
* Runs in O(n log(n)) where n is the number of queues that are under the
* highest queue that went from having no slack to having slack.
*/
public void updateRunnabilityOnAppRemoval(FiCaSchedulerApp app) {
// childqueueX might have no pending apps itself, but if a queue higher up
// in the hierarchy parentqueueY has a maxRunningApps set, an app completion
// in childqueueX could allow an app in some other distant child of
// parentqueueY to become runnable.
// An app removal will only possibly allow another app to become runnable if
// the queue was already at its max before the removal.
// Thus we find the ancestor queue highest in the tree for which the app
// that was at its maxRunningApps before the removal.
LeafQueue queue = app.getCSLeafQueue();
AbstractCSQueue highestQueueWithAppsNowRunnable =
(queue.getNumRunnableApps() == queue.getMaxParallelApps() - 1)
? queue : null;
ParentQueue parent = (ParentQueue) queue.getParent();
while (parent != null) {
if (parent.getNumRunnableApps() == parent.getMaxParallelApps() - 1) {
highestQueueWithAppsNowRunnable = parent;
}
parent = (ParentQueue) parent.getParent();
}
List<List<FiCaSchedulerApp>> appsNowMaybeRunnable =
new ArrayList<List<FiCaSchedulerApp>>();
// Compile lists of apps which may now be runnable
// We gather lists instead of building a set of all non-runnable apps so
// that this whole operation can be O(number of queues) instead of
// O(number of apps)
if (highestQueueWithAppsNowRunnable != null) {
gatherPossiblyRunnableAppLists(highestQueueWithAppsNowRunnable,
appsNowMaybeRunnable);
}
String user = app.getUser();
Integer userNumRunning = usersNumRunnableApps.get(user);
if (userNumRunning == null) {
userNumRunning = 0;
}
if (userNumRunning == getUserMaxParallelApps(user) - 1) {
List<FiCaSchedulerApp> userWaitingApps = usersNonRunnableApps.get(user);
if (userWaitingApps != null) {
appsNowMaybeRunnable.add(userWaitingApps);
}
}
updateAppsRunnability(appsNowMaybeRunnable,
appsNowMaybeRunnable.size());
}
/**
* Checks to see whether applications are runnable now by iterating
* through each one of them and check if the queue and user have slack.
*
* if we know how many apps can be runnable, there is no need to iterate
* through all apps, maxRunnableApps is used to break out of the iteration.
*/
private void updateAppsRunnability(List<List<FiCaSchedulerApp>>
appsNowMaybeRunnable, int maxRunnableApps) {
// Scan through and check whether this means that any apps are now runnable
Iterator<FiCaSchedulerApp> iter = new MultiListStartTimeIterator(
appsNowMaybeRunnable);
FiCaSchedulerApp prev = null;
List<FiCaSchedulerApp> noLongerPendingApps = new ArrayList<>();
while (iter.hasNext()) {
FiCaSchedulerApp next = iter.next();
if (next == prev) {
continue;
}
if (checkRunnabilityWithUpdate(next)) {
LeafQueue nextQueue = next.getCSLeafQueue();
LOG.info("{} is now runnable in {}",
next.getApplicationAttemptId(), nextQueue);
trackRunnableApp(next);
FiCaSchedulerApp appSched = next;
nextQueue.submitApplicationAttempt(next, next.getUser());
noLongerPendingApps.add(appSched);
if (noLongerPendingApps.size() >= maxRunnableApps) {
break;
}
}
prev = next;
}
// We remove the apps from their pending lists afterwards so that we don't
// pull them out from under the iterator. If they are not in these lists
// in the first place, there is a bug.
for (FiCaSchedulerApp appSched : noLongerPendingApps) {
if (!(appSched.getCSLeafQueue().removeNonRunnableApp(appSched))) {
LOG.error("Can't make app runnable that does not already exist in queue"
+ " as non-runnable: {}. This should never happen.",
appSched.getApplicationAttemptId());
}
if (!usersNonRunnableApps.remove(appSched.getUser(), appSched)) {
LOG.error("Waiting app {} expected to be in "
+ "usersNonRunnableApps, but was not. This should never happen.",
appSched.getApplicationAttemptId());
}
}
}
public void untrackApp(FiCaSchedulerApp app) {
if (app.isRunnable()) {
untrackRunnableApp(app);
} else {
untrackNonRunnableApp(app);
}
}
/**
* Updates the relevant tracking variables after a runnable app with the given
* queue and user has been removed.
*/
private void untrackRunnableApp(FiCaSchedulerApp app) {
// Update usersRunnableApps
String user = app.getUser();
int newUserNumRunning = usersNumRunnableApps.get(user) - 1;
if (newUserNumRunning == 0) {
usersNumRunnableApps.remove(user);
} else {
usersNumRunnableApps.put(user, newUserNumRunning);
}
// Update runnable app bookkeeping for queues
AbstractCSQueue queue = (AbstractCSQueue) app.getQueue();
ParentQueue parent = (ParentQueue) queue.getParent();
while (parent != null) {
parent.decrementRunnableApps();
parent = (ParentQueue) parent.getParent();
}
}
/**
* Stops tracking the given non-runnable app.
*/
private void untrackNonRunnableApp(FiCaSchedulerApp app) {
usersNonRunnableApps.remove(app.getUser(), app);
}
/**
* Traverses the queue hierarchy under the given queue to gather all lists
* of non-runnable applications.
*/
private void gatherPossiblyRunnableAppLists(AbstractCSQueue queue,
List<List<FiCaSchedulerApp>> appLists) {
if (queue.getNumRunnableApps() < queue.getMaxParallelApps()) {
if (queue instanceof LeafQueue) {
appLists.add(
((LeafQueue)queue).getCopyOfNonRunnableAppSchedulables());
} else {
for (CSQueue child : queue.getChildQueues()) {
gatherPossiblyRunnableAppLists((AbstractCSQueue) child, appLists);
}
}
}
}
private int getUserMaxParallelApps(String user) {
CapacitySchedulerConfiguration conf = scheduler.getConfiguration();
if (conf == null) {
return Integer.MAX_VALUE;
}
int userMaxParallelApps = conf.getMaxParallelAppsForUser(user);
return userMaxParallelApps;
}
/**
* Takes a list of lists, each of which is ordered by start time, and returns
* their elements in order of start time.
*
* We maintain positions in each of the lists. Each next() call advances
* the position in one of the lists. We maintain a heap that orders lists
* by the start time of the app in the current position in that list.
* This allows us to pick which list to advance in O(log(num lists)) instead
* of O(num lists) time.
*/
static class MultiListStartTimeIterator implements
Iterator<FiCaSchedulerApp> {
private List<FiCaSchedulerApp>[] appLists;
private int[] curPositionsInAppLists;
private PriorityQueue<IndexAndTime> appListsByCurStartTime;
@SuppressWarnings("unchecked")
MultiListStartTimeIterator(List<List<FiCaSchedulerApp>> appListList) {
appLists = appListList.toArray(new List[appListList.size()]);
curPositionsInAppLists = new int[appLists.length];
appListsByCurStartTime = new PriorityQueue<IndexAndTime>();
for (int i = 0; i < appLists.length; i++) {
long time = appLists[i].isEmpty() ? Long.MAX_VALUE : appLists[i].get(0)
.getStartTime();
appListsByCurStartTime.add(new IndexAndTime(i, time));
}
}
@Override
public boolean hasNext() {
return !appListsByCurStartTime.isEmpty()
&& appListsByCurStartTime.peek().time != Long.MAX_VALUE;
}
@Override
public FiCaSchedulerApp next() {
IndexAndTime indexAndTime = appListsByCurStartTime.remove();
int nextListIndex = indexAndTime.index;
FiCaSchedulerApp next = appLists[nextListIndex]
.get(curPositionsInAppLists[nextListIndex]);
curPositionsInAppLists[nextListIndex]++;
if (curPositionsInAppLists[nextListIndex] <
appLists[nextListIndex].size()) {
indexAndTime.time = appLists[nextListIndex]
.get(curPositionsInAppLists[nextListIndex]).getStartTime();
} else {
indexAndTime.time = Long.MAX_VALUE;
}
appListsByCurStartTime.add(indexAndTime);
return next;
}
@Override
public void remove() {
throw new UnsupportedOperationException("Remove not supported");
}
private static class IndexAndTime implements Comparable<IndexAndTime> {
private int index;
private long time;
IndexAndTime(int index, long time) {
this.index = index;
this.time = time;
}
@Override
public int compareTo(IndexAndTime o) {
return time < o.time ? -1 : (time > o.time ? 1 : 0);
}
@Override
public boolean equals(Object o) {
if (!(o instanceof IndexAndTime)) {
return false;
}
IndexAndTime other = (IndexAndTime)o;
return other.time == time;
}
@Override
public int hashCode() {
return (int)time;
}
}
}
}
|
{
"content_hash": "8e362d2025328e1cfe346becc67ce206",
"timestamp": "",
"source": "github",
"line_count": 420,
"max_line_length": 92,
"avg_line_length": 33.99285714285714,
"alnum_prop": 0.6872592281291587,
"repo_name": "steveloughran/hadoop",
"id": "d1a62b40941356b2fd59ae0d92fd8d8ab3454ef1",
"size": "15083",
"binary": false,
"copies": "1",
"ref": "refs/heads/trunk",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CSMaxRunningAppsEnforcer.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "78591"
},
{
"name": "C",
"bytes": "1974547"
},
{
"name": "C++",
"bytes": "2861923"
},
{
"name": "CMake",
"bytes": "115553"
},
{
"name": "CSS",
"bytes": "117128"
},
{
"name": "Dockerfile",
"bytes": "7311"
},
{
"name": "HTML",
"bytes": "420629"
},
{
"name": "Java",
"bytes": "93884754"
},
{
"name": "JavaScript",
"bytes": "1245137"
},
{
"name": "Python",
"bytes": "23553"
},
{
"name": "Shell",
"bytes": "480813"
},
{
"name": "TLA",
"bytes": "14997"
},
{
"name": "TSQL",
"bytes": "30600"
},
{
"name": "TeX",
"bytes": "19322"
},
{
"name": "XSLT",
"bytes": "18026"
}
]
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="zh">
<head>
<!-- Generated by javadoc (1.8.0_20) on Wed Aug 03 20:26:05 CST 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>HttpRequest</title>
<meta name="date" content="2016-08-03">
<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="HttpRequest";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>您的浏览器已禁用 JavaScript。</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="跳过导航链接">跳过导航链接</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="导航">
<li><a href="../../../overview-summary.html">概览</a></li>
<li><a href="package-summary.html">程序包</a></li>
<li class="navBarCell1Rev">类</li>
<li><a href="class-use/HttpRequest.html">使用</a></li>
<li><a href="package-tree.html">树</a></li>
<li><a href="../../../deprecated-list.html">已过时</a></li>
<li><a href="../../../index-files/index-1.html">索引</a></li>
<li><a href="../../../help-doc.html">帮助</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../fatspider/util/net/Download.html" title="fatspider.util.net中的类"><span class="typeNameLink">上一个类</span></a></li>
<li>下一个类</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?fatspider/util/net/HttpRequest.html" target="_top">框架</a></li>
<li><a href="HttpRequest.html" target="_top">无框架</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">所有类</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>概要: </li>
<li>嵌套 | </li>
<li>字段 | </li>
<li><a href="#constructor.summary">构造器</a> | </li>
<li><a href="#method.summary">方法</a></li>
</ul>
<ul class="subNavList">
<li>详细资料: </li>
<li>字段 | </li>
<li><a href="#constructor.detail">构造器</a> | </li>
<li><a href="#method.detail">方法</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">fatspider.util.net</div>
<h2 title="类 HttpRequest" class="title">类 HttpRequest</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>fatspider.util.net.HttpRequest</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">HttpRequest</span>
extends java.lang.Object</pre>
<div class="block">Http工具,提供常用的get,post方法,并提供获取输入流,正文等方法</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>构造器概要</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="构造器概要表, 列表构造器和解释">
<caption><span>构造器</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">构造器和说明</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../fatspider/util/net/HttpRequest.html#HttpRequest-java.lang.String-">HttpRequest</a></span>(java.lang.String url)</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>方法概要</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="方法概要表, 列表方法和解释">
<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="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">限定符和类型</th>
<th class="colLast" scope="col">方法和说明</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../fatspider/util/net/HttpRequest.html#getBody--">getBody</a></span>()</code>
<div class="block">获取响应的utf-8正文</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../fatspider/util/net/HttpRequest.html#getBody-java.lang.String-">getBody</a></span>(java.lang.String charset)</code> </td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>java.net.HttpURLConnection</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../fatspider/util/net/HttpRequest.html#getConnect--">getConnect</a></span>()</code> </td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>java.io.InputStream</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../fatspider/util/net/HttpRequest.html#getInputStream--">getInputStream</a></span>()</code>
<div class="block">获取输入流</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../fatspider/util/net/HttpRequest.html#getUrl--">getUrl</a></span>()</code> </td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>java.net.HttpURLConnection</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../fatspider/util/net/HttpRequest.html#open-java.util.HashMap-java.util.HashMap-int-">open</a></span>(java.util.HashMap<java.lang.String,java.lang.String> parms,
java.util.HashMap<java.lang.String,java.lang.String> data,
int second)</code>
<div class="block">get方法获取链接</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>java.net.HttpURLConnection</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../fatspider/util/net/HttpRequest.html#post-java.util.HashMap-java.util.HashMap-int-">post</a></span>(java.util.HashMap<java.lang.String,java.lang.String> parms,
java.util.HashMap<java.lang.String,java.lang.String> data,
int second)</code>
<div class="block">post方法打开链接</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../fatspider/util/net/HttpRequest.html#setCookie-java.lang.String-">setCookie</a></span>(java.lang.String cookie)</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>从类继承的方法 java.lang.Object</h3>
<code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>构造器详细资料</h3>
<a name="HttpRequest-java.lang.String-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>HttpRequest</h4>
<pre>public HttpRequest(java.lang.String url)</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>方法详细资料</h3>
<a name="getUrl--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getUrl</h4>
<pre>public java.lang.String getUrl()</pre>
</li>
</ul>
<a name="getConnect--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getConnect</h4>
<pre>public java.net.HttpURLConnection getConnect()</pre>
</li>
</ul>
<a name="setCookie-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setCookie</h4>
<pre>public void setCookie(java.lang.String cookie)</pre>
</li>
</ul>
<a name="open-java.util.HashMap-java.util.HashMap-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>open</h4>
<pre>public java.net.HttpURLConnection open(java.util.HashMap<java.lang.String,java.lang.String> parms,
java.util.HashMap<java.lang.String,java.lang.String> data,
int second)
throws java.lang.Exception</pre>
<div class="block">get方法获取链接</div>
<dl>
<dt><span class="paramLabel">参数:</span></dt>
<dd><code>parms</code> - 头部参数</dd>
<dd><code>data</code> - 数据</dd>
<dd><code>second</code> - 连接超时秒</dd>
<dt><span class="returnLabel">返回:</span></dt>
<dt><span class="throwsLabel">抛出:</span></dt>
<dd><code>java.lang.Exception</code></dd>
</dl>
</li>
</ul>
<a name="post-java.util.HashMap-java.util.HashMap-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>post</h4>
<pre>public java.net.HttpURLConnection post(java.util.HashMap<java.lang.String,java.lang.String> parms,
java.util.HashMap<java.lang.String,java.lang.String> data,
int second)
throws java.lang.Exception</pre>
<div class="block">post方法打开链接</div>
<dl>
<dt><span class="paramLabel">参数:</span></dt>
<dd><code>parms</code> - 头部参数</dd>
<dd><code>data</code> - 数据</dd>
<dd><code>second</code> - 连接超时秒</dd>
<dt><span class="returnLabel">返回:</span></dt>
<dt><span class="throwsLabel">抛出:</span></dt>
<dd><code>java.lang.Exception</code></dd>
</dl>
</li>
</ul>
<a name="getInputStream--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getInputStream</h4>
<pre>public java.io.InputStream getInputStream()
throws java.lang.Exception</pre>
<div class="block">获取输入流</div>
<dl>
<dt><span class="returnLabel">返回:</span></dt>
<dt><span class="throwsLabel">抛出:</span></dt>
<dd><code>java.lang.Exception</code></dd>
</dl>
</li>
</ul>
<a name="getBody--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBody</h4>
<pre>public java.lang.String getBody()
throws java.io.IOException</pre>
<div class="block">获取响应的utf-8正文</div>
<dl>
<dt><span class="returnLabel">返回:</span></dt>
<dt><span class="throwsLabel">抛出:</span></dt>
<dd><code>java.io.IOException</code></dd>
</dl>
</li>
</ul>
<a name="getBody-java.lang.String-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getBody</h4>
<pre>public java.lang.String getBody(java.lang.String charset)
throws java.io.IOException</pre>
<dl>
<dt><span class="paramLabel">参数:</span></dt>
<dd><code>charset</code> - 字符编码</dd>
<dt><span class="returnLabel">返回:</span></dt>
<dt><span class="throwsLabel">抛出:</span></dt>
<dd><code>java.io.IOException</code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="跳过导航链接">跳过导航链接</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="导航">
<li><a href="../../../overview-summary.html">概览</a></li>
<li><a href="package-summary.html">程序包</a></li>
<li class="navBarCell1Rev">类</li>
<li><a href="class-use/HttpRequest.html">使用</a></li>
<li><a href="package-tree.html">树</a></li>
<li><a href="../../../deprecated-list.html">已过时</a></li>
<li><a href="../../../index-files/index-1.html">索引</a></li>
<li><a href="../../../help-doc.html">帮助</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../fatspider/util/net/Download.html" title="fatspider.util.net中的类"><span class="typeNameLink">上一个类</span></a></li>
<li>下一个类</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?fatspider/util/net/HttpRequest.html" target="_top">框架</a></li>
<li><a href="HttpRequest.html" target="_top">无框架</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">所有类</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>概要: </li>
<li>嵌套 | </li>
<li>字段 | </li>
<li><a href="#constructor.summary">构造器</a> | </li>
<li><a href="#method.summary">方法</a></li>
</ul>
<ul class="subNavList">
<li>详细资料: </li>
<li>字段 | </li>
<li><a href="#constructor.detail">构造器</a> | </li>
<li><a href="#method.detail">方法</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
|
{
"content_hash": "45eb4139a62ed7acf0c84bf020713b13",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 391,
"avg_line_length": 33.408018867924525,
"alnum_prop": 0.6266854924108719,
"repo_name": "MashiMaroLjc/FunnySpider",
"id": "21e46e7800a7b8b69bc0ff9ed9bb080956f3e802",
"size": "14871",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/fatspider/util/net/HttpRequest.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "51084"
}
]
}
|
function isVinValid(vin) {
vin = vin.toUpperCase();
if(vin.length != 17) return false;
if(!vin.indexOf("1FABP28T") < 0) return false;
return true;
}
function handleYear(vin, yearInputID, slapperContainerID) {
vin = vin.toUpperCase();
if(isVinValid(vin)) {
var yearCode = vin[9];
var year = "";
switch(yearCode) {
case "E":
year = "1984";
break;
case "F":
year = "1985";
break;
case "G":
year = "1986";
break;
default:
break;
}
document.getElementById(yearInputID).value = year;
setSlapperVisibility(year);
}
}
function setSlapperVisibility(year) {
//alert(year);
switch(year) {
case "1984":
document.getElementById("spanSlappers").style.display = "";
break;
case "1985":
document.getElementById("spanSlappers").style.display = "none";
document.getElementById("spanSlappers").value = "3";
break;
case "1985.5":
document.getElementById("spanSlappers").style.display = "none";
document.getElementById("spanSlappers").value = "3";
break;
case "1986":
document.getElementById("spanSlappers").style.display = "none";
document.getElementById("spanSlappers").value = "3";
break;
default:
break;
}
}
|
{
"content_hash": "d4fbf9f94922e84ec1b8ed984b4363c5",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 67,
"avg_line_length": 23.09433962264151,
"alnum_prop": 0.6421568627450981,
"repo_name": "srenner/svoregistry",
"id": "884ee6abe4eeaf3b073a949a1ebdf85630a30948",
"size": "1224",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "svoregistry/static/js/add.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4246"
},
{
"name": "JavaScript",
"bytes": "246423"
},
{
"name": "Python",
"bytes": "31458"
}
]
}
|
End of preview.
No dataset card yet
- Downloads last month
- 7