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: ArrowInvalid
Message: JSON parse error: Missing a closing quotation mark in string. in row 714
Traceback: Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables
dataset = json.load(f)
File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 5198)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
for _, table in generator:
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables
raise e
File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables
pa_table = paj.read_json(
File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: JSON parse error: Missing a closing quotation mark in string. in row 714
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 |
|---|---|
<?php
namespace Sonata\AdminBundle\Datagrid;
use Doctrine\Common\Collections\ArrayCollection;
/**
* Class SimplePager.
*
* @author Lukas Kahwe Smith <smith@pooteeweet.org>
* @author Sjoerd Peters <sjoerd.peters@gmail.com>
*/
class SimplePager extends Pager
{
/**
* @var bool
*/
protected $haveToPaginate;
/**
* How many pages to look forward to create links to next pages.
*
* @var int
*/
protected $threshold;
/**
* @var int
*/
protected $thresholdCount;
/**
* The threshold parameter can be used to determine how far ahead the pager
* should fetch results.
*
* If set to 1 which is the minimal value the pager will generate a link to the next page
* If set to 2 the pager will generate links to the next two pages
* If set to 3 the pager will generate links to the next three pages
* etc.
*
* @param int $maxPerPage Number of records to display per page
* @param int $threshold
*/
public function __construct($maxPerPage = 10, $threshold = 1)
{
parent::__construct($maxPerPage);
$this->setThreshold($threshold);
}
/**
* Returns the exact count when there is only one page or when the current
* equals the last page.
*
* In all other cases an estimate of the total count is returned.
*
* @return int
*/
public function getNbResults()
{
$n = ceil(($this->getLastPage() - 1) * $this->getMaxPerPage());
if ($this->getLastPage() == $this->getPage()) {
return $n + $this->thresholdCount;
}
return $n;
}
/**
* Get all the results for the pager instance.
*
* @param mixed $hydrationMode A hydration mode identifier
*
* @return array
*/
public function getResults($hydrationMode = null)
{
if ($this->results) {
return $this->results;
}
$this->results = $this->getQuery()->execute(array(), $hydrationMode);
$this->thresholdCount = count($this->results);
if (count($this->results) > $this->getMaxPerPage()) {
$this->haveToPaginate = true;
if ($this->results instanceof ArrayCollection) {
$this->results = new ArrayCollection($this->results->slice(0, $this->getMaxPerPage()));
} else {
$this->results = new ArrayCollection(array_slice($this->results, 0, $this->getMaxPerPage()));
}
} else {
$this->haveToPaginate = false;
}
return $this->results;
}
/**
* {@inheritDoc}
*/
public function haveToPaginate()
{
return $this->haveToPaginate || $this->getPage() > 1;
}
/**
* {@inheritDoc}
*/
protected function resetIterator()
{
parent::resetIterator();
$this->haveToPaginate = false;
}
/**
* {@inheritDoc}
*
* @throws \RuntimeException the QueryBuilder is uninitialized.
*/
public function init()
{
if (!$this->getQuery()) {
throw new \RuntimeException('Uninitialized QueryBuilder');
}
$this->resetIterator();
if (0 == $this->getPage() || 0 == $this->getMaxPerPage()) {
$this->setLastPage(0);
$this->getQuery()->setFirstResult(0);
$this->getQuery()->setMaxResults(0);
} else {
$offset = ($this->getPage() - 1) * $this->getMaxPerPage();
$this->getQuery()->setFirstResult($offset);
$maxOffset = $this->getThreshold() > 0
? $this->getMaxPerPage() * $this->threshold + 1 : $this->getMaxPerPage() + 1;
$this->getQuery()->setMaxResults($maxOffset);
$this->initializeIterator();
$t = (int) ceil($this->thresholdCount / $this->getMaxPerPage()) + $this->getPage() - 1;
$this->setLastPage($t);
}
}
/**
* Set how many pages to look forward to create links to next pages.
*
* @param int $threshold
*/
public function setThreshold($threshold)
{
$this->threshold = (int) $threshold;
}
/**
* @return int
*/
public function getThreshold()
{
return $this->threshold;
}
}
|
{
"content_hash": "fc637792561178b246377e318dedc428",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 109,
"avg_line_length": 26.151515151515152,
"alnum_prop": 0.5552723059096176,
"repo_name": "andythorne/SonataAdminBundle",
"id": "d0f317ea9d8bbe518d0cb3d6ed223e3e1f3072c3",
"size": "4562",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "Datagrid/SimplePager.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "18365"
},
{
"name": "HTML",
"bytes": "180986"
},
{
"name": "JavaScript",
"bytes": "23174"
},
{
"name": "Makefile",
"bytes": "5751"
},
{
"name": "PHP",
"bytes": "1293869"
},
{
"name": "Python",
"bytes": "7893"
}
]
}
|
class SignatureDocumentFieldsResult
attr_accessor :document_id, :fields
# :internal => :external
def self.attribute_map
{
:document_id => :documentId, :fields => :fields
}
end
def initialize(attributes = {})
# Morph attribute keys into undescored rubyish style
if attributes.to_s != ""
if SignatureDocumentFieldsResult.attribute_map["document_id".to_sym] != nil
name = "document_id".to_sym
value = attributes["documentId"]
send("#{name}=", value) if self.respond_to?(name)
end
if SignatureDocumentFieldsResult.attribute_map["fields".to_sym] != nil
name = "fields".to_sym
value = attributes["fields"]
if value.is_a?(Array)
array = Array.new
value.each do |arrayValue|
array.push SignatureDocumentFieldInfo.new(arrayValue)
end
send("#{name}=", array) if self.respond_to?(name)
end
end
end
end
def to_body
body = {}
SignatureDocumentFieldsResult.attribute_map.each_pair do |key,value|
body[value] = self.send(key) unless self.send(key).nil?
end
body
end
end
|
{
"content_hash": "d140f39f5164cbc25cc11914551c9db1",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 81,
"avg_line_length": 26.790697674418606,
"alnum_prop": 0.6215277777777778,
"repo_name": "liosha2007/groupdocs-ruby",
"id": "a0e4bd8e1d0012d7e67578416e48d24ea1cc23b6",
"size": "1152",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "groupdocs/models/signaturedocumentfieldsresult.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ruby",
"bytes": "1008444"
}
]
}
|
<?php
// Protect from unauthorized access
defined('F0F_INCLUDED') or die;
/**
* PostgreSQL database iterator.
*/
class F0FDatabaseIteratorPostgresql extends F0FDatabaseIterator
{
/**
* Get the number of rows in the result set for the executed SQL given by the cursor.
*
* @return integer The number of rows in the result set.
*
* @see Countable::count()
*/
public function count()
{
return @pg_num_rows($this->cursor);
}
/**
* Method to fetch a row from the result set cursor as an object.
*
* @return mixed Either the next row from the result set or false if there are no more rows.
*/
protected function fetchObject()
{
return @pg_fetch_object($this->cursor, null, $this->class);
}
/**
* Method to free up the memory used for the result set.
*
* @return void
*/
protected function freeResult()
{
@pg_free_result($this->cursor);
}
}
|
{
"content_hash": "b59187dbc5e13adc2fe5a8432b229cc8",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 96,
"avg_line_length": 20.86046511627907,
"alnum_prop": 0.6677814938684504,
"repo_name": "notarget84/Grupo-Estudos-do-Pulmao",
"id": "1d01275fe9c3080264e477e7dcabd7f3b8010a24",
"size": "1306",
"binary": false,
"copies": "32",
"ref": "refs/heads/master",
"path": "libraries/f0f/database/iterator/postgresql.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1589000"
},
{
"name": "JavaScript",
"bytes": "243108"
},
{
"name": "PHP",
"bytes": "6222901"
}
]
}
|
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width">
<!--<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">-->
<meta name="keywords" content="react,reactjs,react component,component,select,control,ui,javascript,drag,selection,items">
<meta name="description" content="Simple React Drag-to-Select component with mouse and touch support, and 0 dependencies">
<meta property="og:locale" content="en-us">
<meta property="og:title" content="React-DS">
<meta property="og:description" content="Simple React Drag-to-Select component with mouse and touch support, and 0 dependencies">
<meta property="og:url" content="https://aurbano.eu/react-ds">
<meta property="og:site_name" content="React-DS">
<meta property="og:type" content="article">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React DS Example</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<header class="page-header">
<div class="container">
<h1>React DS</h1>
<p>Tiny (7KB) <a href="http://facebook.github.io/react/" target="_blank">ReactJS</a> Drag-to-Select component (with no dependencies! with support for touch devices!</p>
</div>
</header>
<div class="page-subheader">
<div class="container">
<a href="http://github.com/aurbano/react-ds" class="page-subheader__link" target="_blank">Code and Docs on GitHub</a>
<span class="page-subheader__button">
<a id="github-stars-button" class="github-button" data-style="" href="https://github.com/aurbano/react-ds" data-count-href="/aurbano/react-ds/stargazers" data-count-api="/repos/aurbano/react-ds#stargazers_count" data-count-aria-label="# stargazers on GitHub" aria-label="Star aurbano/react-ds on GitHub">Star</a>
</span>
</div>
</div>
<div class="page-body">
<div class="container">
<form>
<!-- the React application is loaded in the #root element -->
<div id="root"></div>
</form>
</div>
</div>
<footer class="page-footer">
<div class="container">
<span>Copyright © <a href="https://aurbano.eu" target="_blank">Alejandro U. Alvarez</a> 2016. MIT Licensed.</span>
</div>
</footer>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script async defer id="github-bjs" src="https://buttons.github.io/buttons.js"></script>
</body>
</html>
|
{
"content_hash": "1b8a41edcfc4539875fe4b929d48966c",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 316,
"avg_line_length": 49.333333333333336,
"alnum_prop": 0.6610810810810811,
"repo_name": "aurbano/react-ds",
"id": "bc5d96a5cd6558725f4ae117e8f2e09975b2ecbd",
"size": "3700",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "example/app/public/index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "6821"
},
{
"name": "HTML",
"bytes": "3700"
},
{
"name": "JavaScript",
"bytes": "23001"
}
]
}
|
ACCEPTED
#### According to
Interim Register of Marine and Nonmarine Genera
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "a4fff4b69838cdb2f2a1075e79ce0dbc",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 47,
"avg_line_length": 10.923076923076923,
"alnum_prop": 0.7183098591549296,
"repo_name": "mdoering/backbone",
"id": "8816c239ea9f8ec7513351ebcb3d945ce093592e",
"size": "209",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Basidiomycota/Agaricomycetes/Corticiales/Corticiaceae/Corticium/Corticium salmonicolor/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
$(".fold-table tr.view").on("click", function() {
if ($(this).hasClass("open")) {
$(this).removeClass("open").next(".fold").removeClass("open");
} else {
$(".fold-table tr.view").removeClass("open").next(".fold").removeClass("open");
$(this).addClass("open").next(".fold").addClass("open");
}
});
|
{
"content_hash": "e80dbb907e769561134fd90f96f7fb07",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 89,
"avg_line_length": 43.625,
"alnum_prop": 0.5243553008595988,
"repo_name": "carolineartz/Polity",
"id": "b4545fb0e5b7fc2fbf189d9291308488980ac4bb",
"size": "571",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/assets/javascripts/legislators.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "125499"
},
{
"name": "CoffeeScript",
"bytes": "2402"
},
{
"name": "JavaScript",
"bytes": "4033"
},
{
"name": "Ruby",
"bytes": "102901"
}
]
}
|
require 'google/apis/core/base_service'
require 'google/apis/core/json_representation'
require 'google/apis/core/hashable'
require 'google/apis/errors'
module Google
module Apis
module ArtifactregistryV1
# Artifact Registry API
#
# Store and manage build artifacts in a scalable and integrated service built on
# Google infrastructure.
#
# @example
# require 'google/apis/artifactregistry_v1'
#
# Artifactregistry = Google::Apis::ArtifactregistryV1 # Alias the module
# service = Artifactregistry::ArtifactRegistryService.new
#
# @see https://cloud.google.com/artifacts/docs/
class ArtifactRegistryService < Google::Apis::Core::BaseService
# @return [String]
# API key. Your API key identifies your project and provides you with API access,
# quota, and reports. Required unless you provide an OAuth 2.0 token.
attr_accessor :key
# @return [String]
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
attr_accessor :quota_user
def initialize
super('https://artifactregistry.googleapis.com/', '')
@batch_path = 'batch'
end
# Starts asynchronous cancellation on a long-running operation. The server makes
# a best effort to cancel the operation, but success is not guaranteed. If the
# server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
# Clients can use Operations.GetOperation or other methods to check whether the
# cancellation succeeded or whether the operation completed despite cancellation.
# On successful cancellation, the operation is not deleted; instead, it becomes
# an operation with an Operation.error value with a google.rpc.Status.code of 1,
# corresponding to `Code.CANCELLED`.
# @param [String] name
# The name of the operation resource to be cancelled.
# @param [Google::Apis::ArtifactregistryV1::CancelOperationRequest] cancel_operation_request_object
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ArtifactregistryV1::Empty] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ArtifactregistryV1::Empty]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def cancel_operation(name, cancel_operation_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:post, 'v1/{+name}:cancel', options)
command.request_representation = Google::Apis::ArtifactregistryV1::CancelOperationRequest::Representation
command.request_object = cancel_operation_request_object
command.response_representation = Google::Apis::ArtifactregistryV1::Empty::Representation
command.response_class = Google::Apis::ArtifactregistryV1::Empty
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Deletes a long-running operation. This method indicates that the client is no
# longer interested in the operation result. It does not cancel the operation.
# If the server doesn't support this method, it returns `google.rpc.Code.
# UNIMPLEMENTED`.
# @param [String] name
# The name of the operation resource to be deleted.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ArtifactregistryV1::Empty] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ArtifactregistryV1::Empty]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def delete_operation(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:delete, 'v1/{+name}', options)
command.response_representation = Google::Apis::ArtifactregistryV1::Empty::Representation
command.response_class = Google::Apis::ArtifactregistryV1::Empty
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Gets the latest state of a long-running operation. Clients can use this method
# to poll the operation result at intervals as recommended by the API service.
# @param [String] name
# The name of the operation resource.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ArtifactregistryV1::Operation] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ArtifactregistryV1::Operation]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def get_operation(name, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v1/{+name}', options)
command.response_representation = Google::Apis::ArtifactregistryV1::Operation::Representation
command.response_class = Google::Apis::ArtifactregistryV1::Operation
command.params['name'] = name unless name.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
# Lists operations that match the specified filter in the request. If the server
# doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name`
# binding allows API services to override the binding to use different resource
# name schemes, such as `users/*/operations`. To override the binding, API
# services can add a binding such as `"/v1/`name=users/*`/operations"` to their
# service configuration. For backwards compatibility, the default name includes
# the operations collection id, however overriding users must ensure the name
# binding is the parent resource, without the operations collection id.
# @param [String] filter
# The standard list filter.
# @param [String] name
# The name of the operation's parent resource.
# @param [Fixnum] page_size
# The standard list page size.
# @param [String] page_token
# The standard list page token.
# @param [String] fields
# Selector specifying which fields to include in a partial response.
# @param [String] quota_user
# Available to use for quota purposes for server-side applications. Can be any
# arbitrary string assigned to a user, but should not exceed 40 characters.
# @param [Google::Apis::RequestOptions] options
# Request-specific options
#
# @yield [result, err] Result & error if block supplied
# @yieldparam result [Google::Apis::ArtifactregistryV1::ListOperationsResponse] parsed result object
# @yieldparam err [StandardError] error object if request failed
#
# @return [Google::Apis::ArtifactregistryV1::ListOperationsResponse]
#
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
# @raise [Google::Apis::AuthorizationError] Authorization is required
def list_operations(filter: nil, name: nil, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
command = make_simple_command(:get, 'v1/operations', options)
command.response_representation = Google::Apis::ArtifactregistryV1::ListOperationsResponse::Representation
command.response_class = Google::Apis::ArtifactregistryV1::ListOperationsResponse
command.query['filter'] = filter unless filter.nil?
command.query['name'] = name unless name.nil?
command.query['pageSize'] = page_size unless page_size.nil?
command.query['pageToken'] = page_token unless page_token.nil?
command.query['fields'] = fields unless fields.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
execute_or_queue_command(command, &block)
end
protected
def apply_command_defaults(command)
command.query['key'] = key unless key.nil?
command.query['quotaUser'] = quota_user unless quota_user.nil?
end
end
end
end
end
|
{
"content_hash": "386a4332f0f3a9d9bd12a12064f6d74f",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 136,
"avg_line_length": 56.93877551020408,
"alnum_prop": 0.6673835125448029,
"repo_name": "googleapis/google-api-ruby-client",
"id": "cba09f073e408d0ffd153b9ac968c387b7d191e0",
"size": "11737",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "google-api-client/generated/google/apis/artifactregistry_v1/service.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ruby",
"bytes": "198322756"
},
{
"name": "Shell",
"bytes": "19549"
}
]
}
|
import { argv } from '../../config';
export default {
publicPath: '/',
headers: { 'Access-Control-Allow-Origin': '*' },
watchOptions: {
// polling always just works, everywhere, anytime,
// but eats your CPU! be carefull ^__^
poll: false,
aggregateTimeout: 100
},
stats: {
children: false,
colors: true,
reasons: true,
chunks: argv.verbose,
profile: argv.profile
},
// if not in verbose mode display no info to console
// (only warnings and errors)
noInfo: !argv.verbose,
// set this to true and you'll see no error output in the console
// and it will make much harder to know whats wrong
quiet: argv.quiet
};
// for other settings see
// http://webpack.github.io/docs/webpack-dev-middleware.html
|
{
"content_hash": "7bd4af1ff4617a9f361adb159d9e861b",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 67,
"avg_line_length": 25.4,
"alnum_prop": 0.652230971128609,
"repo_name": "vyorkin-personal/erlyeditor",
"id": "c7a942b87745903934aad99432c9a78d89644b7b",
"size": "762",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "example/webpack/development/devMiddleware.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "45174"
},
{
"name": "GLSL",
"bytes": "2809"
},
{
"name": "JavaScript",
"bytes": "240577"
},
{
"name": "Makefile",
"bytes": "185"
}
]
}
|
package android.support.v4.widget;
import android.app.SearchManager;
import android.content.ComponentName;
import android.content.Context;
import android.view.View;
import android.widget.SearchView;
class SearchViewCompatHoneycomb
{
static interface OnCloseListenerCompatBridge
{
public abstract boolean onClose();
}
static interface OnQueryTextListenerCompatBridge
{
public abstract boolean onQueryTextChange(String s);
public abstract boolean onQueryTextSubmit(String s);
}
SearchViewCompatHoneycomb()
{
}
public static CharSequence getQuery(View view)
{
return ((SearchView)view).getQuery();
}
public static boolean isIconified(View view)
{
return ((SearchView)view).isIconified();
}
public static boolean isQueryRefinementEnabled(View view)
{
return ((SearchView)view).isQueryRefinementEnabled();
}
public static boolean isSubmitButtonEnabled(View view)
{
return ((SearchView)view).isSubmitButtonEnabled();
}
public static Object newOnCloseListener(OnCloseListenerCompatBridge oncloselistenercompatbridge)
{
return new android.widget.SearchView.OnCloseListener(oncloselistenercompatbridge) {
final OnCloseListenerCompatBridge val$listener;
public boolean onClose()
{
return listener.onClose();
}
{
listener = oncloselistenercompatbridge;
super();
}
};
}
public static Object newOnQueryTextListener(OnQueryTextListenerCompatBridge onquerytextlistenercompatbridge)
{
return new android.widget.SearchView.OnQueryTextListener(onquerytextlistenercompatbridge) {
final OnQueryTextListenerCompatBridge val$listener;
public boolean onQueryTextChange(String s)
{
return listener.onQueryTextChange(s);
}
public boolean onQueryTextSubmit(String s)
{
return listener.onQueryTextSubmit(s);
}
{
listener = onquerytextlistenercompatbridge;
super();
}
};
}
public static View newSearchView(Context context)
{
return new SearchView(context);
}
public static void setIconified(View view, boolean flag)
{
((SearchView)view).setIconified(flag);
}
public static void setMaxWidth(View view, int i)
{
((SearchView)view).setMaxWidth(i);
}
public static void setOnCloseListener(Object obj, Object obj1)
{
((SearchView)obj).setOnCloseListener((android.widget.SearchView.OnCloseListener)obj1);
}
public static void setOnQueryTextListener(Object obj, Object obj1)
{
((SearchView)obj).setOnQueryTextListener((android.widget.SearchView.OnQueryTextListener)obj1);
}
public static void setQuery(View view, CharSequence charsequence, boolean flag)
{
((SearchView)view).setQuery(charsequence, flag);
}
public static void setQueryHint(View view, CharSequence charsequence)
{
((SearchView)view).setQueryHint(charsequence);
}
public static void setQueryRefinementEnabled(View view, boolean flag)
{
((SearchView)view).setQueryRefinementEnabled(flag);
}
public static void setSearchableInfo(View view, ComponentName componentname)
{
view = (SearchView)view;
view.setSearchableInfo(((SearchManager)view.getContext().getSystemService("search")).getSearchableInfo(componentname));
}
public static void setSubmitButtonEnabled(View view, boolean flag)
{
((SearchView)view).setSubmitButtonEnabled(flag);
}
}
|
{
"content_hash": "ead39d577f377bc5d11d8e2e7302b20c",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 127,
"avg_line_length": 26.713286713286713,
"alnum_prop": 0.6581151832460733,
"repo_name": "Hamz-a/MyCTFWriteUps",
"id": "594a463d16c350c7facebcff04c135ef74b504fc",
"size": "3995",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "seccon_2015/Reverse-Engineering Android APK 1/files/source/src/android/support/v4/widget/SearchViewCompatHoneycomb.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "5341"
},
{
"name": "Java",
"bytes": "4932411"
},
{
"name": "PHP",
"bytes": "2945"
},
{
"name": "Python",
"bytes": "3392"
}
]
}
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("02.ChangeList")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("02.ChangeList")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b6c1466b-1d30-401c-9bdb-d307791a2803")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
{
"content_hash": "31676aac7dd18691146aa5bbd2f419d2",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 38.72222222222222,
"alnum_prop": 0.7467718794835008,
"repo_name": "whywherewhat/ProgrammingFundamentalsMay2017",
"id": "b1eada8a20444d1fcba270d242c9e3357c0bb2ca",
"size": "1397",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "07.Lists-Exercises/02.ChangeList/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "722762"
}
]
}
|
using FarseerPhysics.Collision.Shapes;
using Microsoft.Xna.Framework;
namespace Nez.Farseer
{
public class FSCollisionEdge : FSCollisionShape
{
Vector2 _vertex1 = new Vector2(-0.01f, 0);
Vector2 _vertex2 = new Vector2(0.01f, 0);
public FSCollisionEdge()
{
_fixtureDef.Shape = new EdgeShape();
}
#region Configuration
public FSCollisionEdge SetVertices(Vector2 vertex1, Vector2 vertex2)
{
_vertex1 = vertex1;
_vertex2 = vertex2;
RecreateFixture();
return this;
}
#endregion
void RecreateFixture()
{
DestroyFixture();
var edgeShape = _fixtureDef.Shape as EdgeShape;
edgeShape.Vertex1 = _vertex1 * Transform.Scale * FSConvert.DisplayToSim;
edgeShape.Vertex2 = _vertex2 * Transform.Scale * FSConvert.DisplayToSim;
CreateFixture();
}
}
}
|
{
"content_hash": "ac6ec740ece5aae2be647e34b6a1f1cd",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 75,
"avg_line_length": 18.697674418604652,
"alnum_prop": 0.7064676616915423,
"repo_name": "prime31/Nez",
"id": "10566452b91ddc23bfa107c2f162f5ec60fd64c9",
"size": "806",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "Nez.FarseerPhysics/Nez/HighLevel/Components/Shapes/FSCollisionEdge.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "3511214"
},
{
"name": "CSS",
"bytes": "1333"
},
{
"name": "HLSL",
"bytes": "44623"
},
{
"name": "JavaScript",
"bytes": "6935"
},
{
"name": "Shell",
"bytes": "554"
}
]
}
|
package org.apache.hadoop.hbase.procedure2.store.region;
import static org.hamcrest.CoreMatchers.startsWith;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
import org.apache.commons.lang3.mutable.MutableLong;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseCommonTestingUtility;
import org.apache.hadoop.hbase.HBaseIOException;
import org.apache.hadoop.hbase.Server;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.RegionInfoBuilder;
import org.apache.hadoop.hbase.master.assignment.AssignProcedure;
import org.apache.hadoop.hbase.master.region.MasterRegion;
import org.apache.hadoop.hbase.master.region.MasterRegionFactory;
import org.apache.hadoop.hbase.procedure2.ProcedureTestingUtility.LoadCounter;
import org.apache.hadoop.hbase.procedure2.store.LeaseRecovery;
import org.apache.hadoop.hbase.procedure2.store.ProcedureStore.ProcedureIterator;
import org.apache.hadoop.hbase.procedure2.store.ProcedureStore.ProcedureLoader;
import org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore;
import org.apache.hadoop.hbase.regionserver.MemStoreLAB;
import org.apache.hadoop.hbase.testclassification.MasterTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.util.CommonFSUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@SuppressWarnings("deprecation")
@Category({ MasterTests.class, SmallTests.class })
public class TestRegionProcedureStoreMigration {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestRegionProcedureStoreMigration.class);
private HBaseCommonTestingUtility htu;
private Server server;
private MasterRegion region;
private RegionProcedureStore store;
private WALProcedureStore walStore;
@Before
public void setUp() throws IOException {
htu = new HBaseCommonTestingUtility();
Configuration conf = htu.getConfiguration();
conf.setBoolean(MemStoreLAB.USEMSLAB_KEY, false);
// Runs on local filesystem. Test does not need sync. Turn off checks.
conf.setBoolean(CommonFSUtils.UNSAFE_STREAM_CAPABILITY_ENFORCE, false);
Path testDir = htu.getDataTestDir();
CommonFSUtils.setRootDir(conf, testDir);
walStore = new WALProcedureStore(conf, new LeaseRecovery() {
@Override
public void recoverFileLease(FileSystem fs, Path path) throws IOException {
}
});
walStore.start(1);
walStore.recoverLease();
walStore.load(new LoadCounter());
server = RegionProcedureStoreTestHelper.mockServer(conf);
region = MasterRegionFactory.create(server);
}
@After
public void tearDown() throws IOException {
if (store != null) {
store.stop(true);
}
region.close(true);
walStore.stop(true);
htu.cleanupTestDir();
}
@Test
public void test() throws IOException {
List<RegionProcedureStoreTestProcedure> procs = new ArrayList<>();
for (int i = 0; i < 10; i++) {
RegionProcedureStoreTestProcedure proc = new RegionProcedureStoreTestProcedure();
walStore.insert(proc, null);
procs.add(proc);
}
for (int i = 5; i < 10; i++) {
walStore.delete(procs.get(i).getProcId());
}
walStore.stop(true);
SortedSet<RegionProcedureStoreTestProcedure> loadedProcs =
new TreeSet<>((p1, p2) -> Long.compare(p1.getProcId(), p2.getProcId()));
MutableLong maxProcIdSet = new MutableLong(0);
store = RegionProcedureStoreTestHelper.createStore(server, region, new ProcedureLoader() {
@Override
public void setMaxProcId(long maxProcId) {
maxProcIdSet.setValue(maxProcId);
}
@Override
public void load(ProcedureIterator procIter) throws IOException {
while (procIter.hasNext()) {
RegionProcedureStoreTestProcedure proc =
(RegionProcedureStoreTestProcedure) procIter.next();
loadedProcs.add(proc);
}
}
@Override
public void handleCorrupted(ProcedureIterator procIter) throws IOException {
if (procIter.hasNext()) {
fail("Found corrupted procedures");
}
}
});
assertEquals(10, maxProcIdSet.longValue());
assertEquals(5, loadedProcs.size());
int procId = 1;
for (RegionProcedureStoreTestProcedure proc : loadedProcs) {
assertEquals(procId, proc.getProcId());
procId++;
}
Path testDir = htu.getDataTestDir();
FileSystem fs = testDir.getFileSystem(htu.getConfiguration());
Path oldProcWALDir = new Path(testDir, WALProcedureStore.MASTER_PROCEDURE_LOGDIR);
// make sure the old proc wal directory has been deleted.
assertFalse(fs.exists(oldProcWALDir));
}
@Test
public void testMigrateWithUnsupportedProcedures() throws IOException {
AssignProcedure assignProc = new AssignProcedure();
assignProc.setProcId(1L);
assignProc.setRegionInfo(RegionInfoBuilder.newBuilder(TableName.valueOf("table")).build());
walStore.insert(assignProc, null);
walStore.stop(true);
try {
store = RegionProcedureStoreTestHelper.createStore(server, region, new LoadCounter());
fail("Should fail since AssignProcedure is not supported");
} catch (HBaseIOException e) {
assertThat(e.getMessage(), startsWith("Unsupported"));
}
}
}
|
{
"content_hash": "d95c14cfb7d203d9f98a17ab18053e7d",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 95,
"avg_line_length": 36.175,
"alnum_prop": 0.7455079474775398,
"repo_name": "HubSpot/hbase",
"id": "3e30caa04770a98359cab1b6e57defffbd3c6023",
"size": "6593",
"binary": false,
"copies": "1",
"ref": "refs/heads/hubspot-2.5",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/procedure2/store/region/TestRegionProcedureStoreMigration.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "26366"
},
{
"name": "C",
"bytes": "4041"
},
{
"name": "C++",
"bytes": "19726"
},
{
"name": "CMake",
"bytes": "1437"
},
{
"name": "CSS",
"bytes": "8033"
},
{
"name": "Dockerfile",
"bytes": "13729"
},
{
"name": "HTML",
"bytes": "18151"
},
{
"name": "Java",
"bytes": "40683660"
},
{
"name": "JavaScript",
"bytes": "9455"
},
{
"name": "Makefile",
"bytes": "1359"
},
{
"name": "PHP",
"bytes": "8385"
},
{
"name": "Perl",
"bytes": "383739"
},
{
"name": "Python",
"bytes": "102210"
},
{
"name": "Roff",
"bytes": "2896"
},
{
"name": "Ruby",
"bytes": "766684"
},
{
"name": "Shell",
"bytes": "312013"
},
{
"name": "Thrift",
"bytes": "55594"
},
{
"name": "XSLT",
"bytes": "3924"
}
]
}
|
var buttonsInstance = (
<SplitButton title="Dropdown right" pullRight>
<MenuItem eventKey="1">Action</MenuItem>
<MenuItem eventKey="2">Another action</MenuItem>
<MenuItem eventKey="3">Something else here</MenuItem>
<MenuItem divider />
<MenuItem eventKey="4">Separated link</MenuItem>
</SplitButton>
);
React.render(buttonsInstance, mountNode);
|
{
"content_hash": "47fc5913da96fbb579fa33849665e816",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 59,
"avg_line_length": 35,
"alnum_prop": 0.6909090909090909,
"repo_name": "aforty/react-bootstrap",
"id": "b3dabc3f0fd1e12916baafaa5229950c3e7ee9b6",
"size": "385",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/examples/SplitButtonRight.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "845"
},
{
"name": "JavaScript",
"bytes": "250231"
}
]
}
|
<?php
namespace TemplateHandler;
use GameOfLife\Field;
/**
* Loads templates from files.
*/
class TemplateLoader extends TemplateHandler
{
/**
* TemplateLoader constructor.
*
* @param String $_templatesBaseDirectory The base directory for default and custom templates
*/
public function __construct(String $_templatesBaseDirectory)
{
parent::__construct($_templatesBaseDirectory);
}
/**
* Loads a template from a file.
*
* @param String $_templateName The name of the template
*
* @return array The loaded template
*
* @throws \Exception The exception when the template file was not found or the file could not be read
*/
public function loadTemplate(String $_templateName)
{
$fileName = $_templateName . ".txt";
$defaultTemplatePath = $this->defaultTemplatesDirectory . "/" . $fileName;
$customTemplatePath = $this->customTemplatesDirectory . "/" . $fileName;
// Check whether the specified template exists
if (file_exists($defaultTemplatePath)) $fileName = $defaultTemplatePath;
elseif (file_exists($customTemplatePath)) $fileName = $customTemplatePath;
else throw new \Exception("The template file could not be found.");
// Read the template
$lines = $this->fileSystemReader->readFile($fileName);
$fields = array();
for ($y = 0; $y < count($lines); $y++)
{
$fields[] = array();
$row = str_split($lines[$y]);
for ($x = 0; $x < count($row); $x++)
{
if ($row[$x] == "X") $cellState = true;
else $cellState = false;
$fields[$y][] = new Field($x, $y, $cellState);
}
}
return $fields;
}
}
|
{
"content_hash": "42402193deb38e2d872b0ec93f9e0f25",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 106,
"avg_line_length": 28.4375,
"alnum_prop": 0.5824175824175825,
"repo_name": "ylapp1/GameOfLife",
"id": "4639525eddd1aa36a6b34dc57c9551707f604909",
"size": "1945",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/GameOfLife/Inputs/TemplateHandler/TemplateLoader.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "245173"
}
]
}
|
display: flex;
flex-wrap: nowrap;
justify-content: space-around;
align-items: center;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}
|
{
"content_hash": "d50c002e8a478397f1828f1086da5e9c",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 32,
"avg_line_length": 17,
"alnum_prop": 0.6352941176470588,
"repo_name": "SanderVerkuil/how-i-spent-my-time",
"id": "61d8144aaeab7cbcf9892b7bb1f2ce1fad0c88f5",
"size": "183",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/css/page.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "183"
},
{
"name": "HTML",
"bytes": "417"
},
{
"name": "JavaScript",
"bytes": "2050"
}
]
}
|
//using System;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
//using System.Linq.Dynamic;
//using System.Threading.Tasks;
using System.Transactions;
using DrynksMe.Services.Models;
//using MoreLinq;
using Dapper;
using DrynksMe.DataAccess.Infrastructure;
using DrynksMe.DataAccess.Models;
using DrynksMe.Services.Contracts;
using IsolationLevel = System.Transactions.IsolationLevel;
namespace DrynksMe.Services
{
public class MerchantService : BaseServices, IMerchantService
{
public MerchantService(IDatabaseContext databaseContext)
: base(databaseContext){}
public IEnumerable<Merchant> GetMerchantsByCoordinates(double longitude, double latitude,int radius)
{
const string sqlToGetMechants =
@"select * from Merchant
where IsActive = 1
And dbo.CoordinateDistanceMiles(Latitude, Longitude, @UserLatitude, @UserLongitude) < @Radius";
using (var connection = DatabaseContext.Connection)
{
return
connection.Query<Merchant>(sqlToGetMechants,
new
{
@UserLatitude = latitude,
@UserLongitude = longitude,
@Radius = radius
}).ToList();
}
}
public IEnumerable<Merchant> GetVenues()
{
using (var connection = DatabaseContext.Connection)
{
var merchants = connection.GetList<Merchant>();
return merchants.ToList();
}
}
public int AddVenue(Merchant merchant,int[] merchantTypeIds)
{
int returnVal;
using (var connection = DatabaseContext.Connection)
using (var transaction = connection.BeginTransaction())
{
returnVal = connection.Insert(merchant, transaction);
InsertMerchantTypeAssociation(merchantTypeIds, returnVal, connection, transaction);
transaction.Commit();
}
return returnVal;
}
private static void InsertMerchantTypeAssociation(int[] merchantTypeIds, int returnVal, IDbConnection connection,
IDbTransaction transaction=null)
{
foreach (var mAssoc in merchantTypeIds
.Select(merchantTypeId => new MerchantTypeAssociation
{
MerchantId = returnVal,
MerchantTypeId = merchantTypeId
}))
{
connection.Insert(mAssoc, transaction);
}
}
public int UpdateVenue(Merchant merchant,int[] merchantTypeIds)
{
int returnVal;
using (var connection = SqlConnection)
using (
var scope = new TransactionScope(TransactionScopeOption.Required,
new TransactionOptions {IsolationLevel = IsolationLevel.Serializable}))
{
connection.EnlistTransaction(Transaction.Current);
returnVal = connection.Update(merchant);
DeleteMerchantAssociations(merchant.Id, connection);
InsertMerchantTypeAssociation(merchantTypeIds, merchant.Id, connection);
scope.Complete();
}
return returnVal;
}
private static void DeleteMerchantAssociations(int merchantId, SqlConnection connection)
{
const string sql = @"Delete from [dbo].[MerchantTypeAssociation] where MerchantId = @merchantId";
connection.Execute(sql, new {@merchantId = merchantId});
}
public IEnumerable<MerchantType> GetAllMerchantTypes()
{
using (var connection = DatabaseContext.Connection)
{
return connection.GetList<MerchantType>();
}
}
public MerchantGroup GetVenue(int id)
{
const string sqlToGetMerchantType =
@"
Select * from MerchantType;
Select * From Merchant where Id = @Id;
Select MT.* from MerchantType MT
inner join MerchantTypeAssociation MTA on MT.Id = MTA.MerchantTypeId
where MTA.MerchantId = @Id;";
using (var connection = DatabaseContext.Connection)
using (var multi = connection.QueryMultiple(sqlToGetMerchantType, new { @Id = id }))
{
var merchantGroup = new MerchantGroup
{
AllMerchantTypes = multi.Read<MerchantType>().ToList(),
Merchant = multi.Read<Merchant>().First(),
MerchantTypeForMerchants = multi.Read<MerchantType>().ToList()
};
return merchantGroup;
}
}
public MerchantWithComments GetVenueWithComments(int id)
{
const string sqlToGetMerchantType =
@"
Select * From Merchant where Id = @Id;
Select * from UserMerchantComment where MerchantId = @Id
and IsShared = 1 and IsApproved = 1;
";
using (var connection = DatabaseContext.Connection)
using (var multi = connection.QueryMultiple(sqlToGetMerchantType, new { @Id = id }))
{
var merchantWithComments = new MerchantWithComments
{
Merchant = multi.Read<Merchant>().First(),
Comments = multi.Read<UserMerchantComment>().ToList()
};
return merchantWithComments;
}
}
public void AddVenueComment(User user, int merchantId, string comment)
{
var userComment = new UserMerchantComment
{
Comment = comment,
UserId = user.Id,
IsShared = user.Share,
IsApproved = true,
MerchantId = merchantId,
CreateDate = DateTime.Now,
UpdateDate = DateTime.Now
};
using (var connection = SqlConnection)
using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = System.Transactions.IsolationLevel.Serializable }))
{
connection.EnlistTransaction(Transaction.Current);
connection.Insert(userComment);
scope.Complete();
}
}
public void UpdateUserMerchantCommentForShared(User user, IDbConnection connection)
{
const string sqlToUpdateMerchantCommentForShare =
@"Update UserMerchantComment
Set IsShared = @IsShared
Where UserId = @UserId";
connection.Execute(sqlToUpdateMerchantCommentForShare, new {@IsShared = user.Share, @UserId = user.Id});
}
public IEnumerable<Merchant> GetFeaturedMerchants()
{
var todaysDate = DateTime.Now;
// TODO:Think of better SQL
const string sqlToGetFeaturedBrands =
@"select * from Merchant M
inner join
(select Distinct(MTA.MerchantId) from MerchantTypeAssociation MTA
inner join MerchantType MT on MTA.MerchantTypeId = MT.Id
inner join Campaign C on MTA.MerchantId = C.MerchantId
where C.IsActive = 1 And StartDate <= startDate and EndDate >= endDate And MT.TypeDescription = 'Brand'
) as B on M.Id = B.MerchantId
where M.IsActive = 1 And M.IsPremierMerchant = 1";
using (var connection = DatabaseContext.Connection)
{
var merchants = connection.Query<Merchant>(sqlToGetFeaturedBrands,
new {@startDate = todaysDate, @endDate = todaysDate});
return merchants.ToList();
}
}
public IEnumerable<MerchantSearchResult> Search(MerchantSearchModel merchantSearchModel)
{
var merchantQuery = new MerchantQuery();
var param = new DynamicParameters();
if (!string.IsNullOrEmpty(merchantSearchModel.ProfileName))
{
param.AddDynamicParams(new { @profileName = "%" + merchantSearchModel.ProfileName + "%" });
merchantQuery = merchantQuery.ByProfileName();
}
if (!string.IsNullOrEmpty(merchantSearchModel.MerchantName))
{
param.AddDynamicParams(new { @merchantName = "%" + merchantSearchModel.MerchantName + "%" });
merchantQuery = merchantQuery.ByMerchantName();
}
if (!string.IsNullOrEmpty(merchantSearchModel.VenueType))
{
param.AddDynamicParams(new { @venueType = "%" + merchantSearchModel.VenueType + "%" });
merchantQuery = merchantQuery.ByVenueType();
}
if (!string.IsNullOrEmpty(merchantSearchModel.TwitterHandle))
{
param.AddDynamicParams(new { @twitterHandle = "%" + merchantSearchModel.TwitterHandle + "%" });
merchantQuery = merchantQuery.ByTwitterHandle();
}
// ReSharper disable RedundantAnonymousTypePropertyName
param.AddDynamicParams(new { @startRow = merchantSearchModel.StartRowNum });
// ReSharper restore RedundantAnonymousTypePropertyName
// ReSharper disable RedundantAnonymousTypePropertyName
param.AddDynamicParams(new { @endRow = merchantSearchModel.EndRowNum });
// ReSharper restore RedundantAnonymousTypePropertyName
var sql = merchantQuery.Bind();
using ( var connection=DatabaseContext.Connection)
{
var merchants = connection.Query<MerchantSearchResult>(sql,param);
return merchants.ToList();
}
}
public IEnumerable<Merchant> SearchByTags(IEnumerable<string> tags)
{
const string sqlToGetMerchantByTags =
@"select Distinct(M.Id), M.* from Merchant M
inner join MerchantTag MT on M.Id = MT.MerchantId
inner join Tag T on MT.TagId = T.Id
where T.TagName IN @Tags";
using (var connection = DatabaseContext.Connection)
{
return connection.Query<Merchant>(sqlToGetMerchantByTags, new {@Tags = tags}).ToList();
}
}
public IEnumerable<DrinksResultModel> GetDrinks(int merchantId)
{
const string sqlToGetDrinksForMerchant =
@"select D.*,MD.IsSignature from Drink D
inner join MerchantDrink MD on D.Id = MD.DrinkId
where D.IsShared = 1 and MD.MerchantId = @MerchantId";
using (var connection = DatabaseContext.Connection)
{
return
connection.Query<DrinksResultModel>(sqlToGetDrinksForMerchant, new {@MerchantId = merchantId})
.ToList();
}
}
//private bool Validator(Merchant merchant)
//{
// var list = new List<Func<Merchant, bool>>()
// {
// x => x.City == "NY",
// x => x.Email == "NotNull"
// };
// return list.All(x => x(merchant));
//}
}
}
|
{
"content_hash": "84fd3e46bf0cfb790a15bd9969e60add",
"timestamp": "",
"source": "github",
"line_count": 326,
"max_line_length": 178,
"avg_line_length": 37.420245398773005,
"alnum_prop": 0.54291335355357,
"repo_name": "YogirajA/DrynksCode",
"id": "c2657d2694e09d1e9321fd44de06a10694d5a201",
"size": "12201",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DrynksMe.Services/DrynksMe.Services/MerchantService.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "221"
},
{
"name": "C#",
"bytes": "189883"
},
{
"name": "CSS",
"bytes": "37314"
},
{
"name": "JavaScript",
"bytes": "363287"
},
{
"name": "SQL",
"bytes": "19741"
}
]
}
|
using System;
using System.Text;
using FluentAssertions;
using Msg.Core.Transport.Frames;
using Msg.Core.Transport.Frames.Amqp.Serialization;
using Xunit;
namespace Msg.Core.Specs.Transport.Frames.Amqp.Serialization
{
public class AmqpFrameSerializerSpecs
{
[Fact]
public void Given_a_non_AMQP_frame_When_deserializing_a_frame_Then_an_argument_exception_is_thrown()
{
// Act
Action action = () => AmqpFrameSerializer.Deserialize(new Frame(
new FrameHeader(new FrameSize(13), new DataOffset(2), FrameHeaderType.SASL, 1),
new FrameExtendedHeader(new byte[0]),
new FrameBody(Encoding.ASCII.GetBytes("Begin"))));
// Assert
action
.Should().Throw<ArgumentException>()
.WithMessage("The frame must be of type AMQP.\nParameter name: frame");
}
}
}
|
{
"content_hash": "a025df851c472d1c5991ee6043c8e4f6",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 108,
"avg_line_length": 33.888888888888886,
"alnum_prop": 0.6327868852459017,
"repo_name": "jagrem/msg",
"id": "02203d031c77a5a6daba53727b72fa70e929f6b8",
"size": "915",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Core/Msg.Core.Specs/Transport/Frames/Amqp/Serialization/AmqpFrameSerializerSpecs.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "129260"
}
]
}
|
<?php
$data='{
"template_id_short":"TM00015"
}';
$sendUrl="https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token=".getToken();
$sendarr=(array)json_decode(postOutput($data,$sendUrl));
// echo $shortarr['short_url'];
print_r($sendarr);
function getToken(){
/*获取Token*/
$appid="wxd4b77c94a9bc7e46";
$secret="f264362d4d2e7626ac4c19b40b860509";
$url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$secret;
$output = getOutput($url);
$token=(array)json_decode($output);
return $token['access_token'];
}
function getOutput($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
function postOutput($data, $url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
// curl_setopt($ch, CURLOPT_USERAGENT, "");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$tmpInfo = curl_exec($ch);
if (curl_errno($ch)){
return curl_errno($ch);
}
curl_close($ch);
return $tmpInfo;
}
?>
|
{
"content_hash": "dc55e079235aaf0c8f780e7e8053e43f",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 110,
"avg_line_length": 29.115384615384617,
"alnum_prop": 0.6829590488771466,
"repo_name": "xuncl/WeixinTest",
"id": "0163291cd7fd358169f9d633d27539f58adbfa84",
"size": "1518",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "addTemplate.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "814"
},
{
"name": "PHP",
"bytes": "33753"
}
]
}
|
'use strict';
var express = require('express');
var router = express.Router();
var ctrl = require('./controller');
router.get('/auth/twitter', ctrl.authTwitter);
router.get('/auth/twitter/cb', ctrl.authTwitterCb);
router.get('/logout', ctrl.logout);
router.get('/profile', isLoggedIn, ctrl.show);
module.exports = router;
function isLoggedIn(req, res, next) {
if (req.isAuthenticated()) {
return next();
}
res.redirect('/');
}
|
{
"content_hash": "1132b4e2042bb2d8ee65c62da06894c8",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 51,
"avg_line_length": 20.181818181818183,
"alnum_prop": 0.6756756756756757,
"repo_name": "ldmcdaniel/minitwit",
"id": "78b48340644bbf9b0ae39842cf562eb78db3a669",
"size": "444",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/user/routes.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "73"
},
{
"name": "HTML",
"bytes": "1165"
},
{
"name": "JavaScript",
"bytes": "20110"
}
]
}
|
package example.repo;
import example.model.Customer571;
import java.util.List;
import org.springframework.data.repository.CrudRepository;
public interface Customer571Repository extends CrudRepository<Customer571, Long> {
List<Customer571> findByLastName(String lastName);
}
|
{
"content_hash": "d38ad6be259e193bc0ec3d0db06ecd71",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 82,
"avg_line_length": 23.333333333333332,
"alnum_prop": 0.8285714285714286,
"repo_name": "spring-projects/spring-data-examples",
"id": "e11554e3795d62b411ed3d7dd3a0cd5f21278611",
"size": "280",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "jpa/deferred/src/main/java/example/repo/Customer571Repository.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "407"
},
{
"name": "HTML",
"bytes": "11754"
},
{
"name": "Java",
"bytes": "3549318"
},
{
"name": "Kotlin",
"bytes": "25902"
}
]
}
|
package com.firefly.web.action.campApply.createApply;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.firefly.dto.CustomerDto;
import com.firefly.model.CampApply;
import com.firefly.service.CampApplyService;
import com.firefly.service.framework.BasicCode;
import com.firefly.web.framework.PageCookie;
import com.firefly.web.framework.PageSession;
import com.firefly.web.framework.action.SimpleJsonAction;
import com.firefly.web.framework.model.BaseJsonModel;
import lombok.extern.log4j.Log4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
@Log4j
public class CreateCampApplyAction extends SimpleJsonAction<CreateCampApplyInputVo, BaseJsonModel> {
private static final String PAGE_URL_PARTTEN = "/user/sessionUser";
@Autowired
private CampApplyService campApplyService;
@Override
protected BaseJsonModel doBiz(CreateCampApplyInputVo inputVo, PageCookie cookie, PageSession session, CustomerDto customer) throws Exception {
BaseJsonModel result = new BaseJsonModel();
try {
Assert.isTrue(!StringUtils.isEmpty(inputVo.getName()), "姓名必须填写");
// Assert.isTrue(!StringUtils.isEmpty(inputVo.getWeixinAccount()), "微信号必须填写");
Assert.isTrue(!StringUtils.isEmpty(inputVo.getMobile()), "手机号必须填写");
Assert.isTrue(!StringUtils.isEmpty(inputVo.getChildAge()), "孩子年龄必须填写");
Assert.isTrue(!StringUtils.isEmpty(inputVo.getCanSpeakEnglish()), "孩子是否有英语基础");
} catch (IllegalArgumentException e) {
result.setResult(BasicCode.FAILED);
result.setRespMsg(e.getMessage());
}
CampApply campApply = new CampApply();
BeanUtils.copyProperties(inputVo, campApply);
if (customer != null) {
campApply.setUserId(customer.getId());
}
campApplyService.createCampApply(campApply);
result.setResult(BasicCode.SUCCESS);
return result;
}
@ResponseBody
@RequestMapping(PAGE_URL_PARTTEN)
public Object handleRequest(HttpServletRequest request, HttpServletResponse response, CreateCampApplyInputVo inputVo)
throws Exception {
return super.handleRequest(request, response, inputVo);
}
}
|
{
"content_hash": "4d1f395cd58d59e7ee9b16afb000eb9a",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 146,
"avg_line_length": 40.328125,
"alnum_prop": 0.7500968616815188,
"repo_name": "talentstrong/fireflyEnglish",
"id": "1170b9cb68707e9dc1d05fcddcd1fc8b7a8fa504",
"size": "2655",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "centralWeb/src/main/java/com/firefly/web/action/campApply/createApply/CreateCampApplyAction.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "5659"
},
{
"name": "HTML",
"bytes": "28138"
},
{
"name": "Java",
"bytes": "98739"
},
{
"name": "JavaScript",
"bytes": "1518"
}
]
}
|
layout: post
title: Lettre de Dalat
author: thu4nvd
subtitle: Ecrive e fransais
date: 2021-04-13 05:05:05 +0800
categories: [Blogging, language]
tags: [french]
---
## Lettre de Dalat
### 💥Sujet
Vous êtes en vacances sur la montagne.
Écrivez une lettre à un ami pour lui faire part de vos impressions.

### 📝Texte
Dalat, le 1er juillet 199x..
Mon chez ami,
Mon frère et moi, nous sommes très heureux de savoir, par ta lettre du 27 dernier que tu es enchanté de ton séjour de Nhatrang, au bord de la mer.
Nous ne le sommes pas moins du nôtre, à Dalat.
Nos premiers jours ne furent pas très éblouissants, hélas !
Nous avons trouver le climat d'ici un peu trop froid, quoique certaines gens l'assimilent au climat tempéré de France.
Et mon frère a attrapé, dès sa venue ici, un rhume de cerveau qui l'a alité pendant quelques jours.
Mais par bonheur, après un demi-mois d'acclimation, notre séjour est devenu très agréable et nous trouvons ce pays bien pittoresque avec ses hautes montagnes entassées les unes sur les autres, ses rochers abrupts, ses gorges profondes, ses lacs très poétiques, tel le lac du Soupir et ses cascades d'argent qui, tombant des grandes hauteurs, bondissent d'un rocher à l'autre telles les chutes de Camly et de Goughad...
Nous passons toute la journée à gravir les collines, à parcourir les forêts de sapins, à contempler les vallons et les plantations de thé et de café.
Le chalet où nous séjournons est entouré d'un jardin superbe rempli de fleurs: des orchidées, des pâquerettes, des chrysanthèmes, des pensées, des dahlias...
que sais-je encore !
Et le verger étagé sur le flanc de la colline nous donne à profusion des fruits délicieux: fraises, pommes, prunes, pêches, poires...
Tu t'es bien réjoui au bord de la mer: Voudrais-tu nous faire le grand plaisir de venir passer une semaine ici avec nous, avant la fin des vacances?
En attendant ta réponse, nous t'envoyons nos sentiments les plus cordiaux.
Tes amis sincères,
### 🖋 Chú thích
Mots | | Nghĩa |
------------- |:-------------:| -----:|
Le 27 courant || 27 tháng này
Eblouissant | éblouir |xán lạn
Assimiler |= semblable |đồng hóa, ví với
Climat tempéré || khí hậu ôn hòa
Attraper un rhume de cerveau |bị cảm, sổ mũi
Aliter || nằm liệt giường
Par bonheur !| heureusement | May thay!
Acclimation || sự thuộc phong thỏ, khí hậu
Le séjour || thời gian lưu trú
Montagnes entassées les uns sur les autres || Núi non trùng điệp
Le rocher || tảng đá, núi đá
Abrupt || dốc, dựng đứng
Une gorge || Khe, lạch
Le lac de Soupir|| hồ Than thở
Une cascade || thác nước
Bondir || nhảy
Une chute | une cascade| một thác nước
Gravir | escalader | leo( núi, đồi)
Parcourir ||đi khắp, đi ngang dọc
Le vallon || thung lũng nhỏ
La plantation || đồn điền, vườn
Le chalet || nhà gỗ trên núi
Superbe || tuyệt đẹp, tuyệt mỹ
L'orchidée || lan, cây lan
La pâquerette || bạch cúc
Le chrysanthème || cúc vàng
La pensée || tử la lan, păng xê
Le dahlia || thược dược
Le verger || vườn ăn quả
Étagé || tầng tầng, thành tầng, thành tán
A profusion || nhiều dồi dào, ê hề
Délicieux(se) || ngon lành
La fraise || quả dâu
Le fraisier || cây dâu
La prune || trái mận
Se réjouir || vui thích
|
{
"content_hash": "2f2a069b2127e044d1eb0a555975a5dc",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 420,
"avg_line_length": 39.917647058823526,
"alnum_prop": 0.7297376952549366,
"repo_name": "thu4nvd/thu4nvd.github.io",
"id": "eea16fa73dbcdd4279976e4b1ef378a41c061f8d",
"size": "3636",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2021-04-13-lettrededalat.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "21846"
},
{
"name": "HTML",
"bytes": "23110"
},
{
"name": "JavaScript",
"bytes": "6288"
},
{
"name": "Ruby",
"bytes": "5404"
}
]
}
|
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<script>
description("This tests the constructor for the TransitionEvent DOM class.");
// No initializer is passed.
shouldBe("new TransitionEvent('eventType').bubbles", "false");
shouldBe("new TransitionEvent('eventType').cancelable", "false");
shouldBeEqualToString("new TransitionEvent('eventType').propertyName", "");
shouldBe("new TransitionEvent('eventType').elapsedTime", "0");
shouldBeEqualToString("new TransitionEvent('eventType').pseudoElement", "");
// bubbles is passed.
shouldBe("new TransitionEvent('eventType', { bubbles: false }).bubbles", "false");
shouldBe("new TransitionEvent('eventType', { bubbles: true }).bubbles", "true");
// cancelable is passed.
shouldBe("new TransitionEvent('eventType', { cancelable: false }).cancelable", "false");
shouldBe("new TransitionEvent('eventType', { cancelable: true }).cancelable", "true");
// propertyName is passed.
// Strings.
shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: 'doremi' }).propertyName", "doremi");
shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: '' }).propertyName", "");
// Non-strings.
shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: undefined }).propertyName", "undefined");
shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: null }).propertyName", "null");
shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: false }).propertyName", "false");
shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: true }).propertyName", "true");
shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: 12345 }).propertyName", "12345");
shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: 18446744073709551615 }).propertyName", "18446744073709552000");
shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: NaN }).propertyName", "NaN");
shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: [] }).propertyName", "");
shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: [1, 2, 3] }).propertyName", "1,2,3");
shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: {doremi: 12345} }).propertyName", "[object Object]");
shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: {valueOf: function () { return 'doremi'; } } }).propertyName", "[object Object]");
// elapsedTime is passed.
// Numeric values.
shouldBe("new TransitionEvent('eventType', { elapsedTime: 0 }).elapsedTime", "0");
shouldBe("new TransitionEvent('eventType', { elapsedTime: 123.45 }).elapsedTime", "123.45");
shouldBe("new TransitionEvent('eventType', { elapsedTime: -123.45 }).elapsedTime", "-123.45");
shouldBe("new TransitionEvent('eventType', { elapsedTime: 18446744073709551615 }).elapsedTime", "18446744073709551615");
shouldBe("new TransitionEvent('eventType', { elapsedTime: NaN }).elapsedTime", "NaN");
shouldBe("new TransitionEvent('eventType', { elapsedTime: Infinity }).elapsedTime", "Infinity");
shouldBe("new TransitionEvent('eventType', { elapsedTime: -Infinity }).elapsedTime", "-Infinity");
// pseudoElement is passed.
// Strings.
shouldBeEqualToString("new TransitionEvent('eventType', { pseudoElement: '::before' }).pseudoElement", "::before");
shouldBeEqualToString("new TransitionEvent('eventType', { pseudoElement: '' }).pseudoElement", "");
// Non-numeric values.
shouldBe("new TransitionEvent('eventType', { elapsedTime: undefined }).elapsedTime", "NaN");
shouldBe("new TransitionEvent('eventType', { elapsedTime: null }).elapsedTime", "0");
shouldBe("new TransitionEvent('eventType', { elapsedTime: false }).elapsedTime", "0");
shouldBe("new TransitionEvent('eventType', { elapsedTime: true }).elapsedTime", "1");
shouldBe("new TransitionEvent('eventType', { elapsedTime: '' }).elapsedTime", "0");
shouldBe("new TransitionEvent('eventType', { elapsedTime: 'doremi' }).elapsedTime", "NaN");
shouldBe("new TransitionEvent('eventType', { elapsedTime: [] }).elapsedTime", "0");
shouldBe("new TransitionEvent('eventType', { elapsedTime: [123.45] }).elapsedTime", "123.45");
shouldBe("new TransitionEvent('eventType', { elapsedTime: [123.45, 678.90] }).elapsedTime", "NaN");
shouldBe("new TransitionEvent('eventType', { elapsedTime: {doremi: 123.45} }).elapsedTime", "NaN");
shouldBe("new TransitionEvent('eventType', { elapsedTime: {valueOf: function () { return 123.45 } } }).elapsedTime", "123.45");
// All initializers are passed.
shouldBe("new TransitionEvent('eventType', { bubbles: true, cancelable: true, propertyName: 'doremi', elapsedTime: 123.45, pseudoElement: '::after' }).bubbles", "true");
shouldBe("new TransitionEvent('eventType', { bubbles: true, cancelable: true, propertyName: 'doremi', elapsedTime: 123.45, pseudoElement: '::after' }).cancelable", "true");
shouldBe("new TransitionEvent('eventType', { bubbles: true, cancelable: true, propertyName: 'doremi', elapsedTime: 123.45, pseudoElement: '::after' }).propertyName", "'doremi'");
shouldBe("new TransitionEvent('eventType', { bubbles: true, cancelable: true, propertyName: 'doremi', elapsedTime: 123.45, pseudoElement: '::after' }).elapsedTime", "123.45");
shouldBe("new TransitionEvent('eventType', { bubbles: true, cancelable: true, propertyName: 'doremi', elapsedTime: 123.45, pseudoElement: '::after' }).pseudoElement", "'::after'");
</script>
</body>
</html>
|
{
"content_hash": "dd225343334f1caded777076db51bb9a",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 180,
"avg_line_length": 68.15,
"alnum_prop": 0.731474688187821,
"repo_name": "lordmos/blink",
"id": "240b270904a074ab7bd38c6034dea7388fec27b6",
"size": "5452",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "LayoutTests/fast/events/constructors/transition-event-constructor.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "6433"
},
{
"name": "C",
"bytes": "753714"
},
{
"name": "C++",
"bytes": "40028043"
},
{
"name": "CSS",
"bytes": "539440"
},
{
"name": "F#",
"bytes": "8755"
},
{
"name": "Java",
"bytes": "18650"
},
{
"name": "JavaScript",
"bytes": "25700387"
},
{
"name": "Objective-C",
"bytes": "426711"
},
{
"name": "PHP",
"bytes": "141755"
},
{
"name": "Perl",
"bytes": "901523"
},
{
"name": "Python",
"bytes": "3748305"
},
{
"name": "Ruby",
"bytes": "141818"
},
{
"name": "Shell",
"bytes": "9635"
},
{
"name": "XSLT",
"bytes": "49328"
}
]
}
|
package com.wowwee.snappetssampleproject.util;
import android.util.Log;
import com.wowwee.bluetoothrobotcontrollib.snappets.SnapPets;
import com.wowwee.snappetssampleproject.enums.DownloadStatus;
import com.wowwee.snappetssampleproject.fragments.CameraFragment;
import com.wowwee.snappetssampleproject.snappethelper.ConnectSnappetCallback;
import com.wowwee.snappetssampleproject.snappethelper.SnappetsHelper;
import java.io.File;
public class DownloadManager {
static private DownloadManager s_instance = null;
;
ConnectSnappetCallback snappetCallback = null;
private DownloadStatus downloaderStatus = DownloadStatus.PhotoDownloaderStatusIdle;
private Callback m_callback = null;
protected DownloadManager() {
this.downloaderStatus = DownloadStatus.PhotoDownloaderStatusIdle;
}
static public DownloadManager GetInstance() {
if (s_instance == null) {
s_instance = new DownloadManager();
}
return s_instance;
}
public void SetCallback(Callback acallback) {
this.m_callback = acallback;
}
public void DownloadAllPhotos() {
final CameraInstance.Callback cameraCallback = new CameraInstance.Callback() {
@Override
public void init() {
// TODO Auto-generated method stub
}
@Override
public void beforeTakePicture() {
// TODO Auto-generated method stub
}
@Override
public void afterTakePicture(final File file) {
// TODO Auto-generated method stub
Thread newThread = new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
DownloadManager.this.m_callback.notifyPhotoDownloaded(file);
SnappetsHelper.getInstance().getConnectedSnappet().deletePhotoID(1);
}
});
newThread.start();
}
};
snappetCallback = new ConnectSnappetCallback() {
private int imageTotalSize = 0;
private int imageBufferSize = 0;
@Override
public void receivedImagePieceSize(int size) {
// Log.d(CameraFragment.class.toString(), "receivedImagePieceSize: "+size);
imageBufferSize += size;
// handler.updateLoadingProgress(imageBufferSize*100/imageTotalSize);
}
@Override
public void receivedImageBuffer(byte[] buffer) {
Log.i(CameraFragment.class.toString(), "receivedImageBuffer: " + buffer.length);
CameraInstance.getInstance().takePictureFromSnappet(cameraCallback, buffer);
// takePictureFromSnappet(buffer);
}
@Override
public void receiveImageTotalSize(int size) {
// Log.d(CameraFragment.class.toString(), "receiveImageTotalSize: "+size);
imageTotalSize = size;
imageBufferSize = 0;
}
@Override
public void disconnected(SnapPets snapPet) {
}
@Override
public void connected(SnapPets snapPet) {
if (downloaderStatus == DownloadStatus.PhotoDownloaderStatusDownloading)
SnappetsHelper.getInstance().readPhotoCount(SnappetsHelper.getInstance().getConnectedSnappet(), snappetCallback);
}
@Override
public void didPressedButton() {
Log.d(CameraFragment.class.toString(), "didPressedButton");
// handler.pressTakePicture();
}
@Override
public void receivedPhotoCount(final int count) {
// TODO Auto-generated method stub
Log.i(CameraFragment.class.toString(), "receivedPhotoCount: " + count);
if (count > 0) {
if (downloaderStatus == DownloadStatus.PhotoDownloaderStatusDownloading) {
Thread newThread = new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < count; i++) {
Log.i(CameraFragment.class.toString(), "getPhoto");
SnappetsHelper.getInstance().getConnectedSnappet().getPhotoID(1);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});
newThread.start();
} else
downloaderStatus = DownloadStatus.PhotoDownloaderStatusIdle;
// [PhotoLibraryManager sharedInstance].currentPhotoId = 0;
// uint8_t photoIdByte = (uint8_t)([PhotoLibraryManager sharedInstance].currentPhotoId+1);
// [[ConnectionManager sharedInstance].snappet snappetGetPhoto:kSnappetPhotoLargeSize photoID:photoIdByte];
} else {
// if (self.delegate != nil) {
// [self.delegate didCompleteDownloadTask];
// }
DownloadManager.this.downloaderStatus = DownloadStatus.PhotoDownloaderStatusIdle;
DownloadManager.this.m_callback.finishedPhotoDownload();
}
}
@Override
public void didDeletePhoto(int id) {
// TODO Auto-generated method stub
Log.i(CameraFragment.class.toString(), "didDeletePhoto");
Thread newThread = new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (downloaderStatus == DownloadStatus.PhotoDownloaderStatusDownloading)
SnappetsHelper.getInstance().readPhotoCount(SnappetsHelper.getInstance().getConnectedSnappet(), snappetCallback);
else
downloaderStatus = DownloadStatus.PhotoDownloaderStatusIdle;
}
});
newThread.start();
}
};
SnappetsHelper.getInstance().readPhotoCount(SnappetsHelper.getInstance().getConnectedSnappet(), snappetCallback);
this.downloaderStatus = DownloadStatus.PhotoDownloaderStatusDownloading;
DownloadManager.this.m_callback.startedPhotoDownload();
}
public void Stop() {
if (SnappetsHelper.getInstance().getConnectedSnappet() != null)
SnappetsHelper.getInstance().getConnectedSnappet().stopTransfer();
this.downloaderStatus = DownloadStatus.PhotoDownloaderStatusStopped;
DownloadManager.this.m_callback.finishedPhotoDownload();
}
public boolean IsDownloading() {
return this.downloaderStatus == DownloadStatus.PhotoDownloaderStatusDownloading;
}
public interface Callback {
void startedPhotoDownload();
void notifyPhotoDownloaded(File file);
void finishedPhotoDownload();
}
}
|
{
"content_hash": "c4809ff2ac3515d39d369bee4d04fbbb",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 141,
"avg_line_length": 38.91747572815534,
"alnum_prop": 0.544343270550081,
"repo_name": "WowWeeLabs/SnapPets-Android-SDK",
"id": "f526955af07429b7de0a75cba20e5fcd43d8a97d",
"size": "8017",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/wowwee/snappetssampleproject/util/DownloadManager.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "277240"
}
]
}
|
package org.oep.core.dossiermgt.model;
import com.liferay.portal.model.PersistedModel;
/**
* The extended model interface for the DossierDoc service. Represents a row in the "oep_dossiermgt_DossierDoc" database table, with each column mapped to a property of this class.
*
* @author trungdk
* @see DossierDocModel
* @see org.oep.core.dossiermgt.model.impl.DossierDocImpl
* @see org.oep.core.dossiermgt.model.impl.DossierDocModelImpl
* @generated
*/
public interface DossierDoc extends DossierDocModel, PersistedModel {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify this interface directly. Add methods to {@link org.oep.core.dossiermgt.model.impl.DossierDocImpl} and rerun ServiceBuilder to automatically copy the method declarations to this interface.
*/
}
|
{
"content_hash": "93d5bac0be708173ff18043b9c1da667",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 204,
"avg_line_length": 35.68181818181818,
"alnum_prop": 0.7757961783439491,
"repo_name": "thongdv/OEPv2",
"id": "efa1f785b56e3674cea8b18dde84409bada7c3d6",
"size": "1376",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "portlets/oep-core-dossiermgt-portlet/docroot/WEB-INF/service/org/oep/core/dossiermgt/model/DossierDoc.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "3742"
},
{
"name": "Java",
"bytes": "9945598"
},
{
"name": "Shell",
"bytes": "3152"
}
]
}
|
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- From: file:/Users/Guest/Desktop/Instagram%20Clone/ParseStarterProject/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/res/values-v18/values-v18.xml -->
<eat-comment/>
<dimen name="abc_switch_padding">0px</dimen>
</resources>
|
{
"content_hash": "284d7c94c342fc6863af4ac95ff76dbe",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 185,
"avg_line_length": 52.833333333333336,
"alnum_prop": 0.7255520504731862,
"repo_name": "YHoP/InstagramClone",
"id": "3ac9fcda94a4573382f41347381ea41e05315dab",
"size": "317",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ParseStarterProject/build/intermediates/res/merged/debug/values-v18/values-v18.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "450930"
}
]
}
|
formController.$inject = ['$scope', '$routeParams', 'User'];
function formController($scope, $routeParams, User) {
var $ctrl = this, unsubscribe;
$ctrl.create = User.create; // it works due to these methods are
$ctrl.update = User.update; // already binded to the User
if ($routeParams.id) {
User.getById( $routeParams.id ).then( function(response) {
$ctrl.user = response.data;
} );
} else {
$ctrl.user = { }
}
}
angular
.module('app')
.controller('formController', formController)
|
{
"content_hash": "b14d35eb6c0f8e61f60ce469da89a15c",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 66,
"avg_line_length": 27.05,
"alnum_prop": 0.6247689463955638,
"repo_name": "DScheglov/user-list-frontend",
"id": "122272c51b95a33199c7cae1d2d79565697f0cfe",
"size": "560",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/controllers/form-ctrl.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "342"
},
{
"name": "HTML",
"bytes": "2838"
},
{
"name": "JavaScript",
"bytes": "8810"
},
{
"name": "Makefile",
"bytes": "270"
}
]
}
|
import { ScrollStrategy } from './scroll-strategy';
import { ViewportRuler } from '../position/viewport-ruler';
/**
* Strategy that will prevent the user from scrolling while the overlay is visible.
*/
export declare class BlockScrollStrategy implements ScrollStrategy {
private _viewportRuler;
private _previousHTMLStyles;
private _previousScrollPosition;
private _isEnabled;
constructor(_viewportRuler: ViewportRuler);
attach(): void;
enable(): void;
disable(): void;
private _canBeEnabled();
}
|
{
"content_hash": "91c6bb0376430238e0e1c4ed498d6d6a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 83,
"avg_line_length": 33.4375,
"alnum_prop": 0.7233644859813084,
"repo_name": "aitboudad/material2-builds",
"id": "a33b570d85ad3f08308a36938263da4a0c8b11eb",
"size": "535",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "typings/core/overlay/scroll/block-scroll-strategy.d.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "73521"
},
{
"name": "JavaScript",
"bytes": "1008210"
}
]
}
|
'''
DPMixModel.py
Bayesian parametric mixture model with a unbounded number of components K
Attributes
-------
K : # of components
alpha0 : scalar concentration hyperparameter of Dirichlet process prior
qalpha0 : K-length vector, params for variational factor q(v)
qalpha1 : K-length vector, params for variational factor q(v)
q(v[k]) ~ Beta(qalpha1[k], qalpha0[k])
truncType : str type of truncation for the Dirichlet Process
'z' : truncate on the assignments [default]
or 'v' : truncate stick-breaking distribution
'''
import numpy as np
from bnpy.allocmodel import AllocModel
from bnpy.suffstats import SuffStatBag
from bnpy.util import NumericUtil
from bnpy.util import gammaln, digamma, EPS
class DPMixModel(AllocModel):
######################################################### Constructors
#########################################################
def __init__(self, inferType, priorDict=None):
if inferType == 'EM':
raise ValueError('EM not supported for DPMixModel')
self.inferType = inferType
if priorDict is None:
self.alpha0 = 1.0 # Uniform!
self.alpha1 = 1.0
self.truncType = 'z'
else:
self.set_prior(priorDict)
self.K = 0
def set_prior(self, PriorParamDict):
self.alpha1 = 1.0
self.alpha0 = PriorParamDict['alpha0']
self.truncType = PriorParamDict['truncType']
def set_helper_params( self ):
''' Set dependent attributes given primary global params.
For DP mixture, this means precomputing digammas.
'''
DENOM = digamma(self.qalpha0 + self.qalpha1)
self.ElogV = digamma(self.qalpha1) - DENOM
self.Elog1mV = digamma(self.qalpha0) - DENOM
if self.truncType == 'v':
self.qalpha1[-1] = 1
self.qalpha0[-1] = EPS # avoid digamma(0), which is way too HUGE
self.ElogV[-1] = 0 # log(1) => 0
self.Elog1mV[-1] = np.log(1e-40) # log(0) => -INF, never used
# Calculate expected mixture weights E[ log w_k ]
self.Elogw = self.ElogV.copy() #copy so we can do += without modifying ElogV
self.Elogw[1:] += self.Elog1mV[:-1].cumsum()
######################################################### Accessors
#########################################################
def get_keys_for_memoized_local_params(self):
''' Return list of string names of the LP fields
that this object needs to memoize across visits to a particular batch
'''
return list()
######################################################### Local Params
#########################################################
def calc_local_params(self, Data, LP, **kwargs):
''' Calculate local parameters for each data item and each component.
This is part of the E-step.
Args
-------
Data : bnpy data object with Data.nObs observations
LP : local param dict with fields
E_log_soft_ev : Data.nObs x K array
E_log_soft_ev[n,k] = log p(data obs n | comp k)
Returns
-------
LP : local param dict with fields
resp : Data.nObs x K array whose rows sum to one
resp[n,k] = posterior responsibility that comp. k has for data n
'''
lpr = LP['E_log_soft_ev']
lpr += self.Elogw
# Calculate exp in numerically stable manner (first subtract the max)
# perform this in-place so no new allocations occur
NumericUtil.inplaceExpAndNormalizeRows(lpr)
LP['resp'] = lpr
assert np.allclose(lpr.sum(axis=1), 1)
return LP
######################################################### Suff Stats
#########################################################
def get_global_suff_stats(self, Data, LP,
doPrecompEntropy=False,
doPrecompMergeEntropy=False, mPairIDs=None):
''' Calculate the sufficient statistics for global parameter updates
Only adds stats relevant for this allocModel.
Other stats are added by the obsModel.
Args
-------
Data : bnpy data object
LP : local param dict with fields
resp : Data.nObs x K array,
where resp[n,k] = posterior resp of comp k
doPrecompEntropy : boolean flag
indicates whether to precompute ELBO terms in advance
used for memoized learning algorithms (moVB)
doPrecompMergeEntropy : boolean flag
indicates whether to precompute ELBO terms in advance
for all possible merges of pairs of components
used for optional merge moves
Returns
-------
SS : SuffStats for K components, with field
N : vector of length-K,
effective number of observations assigned to each comp
'''
Nvec = np.sum(LP['resp'], axis=0)
SS = SuffStatBag(K=Nvec.size, D=Data.dim)
SS.setField('N', Nvec, dims=('K'))
if doPrecompEntropy:
ElogqZ_vec = self.E_logqZ(LP)
SS.setELBOTerm('ElogqZ', ElogqZ_vec, dims=('K'))
if doPrecompMergeEntropy:
# Hmerge : KxK matrix of entropies for all possible pair-wise merges
# for example, if we had only 3 components {0,1,2}
# Hmerge = [ 0 H(0,1) H(0,2)
# 0 0 H(1,2)
# 0 0 0 ]
# where H(i,j) is entropy if components i and j merged.
Hmerge = np.zeros((self.K, self.K))
for jj in range(self.K):
compIDs = np.arange(jj+1, self.K)
Rcombo = LP['resp'][:,jj][:,np.newaxis] + LP['resp'][:,compIDs]
Hmerge[jj,compIDs] = np.sum(Rcombo*np.log(Rcombo+EPS), axis=0)
SS.setMergeTerm('ElogqZ', Hmerge, dims=('K','K'))
return SS
######################################################### Global Params
#########################################################
def update_global_params_VB( self, SS, **kwargs ):
''' Updates global params (stick-breaking Beta params qalpha1, qalpha0)
for conventional VB learning algorithm.
New parameters have exactly the number of components specified by SS.
'''
self.K = SS.K
qalpha1 = self.alpha1 + SS.N
qalpha0 = self.alpha0 * np.ones(self.K)
qalpha0[:-1] += SS.N[::-1].cumsum()[::-1][1:]
self.qalpha1 = qalpha1
self.qalpha0 = qalpha0
self.set_helper_params()
def update_global_params_soVB( self, SS, rho, **kwargs ):
''' Update global params (stick-breaking Beta params qalpha1, qalpha0).
for stochastic online VB.
'''
assert self.K == SS.K
qalpha1 = self.alpha1 + SS.N
qalpha0 = self.alpha0 * np.ones( self.K )
qalpha0[:-1] += SS.N[::-1].cumsum()[::-1][1:]
self.qalpha1 = rho * qalpha1 + (1-rho) * self.qalpha1
self.qalpha0 = rho * qalpha0 + (1-rho) * self.qalpha0
self.set_helper_params()
def set_global_params(self, hmodel=None, K=None, qalpha1=None,
qalpha0=None, **kwargs):
''' Directly set global parameters qalpha0, qalpha1 to provided values
'''
if hmodel is not None:
self.K = hmodel.allocModel.K
self.qalpha1 = hmodel.allocModel.qalpha1
self.qalpha0 = hmodel.allocModel.qalpha0
self.set_helper_params()
return
if type(qalpha1) != np.ndarray or qalpha1.size != K or qalpha0.size != K:
raise ValueError("Bad DP Parameters")
self.K = K
self.qalpha1 = qalpha1
self.qalpha0 = qalpha0
self.set_helper_params()
######################################################### Evidence
#########################################################
def calc_evidence(self, Data, SS, LP=None ):
'''
'''
evV = self.E_logpV() - self.E_logqV()
if SS.hasELBOTerm('ElogqZ'):
evZq = np.sum(SS.getELBOTerm('ElogqZ'))
else:
evZq = np.sum(self.E_logqZ(LP))
if SS.hasAmpFactor():
evZ = self.E_logpZ(SS) - SS.ampF * evZq
else:
evZ = self.E_logpZ(SS) - evZq
return evZ + evV
def E_logpZ(self, SS):
return np.inner( SS.N, self.Elogw )
def E_logqZ(self, LP):
return np.sum(LP['resp'] * np.log(LP['resp']+EPS), axis=0)
def E_logpV( self ):
logNormC = gammaln(self.alpha0 + self.alpha1) \
- gammaln(self.alpha0) - gammaln(self.alpha1)
logBetaPDF = (self.alpha1-1)*self.ElogV + (self.alpha0-1)*self.Elog1mV
if self.truncType == 'z':
return self.K*logNormC + logBetaPDF.sum()
elif self.truncType == 'v':
return self.K*logNormC + logBetaPDF[:-1].sum()
def E_logqV( self ):
logNormC = gammaln(self.qalpha0 + self.qalpha1) \
- gammaln(self.qalpha0) - gammaln(self.qalpha1)
logBetaPDF = (self.qalpha1-1)*self.ElogV + (self.qalpha0-1)*self.Elog1mV
if self.truncType == 'z':
return logNormC.sum() + logBetaPDF.sum()
elif self.truncType == 'v':
# skip last entry because entropy of Beta(1,0) = 0
return logNormC[:-1].sum() + logBetaPDF[:-1].sum()
######################################################### IO Utils
######################################################### for humans
def get_info_string( self):
''' Returns one-line human-readable terse description of this object
'''
msgPattern = 'DP mixture with K=%d. Concentration alpha0= %.2f'
return msgPattern % (self.K, self.alpha0)
######################################################### IO Utils
######################################################### for machines
def to_dict(self):
return dict(qalpha1=self.qalpha1, qalpha0=self.qalpha0)
def from_dict(self, myDict):
self.inferType = myDict['inferType']
self.K = myDict['K']
self.qalpha1 = myDict['qalpha1']
self.qalpha0 = myDict['qalpha0']
if self.qalpha0.ndim == 0:
self.qalpha0 = self.qalpha1[np.newaxis]
if self.qalpha0.ndim == 0:
self.qalpha0 = self.qalpha0[np.newaxis]
self.set_helper_params()
def get_prior_dict(self):
return dict(alpha1=self.alpha1, alpha0=self.alpha0, K=self.K,
truncType=self.truncType)
|
{
"content_hash": "683fe5ec512bd3c11b9cf6fb6c310606",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 94,
"avg_line_length": 38.77186311787072,
"alnum_prop": 0.5517309012454643,
"repo_name": "daeilkim/refinery",
"id": "40b77ec27eaa7e1b76ccde245af2afb70fd07993",
"size": "10197",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "refinery/bnpy/bnpy-dev/bnpy/allocmodel/mix/DPMixModel.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "246351"
},
{
"name": "C++",
"bytes": "3051"
},
{
"name": "CSS",
"bytes": "34687"
},
{
"name": "HTML",
"bytes": "38220"
},
{
"name": "JavaScript",
"bytes": "111429"
},
{
"name": "Makefile",
"bytes": "3707"
},
{
"name": "Puppet",
"bytes": "5562"
},
{
"name": "Python",
"bytes": "855634"
},
{
"name": "Shell",
"bytes": "463"
}
]
}
|
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"time"
)
var (
recognizedOptions = []string{"share", "filemode", "dirmode", "uid", "gid", "nolock", "remotepath"}
)
type volumeMetadata struct {
CreatedAt time.Time `json:"created_at"`
Account string `json:"account"`
Options VolumeOptions `json:"options"`
}
// VolumeOptions stores the opts passed to the driver by the docker engine.
type VolumeOptions struct {
Share string `json:"share"`
FileMode string `json:"filemode"`
DirMode string `json:"dirmode"`
UID string `json:"uid"`
GID string `json:"gid"`
NoLock bool `json:"nolock"`
RemotePath string `json:"remotepath"`
}
type metadataDriver struct {
metaDir string
}
func newMetadataDriver(metaDir string) (*metadataDriver, error) {
if err := os.MkdirAll(metaDir, 0700); err != nil {
return nil, fmt.Errorf("error creating %s: %v", metaDir, err)
}
return &metadataDriver{metaDir}, nil
}
func (m *metadataDriver) Validate(meta map[string]string) (volumeMetadata, error) {
var v volumeMetadata
var opts VolumeOptions
// Validate keys
for k := range meta {
found := false
for _, opts := range recognizedOptions {
if k == opts {
found = true
break
}
}
if !found {
return v, fmt.Errorf("not a recognized volume driver option: %q", k)
}
}
opts.Share = meta["share"]
opts.DirMode = meta["dirmode"]
opts.FileMode = meta["filemode"]
opts.GID = meta["gid"]
opts.UID = meta["uid"]
opts.RemotePath = meta["remotepath"]
if meta["nolock"] == "true" {
opts.NoLock = true
}
return volumeMetadata{
Options: opts,
}, nil
}
func (m *metadataDriver) Delete(name string) error {
if err := os.RemoveAll(m.path(name)); err != nil {
return fmt.Errorf("cannot delete volume metadata: %v", err)
}
return nil
}
func (m *metadataDriver) Set(name string, meta volumeMetadata) error {
b, err := json.Marshal(meta)
if err != nil {
return fmt.Errorf("cannot serialize metadata: %v", err)
}
if err := ioutil.WriteFile(m.path(name), b, 0600); err != nil {
return fmt.Errorf("cannot write metadata: %v", err)
}
return nil
}
func (m *metadataDriver) Get(name string) (volumeMetadata, error) {
var v volumeMetadata
b, err := ioutil.ReadFile(m.path(name))
if err != nil {
return v, fmt.Errorf("cannot read metadata: %v", err)
}
if err := json.Unmarshal(b, &v); err != nil {
return v, fmt.Errorf("cannot deserialize metadata: %v", err)
}
return v, nil
}
func (m *metadataDriver) List() ([]string, error) {
var volumes []string
// return all the file names under metadata directory
if err := filepath.Walk(m.metaDir, func(path string, info os.FileInfo, inErr error) error {
if inErr != nil {
return inErr
}
if path == m.metaDir {
// directory itself, skip
return nil
}
if info.IsDir() { // a directory
return filepath.SkipDir
}
// base file name indicates the volume name
volumes = append(volumes, filepath.Base(path))
return nil
}); err != nil {
return volumes, fmt.Errorf("cannot list directory: %v", err)
}
return volumes, nil
}
func (m *metadataDriver) path(name string) string {
return filepath.Join(m.metaDir, name)
}
|
{
"content_hash": "618aeb62a56237315bc91c063079c47c",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 99,
"avg_line_length": 23.77037037037037,
"alnum_prop": 0.6650046743533811,
"repo_name": "Azure/azurefile-dockervolumedriver",
"id": "34fdc300d1da29c10c6251ab1d0a289d708f1201",
"size": "3209",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "metadata.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "16906"
}
]
}
|
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="SHORTCUT ICON" href="../../../../../img/clover.ico" />
<link rel="stylesheet" href="../../../../../aui/css/aui.min.css" media="all"/>
<link rel="stylesheet" href="../../../../../aui/css/aui-experimental.min.css" media="all"/>
<!--[if IE 9]><link rel="stylesheet" href="../../../../../aui/css/aui-ie9.min.css" media="all"/><![endif]-->
<style type="text/css" media="all">
@import url('../../../../../style.css');
@import url('../../../../../tree.css');
</style>
<script src="../../../../../jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui-experimental.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui-soy.min.js" type="text/javascript"></script>
<script src="../../../../../package-nodes-tree.js" type="text/javascript"></script>
<script src="../../../../../clover-tree.js" type="text/javascript"></script>
<script src="../../../../../clover.js" type="text/javascript"></script>
<script src="../../../../../clover-descriptions.js" type="text/javascript"></script>
<script src="../../../../../cloud.js" type="text/javascript"></script>
<title>ABA Route Transit Number Validator 1.0.1-SNAPSHOT</title>
</head>
<body>
<div id="page">
<header id="header" role="banner">
<nav class="aui-header aui-dropdown2-trigger-group" role="navigation">
<div class="aui-header-inner">
<div class="aui-header-primary">
<h1 id="logo" class="aui-header-logo aui-header-logo-clover">
<a href="http://openclover.org" title="Visit OpenClover home page"><span class="aui-header-logo-device">OpenClover</span></a>
</h1>
</div>
<div class="aui-header-secondary">
<ul class="aui-nav">
<li id="system-help-menu">
<a class="aui-nav-link" title="Open online documentation" target="_blank"
href="http://openclover.org/documentation">
<span class="aui-icon aui-icon-small aui-iconfont-help"> Help</span>
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="aui-page-panel">
<div class="aui-page-panel-inner">
<div class="aui-page-panel-nav aui-page-panel-nav-clover">
<div class="aui-page-header-inner" style="margin-bottom: 20px;">
<div class="aui-page-header-image">
<a href="http://cardatechnologies.com" target="_top">
<div class="aui-avatar aui-avatar-large aui-avatar-project">
<div class="aui-avatar-inner">
<img src="../../../../../img/clover_logo_large.png" alt="Clover icon"/>
</div>
</div>
</a>
</div>
<div class="aui-page-header-main" >
<h1>
<a href="http://cardatechnologies.com" target="_top">
ABA Route Transit Number Validator 1.0.1-SNAPSHOT
</a>
</h1>
</div>
</div>
<nav class="aui-navgroup aui-navgroup-vertical">
<div class="aui-navgroup-inner">
<ul class="aui-nav">
<li class="">
<a href="../../../../../dashboard.html">Project overview</a>
</li>
</ul>
<div class="aui-nav-heading packages-nav-heading">
<strong>Packages</strong>
</div>
<div class="aui-nav project-packages">
<form method="get" action="#" class="aui package-filter-container">
<input type="text" autocomplete="off" class="package-filter text"
placeholder="Type to filter packages..." name="package-filter" id="package-filter"
title="Start typing package name (or part of the name) to search through the tree. Use arrow keys and the Enter key to navigate."/>
</form>
<p class="package-filter-no-results-message hidden">
<small>No results found.</small>
</p>
<div class="packages-tree-wrapper" data-root-relative="../../../../../" data-package-name="com.cardatechnologies.utils.validators.abaroutevalidator">
<div class="packages-tree-container"></div>
<div class="clover-packages-lozenges"></div>
</div>
</div>
</div>
</nav> </div>
<section class="aui-page-panel-content">
<div class="aui-page-panel-content-clover">
<div class="aui-page-header-main"><ol class="aui-nav aui-nav-breadcrumbs">
<li><a href="../../../../../dashboard.html"> Project Clover database Sat Aug 7 2021 12:29:33 MDT</a></li>
<li><a href="test-pkg-summary.html">Package com.cardatechnologies.utils.validators.abaroutevalidator</a></li>
<li><a href="test-Test_AbaRouteValidator_06.html">Class Test_AbaRouteValidator_06</a></li>
</ol></div>
<h1 class="aui-h2-clover">
Test testAbaNumberCheck_10244_bad
</h1>
<table class="aui">
<thead>
<tr>
<th>Test</th>
<th><label title="The test result. Either a Pass, Fail or Error.">Status</label></th>
<th><label title="When the test execution was started">Start time</label></th>
<th><label title="The total time in seconds taken to run this test.">Time (seconds)</label></th>
<th><label title="A failure or error message if the test is not successful.">Message</label></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_06.html?line=5920#src-5920" >testAbaNumberCheck_10244_bad</a>
</td>
<td>
<span class="sortValue">1</span><span class="aui-lozenge aui-lozenge-success">PASS</span>
</td>
<td>
7 Aug 12:36:26
</td>
<td>
0.0 </td>
<td>
<div></div>
<div class="errorMessage"></div>
</td>
</tr>
</tbody>
</table>
<div> </div>
<table class="aui aui-table-sortable">
<thead>
<tr>
<th style="white-space:nowrap;"><label title="A class that was directly hit by this test.">Target Class</label></th>
<th colspan="4"><label title="The percentage of coverage contributed by each single test.">Coverage contributed by</label> testAbaNumberCheck_10244_bad</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span class="sortValue">com.cardatechnologies.utils.validators.abaroutevalidator.exceptions.AbaRouteValidationException</span>
  <a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/exceptions/AbaRouteValidationException.html?id=20167#AbaRouteValidationException" title="AbaRouteValidationException" name="sl-43">com.cardatechnologies.utils.validators.abaroutevalidator.exceptions.AbaRouteValidationException</a>
</td>
<td>
<span class="sortValue">0.5714286</span>57.1%
</td>
<td class="align-middle" style="width: 100%" colspan="3">
<div>
<div title="57.1% Covered" style="min-width:40px;" class="barNegative contribBarNegative contribBarNegative"><div class="barPositive contribBarPositive contribBarPositive" style="width:57.1%"></div></div></div> </td>
</tr>
<tr>
<td>
<span class="sortValue">com.cardatechnologies.utils.validators.abaroutevalidator.ErrorCodes</span>
  <a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/ErrorCodes.html?id=20167#ErrorCodes" title="ErrorCodes" name="sl-42">com.cardatechnologies.utils.validators.abaroutevalidator.ErrorCodes</a>
</td>
<td>
<span class="sortValue">0.5714286</span>57.1%
</td>
<td class="align-middle" style="width: 100%" colspan="3">
<div>
<div title="57.1% Covered" style="min-width:40px;" class="barNegative contribBarNegative contribBarNegative"><div class="barPositive contribBarPositive contribBarPositive" style="width:57.1%"></div></div></div> </td>
</tr>
<tr>
<td>
<span class="sortValue">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</span>
  <a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/AbaRouteValidator.html?id=20167#AbaRouteValidator" title="AbaRouteValidator" name="sl-47">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</a>
</td>
<td>
<span class="sortValue">0.29411766</span>29.4%
</td>
<td class="align-middle" style="width: 100%" colspan="3">
<div>
<div title="29.4% Covered" style="min-width:40px;" class="barNegative contribBarNegative contribBarNegative"><div class="barPositive contribBarPositive contribBarPositive" style="width:29.4%"></div></div></div> </td>
</tr>
</tbody>
</table>
</div> <!-- class="aui-page-panel-content-clover" -->
<footer id="footer" role="contentinfo">
<section class="footer-body">
<ul>
<li>
Report generated by <a target="_new" href="http://openclover.org">OpenClover</a> v 4.4.1
on Sat Aug 7 2021 12:49:26 MDT using coverage data from Sat Aug 7 2021 12:47:23 MDT.
</li>
</ul>
<ul>
<li>OpenClover is free and open-source software. </li>
</ul>
</section>
</footer> </section> <!-- class="aui-page-panel-content" -->
</div> <!-- class="aui-page-panel-inner" -->
</div> <!-- class="aui-page-panel" -->
</div> <!-- id="page" -->
</body>
</html>
|
{
"content_hash": "468f21c8697315843ba551ed76ff09c5",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 359,
"avg_line_length": 46.744680851063826,
"alnum_prop": 0.5302685480200273,
"repo_name": "dcarda/aba.route.validator",
"id": "e8682f9a279d6dcc061e0c2fd83857b57005c105",
"size": "10985",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "target13/site/clover/com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_06_testAbaNumberCheck_10244_bad_fk7.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "18715254"
}
]
}
|
<h1 class="md-title">Partnership Development</h1>
<div ng-repeat="(key,note) in $ctrl.contact.notes " >
<div layout="row">
<div flex>
{{note.text}}
</div>
<span ng-if="note.postcard" class="contactinteraction"> <i class="fa fa-picture-o" aria-hidden="true"></i> Postcard Sent</span>
<span ng-if="note.video_email" class="contactinteraction"> <i class="fa fa-video-camera" aria-hidden="true"></i> video_email</span>
<span ng-if="note.phone" class="contactinteraction"> <i class="fa fa-phone" aria-hidden="true"></i>
phone</span>
<div style="color:grey; " >- {{note.first_name}} {{note.last_name|limitTo:1}}. [<span am-time-ago="note.time" ></span>]
<i class="fa fa-times no-print" ng-click="$ctrl.deleteNote(key)"></i> </div>
</div>
<md-divider> </md-divider>
</div>
<form ng-submit="$ctrl.addNote()" layout="column" class="no-print" style="background-color:rgba(50,50,50,0.025)">
<md-input-container md-no-float flex class="no-md-error" style="margin:0px">
<input ng-model="$ctrl.new_note.text" placeholder="Interaction note... (optional)" autocomplete="off">
</md-input-container>
<div layout-gt-xs="row" layout="column" layout-align-gt-xs="start center">
<md-checkbox ng-model="$ctrl.new_note.postcard">Sent Postcard</md-checkbox>
<md-checkbox ng-model="$ctrl.new_note.video_email">Sent VideoEmail</md-checkbox>
<md-checkbox ng-model="$ctrl.new_note.phone">Phone Call</md-checkbox>
<div flex></div>
<md-button class="md-primary " style=" padding:0px" type="submit">add</md-button>
</div>
</form>
<br>
<div ng-if="$ctrl.contact.last.payment"> <b>Last Payment Received</b> {{$ctrl.contact.last.payment|date}} </div>
<div ng-if="$ctrl.contact.last.ministry_support"> <b>Last Ministry Support</b> {{$ctrl.contact.last.ministry_support|date}} </div>
<div ng-if="$ctrl.contact.last.staff_support"> <b>Last Staff Support</b> {{$ctrl.contact.last.staff_support|date}} </div>
<h1 class="md-title" ng-if="$ctrl.contact.mailing_lists">Mailing Lists</h1>
<div ng-repeat="(key,item) in $ctrl.contact.mailing_lists">{{item.name}} : {{item.status}} ({{item.signup_date|date}}) {{item.stats}}
<md-divider></md-divider>
</div>
<h1 class="md-title" ng-if="$ctrl.donor.years">Donations</h1>
<div ng-repeat="(key,item) in $ctrl.donor.years"><b> {{key}} : donations {{item.transaction_count}}, year to date: ${{item.full_year_total}} </b>
<md-divider></md-divider>
<div ng-repeat="tran in item.transactions" layout="row">
<div flex></div>
<div flex>{{tran.date|date}}</div>
<div flex>{{tran.fund_id}} </div>
<div flex> {{tran.method}}</div>
<div flex> {{tran.amount}} </div>
</div>
</div>
<a ng-click="show_more = !show_more">Show all info</a>
<pre ng-if="show_more">
{{ $ctrl.contact| json}}
</pre>
|
{
"content_hash": "3a6ecb2dda02625699c0ae661bb6b7d9",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 146,
"avg_line_length": 37.413333333333334,
"alnum_prop": 0.6560940841054882,
"repo_name": "timtimmytime/ywam-staff-webapp-firebase",
"id": "062d421bc489dccbe3f16b50674cbceb67a16788",
"size": "2806",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "angular_client/app/common/contactManagementCard/contactManagementCard.html",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "13672"
},
{
"name": "HTML",
"bytes": "224580"
},
{
"name": "JavaScript",
"bytes": "584696"
}
]
}
|
<component name="libraryTable">
<library name="constraint-layout-solver-1.0.2">
<CLASSES>
<root url="jar://E:/AndroidSDK/sdk/extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.2/constraint-layout-solver-1.0.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
|
{
"content_hash": "0bf7a249fc7e18b5dfaba5bb573fa105",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 163,
"avg_line_length": 36.888888888888886,
"alnum_prop": 0.6837349397590361,
"repo_name": "AlarmZeng/NetworkStateView",
"id": "b2ef62a391b0f196fb1012b1e4340fc930ea4abe",
"size": "332",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": ".idea/libraries/constraint_layout_solver_1_0_2.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "16529"
}
]
}
|
package com.haskforce.parsing.srcExtsDatatypes;
/**
* PrimString l String String
*/
public class PrimString extends LiteralTopType {
public SrcInfoSpan srcInfoSpan;
public String value;
public String representation;
@Override
public String toString() {
return "PrimString{" +
"value='" + value + '\'' +
", representation='" + representation + '\'' +
'}';
}
}
|
{
"content_hash": "2e568dde6f116f1ca52def5a9531f6ba",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 62,
"avg_line_length": 24.77777777777778,
"alnum_prop": 0.5829596412556054,
"repo_name": "begray/intellij-haskforce",
"id": "bb2afbd23a8bf3bfb1de36417e7d58646a8b01bc",
"size": "446",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/com/haskforce/parsing/srcExtsDatatypes/PrimString.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "435"
},
{
"name": "Haskell",
"bytes": "112147"
},
{
"name": "Java",
"bytes": "1304188"
},
{
"name": "Lex",
"bytes": "44643"
},
{
"name": "Scala",
"bytes": "53380"
},
{
"name": "Shell",
"bytes": "585"
}
]
}
|
/**
* @author Igor V. Stolyarov
*/
package net.windward.android.awt.image;
import org.apache.harmony.awt.internal.nls.Messages;
public class MultiPixelPackedSampleModel extends SampleModel {
private int pixelBitStride;
private int scanlineStride;
private int dataBitOffset;
private int bitMask;
private int dataElementSize;
private int pixelsPerDataElement;
public MultiPixelPackedSampleModel(int dataType, int w, int h,
int numberOfBits, int scanlineStride, int dataBitOffset) {
super(dataType, w, h, 1);
if (dataType != DataBuffer.TYPE_BYTE &&
dataType != DataBuffer.TYPE_USHORT &&
dataType != DataBuffer.TYPE_INT) {
// awt.61=Unsupported data type: {0}
throw new IllegalArgumentException(Messages.getString("awt.61", //$NON-NLS-1$
dataType));
}
this.scanlineStride = scanlineStride;
if(numberOfBits == 0) {
// awt.20C=Number of Bits equals to zero
throw new RasterFormatException(Messages.getString("awt.20C")); //$NON-NLS-1$
}
this.pixelBitStride = numberOfBits;
this.dataElementSize = DataBuffer.getDataTypeSize(dataType);
if(dataElementSize % pixelBitStride != 0) {
// awt.20D=The number of bits per pixel is not a power of 2 or pixels span data element boundaries
throw new RasterFormatException(Messages.getString("awt.20D")); //$NON-NLS-1$
}
if(dataBitOffset % numberOfBits != 0) {
// awt.20E=Data Bit offset is not a multiple of pixel bit stride
throw new RasterFormatException(Messages.getString("awt.20E")); //$NON-NLS-1$
}
this.dataBitOffset = dataBitOffset;
this.pixelsPerDataElement = dataElementSize / pixelBitStride;
this.bitMask = (1 << numberOfBits) - 1;
}
public MultiPixelPackedSampleModel(int dataType, int w, int h,
int numberOfBits) {
this(dataType, w, h, numberOfBits, (numberOfBits * w +
DataBuffer.getDataTypeSize(dataType) - 1) /
DataBuffer.getDataTypeSize(dataType), 0);
}
@Override
public Object getDataElements(int x, int y, Object obj, DataBuffer data) {
if (x < 0 || y < 0 || x >= this.width || y >= this.height) {
// awt.63=Coordinates are not in bounds
throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$
}
switch (getTransferType()) {
case DataBuffer.TYPE_BYTE:
byte bdata[];
if (obj == null) {
bdata = new byte[1];
} else {
bdata = (byte[]) obj;
}
bdata[0] = (byte) getSample(x, y, 0, data);
obj = bdata;
break;
case DataBuffer.TYPE_USHORT:
short sdata[];
if (obj == null) {
sdata = new short[1];
} else {
sdata = (short[]) obj;
}
sdata[0] = (short) getSample(x, y, 0, data);
obj = sdata;
break;
case DataBuffer.TYPE_INT:
int idata[];
if (obj == null) {
idata = new int[1];
} else {
idata = (int[]) obj;
}
idata[0] = getSample(x, y, 0, data);
obj = idata;
break;
}
return obj;
}
@Override
public void setDataElements(int x, int y, Object obj, DataBuffer data) {
setSample(x, y, obj, data, 1, 0);
}
@Override
public boolean equals(Object o) {
if ((o == null) || !(o instanceof MultiPixelPackedSampleModel)) {
return false;
}
MultiPixelPackedSampleModel model = (MultiPixelPackedSampleModel) o;
return this.width == model.width &&
this.height == model.height &&
this.numBands == model.numBands &&
this.dataType == model.dataType &&
this.pixelBitStride == model.pixelBitStride &&
this.bitMask == model.bitMask &&
this.pixelsPerDataElement == model.pixelsPerDataElement &&
this.dataElementSize == model.dataElementSize &&
this.dataBitOffset == model.dataBitOffset &&
this.scanlineStride == model.scanlineStride;
}
@Override
public SampleModel createSubsetSampleModel(int bands[]) {
if (bands != null && bands.length != 1) {
// awt.20F=Number of bands must be only 1
throw new RasterFormatException(Messages.getString("awt.20F")); //$NON-NLS-1$
}
return createCompatibleSampleModel(width, height);
}
@Override
public SampleModel createCompatibleSampleModel(int w, int h) {
return new MultiPixelPackedSampleModel(dataType, w, h, pixelBitStride);
}
@Override
public int[] getPixel(int x, int y, int iArray[], DataBuffer data) {
if (x < 0 || y < 0 || x >= this.width || y >= this.height) {
// awt.63=Coordinates are not in bounds
throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$
}
int pixel[];
if (iArray == null) {
pixel = new int[numBands];
} else {
pixel = iArray;
}
pixel[0] = getSample(x, y, 0, data);
return pixel;
}
@Override
public void setPixel(int x, int y, int iArray[], DataBuffer data) {
setSample(x, y, iArray, data, 2, 0);
}
@Override
public int getSample(int x, int y, int b, DataBuffer data) {
if (x < 0 || y < 0 || x >= this.width || y >= this.height || b != 0) {
// awt.63=Coordinates are not in bounds
throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$
}
int bitnum = dataBitOffset + x * pixelBitStride;
int elem = data.getElem(y * scanlineStride + bitnum / dataElementSize);
int shift = dataElementSize - (bitnum & (dataElementSize - 1)) -
pixelBitStride;
return (elem >> shift) & bitMask;
}
@Override
public void setSample(int x, int y, int b, int s, DataBuffer data) {
if (b != 0) {
// awt.63=Coordinates are not in bounds
throw new ArrayIndexOutOfBoundsException(Messages.getString("awt.63")); //$NON-NLS-1$
}
setSample(x, y, null, data, 3, s);
}
@Override
public DataBuffer createDataBuffer() {
DataBuffer dataBuffer = null;
int size = scanlineStride * height;
switch (dataType) {
case DataBuffer.TYPE_BYTE:
dataBuffer = new DataBufferByte(size + (dataBitOffset + 7) / 8);
break;
case DataBuffer.TYPE_USHORT:
dataBuffer = new DataBufferUShort(size + (dataBitOffset + 15) / 16);
break;
case DataBuffer.TYPE_INT:
dataBuffer = new DataBufferInt(size + (dataBitOffset + 31) / 32);
break;
}
return dataBuffer;
}
public int getOffset(int x, int y) {
return y * scanlineStride + (x * pixelBitStride + dataBitOffset) /
dataElementSize;
}
@Override
public int getSampleSize(int band) {
return pixelBitStride;
}
public int getBitOffset(int x) {
return (x * pixelBitStride + dataBitOffset) % dataElementSize;
}
@Override
public int[] getSampleSize() {
int sampleSizes[] = { pixelBitStride };
return sampleSizes;
}
@Override
public int hashCode() {
int hash = 0;
int tmp = 0;
hash = width;
tmp = hash >>> 24;
hash <<= 8;
hash |= tmp;
hash ^= height;
tmp = hash >>> 24;
hash <<= 8;
hash |= tmp;
hash ^= numBands;
tmp = hash >>> 24;
hash <<= 8;
hash |= tmp;
hash ^= dataType;
tmp = hash >>> 24;
hash <<= 8;
hash |= tmp;
hash ^= scanlineStride;
tmp = hash >>> 24;
hash <<= 8;
hash |= tmp;
hash ^= pixelBitStride;
tmp = hash >>> 24;
hash <<= 8;
hash |= tmp;
hash ^= dataBitOffset;
tmp = hash >>> 24;
hash <<= 8;
hash |= tmp;
hash ^= bitMask;
tmp = hash >>> 24;
hash <<= 8;
hash |= tmp;
hash ^= dataElementSize;
tmp = hash >>> 24;
hash <<= 8;
hash |= tmp;
hash ^= pixelsPerDataElement;
return hash;
}
@Override
public int getTransferType() {
if (pixelBitStride > 16) {
return DataBuffer.TYPE_INT;
} else if (pixelBitStride > 8) {
return DataBuffer.TYPE_USHORT;
} else {
return DataBuffer.TYPE_BYTE;
}
}
public int getScanlineStride() {
return scanlineStride;
}
public int getPixelBitStride() {
return pixelBitStride;
}
@Override
public int getNumDataElements() {
return 1;
}
public int getDataBitOffset() {
return dataBitOffset;
}
/**
* This method is used by other methods of this class. The behaviour of
* this method depends on the method which has been invoke this one. The
* argument methodId is used to choose valid behaviour in a particular case.
* If methodId is equal to 1 it means that this method has been invoked by
* the setDataElements() method, 2 - means setPixel(), and setSample() in
* any other cases.
*/
private void setSample(final int x, final int y, final Object obj,
final DataBuffer data, final int methodId, int s) {
if ((x < 0) || (y < 0) || (x >= this.width) || (y >= this.height)) {
// awt.63=Coordinates are not in bounds
throw new ArrayIndexOutOfBoundsException(Messages
.getString("awt.63")); //$NON-NLS-1$
}
final int bitnum = dataBitOffset + x * pixelBitStride;
final int idx = y * scanlineStride + bitnum / dataElementSize;
final int shift = dataElementSize - (bitnum & (dataElementSize - 1))
- pixelBitStride;
final int mask = ~(bitMask << shift);
int elem = data.getElem(idx);
switch (methodId) {
case 1: { // Invoked from setDataElements()
switch (getTransferType()) {
case DataBuffer.TYPE_BYTE:
s = ((byte[]) obj)[0] & 0xff;
break;
case DataBuffer.TYPE_USHORT:
s = ((short[]) obj)[0] & 0xffff;
break;
case DataBuffer.TYPE_INT:
s = ((int[]) obj)[0];
break;
}
break;
}
case 2: { // Invoked from setPixel()
s = ((int[]) obj)[0];
break;
}
}
elem &= mask;
elem |= (s & bitMask) << shift;
data.setElem(idx, elem);
}
}
|
{
"content_hash": "5f16cda76bb445aa977c623ec5348169",
"timestamp": "",
"source": "github",
"line_count": 355,
"max_line_length": 110,
"avg_line_length": 31.450704225352112,
"alnum_prop": 0.5395432154052844,
"repo_name": "windwardadmin/android-awt",
"id": "6b54e1820b7db9ca2630af1fd296b305d10c8758",
"size": "11977",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/net/windward/android/awt/image/MultiPixelPackedSampleModel.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "4400806"
},
{
"name": "Shell",
"bytes": "170"
}
]
}
|
module JamisBuck
module Routing
module RouteExtensions
def self.included(base)
base.alias_method_chain :recognition_conditions, :host
end
def recognition_conditions_with_host
result = recognition_conditions_without_host
result << "conditions[:host] === env[:host]" if conditions[:host]
result << "conditions[:domain] === env[:domain]" if conditions[:domain]
result << "conditions[:subdomain] === env[:subdomain]" if conditions[:subdomain]
result
end
end
end
end
|
{
"content_hash": "437fa0579c4d78169171d4606b05b754",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 86,
"avg_line_length": 27.36842105263158,
"alnum_prop": 0.6807692307692308,
"repo_name": "treybean/Webiva-lis",
"id": "ced450979c5072e73cce7b7778012f6337377593",
"size": "520",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "vendor/plugins/routing_tricks/lib/jamis_buck/routing/route.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1603531"
},
{
"name": "PHP",
"bytes": "19204"
},
{
"name": "Perl",
"bytes": "3172"
},
{
"name": "Ruby",
"bytes": "3040685"
},
{
"name": "Shell",
"bytes": "17397"
}
]
}
|
FROM openjdk:11-slim
WORKDIR /app
COPY ktor-asyncdb/gradle gradle
COPY ktor-asyncdb/build.gradle build.gradle
COPY ktor-asyncdb/gradle.properties gradle.properties
COPY ktor-asyncdb/gradlew gradlew
COPY ktor-asyncdb/settings.gradle settings.gradle
COPY ktor-asyncdb/src src
RUN /app/gradlew --no-daemon shadowJar
CMD ["java", "-server", "-XX:+UseParallelGC", "-Xms2G","-Xmx2G", "-jar", "/app/build/libs/bench.jar", "jasync-sql"]
|
{
"content_hash": "e2dd82312a7bc146a23e79a00d4d04df",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 115,
"avg_line_length": 42.9,
"alnum_prop": 0.7715617715617715,
"repo_name": "jeevatkm/FrameworkBenchmarks",
"id": "7f1cafd46d61efaef566db8a22c335443f664b5f",
"size": "429",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "frameworks/Kotlin/ktor/ktor-jasync.dockerfile",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "104"
},
{
"name": "Batchfile",
"bytes": "2088"
},
{
"name": "C",
"bytes": "159009"
},
{
"name": "C#",
"bytes": "408319"
},
{
"name": "C++",
"bytes": "118817"
},
{
"name": "CMake",
"bytes": "2823"
},
{
"name": "CSS",
"bytes": "17457"
},
{
"name": "Clojure",
"bytes": "78497"
},
{
"name": "Common Lisp",
"bytes": "2653"
},
{
"name": "Crystal",
"bytes": "24233"
},
{
"name": "D",
"bytes": "30033"
},
{
"name": "Dart",
"bytes": "52149"
},
{
"name": "Dockerfile",
"bytes": "286276"
},
{
"name": "Elixir",
"bytes": "11485"
},
{
"name": "Erlang",
"bytes": "41222"
},
{
"name": "F#",
"bytes": "89877"
},
{
"name": "Go",
"bytes": "118936"
},
{
"name": "Groovy",
"bytes": "21834"
},
{
"name": "HTML",
"bytes": "138242"
},
{
"name": "Hack",
"bytes": "1945"
},
{
"name": "Haskell",
"bytes": "29053"
},
{
"name": "Java",
"bytes": "618410"
},
{
"name": "JavaScript",
"bytes": "168850"
},
{
"name": "Kotlin",
"bytes": "52933"
},
{
"name": "Lua",
"bytes": "14508"
},
{
"name": "Makefile",
"bytes": "3052"
},
{
"name": "Meson",
"bytes": "846"
},
{
"name": "MoonScript",
"bytes": "2396"
},
{
"name": "Nim",
"bytes": "1645"
},
{
"name": "PHP",
"bytes": "649217"
},
{
"name": "PLpgSQL",
"bytes": "3446"
},
{
"name": "Perl",
"bytes": "12797"
},
{
"name": "Python",
"bytes": "314850"
},
{
"name": "QMake",
"bytes": "2301"
},
{
"name": "Ruby",
"bytes": "82555"
},
{
"name": "Rust",
"bytes": "72892"
},
{
"name": "Scala",
"bytes": "57723"
},
{
"name": "Shell",
"bytes": "47827"
},
{
"name": "Smarty",
"bytes": "436"
},
{
"name": "Swift",
"bytes": "96148"
},
{
"name": "TypeScript",
"bytes": "13551"
},
{
"name": "UrWeb",
"bytes": "4453"
},
{
"name": "Vala",
"bytes": "1579"
},
{
"name": "Visual Basic",
"bytes": "27087"
},
{
"name": "Volt",
"bytes": "511"
}
]
}
|
using System;
public class IsoscelesTriangle
{
public static void Main()
{
char symbol = '\u00A9';
Console.WriteLine(" {0}", symbol);
Console.WriteLine();
Console.WriteLine(" {0} {1}", symbol, symbol);
Console.WriteLine();
Console.WriteLine(" {0} {1}", symbol, symbol);
Console.WriteLine();
Console.WriteLine(" {0} {1} {2} {3}", symbol, symbol, symbol, symbol);
}
}
|
{
"content_hash": "13a12bc8073f8935f695b4c513ac683f",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 78,
"avg_line_length": 25.166666666666668,
"alnum_prop": 0.5496688741721855,
"repo_name": "EmilMitev/Telerik-Academy",
"id": "d243948f7e5fa8187bb9d031ce3b4a08f9405f79",
"size": "980",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "CSharp - part 1/2.PrimitiveDataTypesAndVariables/08.IsoscelesTriangle/IsoscelesTriangle.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "591386"
},
{
"name": "Batchfile",
"bytes": "122"
},
{
"name": "C#",
"bytes": "5141557"
},
{
"name": "CSS",
"bytes": "1506884"
},
{
"name": "CoffeeScript",
"bytes": "5994"
},
{
"name": "HTML",
"bytes": "1456770"
},
{
"name": "JavaScript",
"bytes": "18718229"
},
{
"name": "Makefile",
"bytes": "2344"
},
{
"name": "PowerShell",
"bytes": "468"
},
{
"name": "SQLPL",
"bytes": "21864"
},
{
"name": "Shell",
"bytes": "140"
},
{
"name": "XSLT",
"bytes": "4359"
}
]
}
|
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Bijdr. 670. 1826
#### Original name
null
### Remarks
null
|
{
"content_hash": "6b416dc3a8afbef6ebb78b9425bcb39e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 11.23076923076923,
"alnum_prop": 0.6917808219178082,
"repo_name": "mdoering/backbone",
"id": "bc9a76f68dbed34e1138032e608adc28f1b82963",
"size": "200",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Ericales/Ebenaceae/Diospyros/Diospyros macrophylla/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
using Nucleus.Maths;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Nucleus.Rendering
{
/// <summary>
/// A colour gradient that smoothly varies between colours keyed
/// at different double parameters
/// </summary>
[Serializable]
public class ColourGradient : LinearDataSet<Colour>
{
#region Constants
/// <summary>
/// A linear gradient from red to green
/// </summary>
public static ColourGradient RedToGreen = new ColourGradient(Colour.Red, Colour.Green);
#endregion
#region Constructors
/// <summary>
/// Initialise a new blank ColourGradient
/// </summary>
public ColourGradient() : base() { }
/// <summary>
/// Initialise a new data set containing the specified values.
/// Each value will be plotted against it's index in the list
/// </summary>
/// <param name="values"></param>
public ColourGradient(IList<Colour> values) : base(values) { }
/// <summary>
/// Initialise a new data set containing the specified values.
/// Each value will be plotted against it's index in the list
/// </summary>
/// <param name="values"></param>
public ColourGradient(params Colour[] values) : this((IList<Colour>)values) { }
/// <summary>
/// Initialise a new data set containing the specified initial pairing
/// of values
/// </summary>
/// <param name="firstKey"></param>
/// <param name="firstValue"></param>
public ColourGradient(double firstKey, Colour firstValue) : this()
{
Add(firstKey, firstValue);
}
/// <summary>
/// Initialise a new data set containing the specified constant value between
/// 0 and 1.0.
/// </summary>
/// <param name="constantValue"></param>
public ColourGradient(Colour constantValue) : this(0, constantValue, 1, constantValue) { }
/// <summary>
/// Initialise a new data set containing the two specified initial pairings
/// </summary>
/// <param name="firstKey"></param>
/// <param name="firstValue"></param>
/// <param name="secondKey"></param>
/// <param name="secondValue"></param>
public ColourGradient(double firstKey, Colour firstValue, double secondKey, Colour secondValue)
: this(firstKey, firstValue)
{
Add(secondKey, secondValue);
}
/// <summary>
/// Initialise a new data set containing the two specified initial pairings
/// </summary>
/// <param name="firstKey"></param>
/// <param name="firstValue"></param>
/// <param name="secondKey"></param>
/// <param name="secondValue"></param>
public ColourGradient(double firstKey, Colour firstValue, double secondKey, Colour secondValue, double thirdKey, Colour thirdValue)
: this(firstKey, firstValue)
{
Add(secondKey, secondValue);
Add(thirdKey, thirdValue);
}
#endregion
#region Methods
protected override Colour Interpolate(Colour v0, Colour v1, double u)
{
return Interpolation.Linear.Interpolate(v0, v1, u);
}
#endregion
}
}
|
{
"content_hash": "fe34f28afd1dd846004af6d865c7be0a",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 139,
"avg_line_length": 33.398058252427184,
"alnum_prop": 0.5906976744186047,
"repo_name": "pnjeffries/Nucleus",
"id": "0764de01c4ade61d4eb20c8ffcbc14e070100367",
"size": "3442",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Nucleus/Nucleus/Rendering/ColourGradient.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "4478271"
}
]
}
|
Summarizes either all selected figures or all figures in the document and displays the result in a notification.
##### Handles
- Multiline selections
- Multiple selections
- Entire documents

|
{
"content_hash": "8c245c27130405c1122288d8227c3bd2",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 112,
"avg_line_length": 36.125,
"alnum_prop": 0.8027681660899654,
"repo_name": "Fredrik01/atom-calculate",
"id": "c2beb242ed9016e5e4671ef3f26cca0c34706cd8",
"size": "315",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "237"
},
{
"name": "CoffeeScript",
"bytes": "6179"
}
]
}
|
package org.jetbrains.jps.incremental.scala
package local
import java.io.File
import java.net.URLClassLoader
import org.jetbrains.jps.incremental.scala.data.{CompilerData, CompilerJars, SbtData}
import org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl._
import org.jetbrains.jps.incremental.scala.model.IncrementalityType
import sbt.compiler.{AggressiveCompile, AnalyzingCompiler, IC}
import sbt.inc.AnalysisStore
import sbt.{ClasspathOptions, Path, ScalaInstance}
import xsbti.{F0, Logger}
/**
* @author Pavel Fatin
*/
class CompilerFactoryImpl(sbtData: SbtData) extends CompilerFactory {
def createCompiler(compilerData: CompilerData, client: Client, fileToStore: File => AnalysisStore): Compiler = {
val scalac: Option[AnalyzingCompiler] = getScalac(sbtData, compilerData.compilerJars, client)
compilerData.compilerJars match {
case Some(jars) if jars.dotty.isDefined =>
return new DottyCompiler(createScalaInstance(jars), jars)
case _ =>
}
compilerData.incrementalType match {
case IncrementalityType.SBT =>
val javac = {
val scala = getScalaInstance(compilerData.compilerJars)
.getOrElse(new ScalaInstance("stub", null, new File(""), new File(""), Seq.empty, None))
val classpathOptions = ClasspathOptions.javac(compiler = false)
AggressiveCompile.directOrFork(scala, classpathOptions, compilerData.javaHome)
}
new SbtCompiler(javac, scalac, fileToStore)
case IncrementalityType.IDEA =>
if (scalac.isDefined) new IdeaIncrementalCompiler(scalac.get)
else throw new IllegalStateException("Could not create scalac instance")
}
}
def getScalac(sbtData: SbtData, compilerJars: Option[CompilerJars], client: Client): Option[AnalyzingCompiler] = {
getScalaInstance(compilerJars).map { scala =>
val compiledIntefaceJar = getOrCompileInterfaceJar(sbtData.interfacesHome, sbtData.sourceJar,
sbtData.interfaceJar, scala, sbtData.javaClassVersion, Option(client))
IC.newScalaCompiler(scala, compiledIntefaceJar, ClasspathOptions.javac(compiler = false))
}
}
private def getScalaInstance(compilerJars: Option[CompilerJars]): Option[ScalaInstance] =
compilerJars.map(createScalaInstance)
}
object CompilerFactoryImpl {
private val scalaInstanceCache = new Cache[CompilerJars, ScalaInstance](3)
def createScalaInstance(jars: CompilerJars): ScalaInstance = {
scalaInstanceCache.getOrUpdate(jars) {
val classLoader = {
val urls = Path.toURLs(jars.library +: jars.compiler +: jars.extra)
new URLClassLoader(urls, sbt.classpath.ClasspathUtilities.rootLoader)
}
val version = readScalaVersionIn(classLoader)
new ScalaInstance(version.getOrElse("unknown"), classLoader, jars.library, jars.compiler, jars.extra, version)
}
}
def readScalaVersionIn(classLoader: ClassLoader): Option[String] =
readProperty(classLoader, "compiler.properties", "version.number")
def getOrCompileInterfaceJar(home: File,
sourceJar: File,
interfaceJar: File,
scalaInstance: ScalaInstance,
javaClassVersion: String,
client: Option[Client]): File = {
val scalaVersion = scalaInstance.actualVersion
val interfaceId = "compiler-interface-" + scalaVersion + "-" + javaClassVersion
val targetJar = new File(home, interfaceId + ".jar")
if (!targetJar.exists) {
client.foreach(_.progress("Compiling Scalac " + scalaVersion + " interface"))
home.mkdirs()
IC.compileInterfaceJar(interfaceId, sourceJar, targetJar, interfaceJar, scalaInstance, NullLogger)
}
targetJar
}
}
object NullLogger extends Logger {
def error(p1: F0[String]) {}
def warn(p1: F0[String]) {}
def info(p1: F0[String]) {}
def debug(p1: F0[String]) {}
def trace(p1: F0[Throwable]) {}
}
|
{
"content_hash": "6fbe5a18b51fc7bba40400625417d656",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 116,
"avg_line_length": 35.86725663716814,
"alnum_prop": 0.6925734024179621,
"repo_name": "loskutov/intellij-scala",
"id": "bb7a83f537210da6f1e657cbabf8b7a9e34ff577",
"size": "4053",
"binary": false,
"copies": "2",
"ref": "refs/heads/idea172.x-better-implicits",
"path": "jps-plugin/src/org/jetbrains/jps/incremental/scala/local/CompilerFactoryImpl.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "55566"
},
{
"name": "Java",
"bytes": "1397858"
},
{
"name": "Lex",
"bytes": "35728"
},
{
"name": "Scala",
"bytes": "11387086"
},
{
"name": "Shell",
"bytes": "537"
}
]
}
|
function [ M ] = simGaussian( M, sigma )
%SIMGAUSSIAN Calculates Gaussian similarity on matrix
% simGaussian(M, sigma) returns a matrix of the same size as
% the distance matrix M, which contains similarity values
% that are computed by using a Gaussian similarity function
% with parameter sigma.
%
% Author: Ingo Buerk
% Year : 2011/2012
% Bachelor Thesis
M = exp(-M.^2 ./ (2*sigma^2));
end
|
{
"content_hash": "0bb5bad93617a49501d488b7cff13ea2",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 62,
"avg_line_length": 30.285714285714285,
"alnum_prop": 0.6839622641509434,
"repo_name": "jejjohnson/manifold_learning",
"id": "b768e520d00e81532e61309339d08ce7a54783d2",
"size": "424",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "src/matlab/external_toolboxes/SpectralClustering/files/other/simGaussian.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "2843"
},
{
"name": "C",
"bytes": "34842"
},
{
"name": "C++",
"bytes": "721577"
},
{
"name": "CMake",
"bytes": "59204"
},
{
"name": "Cuda",
"bytes": "143046"
},
{
"name": "HTML",
"bytes": "1310"
},
{
"name": "Java",
"bytes": "573"
},
{
"name": "Jupyter Notebook",
"bytes": "2760928"
},
{
"name": "M",
"bytes": "5477"
},
{
"name": "Makefile",
"bytes": "29952"
},
{
"name": "Matlab",
"bytes": "1463787"
},
{
"name": "Python",
"bytes": "169950"
},
{
"name": "Shell",
"bytes": "322"
},
{
"name": "TeX",
"bytes": "74581"
},
{
"name": "VHDL",
"bytes": "382"
},
{
"name": "Verilog",
"bytes": "432"
}
]
}
|
.class public Landroid/media/effect/FilterGraphEffect;
.super Landroid/media/effect/FilterEffect;
.source "FilterGraphEffect.java"
# static fields
.field private static final TAG:Ljava/lang/String; = "FilterGraphEffect"
# instance fields
.field protected mGraph:Landroid/filterfw/core/FilterGraph;
.field protected mInputName:Ljava/lang/String;
.field protected mOutputName:Ljava/lang/String;
.field protected mRunner:Landroid/filterfw/core/GraphRunner;
.field protected mSchedulerClass:Ljava/lang/Class;
# direct methods
.method public constructor <init>(Landroid/media/effect/EffectContext;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Class;)V
.locals 0
.parameter "context"
.parameter "name"
.parameter "graphString"
.parameter "inputName"
.parameter "outputName"
.parameter "scheduler"
.prologue
.line 63
invoke-direct {p0, p1, p2}, Landroid/media/effect/FilterEffect;-><init>(Landroid/media/effect/EffectContext;Ljava/lang/String;)V
.line 65
iput-object p4, p0, Landroid/media/effect/FilterGraphEffect;->mInputName:Ljava/lang/String;
.line 66
iput-object p5, p0, Landroid/media/effect/FilterGraphEffect;->mOutputName:Ljava/lang/String;
.line 67
iput-object p6, p0, Landroid/media/effect/FilterGraphEffect;->mSchedulerClass:Ljava/lang/Class;
.line 68
invoke-direct {p0, p3}, Landroid/media/effect/FilterGraphEffect;->createGraph(Ljava/lang/String;)V
.line 70
return-void
.end method
.method private createGraph(Ljava/lang/String;)V
.locals 6
.parameter "graphString"
.prologue
.line 73
new-instance v1, Landroid/filterfw/io/TextGraphReader;
invoke-direct {v1}, Landroid/filterfw/io/TextGraphReader;-><init>()V
.line 75
.local v1, reader:Landroid/filterfw/io/GraphReader;
:try_start_0
invoke-virtual {v1, p1}, Landroid/filterfw/io/TextGraphReader;->readGraphString(Ljava/lang/String;)Landroid/filterfw/core/FilterGraph;
move-result-object v2
iput-object v2, p0, Landroid/media/effect/FilterGraphEffect;->mGraph:Landroid/filterfw/core/FilterGraph;
:try_end_0
.catch Landroid/filterfw/io/GraphIOException; {:try_start_0 .. :try_end_0} :catch_0
.line 80
iget-object v2, p0, Landroid/media/effect/FilterGraphEffect;->mGraph:Landroid/filterfw/core/FilterGraph;
if-nez v2, :cond_0
.line 81
new-instance v2, Ljava/lang/RuntimeException;
const-string v3, "Could not setup effect"
invoke-direct {v2, v3}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
throw v2
.line 76
:catch_0
move-exception v0
.line 77
.local v0, e:Landroid/filterfw/io/GraphIOException;
new-instance v2, Ljava/lang/RuntimeException;
const-string v3, "Could not setup effect"
invoke-direct {v2, v3, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
throw v2
.line 83
.end local v0 #e:Landroid/filterfw/io/GraphIOException;
:cond_0
new-instance v2, Landroid/filterfw/core/SyncRunner;
invoke-virtual {p0}, Landroid/media/effect/FilterGraphEffect;->getFilterContext()Landroid/filterfw/core/FilterContext;
move-result-object v3
iget-object v4, p0, Landroid/media/effect/FilterGraphEffect;->mGraph:Landroid/filterfw/core/FilterGraph;
iget-object v5, p0, Landroid/media/effect/FilterGraphEffect;->mSchedulerClass:Ljava/lang/Class;
invoke-direct {v2, v3, v4, v5}, Landroid/filterfw/core/SyncRunner;-><init>(Landroid/filterfw/core/FilterContext;Landroid/filterfw/core/FilterGraph;Ljava/lang/Class;)V
iput-object v2, p0, Landroid/media/effect/FilterGraphEffect;->mRunner:Landroid/filterfw/core/GraphRunner;
.line 84
return-void
.end method
# virtual methods
.method public apply(IIII)V
.locals 5
.parameter "inputTexId"
.parameter "width"
.parameter "height"
.parameter "outputTexId"
.prologue
.line 88
invoke-virtual {p0}, Landroid/media/effect/FilterGraphEffect;->beginGLEffect()V
.line 89
iget-object v3, p0, Landroid/media/effect/FilterGraphEffect;->mGraph:Landroid/filterfw/core/FilterGraph;
iget-object v4, p0, Landroid/media/effect/FilterGraphEffect;->mInputName:Ljava/lang/String;
invoke-virtual {v3, v4}, Landroid/filterfw/core/FilterGraph;->getFilter(Ljava/lang/String;)Landroid/filterfw/core/Filter;
move-result-object v2
.line 90
.local v2, src:Landroid/filterfw/core/Filter;
if-eqz v2, :cond_0
.line 91
const-string/jumbo v3, "texId"
invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v4
invoke-virtual {v2, v3, v4}, Landroid/filterfw/core/Filter;->setInputValue(Ljava/lang/String;Ljava/lang/Object;)V
.line 92
const-string/jumbo v3, "width"
invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v4
invoke-virtual {v2, v3, v4}, Landroid/filterfw/core/Filter;->setInputValue(Ljava/lang/String;Ljava/lang/Object;)V
.line 93
const-string v3, "height"
invoke-static {p3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v4
invoke-virtual {v2, v3, v4}, Landroid/filterfw/core/Filter;->setInputValue(Ljava/lang/String;Ljava/lang/Object;)V
.line 97
iget-object v3, p0, Landroid/media/effect/FilterGraphEffect;->mGraph:Landroid/filterfw/core/FilterGraph;
iget-object v4, p0, Landroid/media/effect/FilterGraphEffect;->mOutputName:Ljava/lang/String;
invoke-virtual {v3, v4}, Landroid/filterfw/core/FilterGraph;->getFilter(Ljava/lang/String;)Landroid/filterfw/core/Filter;
move-result-object v0
.line 98
.local v0, dest:Landroid/filterfw/core/Filter;
if-eqz v0, :cond_1
.line 99
const-string/jumbo v3, "texId"
invoke-static {p4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move-result-object v4
invoke-virtual {v0, v3, v4}, Landroid/filterfw/core/Filter;->setInputValue(Ljava/lang/String;Ljava/lang/Object;)V
.line 104
:try_start_0
iget-object v3, p0, Landroid/media/effect/FilterGraphEffect;->mRunner:Landroid/filterfw/core/GraphRunner;
invoke-virtual {v3}, Landroid/filterfw/core/GraphRunner;->run()V
:try_end_0
.catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_0
.line 108
invoke-virtual {p0}, Landroid/media/effect/FilterGraphEffect;->endGLEffect()V
.line 109
return-void
.line 95
.end local v0 #dest:Landroid/filterfw/core/Filter;
:cond_0
new-instance v3, Ljava/lang/RuntimeException;
const-string v4, "Internal error applying effect"
invoke-direct {v3, v4}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
throw v3
.line 101
.restart local v0 #dest:Landroid/filterfw/core/Filter;
:cond_1
new-instance v3, Ljava/lang/RuntimeException;
const-string v4, "Internal error applying effect"
invoke-direct {v3, v4}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
throw v3
.line 105
:catch_0
move-exception v1
.line 106
.local v1, e:Ljava/lang/RuntimeException;
new-instance v3, Ljava/lang/RuntimeException;
const-string v4, "Internal error applying effect: "
invoke-direct {v3, v4, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
throw v3
.end method
.method public release()V
.locals 2
.prologue
.line 117
iget-object v0, p0, Landroid/media/effect/FilterGraphEffect;->mGraph:Landroid/filterfw/core/FilterGraph;
invoke-virtual {p0}, Landroid/media/effect/FilterGraphEffect;->getFilterContext()Landroid/filterfw/core/FilterContext;
move-result-object v1
invoke-virtual {v0, v1}, Landroid/filterfw/core/FilterGraph;->tearDown(Landroid/filterfw/core/FilterContext;)V
.line 118
const/4 v0, 0x0
iput-object v0, p0, Landroid/media/effect/FilterGraphEffect;->mGraph:Landroid/filterfw/core/FilterGraph;
.line 119
return-void
.end method
.method public setParameter(Ljava/lang/String;Ljava/lang/Object;)V
.locals 0
.parameter "parameterKey"
.parameter "value"
.prologue
.line 113
return-void
.end method
|
{
"content_hash": "5e02ab3faecfe6b3a04179cc70937ba6",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 170,
"avg_line_length": 29.755395683453237,
"alnum_prop": 0.7188104448742747,
"repo_name": "baidurom/devices-base",
"id": "7cc806d897e24805c0a3760bf41d517159a807b5",
"size": "8272",
"binary": false,
"copies": "4",
"ref": "refs/heads/coron-4.2",
"path": "vendor/aosp/framework.jar.out/smali/android/media/effect/FilterGraphEffect.smali",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Makefile",
"bytes": "12535"
}
]
}
|
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="install_cancel_button">#FF4444</color>
<color name="install_success_button">#99CC00</color>
<color name="separator_dark">#33B5E5</color>
<color name="separator_light">#0099CC</color>
<color name="background_dark">#313131</color>
<color name="background_light">#d1d1d1</color>
<color name="pressed_flavored">#CC33B5E5</color>
<color name="app_not_installed">#ff4444</color>
<color name="app_not_installed_matches">#cc0000</color>
<color name="app_matches">#0099CC</color>
</resources>
|
{
"content_hash": "5fbc67a40b3bc6a9000cc046f954366a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 59,
"avg_line_length": 45.15384615384615,
"alnum_prop": 0.6831345826235093,
"repo_name": "fedefernandez/MyAppList",
"id": "c11cdfbd01ba8e7d694b0c5a9a7322fb3f82d8c3",
"size": "587",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/src/main/res/values/colors.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "215753"
}
]
}
|
package org.apache.logging.log4j.core.helpers;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
import org.apache.logging.log4j.core.config.plugins.PluginFactory;
/**
* Key/Value pair configuration item.
*/
@Plugin(name = "KeyValuePair", category = "Core", printObject = true)
public class KeyValuePair {
private final String key;
private final String value;
/**
* Constructs a key/value pair. The constructor should only be called from test classes.
* @param key The key.
* @param value The value.
*/
public KeyValuePair(final String key, final String value) {
this.key = key;
this.value = value;
}
/**
* Returns the key.
* @return the key.
*/
public String getKey() {
return key;
}
/**
* Returns the value.
* @return The value.
*/
public String getValue() {
return value;
}
@Override
public String toString() {
return key + "=" + value;
}
/**
* Create a Key/Value pair.
* @param key The key.
* @param value The value.
* @return A KeyValuePair.
*/
@PluginFactory
public static KeyValuePair createPair(
@PluginAttribute("key") final String key,
@PluginAttribute("value") final String value) {
return new KeyValuePair(key, value);
}
}
|
{
"content_hash": "63f34d47977db08b44197695d6aea290",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 92,
"avg_line_length": 23.704918032786885,
"alnum_prop": 0.6168741355463347,
"repo_name": "ClarenceAu/log4j2",
"id": "b22c4ceff41986e9a6123e5cdb8c2b96deae8547",
"size": "2246",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/KeyValuePair.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "125403"
},
{
"name": "Java",
"bytes": "3535721"
},
{
"name": "JavaScript",
"bytes": "115015"
}
]
}
|
#pragma once
#include <cstddef>
#include <cstdint>
namespace hadesmem
{
class Process;
class PeFile;
}
void DisassembleEp(hadesmem::Process const& process,
hadesmem::PeFile const& pe_file,
std::uintptr_t ep_rva,
void* ep_va,
std::size_t tabs);
|
{
"content_hash": "22e50fd363442696665e6a7e67070d11",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 52,
"avg_line_length": 20.058823529411764,
"alnum_prop": 0.5366568914956011,
"repo_name": "geota/hadesmem",
"id": "db92e66ffa26de9dc68e2d8cf5f27984f1047e41",
"size": "431",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "examples/dump/disassemble.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "34177"
},
{
"name": "C",
"bytes": "5830"
},
{
"name": "C++",
"bytes": "1406471"
},
{
"name": "PowerShell",
"bytes": "5752"
}
]
}
|
package net.sourceforge.plantuml.activitydiagram.command;
import java.util.List;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass;
import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines2;
import net.sourceforge.plantuml.command.MultilinesStrategy;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorType;
public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram> {
public CommandLinkLongActivity() {
super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE);
}
@Override
public String getPatternEnd() {
return "(?i)^[%s]*([^%g]*)[%g](?:[%s]+as[%s]+([\\p{L}0-9][\\p{L}0-9_.]*))?[%s]*(\\<\\<.*\\>\\>)?[%s]*(?:in[%s]+([%g][^%g]+[%g]|\\S+))?[%s]*(#\\w+)?$";
}
static RegexConcat getRegexConcat() {
return new RegexConcat(new RegexLeaf("^"), //
new RegexOptional(//
new RegexOr("FIRST", //
new RegexLeaf("STAR", "(\\(\\*(top)?\\))"), //
new RegexLeaf("CODE", "([\\p{L}0-9][\\p{L}0-9_.]*)"), //
new RegexLeaf("BAR", "(?:==+)[%s]*([\\p{L}0-9_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([\\p{L}0-9_.]+))?"))), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("BACKCOLOR", "(#\\w+)?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
new RegexLeaf("ARROW_BODY1", "([-.]+)"), //
new RegexLeaf("ARROW_STYLE1",
"(?:\\[((?:#\\w+|dotted|dashed|plain|bold|hidden)(?:,#\\w+|,dotted|,dashed|,plain|,bold|,hidden)*)\\])?"), //
new RegexLeaf("ARROW_DIRECTION", "(\\*|left|right|up|down|le?|ri?|up?|do?)?"), //
new RegexLeaf("ARROW_STYLE2",
"(?:\\[((?:#\\w+|dotted|dashed|plain|bold|hidden)(?:,#\\w+|,dotted|,dashed|,plain|,bold|,hidden)*)\\])?"), //
new RegexLeaf("ARROW_BODY2", "([-.]*)\\>"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("BRACKET", "(?:\\[([^\\]*]+[^\\]]*)\\])?"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("DESC", "[%g]([^%g]*?)"), //
new RegexLeaf("[%s]*"), //
new RegexLeaf("$"));
}
public CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) {
lines = lines.trim(false);
final RegexResult line0 = getStartingPattern().matcher(StringUtils.trin(lines.getFirst499()));
final IEntity entity1 = CommandLinkActivity.getEntity(diagram, line0, true);
if (line0.get("STEREOTYPE", 0) != null) {
entity1.setStereotype(new Stereotype(line0.get("STEREOTYPE", 0)));
}
if (line0.get("BACKCOLOR", 0) != null) {
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet()
.getColorIfValid(line0.get("BACKCOLOR", 0)));
}
final StringBuilder sb = new StringBuilder();
final String desc0 = line0.get("DESC", 0);
Url urlActivity = null;
if (StringUtils.isNotEmpty(desc0)) {
urlActivity = extractUrl(diagram, desc0);
if (urlActivity == null) {
sb.append(desc0);
sb.append("\\n");
}
}
int i = 0;
for (CharSequence cs : lines.subExtract(1, 1)) {
i++;
if (i == 1 && urlActivity == null) {
urlActivity = extractUrl(diagram, cs);
if (urlActivity != null) {
continue;
}
}
sb.append(cs);
if (i < lines.size() - 2) {
sb.append("\\n");
}
}
final List<String> lineLast = StringUtils.getSplit(MyPattern.cmpile(getPatternEnd()), lines.getLast499()
.toString());
if (StringUtils.isNotEmpty(lineLast.get(0))) {
if (sb.length() > 0 && sb.toString().endsWith("\\n") == false) {
sb.append("\\n");
}
sb.append(lineLast.get(0));
}
final String display = sb.toString();
final Code code = Code.of(lineLast.get(1) == null ? display : lineLast.get(1));
String partition = null;
if (lineLast.get(3) != null) {
partition = lineLast.get(3);
partition = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(partition);
}
if (partition != null) {
diagram.getOrCreateGroup(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, null);
}
final IEntity entity2 = diagram.createLeaf(code, Display.getWithNewlines(display), LeafType.ACTIVITY, null);
if (partition != null) {
diagram.endGroup();
}
if (urlActivity != null) {
entity2.addUrl(urlActivity);
}
if (lineLast.get(2) != null) {
entity2.setStereotype(new Stereotype(lineLast.get(2)));
}
if (lineLast.get(4) != null) {
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(lineLast.get(4)));
}
if (entity1 == null || entity2 == null) {
return CommandExecutionResult.error("No such entity");
}
final String arrowBody1 = CommandLinkClass.notNull(line0.get("ARROW_BODY1", 0));
final String arrowBody2 = CommandLinkClass.notNull(line0.get("ARROW_BODY2", 0));
final String arrowDirection = CommandLinkClass.notNull(line0.get("ARROW_DIRECTION", 0));
final String arrow = StringUtils.manageArrowForCuca(arrowBody1 + arrowDirection + arrowBody2 + ">");
final int lenght = arrow.length() - 1;
final Display linkLabel = Display.getWithNewlines(line0.get("BRACKET", 0));
LinkType type = new LinkType(LinkDecor.ARROW, LinkDecor.NONE);
if (arrow.contains(".")) {
type = type.getDotted();
}
Link link = new Link(entity1, entity2, type, linkLabel, lenght);
final Direction direction = StringUtils.getArrowDirection(arrowBody1 + arrowDirection + arrowBody2 + ">");
if (direction == Direction.LEFT || direction == Direction.UP) {
link = link.getInv();
}
if (line0.get("URL", 0) != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
final Url urlLink = urlBuilder.getUrl(line0.get("URL", 0));
link.setUrl(urlLink);
}
CommandLinkClass.applyStyle(line0.getLazzy("ARROW_STYLE", 0), link);
diagram.addLink(link);
return CommandExecutionResult.ok();
}
public Url extractUrl(final ActivityDiagram diagram, CharSequence string) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
return urlBuilder.getUrl(string.toString());
}
}
|
{
"content_hash": "1f22a6125bbe531191cf67cd3769d912",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 152,
"avg_line_length": 38.795811518324605,
"alnum_prop": 0.6766531713900135,
"repo_name": "Banno/sbt-plantuml-plugin",
"id": "691bddacafdfb11f30d52ef321203edb5e2a913e",
"size": "8329",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "12451864"
},
{
"name": "Scala",
"bytes": "7987"
},
{
"name": "Shell",
"bytes": "1069"
}
]
}
|
package cn.droidlover.xdroid.net.converter.gson;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import java.io.IOException;
import cn.droidlover.xdroid.net.exception.ResultErrorException;
import cn.droidlover.xdroid.net.model.SimpleModel;
import okhttp3.ResponseBody;
import retrofit2.Converter;
final class GsonResponseBodyConverter<T> implements Converter<ResponseBody, T> {
private final Gson gson;
private final TypeAdapter<T> adapter;
GsonResponseBodyConverter(Gson gson, TypeAdapter<T> adapter) {
this.gson = gson;
this.adapter = adapter;
}
@Override
public T convert(ResponseBody value) throws IOException {
JsonReader jsonReader = gson.newJsonReader(value.charStream());
try {
T t = adapter.read(jsonReader);
if (t instanceof SimpleModel && !((SimpleModel) t).isValid()) {
throw new ResultErrorException(((SimpleModel) t).getResultCode(), ((SimpleModel) t).getResultMsg());
}
return t;
} finally {
value.close();
}
}
}
|
{
"content_hash": "a9c2d0af9594a658902126e355eb4e63",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 116,
"avg_line_length": 31.805555555555557,
"alnum_prop": 0.6803493449781659,
"repo_name": "fodroid/XDroid-Databinding",
"id": "e2bf94ebd024a70cb9eb519db0fc0bc5d2498cc3",
"size": "1145",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "library/src/main/java/cn/droidlover/xdroid/net/converter/gson/GsonResponseBodyConverter.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "105881"
}
]
}
|
End of preview.
No dataset card yet
- Downloads last month
- 4