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 538
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 1923)
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 538
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 |
|---|---|
(function() {
'use strict';
describe('Directive: disableEntry', function() {
var element,
$scope,
$compile;
function createElement(hasAccess){
$scope.entity.has_access = hasAccess;
$compile(element)($scope);
$scope.$digest();
return element;
}
beforeEach(function() {
module('PDRClient');
inject(function(_$rootScope_, _$compile_) {
$scope = _$rootScope_.$new(true);
$compile = _$compile_;
$scope.entity = {};
element = angular.element("<div class='disable-entry'>");
});
});
describe('when has_access is false', function() {
beforeEach(function() {
element = createElement(false);
});
it('sets opacity to 0.5', function() {
expect(element.css('opacity')).toEqual('0.5');
});
});
describe('when has_access is true', function() {
beforeEach(function() {
element = createElement(true);
});
it('keeps opacity 1', function() {
expect(element.css('opacity')).toEqual('1');
});
});
});
})();
|
{
"content_hash": "ce8db3d6d75a3a564170b4b6ad7e636d",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 65,
"avg_line_length": 24.533333333333335,
"alnum_prop": 0.5389492753623188,
"repo_name": "MobilityLabs/pdredesign-server",
"id": "9facf143ec86a5a0e87c40df6a647b448f31c2e3",
"size": "1104",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/javascripts/common_list/disableEntrySpec.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "63259"
},
{
"name": "Dockerfile",
"bytes": "769"
},
{
"name": "HTML",
"bytes": "311103"
},
{
"name": "JavaScript",
"bytes": "597188"
},
{
"name": "Ruby",
"bytes": "835087"
},
{
"name": "SQLPL",
"bytes": "946591"
},
{
"name": "Shell",
"bytes": "48"
}
]
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Kooboo.CMS.Sites
{
public class SiteRepositoryNotExists : KoobooException
{
public SiteRepositoryNotExists()
: base("The site repository doest not exists.")
{
}
}
}
|
{
"content_hash": "73ef6206733f1f5f4a6fee6769567c92",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 59,
"avg_line_length": 19.5,
"alnum_prop": 0.6602564102564102,
"repo_name": "Epitomy/CMS",
"id": "cfa30c2a25d89566ac912d95c14369a17b373eaa",
"size": "314",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Kooboo.CMS/Kooboo.CMS.Sites/SiteRepositoryNotExists.cs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "1438191"
},
{
"name": "C#",
"bytes": "4602076"
},
{
"name": "JavaScript",
"bytes": "6347088"
},
{
"name": "Shell",
"bytes": "9165"
},
{
"name": "Visual Basic",
"bytes": "1200"
}
]
}
|
README Languages: [DE](README/README-DE.md) | [ES](README/README-ES.md) | [FR](README/README-FR.md) | [IT](README/README-IT.md) | [JP](README/README-JP.md) | [KR](README/README-KR.md) |
[PT](README/README-PT.md) | [RU](README/README-RU.md) |
[CN](README/README-CN.md) | [TW](README/README-TW.md)
You can use [AWS Lambda](http://aws.amazon.com/lambda/) and Amazon Kinesis to process real-time streaming data for application activity tracking, transaction order processing, click stream analysis, data cleansing, metrics generation, log filtering, indexing, social media analysis, and IoT device data telemetry and metering. The architecture described in this [diagram](https://s3.amazonaws.com/awslambda-reference-architectures/stream-processing/lambda-refarch-streamprocessing.pdf) can be created with an AWS CloudFormation template.
[The template](https://s3.amazonaws.com/awslambda-reference-architectures/stream-processing/template.yaml)
does the following:
- Creates a Kinesis Stream
- Creates a DynamoDB table named <stackname>-EventData
- Creates Lambda Function 1 (<stackname>-DDBEventProcessor)
which receives records from Kinesis and writes records to the
DynamoDB table
- Creates an IAM Role and Policy to allow the event processing Lambda
function read from the Kinesis Stream and write to the DynamoDB table
- Creates an IAM user with permission to put events in the Kinesis stream
together with credentials for the user to use in an API client
## Instructions
Step 1 - Create an AWS CloudFormation stack with [the
template](https://s3.amazonaws.com/awslambda-reference-architectures/stream-processing/template.yaml). The AWS CloudFormation template completely automates the building, deployment, and configuration of all the components of the application.
[](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=lambda-refarch-streamprocessing&templateURL=https://s3.amazonaws.com/awslambda-reference-architectures/stream-processing/template.yaml)
Step 2 - Once the AWS CloudFormation stack has successfully been created you can do select the Outputs tab and see the AWS parameters needed in the demo Twitter client in the steps below.
Step 3 - To run the example application you need to update the code with AWS and Twitter information. Open producer/twitter2kinesis.py in a text editor.
Step 4 - To access the Twitter API you need to get [access tokens](https://dev.twitter.com/oauth/overview/application-owner-access-tokens). Make sure you have these available and enter the information in the following parameters:
The Twitter API parameters
```
consumer_key = ""
consumer_secret = ""
access_token_key = ""
access_token_secret = ""
```
Step 5 - Enter the values for the AWS credentials and Amazon Kinesis stream name. This is the information from the Outputs tab of the CloudFormation template you got in step 2:
AWS parameters - from the Outputs tab of the CloudFormation template
```
access_key = ""
secret_access_key = ""
region = ""
stream_name = ""
```
Step 6 - Finally, before running the example code, you need [Python](https://www.python.org/) installed together with the Python modules boto3 and TwitterAPI. If you don't have the modules already, install them using [pip](http://pip.readthedocs.org/en/stable/installing/):
```
pip install -r requirements.txt
```
## Test

Step 1 - Run the producer/twitter2kinesis.py Python application from the command line to start sending tweets into the Kinesis stream.
```
python twitter2kinesis.py
```
Step 2 - In the Amazon DynamoDB management console, select the table named <stackname>-EventData and explore the records.
## Cleanup
To remove all created resources, delete the AWS CloudFormation stack.
|
{
"content_hash": "aadae48e15e585d5f34f776072de1b15",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 537,
"avg_line_length": 53.85333333333333,
"alnum_prop": 0.7781629116117851,
"repo_name": "awslabs/lambda-refarch-streamprocessing",
"id": "8f07dff9c6febd1228c8520b0c8aaf31c86f30ff",
"size": "4104",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "2632"
},
{
"name": "Python",
"bytes": "1482"
}
]
}
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="GENERATOR" content="VSdocman - documentation generator; https://www.helixoft.com" />
<link rel="icon" href="favicon.ico">
<title>PhoneNumberHelper.RemoveFirstLeadingZero Method</title>
<link rel="stylesheet" type="text/css" href="msdn2019/toc.css" />
<script src="msdn2019/toc.js"></script>
<link rel="stylesheet" type="text/css" href="msdn2019/msdn2019.css"></link>
<script src="msdn2019/msdn2019.js" type="text/javascript"></script>
<script src="SyntaxHighlighter/scripts/shCore_helixoft.js" type="text/javascript"></script>
<script src="SyntaxHighlighter/scripts/shBrushVb.js" type="text/javascript"></script>
<script src="SyntaxHighlighter/scripts/shBrushCSharp.js" type="text/javascript"></script>
<script src="SyntaxHighlighter/scripts/shBrushFSharp.js" type="text/javascript"></script>
<script src="SyntaxHighlighter/scripts/shBrushCpp.js" type="text/javascript"></script>
<script src="SyntaxHighlighter/scripts/shBrushJScript.js" type="text/javascript"></script>
<link href="SyntaxHighlighter/styles/shCore.css" rel="stylesheet" type="text/css" />
<link href="SyntaxHighlighter/styles/shThemeMsdnLW.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
SyntaxHighlighter.all();
</script>
<link rel="stylesheet" type="text/css" href="vsdocman_overrides.css"></link>
</head>
<body style="direction: ltr;">
<div id="topic">
<!--HEADER START-->
<div id="header">
<div id="header-top-container">
<div id="header-top-parent-container1">
<div id="header-top-container1">
<div id="runningHeaderText1"><a id="headerLogo" href="#" onclick="window.location.href = getCssCustomProperty('--headerLogoLink'); return false;">logo</a></div>
<div id="runningHeaderText1b"><script>
document.write(getCssCustomProperty('--headerTopCustomLineHtml'));
</script></div>
</div>
</div>
<div id="header-top-container2">
<div id="runningHeaderText">SOLUTION-WIDE PROPERTIES Reference</div>
<div id="search-bar-container">
<form id="search-bar" action="search--.html">
<input id="HeaderSearchInput" type="search" name="search" placeholder="Search" >
<button id="btn-search" class="c-glyph" title="Search">
<span>Search</span>
</button>
</form>
<button id="cancel-search" class="cancel-search" title="Cancel">
<span>Cancel</span>
</button>
</div>
</div>
</div>
<hr />
<div id="header-breadcrumbs"></div>
<div id="headerLinks">
</div>
<hr />
</div>
<!--HEADER END-->
<div id="mainSection">
<div id="toc-area">
<div id="toc-container" class="stickthis full-height">
<div id="-1"></div>
<div id="c-1">
<div id="ci-1" class="inner-for-height"></div>
</div>
</div>
</div>
<div id="mainBody">
<h1 class="title">PhoneNumberHelper.RemoveFirstLeadingZero Method</h1>
<div class="metadata">
Namespace:
<a href="topic_00000000000004A2.html">Tlece.Recruitment.Helpers</a>
<br />Assembly: Tlece.Recruitment (in Tlece.Recruitment.dll)
</div>
<div class="section_container">
<div id="syntaxSection" class="section">
<div id="syntaxCodeBlocks">
<div class="codeSnippetContainer">
<div class="codeSnippetTabs">
<div class="codeSnippetTabLeftCornerActive">
</div>
<div class="codeSnippetTab csFirstTab csActiveTab codeVB">
<a>VB</a>
</div>
<div class="codeSnippetTab csNaTab codeCsharp">
<a href="javascript: CodeSnippet_SetLanguage('Csharp');">C#</a>
</div>
<div class="codeSnippetTab csNaTab codeFsharp">
<a href="javascript: CodeSnippet_SetLanguage('Fsharp');">F#</a>
</div>
<div class="codeSnippetTab csNaTab codeCpp">
<a href="javascript: CodeSnippet_SetLanguage('Cpp');">C++</a>
</div>
<div class="codeSnippetTab csLastTab csNaTab codeJScript">
<a href="javascript: CodeSnippet_SetLanguage('JScript');">JScript</a>
</div>
<div class="codeSnippetTabRightCorner">
</div>
<div style="clear:both;">
</div>
</div>
<div class="codeSnippetCodeCollection">
<div class="codeSnippetToolbar">
<a title="Copy to clipboard." href="javascript:void(0)" onclick="CopyCode(this);">Copy</a>
</div>
<div class="codeSnippetCode codeVB">
<pre xml:space="preserve" class="brush: vb">Public Shared Function RemoveFirstLeadingZero( _ <br /> ByVal <i>input</i> As <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a> _ <br />) As <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a></pre>
</div>
<div class="codeSnippetCode codeNA">
<pre xml:space="preserve">This language is not supported or no code example is available.</pre>
</div>
</div>
</div>
<div class="codeSnippetContainer">
<div class="codeSnippetTabs">
<div class="codeSnippetTabLeftCorner">
</div>
<div class="codeSnippetTab csFirstTab csNaTab codeVB">
<a>VB</a>
</div>
<div class="codeSnippetTab csActiveTab codeCsharp">
<a href="javascript: CodeSnippet_SetLanguage('Csharp');">C#</a>
</div>
<div class="codeSnippetTab csNaTab codeFsharp">
<a href="javascript: CodeSnippet_SetLanguage('Fsharp');">F#</a>
</div>
<div class="codeSnippetTab csNaTab codeCpp">
<a href="javascript: CodeSnippet_SetLanguage('Cpp');">C++</a>
</div>
<div class="codeSnippetTab csLastTab csNaTab codeJScript">
<a href="javascript: CodeSnippet_SetLanguage('JScript');">JScript</a>
</div>
<div class="codeSnippetTabRightCorner">
</div>
<div style="clear:both;">
</div>
</div>
<div class="codeSnippetCodeCollection">
<div class="codeSnippetToolbar">
<a title="Copy to clipboard." href="javascript:void(0)" onclick="CopyCode(this);">Copy</a>
</div>
<div class="codeSnippetCode codeCsharp">
<pre xml:space="preserve" class="brush: csharp">public static <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.string">string</a> RemoveFirstLeadingZero( <br /> <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.string">string</a> <i>input</i> <br />)</pre>
</div>
<div class="codeSnippetCode codeNA">
<pre xml:space="preserve">This language is not supported or no code example is available.</pre>
</div>
</div>
</div>
<div class="codeSnippetContainer">
<div class="codeSnippetTabs">
<div class="codeSnippetTabLeftCorner">
</div>
<div class="codeSnippetTab csFirstTab csNaTab codeVB">
<a>VB</a>
</div>
<div class="codeSnippetTab csNaTab codeCsharp">
<a href="javascript: CodeSnippet_SetLanguage('Csharp');">C#</a>
</div>
<div class="codeSnippetTab csNaTab codeFsharp">
<a href="javascript: CodeSnippet_SetLanguage('Fsharp');">F#</a>
</div>
<div class="codeSnippetTab csActiveTab codeCpp">
<a href="javascript: CodeSnippet_SetLanguage('Cpp');">C++</a>
</div>
<div class="codeSnippetTab csLastTab csNaTab codeJScript">
<a href="javascript: CodeSnippet_SetLanguage('JScript');">JScript</a>
</div>
<div class="codeSnippetTabRightCorner">
</div>
<div style="clear:both;">
</div>
</div>
<div class="codeSnippetCodeCollection">
<div class="codeSnippetToolbar">
<a title="Copy to clipboard." href="javascript:void(0)" onclick="CopyCode(this);">Copy</a>
</div>
<div class="codeSnippetCode codeCpp">
<pre xml:space="preserve" class="brush: cpp">public: <br />static <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a>^ RemoveFirstLeadingZero( <br /> <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a>^ <i>input</i> <br />) </pre>
</div>
<div class="codeSnippetCode codeNA">
<pre xml:space="preserve">This language is not supported or no code example is available.</pre>
</div>
</div>
</div>
<div class="codeSnippetContainer">
<div class="codeSnippetTabs">
<div class="codeSnippetTabLeftCorner">
</div>
<div class="codeSnippetTab csFirstTab csNaTab codeVB">
<a>VB</a>
</div>
<div class="codeSnippetTab csNaTab codeCsharp">
<a href="javascript: CodeSnippet_SetLanguage('Csharp');">C#</a>
</div>
<div class="codeSnippetTab csNaTab codeFsharp">
<a href="javascript: CodeSnippet_SetLanguage('Fsharp');">F#</a>
</div>
<div class="codeSnippetTab csNaTab codeCpp">
<a href="javascript: CodeSnippet_SetLanguage('Cpp');">C++</a>
</div>
<div class="codeSnippetTab csActiveTab csLastTab codeJScript">
<a href="javascript: CodeSnippet_SetLanguage('JScript');">JScript</a>
</div>
<div class="codeSnippetTabRightCornerActive">
</div>
<div style="clear:both;">
</div>
</div>
<div class="codeSnippetCodeCollection">
<div class="codeSnippetToolbar">
<a title="Copy to clipboard." href="javascript:void(0)" onclick="CopyCode(this);">Copy</a>
</div>
<div class="codeSnippetCode codeJScript">
<pre xml:space="preserve" class="brush: js">public static function RemoveFirstLeadingZero( <br /> <i>input</i> : <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a> <br />) : <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.string">String</a>;</pre>
</div>
<div class="codeSnippetCode codeNA">
<pre xml:space="preserve">This language is not supported or no code example is available.</pre>
</div>
</div>
</div>
</div>
<h4 class="subHeading">
Parameters</h4><dl paramName="input" class="parameterList">
<dt>
<span class="parameter">
input
</span>
</dt>
<dd>
<a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.string">string</a>
</dd>
</dl>
<p>
</p>
<p />
<h4 class="subHeading">
Return Value</h4>
<a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.string">string</a>
</div>
</div>
<div class="section_container">
<div class="section_heading">
<span><a href="javascript:void(0)" title="Collapse" onclick="toggleSection(this);">Applies to</a></span>
<div> </div>
</div>
<div id="frameworksSection" class="section">
<h4 class="subHeading">.NET Framework</h4>Supported in: 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1<br />
</div>
</div>
<div class="section_container">
<div class="section_heading">
<span><a href="javascript:void(0)" title="Collapse" onclick="toggleSection(this);">See Also</a></span>
<div> </div>
</div>
<div id="seeAlsoSection" class="section">
<div>
<a href="topic_00000000000004C4.html">PhoneNumberHelper Class</a><br />
<a href="topic_00000000000004A2.html">Tlece.Recruitment.Helpers Namespace</a><br />
</div>
</div>
</div>
</div>
<div id="internal-toc-area">
<div id="internal-toc-container" class="stickthis">
<h3 id="internal-toc-heading">In this article</h3>
<span id="internal-toc-definition-localized-text">Definition</span>
</div>
</div>
</div>
<div id="footer">
<div id="footer-container">
<p><span style="color: #FF0000;">Generated with unregistered version of <a target="_top" href="http://www.helixoft.com/vsdocman/overview.html">VSdocman</a></span> <br />Your own footer text will only be shown in registered version.</p>
</div>
</div>
</div>
</body>
</html>
|
{
"content_hash": "f9d2638b6afeada6a101e8ffd80352a5",
"timestamp": "",
"source": "github",
"line_count": 407,
"max_line_length": 346,
"avg_line_length": 30.184275184275183,
"alnum_prop": 0.6333740333740334,
"repo_name": "asiboro/asiboro.github.io",
"id": "5393ce979fb0cf4f91576a7cbecfbd9e12208440",
"size": "12285",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vsdoc/topic_00000000000004C6.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "310000"
},
{
"name": "HTML",
"bytes": "135195"
},
{
"name": "JavaScript",
"bytes": "621923"
}
]
}
|
package util
const BINARY_VERSION = "0.2.18-alpha"
|
{
"content_hash": "4c4e416b51c0d25a2022b9e0297598f1",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 37,
"avg_line_length": 17.333333333333332,
"alnum_prop": 0.7307692307692307,
"repo_name": "myaniu/nsq",
"id": "93978861d44b9b7eafa3d0f4f5f14e2ee044b7d3",
"size": "52",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "util/binary_version.go",
"mode": "33188",
"license": "mit",
"language": []
}
|
import json
from base import BaseAGOLClass
import urlparse
import urllib
import os
import json
########################################################################
class TiledService(BaseAGOLClass):
"""
AGOL Tiled Map Service
"""
_mapName = None
_documentInfo = None
_copyrightText = None
_id = None
_layers = None
_tables = None
_supportedImageFormatTypes = None
_storageFormat = None
_capabilities = None
_access = None
_currentVersion = None
_units = None
_type = None
_serviceDescription = None
_status = None
_tileInfo = None
_description = None
_fullExtent = None
_singleFusedMapCache = None
_name = None
_created = None
_maxScale = None
_modified = None
_spatialReference = None
_minScale = None
_server = None
_tileServers = None
#----------------------------------------------------------------------
def __init__(self, url, token_url=None,
username=None, password=None,
initialize=False):
"""Constructor"""
self._url = url
self._username = username
self._password = password
self._token_url = token_url
if not username is None and \
not password is None:
self.generate_token(tokenURL=token_url)
if initialize:
self.__init()
#----------------------------------------------------------------------
def __init(self):
""" loads the data into the class """
if self._token is None:
param_dict = {"f": "json"}
else:
param_dict = {"f": "json",
"token" : self._token
}
json_dict = self._do_get(self._url, param_dict)
attributes = [attr for attr in dir(self)
if not attr.startswith('__') and \
not attr.startswith('_')]
for k,v in json_dict.iteritems():
if k in attributes:
setattr(self, "_"+ k, json_dict[k])
else:
print "_%s = None" % k#k, " - attribute not implmented in tiled service."
#----------------------------------------------------------------------
@property
def initialExtent(self):
""" initial extent of tile service """
if self._initialExtent is None:
self.__init()
return self._initialExtent
#----------------------------------------------------------------------
@property
def mapName(self):
""" returns the map name """
if self._mapName is None:
self.__init()
return self._mapName
#----------------------------------------------------------------------
@property
def documentInfo(self):
""" returns the document information """
if self._documentInfo is None:
self.__init()
return self._documentInfo
#----------------------------------------------------------------------
@property
def copyrightText(self):
""" returns the copyright information """
if self._copyrightText is None:
self.__init()
return self._copyrightText
#----------------------------------------------------------------------
@property
def id(self):
""" returns the ID """
if self._id is None:
self.__init()
return self._id
#----------------------------------------------------------------------
@property
def layers(self):
""" returns the layers """
if self._layers is None:
self.__init()
return self._layers
#----------------------------------------------------------------------
@property
def tables(self):
""" returns the tables in the map service """
if self._tables is None:
self.__init()
return self._tables
#----------------------------------------------------------------------
@property
def supportedImageFormatTypes(self):
""" returns the supported image format types """
if self._supportedImageFormatTypes is None:
self.__init()
return self._supportedImageFormatTypes
#----------------------------------------------------------------------
@property
def storageFormat(self):
""" returns the storage format """
if self._storageFormat is None:
self.__init()
return self._storageFormat
#----------------------------------------------------------------------
@property
def capabilities(self):
""" returns the capabilities """
if self._capabilities is None:
self.__init()
return self._capabilities
#----------------------------------------------------------------------
@property
def access(self):
""" returns the access value """
if self._access is None:
self.__init()
return self._access
#----------------------------------------------------------------------
@property
def currentVersion(self):
""" returns the current version """
if self._currentVersion is None:
self.__init()
return self._currentVersion
#----------------------------------------------------------------------
@property
def units(self):
""" returns the units """
if self._units is None:
self.__init()
return self._units
#----------------------------------------------------------------------
@property
def type(self):
""" returns the type """
if self._type is None:
self.__init()
return self._type
#----------------------------------------------------------------------
@property
def serviceDescription(self):
""" returns the service description """
if self._serviceDescription is None:
self.__init()
return self._serviceDescription
#----------------------------------------------------------------------
@property
def status(self):
""" returns the status """
if self._status is None:
self.__init()
return self._status
#----------------------------------------------------------------------
@property
def tileInfo(self):
""" returns the tile information """
if self._tileInfo is None:
self.__init()
return self._tileInfo
#----------------------------------------------------------------------
@property
def description(self):
""" returns the description """
if self._description is None:
self.__init()
return self._description
#----------------------------------------------------------------------
@property
def fullExtent(self):
""" returns the full extent """
if self._fullExtent is None:
self.__init()
return self._fullExtent
#----------------------------------------------------------------------
@property
def singleFusedMapCache(self):
""" information about the single fused map cache """
if self._singleFusedMapCache is None:
self.__init()
return self._singleFusedMapCache
#----------------------------------------------------------------------
@property
def name(self):
""" returns the service name """
if self._name is None:
self.__init()
return self._name
#----------------------------------------------------------------------
@property
def created(self):
""" returns the created value """
if self._created is None:
self.__init()
return self._created
#----------------------------------------------------------------------
@property
def maxScale(self):
""" returns the maximum scale """
if self._maxScale is None:
self.__init()
return self._maxScale
#----------------------------------------------------------------------
@property
def modified(self):
""" returns the modified value """
if self._modified is None:
self.__init()
return self._modified
#----------------------------------------------------------------------
@property
def spatialReference(self):
""" returns the spatial reference value """
if self._spatialReference is None:
self.__init()
return self._spatialReference
#----------------------------------------------------------------------
@property
def minScale(self):
""" returns the minimum scale """
if self._minScale is None:
self.__init()
return self._minScale
#----------------------------------------------------------------------
@property
def server(self):
""" returns the server information """
if self._server is None:
self.__init()
return self._server
#----------------------------------------------------------------------
@property
def tileServers(self):
""" returns the tile services value """
if self._tileServers is None:
self.__init()
return self._tileServers
|
{
"content_hash": "6e593ee770ffd615235d1271aecb0b3f",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 89,
"avg_line_length": 34.842696629213485,
"alnum_prop": 0.4090078469310975,
"repo_name": "Esri/agol-helper",
"id": "0b38312a3a4a3348b924127f76ebce7ca78099bb",
"size": "9303",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/agol/tiledservice.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "186137"
}
]
}
|
import { expect } from "chai";
import { Form } from "../../../../src";
import FormInterface from "../../../../src/models/FormInterface";
import formN from "./form.n";
// FIXES #436 #417 #450
const fields = [
"arrayChangeAdd[]",
"arrayChangeDel[]",
"arrayChangeEqual[]",
"emptyArray[]",
"flatStill",
"flatChange",
"obj.still",
"obj.deep.change",
"array[].id",
"array[].name",
];
const values = {
arrayChangeAdd: ["a"],
arrayChangeDel: ["a", "b"],
arrayChangeEqual: ["a", "b"],
emptyArray: [],
flatStill: "flat",
flatChange: "flat",
"obj.still": "deep",
"obj.deep.change": "deep",
array: [
{
id: 1,
name: "joe",
},
{
id: 2,
name: "sam",
},
],
};
const initials = {
arrayChangeEqual: ["a", "b"],
"obj.deep.change": "deep",
};
class NewForm extends Form {
hooks() {
return {
onInit(form: FormInterface) {
describe("Check initial prop state:", () => {
it("`flatStill` value should be equal `flat`", () =>
expect(form.$("flatStill").value).to.be.equal("flat"));
it("`flatStill` initial should be equal `flat`", () =>
expect(form.$("flatStill").initial).to.be.equal("flat"));
it("`flatStill` isDirty should be false", () =>
expect(form.$("flatStill").isDirty).to.be.false);
it("`flatStill` isPristine should be true", () =>
expect(form.$("flatStill").isPristine).to.be.true);
});
describe("Check prop state after change:", () => {
form.$("flatChange").set("flat-changed"); // change state
it("`flatChange` value should be equal `flat`", () =>
expect(form.$("flatChange").value).to.be.equal("flat-changed"));
it("`flatChange` initial should be equal `flat`", () =>
expect(form.$("flatChange").initial).to.be.equal("flat"));
it("`flatChange` isDirty should be false", () =>
expect(form.$("flatChange").isDirty).to.be.true);
it("`flatChange` isPristine should be true", () =>
expect(form.$("flatChange").isPristine).to.be.false);
});
describe("Check initial props state:", () => {
it("`obj.still` value should be equal `deep`", () =>
expect(form.$("obj.still").value).to.be.equal("deep"));
it("`obj.still` initial should be equal `deep`", () =>
expect(form.$("obj.still").initial).to.be.equal("deep"));
it("`obj.still` isDirty should be false", () =>
expect(form.$("obj.still").isDirty).to.be.false);
it("`obj.still` isPristine should be true", () =>
expect(form.$("obj.still").isPristine).to.be.true);
});
describe("Check props state after change:", () => {
form.$("obj.deep.change").set("deep-changed"); // change state
it("`obj.deep.change` value should be equal `flat`", () =>
expect(form.$("obj.deep.change").value).to.be.equal(
"deep-changed"
));
it("`obj.deep.change` initial should be equal `flat`", () =>
expect(form.$("obj.deep.change").initial).to.be.equal("deep"));
it("`obj.deep.change` isDirty should be true", () =>
expect(form.$("obj.deep.change").isDirty).to.be.true);
it("`obj.deep.change` isPristine should be false", () =>
expect(form.$("obj.deep.change").isPristine).to.be.false);
});
describe("Check initial props state:", () => {
it("`emptyArray` value should be equal []", () =>
expect(form.$("emptyArray").value).to.be.deep.equal([]));
it("`emptyArray` initial should be equal []", () =>
expect(form.$("emptyArray").initial).to.be.deep.equal([]));
it("`emptyArray` isDirty should be false", () =>
expect(form.$("emptyArray").isDirty).to.be.false);
it("`emptyArray` isPristine should be true", () =>
expect(form.$("emptyArray").isPristine).to.be.true);
});
describe("Check props state after change:", () => {
form.$("arrayChangeAdd").add({ value: "b" }); // change state
it(`"arrayChangeAdd" value should be equal ['a', 'b']`, () =>
expect(form.$("arrayChangeAdd").value).to.be.deep.equal([
"a",
"b",
]));
it(`"arrayChangeAdd" initial should be equal ['a']`, () =>
expect(form.$("arrayChangeAdd").initial).to.be.deep.equal(["a"]));
it(`"arrayChangeAdd" isDirty should be true`, () =>
expect(form.$("arrayChangeAdd").isDirty).to.be.true);
it(`"arrayChangeAdd" isPristine should be false`, () =>
expect(form.$("arrayChangeAdd").isPristine).to.be.false);
});
describe("Check props state after change:", () => {
form.$("arrayChangeDel").del(1); // change state
it(`"arrayChangeDel" value should be equal ['a']`, () =>
expect(form.$("arrayChangeDel").value).to.be.deep.equal(["a"]));
it(`"arrayChangeDel" initial should be equal ['a', 'b']`, () =>
expect(form.$("arrayChangeDel").initial).to.be.deep.equal([
"a",
"b",
]));
it(`"arrayChangeDel" isDirty should be true`, () =>
expect(form.$("arrayChangeDel").isDirty).to.be.true);
it(`"arrayChangeDel" isPristine should be false`, () =>
expect(form.$("arrayChangeDel").isPristine).to.be.false);
});
describe("Check props state after change:", () => {
form.$("arrayChangeEqual").del(1); // change state
form.$("arrayChangeEqual").add({ value: "b" }); // change state
it(`"arrayChangeEqual" value should be equal ['a', 'b']`, () =>
expect(form.$("arrayChangeEqual").value).to.be.deep.equal([
"a",
"b",
]));
it(`"arrayChangeEqual" initial should be equal ['a', 'b']`, () =>
expect(form.$("arrayChangeEqual").initial).to.be.deep.equal([
"a",
"b",
]));
it(`"arrayChangeEqual" isDirty should be false`, () =>
expect(form.$("arrayChangeEqual").isDirty).to.be.false);
it(`"arrayChangeEqual" isPristine should be true`, () =>
expect(form.$("arrayChangeEqual").isPristine).to.be.true);
});
describe("Check props state after change:", () => {
form.$("array").del(0); // change state
form.$("array").add([{ id: 3, name: "max" }]); // change state
const value = [
{ id: 2, name: "sam" },
{ id: 3, name: "max" },
];
const initial = [
{ id: 1, name: "joe" },
{ id: 2, name: "sam" },
];
// initial check
it(`"array" value should be equal "values" const`, () =>
expect(form.$("array").value).to.be.deep.equal(value));
it(`"array" initial should be equal "initial" const`, () =>
expect(form.$("array").initial).to.be.deep.equal(initial));
it(`"array" isDirty should be true`, () =>
expect(form.$("array").isDirty).to.be.true);
it(`"array" isPristine should be false`, () =>
expect(form.$("array").isPristine).to.be.false);
// old fields check
it(`"array" $(1).isDirty should be false`, () =>
expect(form.$("array").$(1).isDirty).to.be.false);
it(`"array" $(1).isPristine should be true`, () =>
expect(form.$("array").$(1).isPristine).to.be.true);
it(`"array" $(1).$('id').isDirty should be false`, () =>
expect(form.$("array").$(1).$("id").isDirty).to.be.false);
it(`"array" $(1).$('id').isPristine should be true`, () =>
expect(form.$("array").$(1).$("id").isPristine).to.be.true);
// added field check
it(`"array" $(2).isDirty should be false`, () =>
expect(form.$("array").$(2).isDirty).to.be.false);
it(`"array" $(2).isPristine should be true`, () =>
expect(form.$("array").$(2).isPristine).to.be.true);
it(`"array" $(2).$('id').isDirty should be false`, () =>
expect(form.$("array").$(2).$("id").isDirty).to.be.false);
it(`"array" $(2).$('id').isPristine should be true`, () =>
expect(form.$("array").$(2).$("id").isPristine).to.be.true);
});
describe("Check Form props state:", () => {
it(`"form" isDirty should be true`, () =>
expect(form.isDirty).to.be.true);
it(`"form" isPristine should be false`, () =>
expect(form.isPristine).to.be.false);
});
},
};
}
}
export default new NewForm(
{
fields,
values,
initials,
},
{ name: "Fixes-T" }
);
|
{
"content_hash": "563fd1bcc522a53397c3670dbd3e21f1",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 78,
"avg_line_length": 40.94009216589862,
"alnum_prop": 0.5138451148131472,
"repo_name": "foxhound87/mobx-react-form",
"id": "41f3dbbc83bfe29605f1472b653da8d20294a38e",
"size": "8884",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/data/forms/fixes/form.t.ts",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "3360"
},
{
"name": "JavaScript",
"bytes": "1055"
},
{
"name": "TypeScript",
"bytes": "293631"
}
]
}
|
<!-- # cockpit client/scripts/repository/deployments/modals/cam-cockpit-delete-deployment-modal.html -->
<div class="modal-header">
<h3 class="modal-title">Delete Deployment: {{ deployment.name || deployment.id }}</h3>
</div>
<div class="modal-body delete-deployment-dialog">
<div notifications-panel></div>
<div ng-hide="countsLoaded()"
class="loader">
<span class="animate-spin glyphicon glyphicon-refresh"></span>
Loading deployment informations...
</div>
<div ng-show="countsLoaded()">
This deployment will be deleted.
<div class="alert alert-info" ng-show="hasInstances()">
{{ getInfoSnippet() }} In order to delete this deployment it is necessary to enable the <code>Cascade</code> flag.
</div>
<form class="form-horizontal"
name="deleteDeploymentForm"
novalidate
request-aware>
<div class="form-group cascade">
<label class="control-label col-xs-5"
for="cascade">
Cascade
<span class="glyphicon glyphicon-question-sign"
tooltip="If the value is enabled, all instances, including historic instances, related to this deployment will also be deleted."
tooltip-placement="right">
</span>
</label>
<div class="col-xs-7">
<label class="checkbox">
<input name="cascade"
type="checkbox"
ng-model="options.cascade">
</label>
</div>
</div>
<div class="form-group skip-custom-listener">
<label class="control-label col-xs-5"
for="skipCustomListeners">
Skip Custom Listeners
<span class="glyphicon glyphicon-question-sign"
tooltip="If the value is enabled, only built-in listeners will be notified with the end event."
tooltip-placement="right">
</span>
</label>
<div class="col-xs-7">
<label class="checkbox">
<input name="skipCustomListeners"
type="checkbox"
ng-model="options.skipCustomListeners">
</label>
</div>
</div>
<div class="form-group skip-custom-listener">
<label class="control-label col-xs-5"
for="skipIoMappings">
Skip IO Mappings
<span class="glyphicon glyphicon-question-sign"
tooltip="If the value is enabled IO mappings will be skipped during deployment removal."
tooltip-placement="right">
</span>
</label>
<div class="col-xs-7">
<label class="checkbox">
<input name="skipIoMappings"
type="checkbox"
ng-model="options.skipIoMappings">
</label>
</div>
</div>
</form>
Are you sure to delete the given deployment?
</div>
</div>
<div class="modal-footer">
<button class="btn btn-link"
ng-click="$dismiss()"
ng-disabled="status === 'PERFORM_DELETE'">Close</button>
<button type="submit"
class="btn btn-primary"
ng-click="deleteDeployment()"
ng-show="countsLoaded()"
ng-disabled="!canDeleteDeployment() || status === 'PERFORM_DELETE'">Delete</button>
</div>
<!-- / cockpit client/scripts/repository/deployments/modals/cam-cockpit-delete-deployment-modal.html -->
|
{
"content_hash": "da0fa27b98bc705fafc7711360045a3a",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 144,
"avg_line_length": 31.1,
"alnum_prop": 0.5805320081847413,
"repo_name": "xlinur/camunda-bpm-webapp",
"id": "ca1ab3b6f3b7f04c2d4347379fd295b859b04872",
"size": "3421",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ui/cockpit/client/scripts/repository/deployments/plugins/actions/delete/modals/cam-cockpit-delete-deployment-modal.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "87172"
},
{
"name": "Groovy",
"bytes": "310"
},
{
"name": "HTML",
"bytes": "355895"
},
{
"name": "Java",
"bytes": "566841"
},
{
"name": "JavaScript",
"bytes": "1295172"
}
]
}
|
from __future__ import unicode_literals
from django.test import TestCase
from multigtfs.models import Feed, Zone
class ZoneTest(TestCase):
def test_string(self):
feed = Feed.objects.create()
zone = Zone.objects.create(feed=feed, zone_id='ZONE')
self.assertEqual(str(zone), '%d-ZONE' % feed.id)
|
{
"content_hash": "83b3b271d0e399e4b6b664030173df0d",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 61,
"avg_line_length": 27.166666666666668,
"alnum_prop": 0.6840490797546013,
"repo_name": "tulsawebdevs/django-multi-gtfs",
"id": "81a959490fe126bb1c5dd8b360f848cc2cafc0ef",
"size": "907",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "multigtfs/tests/test_zone.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "520"
},
{
"name": "Makefile",
"bytes": "2178"
},
{
"name": "Python",
"bytes": "248260"
},
{
"name": "Shell",
"bytes": "309"
}
]
}
|
namespace Dnn.PersonaBar.Servers.Services.Dto
{
public class UpdatePerfSettingsRequest
{
public string CachingProvider { get; set; }
public string PageStatePersistence { get; set; }
public string ModuleCacheProvider { get; set; }
public string PageCacheProvider { get; set; }
public string CacheSetting { get; set; }
public string AuthCacheability { get; set; }
public string UnauthCacheability { get; set; }
public bool SslForCacheSynchronization { get; set; }
public string ClientResourcesManagementMode { get; set; }
public string CurrentHostVersion { get; set; }
public bool HostEnableCompositeFiles { get; set; }
public bool HostMinifyCss { get; set; }
public bool HostMinifyJs { get; set; }
public string CurrentPortalVersion { get; set; }
public bool PortalEnableCompositeFiles { get; set; }
public bool PortalMinifyCss { get; set; }
public bool PortalMinifyJs { get; set; }
}
}
|
{
"content_hash": "cdb7f9bf40ede793045e75d51ff4f189",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 65,
"avg_line_length": 36.785714285714285,
"alnum_prop": 0.6621359223300971,
"repo_name": "dnnsoftware/Dnn.AdminExperience.Extensions",
"id": "31b78267f8889b09f6ab4ee6a4e72c8a25d80362",
"size": "2237",
"binary": false,
"copies": "1",
"ref": "refs/heads/development",
"path": "src/Modules/Settings/Dnn.PersonaBar.Servers/Services/Dto/UpdatePerfSettingsRequest.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "362"
},
{
"name": "C#",
"bytes": "1752728"
},
{
"name": "CSS",
"bytes": "495897"
},
{
"name": "HTML",
"bytes": "38779"
},
{
"name": "JavaScript",
"bytes": "3436901"
}
]
}
|
FROM 773153459320.dkr.ecr.eu-west-1.amazonaws.com/angus.box/genericservice
#
# Service
#
COPY angus /angus
#
# Entrypoint
#
COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
|
{
"content_hash": "73f713337f1de6c7cf0cb1db72e76e77",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 74,
"avg_line_length": 15.75,
"alnum_prop": 0.7566137566137566,
"repo_name": "angus-ai/angus-gateway",
"id": "8b7323b13ec333c3e8a6eda49cd8d69c50a01ea5",
"size": "189",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "189"
},
{
"name": "HTML",
"bytes": "993"
},
{
"name": "Python",
"bytes": "10736"
},
{
"name": "Shell",
"bytes": "47"
}
]
}
|
In this project, you'll label the pixels of a road in images using a Fully Convolutional Network (FCN).
### Setup
##### Frameworks and Packages
Make sure you have the following is installed:
- [Python 3](https://www.python.org/)
- [TensorFlow](https://www.tensorflow.org/)
- [NumPy](http://www.numpy.org/)
- [SciPy](https://www.scipy.org/)
##### Dataset
Download the [Kitti Road dataset](http://www.cvlibs.net/datasets/kitti/eval_road.php) from [here](http://www.cvlibs.net/download.php?file=data_road.zip). Extract the dataset in the `data` folder. This will create the folder `data_road` with all the training a test images.
### Start
##### Implement
Implement the code in the `main.py` module indicated by the "TODO" comments.
The comments indicated with "OPTIONAL" tag are not required to complete.
##### Run
Run the following command to run the project:
```
python main.py
```
**Note** If running this in Jupyter Notebook system messages, such as those regarding test status, may appear in the terminal rather than the notebook.
### Submission
1. Ensure you've passed all the unit tests.
2. Ensure you pass all points on [the rubric](https://review.udacity.com/#!/rubrics/989/view).
3. Submit the following in a zip file.
- `helper.py`
- `main.py`
- `project_tests.py`
- Newest inference images from `runs` folder
|
{
"content_hash": "c41a6d5147748301a78923f03c75f364",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 274,
"avg_line_length": 42.96774193548387,
"alnum_prop": 0.7252252252252253,
"repo_name": "shernshiou/CarND",
"id": "f9d669a49bc59a796ca3cb6ca38d09cfc6b47706",
"size": "1373",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Term3/02-CarND-Semantic-Segmentation/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "468142"
},
{
"name": "C++",
"bytes": "19720100"
},
{
"name": "CMake",
"bytes": "471258"
},
{
"name": "CSS",
"bytes": "10766"
},
{
"name": "Cuda",
"bytes": "263476"
},
{
"name": "Fortran",
"bytes": "2652606"
},
{
"name": "HTML",
"bytes": "562104"
},
{
"name": "JavaScript",
"bytes": "15678"
},
{
"name": "Jupyter Notebook",
"bytes": "752385"
},
{
"name": "Makefile",
"bytes": "537"
},
{
"name": "Python",
"bytes": "118395"
},
{
"name": "Shell",
"bytes": "43052"
}
]
}
|
`convert_encoding`
==================
{% raw %}
The `convert_encoding` filter converts a string from one encoding to another. The first argument is the expected output charset and the second one is the input charset:
````twig
{{ data|convert_encoding('UTF-8', 'iso-2022-jp') }}
````
Arguments
---------
* `to`: The output charset
* `from`: The input charset
{% endraw %}
[back]({{ site.baseurl }}{% link language-reference/filters/index.md %})
|
{
"content_hash": "b5d7fd60be089110e759bb08063559ab",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 168,
"avg_line_length": 22.6,
"alnum_prop": 0.6482300884955752,
"repo_name": "ericmorand/twing",
"id": "c487239ba4ff55412cbaf80a14f5d38bd3b76fcb",
"size": "452",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/language-reference/filters/convert_encoding.md",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "HTML",
"bytes": "1717"
},
{
"name": "TypeScript",
"bytes": "1237730"
}
]
}
|
clear
echo "================================================================="
echo "Beth's Awesome WordPress Installer!!"
echo "================================================================="
# accept the name of our website
echo "Site Name: "
read -e sitename
# accept user input for the user name
echo "Username: "
read -e wpuser
# accept user input for the user name
echo "Password: "
read -e wppass
# accept user input for the user email
echo "Admin Email: "
read -e wpemail
# accept user input for the site address
echo "Site Address: "
read -e siteaddress
# accept user input for the databse name
echo "Database Name: "
read -e dbname
# accept a comma separated list of pages
echo "Add Pages: "
read -e allpages
# accept a comma separated list of categories
echo "Add Categories: "
read -e allcategories
# add a simple yes/no confirmation before we proceed
echo "Run Install? (y/n)"
read -e run
# if the user didn't say no, then go ahead an install
if [ "$run" == n ] ; then
exit
else
touch wp-cli.yml
echo "path: wp" | tee wp-cli.yml
mkdir app && cd app
touch index.php
echo "<?php // silence is golden" | tee index.php
mkdir media mu-plugins plugins themes
cd plugins
touch index.php
echo "<?php // silence is golden" | tee index.php
cd ..
cd themes
touch index.php
echo "<?php // silence is golden" | tee index.php
cd ..
cd ..
mkdir wp && cd wp
# download the WordPress core files
wp core download
# create the wp-config file with our standard setup
wp core config --dbname=$dbname --dbuser=root --dbhost=127.0.0.1 --extra-php <<PHP
define('BASEURL', '$siteaddress');
define('CONTENT_DIR', 'app');
define('WP_CONTENT_DIR', dirname(__FILE__) . '/' . CONTENT_DIR);
define('WP_CONTENT_URL', BASEURL . '/' . CONTENT_DIR);
define('WP_PLUGIN_DIR', dirname(__FILE__) . '/' . CONTENT_DIR . '/plugins');
define('WP_DEBUG', true);
define('DISALLOW_FILE_EDIT', true);
PHP
mv wp-config.php ..
cp index.php ..
# create database, and install WordPress
wp db create
wp core install --url="$siteaddress/wp" --title="$sitename" --admin_user="$wpuser" --admin_password="$wppass" --admin_email="$wpemail"
# show only 5 posts on an archive page
wp option update posts_per_page 5
wp option update home $siteaddress
# delete sample page, and create homepage
wp post delete $(wp post list --post_type=page --posts_per_page=1 --post_status=publish --pagename="sample-page" --field=ID --format=ids)
wp post delete $(wp post list --post_type=post --posts_per_page=1 --post_status=publish --postname="hello-world" --field=ID --format=ids)
wp post create --post_type=page --post_title=Home --post_status=publish --post_author=$(wp user get $wpuser --field=ID --format=ids)
wp post create --post_type=page --post_title=Blog --post_status=publish --post_author=$(wp user get $wpuser --field=ID --format=ids)
# set homepage as front page
wp option update show_on_front 'page'
# set homepage to be the new page
wp option update page_on_front $(wp post list --post_type=page --post_status=publish --posts_per_page=1 --pagename=home --field=ID --format=ids)
wp option update page_for_posts $(wp post list --post_type=page --post_status=publish --posts_per_page=1 --pagename=blog --field=ID --format=ids)
# set timezone to central
wp option update timezone_string 'America/Chicago'
wp option update blogdescription ''
wp option update default_comment_status 'closed'
wp option update default_ping_status 'closed'
wp option update uploads_use_yearmonth_folders ''
# create all of the pages
export IFS=","
for page in $allpages; do
wp post create --post_type=page --post_status=publish --post_author=$(wp user get $wpuser --field=ID --format=ids) --post_title="$(echo $page | sed -e 's/^ *//' -e 's/ *$//')"
done
# create all of the categories
export IFS=","
for category in $allcategories; do
wp term create category $category
done
# set new category to default and remove 'Uncategorized'
wp option update default_category 2
wp option update default_email_category 2
wp term delete category 1
# set pretty urls
wp rewrite structure '/%postname%/' --hard
wp rewrite flush --hard
cd ..
tail -n 1 "index.php" | wc -c | xargs -I {} truncate "index.php" -s -{}
echo "require(dirname(__FILE__).'/wp/wp-blog-header.php');" >> index.php
echo "if ( empty( \$upload_path ) || 'wp-content/uploads' == \$upload_path ) {
update_option( 'upload_path', untrailingslashit( str_replace( 'wp', 'app/media', ABSPATH ) ) );
update_option( 'upload_url_path', home_url( 'app/media' ) );
}" >> wp-config.php
# install the company starter theme
# install the WordPress Boilerplate theme
cd app/themes
git clone https://github.com/Beth3346/wordpress-boilerplate-twig.git
cd wordpress-boilerplate-twig
composer install
npm install
grunt build
cd ..
cd ..
cd wp
wp theme activate wordpress-boilerplate-twig
## themes
# removes the inactive themes that automattically come wth an fresh installation of WP. Since WP needs one
# active theme, this command only removes the inactive one. -JMS
wp theme list --status=inactive --field=name | while read THEME; do wp theme delete $THEME; done;
clear
# create a navigation bar
wp menu create "Main Navigation"
wp menu create "Footer Navigation"
wp menu create "Social Navigation"
# remove most default widgets from sidebar
wp widget delete meta-2
wp widget delete search-2
wp widget delete recent-comments-2
wp widget delete archives-2
clear
echo "================================================================="
echo "Installation is complete. Your username/password is listed below."
echo ""
echo "Username: $wpuser"
echo "Password: $wppass"
echo ""
echo "================================================================="
fi
|
{
"content_hash": "bfe7f18771c50ebf82c4237690a8fd86",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 179,
"avg_line_length": 29.905263157894737,
"alnum_prop": 0.6847940865892291,
"repo_name": "elr-wordpress/wordpress-scripts",
"id": "a0d9aa8a7a0a258a378cdf537f39d5ddd41ff8ba",
"size": "5726",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "wpinstall.sh",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Shell",
"bytes": "5350"
}
]
}
|
<div class="commune_descr limited">
<p>
Carbes est
un village
géographiquement positionné dans le département de Tarn en Midi-Pyrénées. Elle totalisait 194 habitants en 2008.</p>
<p>Si vous pensez emmenager à Carbes, vous pourrez aisément trouver une maison à vendre. </p>
<p>À coté de Carbes sont positionnées géographiquement les communes de
<a href="{{VLROOT}}/immobilier/montpinier_81181/">Montpinier</a> située à 5 km, 166 habitants,
<a href="{{VLROOT}}/immobilier/vielmur-sur-agout_81315/">Vielmur-sur-Agout</a> localisée à 5 km, 1 305 habitants,
<a href="{{VLROOT}}/immobilier/jonquieres_81109/">Jonquières</a> à 3 km, 486 habitants,
<a href="{{VLROOT}}/immobilier/cambounet-sur-le-sor_81054/">Cambounet-sur-le-Sor</a> localisée à 7 km, 771 habitants,
<a href="{{VLROOT}}/immobilier/cuq_81075/">Cuq</a> située à 5 km, 465 habitants,
<a href="{{VLROOT}}/immobilier/frejeville_81098/">Fréjeville</a> localisée à 3 km, 600 habitants,
entre autres. De plus, Carbes est située à seulement sept km de <a href="{{VLROOT}}/immobilier/castres_81065/">Castres</a>.</p>
<p>Le parc de logements, à Carbes, se décomposait en 2011 en deux appartements et 76 maisons soit
un marché relativement équilibré.</p>
</div>
|
{
"content_hash": "6abec426d2d7d6c1d89c706f5465db73",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 133,
"avg_line_length": 74.52941176470588,
"alnum_prop": 0.7379636937647988,
"repo_name": "donaldinou/frontend",
"id": "8f3a9b24f31654fc02f17f2312b5eae0dc855364",
"size": "1299",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Viteloge/CoreBundle/Resources/descriptions/81058.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3073"
},
{
"name": "CSS",
"bytes": "111338"
},
{
"name": "HTML",
"bytes": "58634405"
},
{
"name": "JavaScript",
"bytes": "88564"
},
{
"name": "PHP",
"bytes": "841919"
}
]
}
|
package com.mindfire.review.web.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpSession;
/**
* Created by pratyasa on 3/8/16.
*/
@Controller
public class LogoutController {
/**
* to logout and end the session
* @param httpSession
* @return
*/
@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String logout(HttpSession httpSession) {
httpSession.invalidate();
return "logout";
}
}
|
{
"content_hash": "5b8ed385416f96383fb0a1f63f441052",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 66,
"avg_line_length": 24.6,
"alnum_prop": 0.7317073170731707,
"repo_name": "pratyasam/review-app",
"id": "ee5f01497002c9ab4cde3ad79a5cf27fc33404a5",
"size": "615",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/mindfire/review/web/controllers/LogoutController.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "21241"
},
{
"name": "HTML",
"bytes": "56680"
},
{
"name": "Java",
"bytes": "1160173"
},
{
"name": "JavaScript",
"bytes": "59319"
}
]
}
|
angular.module('cgForm.timelog', [])
.factory('TimeLogFactory', function () {
function twoDigits(d) {
if (0 <= d && d < 10) return '0' + d.toString()
if (-10 < d && d < 0) return '-0' + (-1 * d).toString()
return d.toString()
}
Date.prototype.toMysqlFormat = function () {
return this.getUTCFullYear() + '-' + twoDigits(1 + this.getUTCMonth()) + '-' + twoDigits(this.getUTCDate()) + ' ' + twoDigits(this.getUTCHours() + 5) + ':' + twoDigits(this.getUTCMinutes() + 30) + ':' + twoDigits(this.getUTCSeconds())
}
return {
getCurrentTime: function () {
return new Date().toMysqlFormat()
}
}
})
|
{
"content_hash": "5bb9bee6ecc287f500a57e5a5108b4de",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 246,
"avg_line_length": 35.19047619047619,
"alnum_prop": 0.5060893098782138,
"repo_name": "cghr/cgForm",
"id": "d1069e8d422e35daf502e703b1f51db4803c86e7",
"size": "739",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/timelog/TimeLogFactory.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7774"
},
{
"name": "JavaScript",
"bytes": "725472"
}
]
}
|
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
-- | Check properties of Ivory programs using random inputs.
--
-- Example usage:
--
-- > [ivory|
-- > struct foo
-- > { foo_a :: Stored IFloat
-- > ; foo_b :: Stored Uint8
-- > }
-- > |]
-- >
-- > -- Function we want to generate inputs for.
-- > func :: Def ('[ Uint8
-- > , Ref s (Array 3 (Stored Uint8))
-- > , Ref s (Struct "foo")
-- > ] :-> ())
-- > func = proc "func" $ \u arr str ->
-- > ensures_ (checkStored (arr ! 0) (\r -> r >? u)) $
-- > body $
-- > arrayMap $ \ix -> do
-- > a <- deref (arr ! ix)
-- > b <- deref (str ~> foo_b)
-- > store (arr ! ix) (a + b + u)
-- >
-- > -- Module containing our function
-- > cmodule :: Module
-- > cmodule = package "module" $ do
-- > defStruct (Proxy :: Proxy "foo")
-- > incl func
-- >
-- > -- Running @mkTest@ will produce a C program in @<pwd>/test@ that will check
-- > -- @func@'s contract on 10 random inputs.
-- > mkTest :: IO ()
-- > mkTest = check 10 [] cmodule (contract func)
module Ivory.QuickCheck (check, checkWith, contract) where
import Prelude ()
import Prelude.Compat
import Control.Monad (forM, replicateM)
import Data.IORef (IORef, newIORef, readIORef,
writeIORef)
import Data.List (find, transpose)
import Ivory.Compile.C.CmdlineFrontend
import qualified Ivory.Eval as E
import Ivory.Language
import Ivory.Language.Proc
import qualified Ivory.Language.Syntax as I
import System.IO.Unsafe (unsafeInterleaveIO)
import qualified Test.QuickCheck.Arbitrary as A
import qualified Test.QuickCheck.Gen as G
import Data.Int
import Data.Word
-- XXX: DEBUG
-- import Debug.Trace
-- | Generate a random C program to check that the property holds. The
-- generated program will be placed in the @test@ subdirectory.
checkWith :: Int -- ^ The number of inputs to generate.
-> Opts -- ^ Options to pass to the Ivory compiler.
-> [Module] -- ^ Modules we need to have in scope.
-> Module -- ^ The defining module.
-> Def (args ':-> IBool) -- ^ The property to check.
-> IO ()
checkWith n opts deps m prop@(DefProc p) = do
inputs <- sampleProc m p n
let main = DefProc I.Proc { I.procSym = "main"
, I.procRetTy = I.TyInt I.Int32
, I.procArgs = []
, I.procBody = concat inputs ++ [I.Return $ I.Typed (I.TyInt I.Int32) (I.ExpLit (I.LitInteger 0))]
, I.procRequires = []
, I.procEnsures = []
}
let test = package (I.modName m ++ "__test") $ do
depend m
incl prop
incl main
runCompiler ([m, test]++deps) [] opts -- initialOpts { outDir = Just "test" }
checkWith _ _ _ _ _ = error "I can only check normal Ivory procs!"
-- | Generate a random C program to check that the property holds. The
-- generated program will be placed in the @test@ subdirectory.
check :: Int -- ^ The number of inputs to generate.
-> [Module] -- ^ Modules we need to have in scope.
-> Module -- ^ The defining module.
-> Def (args ':-> IBool) -- ^ The property to check.
-> IO ()
check n deps m p = checkWith n (initialOpts { outDir = Just "test"}) deps m p
-- | Make a @check@able property from an arbitrary Ivory procedure. The
-- property will simply check that the contracts are satisfied.
contract :: Def (args ':-> res) -> Def (args ':-> IBool)
contract (DefProc (I.Proc {..}))
= DefProc I.Proc
{ I.procSym = procSym ++ "__contract_check"
, I.procRetTy = I.TyBool
, I.procArgs = procArgs
, I.procBody = [ I.Call procRetTy Nothing (I.NameSym procSym)
[ I.Typed t (I.ExpVar v) | I.Typed t v <- procArgs ]
, I.Return (I.Typed I.TyBool (I.ExpLit (I.LitBool True)))
]
, I.procRequires = procRequires
, I.procEnsures = []
}
contract _ = error "I can only check contracts of normal Ivory procs!"
mkUnique :: (?counter :: IORef Integer) => IO Integer
mkUnique = do
i <- readIORef ?counter
writeIORef ?counter (i+1)
return i
sampleProc :: Module -> I.Proc -> Int -> IO [I.Block]
sampleProc m@(I.Module {..}) p@(I.Proc {..}) n
= do c <- newIORef 0
let ?counter = c
allInits <- fmap transpose $ forM procArgs $ \ (I.Typed t _) ->
sampleType m t
allAreas <- fmap transpose $ forM (getVisible modAreas) $ \ I.Area {..} -> do
inits <- sampleType m areaType
lazyMapIO (\ (var, blck) -> do
let store = case areaType of
I.TyArr _ _ -> I.RefCopy
I.TyStruct _ -> I.RefCopy
I.TyRef _ -> I.RefCopy -- XXX: this shouldn't actually appear
_ -> I.Store
return $ blck ++ [ store areaType (I.ExpAddrOfGlobal areaSym) (I.ExpVar var)])
inits
--XXX: Refactor!
let validInits =
[ (inits, areas) | (inits, areas) <- zipLonger allInits allAreas
, let (vars, blcks) = unzip inits
, let asgnv = [ I.Assign ty arg (I.ExpVar var)
| (I.Typed ty arg, var) <- zip procArgs vars
]
, E.runEval (E.openModule m (do
E.evalBlock (concat blcks ++ asgnv ++ concat areas)
E.evalRequires procRequires))
== Right True
]
forM (take n validInits) $ \ (args, areas) -> do
let (vars, inits) = unzip args
chk <- mkCheck p vars
return (concat inits ++ concat areas ++ chk)
getVisible :: I.Visible a -> [a]
getVisible xs = I.public xs ++ I.private xs
mkCheck :: (?counter :: IORef Integer)
=> I.Proc -> [I.Var] -> IO I.Block
mkCheck (I.Proc {..}) args = do
n <- mkUnique
let b = mkVar n
let c = [ I.Call I.TyBool (Just b) (I.NameSym procSym)
[ I.Typed t (I.ExpVar v) | (I.Typed t _, v) <- zip procArgs args ]
, I.Assert (I.ExpVar b) ]
return c
sampleType :: (?counter :: IORef Integer)
=> Module -> I.Type -> IO [(I.Var, I.Block)]
sampleType m t = case t of
I.TyInt sz
-> lazyMapIO (mkLocal t) =<< sampleInt sz
I.TyWord sz
-> lazyMapIO (mkLocal t) =<< sampleWord sz
I.TyIndex i
-> lazyMapIO (mkLocal t) =<< sampleIndex i
I.TyBool
-> lazyMapIO (mkLocal t) =<< sampleBool
I.TyChar
-> lazyMapIO (mkLocal t) =<< sampleChar
I.TyFloat
-> lazyMapIO (mkLocal t) =<< sampleFloat
I.TyDouble
-> lazyMapIO (mkLocal t) =<< sampleDouble
I.TyRef ty
-> lazyMapIO (mkRef ty) =<< sampleType m ty
I.TyConstRef ty
-> lazyMapIO (mkRef ty) =<< sampleType m ty
I.TyArr len ty
-> sampleArray m len ty
I.TyStruct ty
-> sampleStruct m ty
I.TyProc _ _ -> err
I.TyVoid -> err
I.TyPtr _ -> err
I.TyConstPtr _ -> err
I.TyCArray _ -> err
I.TyOpaque -> err
where
err = error $ "I don't know how to make values of type '" ++ show t ++ "'!"
mkLocal :: (?counter :: IORef Integer) => I.Type -> I.Init -> IO (I.Var, I.Block)
mkLocal ty init = do
n <- mkUnique
let v = mkVar n
return (v, [I.Local ty v init])
mkRef :: (?counter :: IORef Integer) => I.Type -> (I.Var, I.Block)
-> IO (I.Var, I.Block)
mkRef ty (v, init) = do
n <- mkUnique
let r = I.VarName ("ref" ++ show n)
return (r, init ++ [ I.AllocRef ty r (I.NameVar v) ])
mkVar :: Integer -> I.Var
mkVar n = I.VarName ("var" ++ show n)
mk :: G.Gen a -> IO [a]
mk g = G.generate (G.infiniteListOf g)
sampleInt :: I.IntSize -> IO [I.Init]
sampleInt sz = do
xs <- gen
return [ I.InitExpr (I.TyInt sz) (I.ExpLit (I.LitInteger x)) | x <- xs ]
where
gen = case sz of
I.Int8 -> fmap fromIntegral <$> mk (A.arbitrary :: G.Gen Int8)
I.Int16 -> fmap fromIntegral <$> mk (A.arbitrary :: G.Gen Int16)
I.Int32 -> fmap fromIntegral <$> mk (A.arbitrary :: G.Gen Int32)
I.Int64 -> fmap fromIntegral <$> mk (A.arbitrary :: G.Gen Int64)
sampleWord :: I.WordSize -> IO [I.Init]
sampleWord sz = do
xs <- gen
return [ I.InitExpr (I.TyWord sz) (I.ExpLit (I.LitInteger x))
| x <- xs
]
where
gen = case sz of
I.Word8 -> fmap fromIntegral <$> mk (A.arbitrary :: G.Gen Word8)
I.Word16 -> fmap fromIntegral <$> mk (A.arbitrary :: G.Gen Word16)
I.Word32 -> fmap fromIntegral <$> mk (A.arbitrary :: G.Gen Word32)
I.Word64 -> fmap fromIntegral <$> mk (A.arbitrary :: G.Gen Word64)
sampleIndex :: Integer -> IO [I.Init]
sampleIndex ix = do
xs <- mk (A.arbitrary :: G.Gen Word64)
return [ I.InitExpr (I.TyIndex ix)
(I.ExpLit (I.LitInteger (fromIntegral x `mod` ix)))
| x <- xs
]
sampleBool :: IO [I.Init]
sampleBool = do
bs <- mk A.arbitrary
return [I.InitExpr I.TyBool (I.ExpLit (I.LitBool b)) | b <- bs]
sampleChar :: IO [I.Init]
sampleChar = do
cs <- mk A.arbitrary
return [I.InitExpr I.TyChar (I.ExpLit (I.LitChar c)) | c <- cs]
sampleFloat :: IO [I.Init]
sampleFloat = do
cs <- mk A.arbitrary
return [I.InitExpr I.TyFloat (I.ExpLit (I.LitFloat c)) | c <- cs]
sampleDouble :: IO [I.Init]
sampleDouble = do
cs <- mk A.arbitrary
return [I.InitExpr I.TyDouble (I.ExpLit (I.LitDouble c)) | c <- cs]
sampleStruct :: (?counter :: IORef Integer)
=> I.Module -> String -> IO [(I.Var, I.Block)]
sampleStruct m@(I.Module {..}) ty
= case find (\s -> ty == I.structName s) structs of
Just (I.Struct _ fields) -> repeatIO $ do
(vars, blcks) <- fmap unzip $ forM fields $ \ (I.Typed t _) ->
head <$> sampleType m t
let init = zipWith (\ (I.Typed t f) v -> (f, I.InitExpr t (I.ExpVar v)))
fields vars
(v, blck) <- mkLocal (I.TyStruct ty) (I.InitStruct init)
return (v, concat blcks ++ blck)
_ -> error ("I don't know how to construct a '" ++ ty ++ "'!")
where
structs = I.public modStructs ++ I.private modStructs
sampleArray :: (?counter :: IORef Integer)
=> I.Module -> Int -> I.Type
-> IO [(I.Var, I.Block)]
sampleArray m len ty = repeatIO $ do
(vars, blcks) <- unzip <$> replicateM len (head <$> sampleType m ty)
let init = [ I.InitExpr ty (I.ExpVar v) | v <- vars ]
(v, blck) <- mkLocal (I.TyArr len ty) (I.InitArray init True)
return (v, concat blcks ++ blck)
repeatIO :: IO a -> IO [a]
repeatIO doThis = do
x <- doThis
xs <- unsafeInterleaveIO (repeatIO doThis)
return (x : xs)
lazyMapIO :: (a -> IO b) -> [a] -> IO [b]
lazyMapIO _ [] = return []
lazyMapIO f (a:as) = do
b <- f a
bs <- unsafeInterleaveIO (lazyMapIO f as)
return (b : bs)
zipLonger :: [[a]] -> [[b]] -> [([a], [b])]
zipLonger as bs = zip (as ++ repeat []) (bs ++ repeat [])
|
{
"content_hash": "c0e94436dec1d39950741fb966343b51",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 126,
"avg_line_length": 36.28343949044586,
"alnum_prop": 0.5444571227946985,
"repo_name": "GaloisInc/ivory",
"id": "19fd3a1eb6470641bfa741105598ed608115cefc",
"size": "11393",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ivory-quickcheck/src/Ivory/QuickCheck.hs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "22673"
},
{
"name": "Haskell",
"bytes": "685344"
},
{
"name": "Isabelle",
"bytes": "105900"
},
{
"name": "Makefile",
"bytes": "2355"
},
{
"name": "Objective-C",
"bytes": "1887"
},
{
"name": "Shell",
"bytes": "1360"
},
{
"name": "TeX",
"bytes": "215578"
}
]
}
|
/*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.cloudkms.v1.model;
/**
* Contains an HSM-generated attestation about a key operation. For more information, see [Verifying
* attestations] (https://cloud.google.com/kms/docs/attest-key).
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Cloud Key Management Service (KMS) API. For a
* detailed explanation see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class KeyOperationAttestation extends com.google.api.client.json.GenericJson {
/**
* Output only. The certificate chains needed to validate the attestation
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private CertificateChains certChains;
/**
* Output only. The attestation data provided by the HSM when the key operation was performed.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String content;
/**
* Output only. The format of the attestation data.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String format;
/**
* Output only. The certificate chains needed to validate the attestation
* @return value or {@code null} for none
*/
public CertificateChains getCertChains() {
return certChains;
}
/**
* Output only. The certificate chains needed to validate the attestation
* @param certChains certChains or {@code null} for none
*/
public KeyOperationAttestation setCertChains(CertificateChains certChains) {
this.certChains = certChains;
return this;
}
/**
* Output only. The attestation data provided by the HSM when the key operation was performed.
* @see #decodeContent()
* @return value or {@code null} for none
*/
public java.lang.String getContent() {
return content;
}
/**
* Output only. The attestation data provided by the HSM when the key operation was performed.
* @see #getContent()
* @return Base64 decoded value or {@code null} for none
*
* @since 1.14
*/
public byte[] decodeContent() {
return com.google.api.client.util.Base64.decodeBase64(content);
}
/**
* Output only. The attestation data provided by the HSM when the key operation was performed.
* @see #encodeContent()
* @param content content or {@code null} for none
*/
public KeyOperationAttestation setContent(java.lang.String content) {
this.content = content;
return this;
}
/**
* Output only. The attestation data provided by the HSM when the key operation was performed.
* @see #setContent()
*
* <p>
* The value is encoded Base64 or {@code null} for none.
* </p>
*
* @since 1.14
*/
public KeyOperationAttestation encodeContent(byte[] content) {
this.content = com.google.api.client.util.Base64.encodeBase64URLSafeString(content);
return this;
}
/**
* Output only. The format of the attestation data.
* @return value or {@code null} for none
*/
public java.lang.String getFormat() {
return format;
}
/**
* Output only. The format of the attestation data.
* @param format format or {@code null} for none
*/
public KeyOperationAttestation setFormat(java.lang.String format) {
this.format = format;
return this;
}
@Override
public KeyOperationAttestation set(String fieldName, Object value) {
return (KeyOperationAttestation) super.set(fieldName, value);
}
@Override
public KeyOperationAttestation clone() {
return (KeyOperationAttestation) super.clone();
}
}
|
{
"content_hash": "7476c12b8a3145aafdfd51f013ad35ba",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 182,
"avg_line_length": 31.36111111111111,
"alnum_prop": 0.704162976085031,
"repo_name": "googleapis/google-api-java-client-services",
"id": "24a7b5d7d9a89554025312c6a9dc4a3c9c377844",
"size": "4516",
"binary": false,
"copies": "3",
"ref": "refs/heads/main",
"path": "clients/google-api-services-cloudkms/v1/2.0.0/com/google/api/services/cloudkms/v1/model/KeyOperationAttestation.java",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
/* $Id: getifaddr.h,v 1.5 2011/05/15 08:59:27 nanard Exp $ */
/* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2011 Thomas Bernard
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */
#ifndef GETIFADDR_H_INCLUDED
#define GETIFADDR_H_INCLUDED
/* getifaddr()
* take a network interface name and write the
* ip v4 address as text in the buffer
* returns: 0 success, -1 failure */
int
getifaddr(const char * ifname, char * buf, int len);
/* find a non link local IP v6 address for the interface.
* if ifname is NULL, look for all interfaces */
int
find_ipv6_addr(const char * ifname,
char * dst, int n);
#endif
|
{
"content_hash": "3b21a866b8ce0ff4f1f4c739ef7d08a8",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 61,
"avg_line_length": 29.48,
"alnum_prop": 0.6987788331071914,
"repo_name": "SecretsCoin/SecretsCoin",
"id": "471f9e2555a95b97286b6b1f326b295ccb2b43d4",
"size": "737",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/miniupnpc/miniupnp-miniupnpc_1_8/miniupnpd/getifaddr.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "61562"
},
{
"name": "Batchfile",
"bytes": "912"
},
{
"name": "C",
"bytes": "998092"
},
{
"name": "C++",
"bytes": "1685526"
},
{
"name": "CMake",
"bytes": "12602"
},
{
"name": "Groff",
"bytes": "21260"
},
{
"name": "Java",
"bytes": "9806"
},
{
"name": "Makefile",
"bytes": "34740"
},
{
"name": "NSIS",
"bytes": "6041"
},
{
"name": "Objective-C",
"bytes": "1235"
},
{
"name": "Objective-C++",
"bytes": "3537"
},
{
"name": "Python",
"bytes": "51724"
},
{
"name": "QMake",
"bytes": "12785"
},
{
"name": "Shell",
"bytes": "30857"
}
]
}
|
using System;
using System.Data;
using System.Net;
using System.Net.Mime;
using System.Threading.Tasks;
namespace Rs317.Sharp
{
public class Program
{
public static async Task Main(string[] args)
{
Console.WriteLine($"RS2 user client - release #{317} using Rs317.Sharp by Glader");
try
{
Program program = new Program();
await program.StartClient(0, 0, true);
}
catch(Exception exception)
{
throw new InvalidOperationException($"Erorr: {exception.Message} \n\n Stack: {exception.StackTrace}");
}
}
public async Task StartClient(int localWorldId, short portOffset, bool membersWorld)
{
Task clientRunningAwaitable = signlink.startpriv("127.0.0.1");
ClientConfiguration configuration = new ClientConfiguration(localWorldId, portOffset, membersWorld);
OpenTkImageProducerFactory imageProducerFactory = new OpenTkImageProducerFactory();
OpenTKClient client = CreateOpenTkClient(configuration, imageProducerFactory);
using (OpenTKGameWindow gameWindow = new OpenTKGameWindow(765, 503, client, imageProducerFactory, client))
{
client.createClientFrame(765, 503);
gameWindow.Run(20, 60);
}
await clientRunningAwaitable
.ConfigureAwait(false);
}
public virtual OpenTKClient CreateOpenTkClient(ClientConfiguration configuration, OpenTkImageProducerFactory imageProducerFactory)
{
return new OpenTKClient(configuration, new OpenTKRsGraphicsContext(), imageProducerFactory, new DefaultBufferFactory());
}
}
}
|
{
"content_hash": "58ef6f1577bbadabeeb7627e5efb3cfe",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 132,
"avg_line_length": 30.591836734693878,
"alnum_prop": 0.7558372248165444,
"repo_name": "HelloKitty/317refactor",
"id": "bcfc6e886c71aac8bb48c30873b92923c191e750",
"size": "1501",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Client/Rs317.Client.OpenTK/Program.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "968470"
}
]
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE259_Hard_Coded_Password__w32_wchar_t_54e.c
Label Definition File: CWE259_Hard_Coded_Password__w32.label.xml
Template File: sources-sink-54e.tmpl.c
*/
/*
* @description
* CWE: 259 Use of Hard-coded Password
* BadSource: Use a hardcoded password
* GoodSource: Read the password from the console
* Sink:
* BadSink : Authenticate the user using LogonUserW()
* Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#define PASSWORD L"ABCD1234!"
#include <windows.h>
#pragma comment(lib, "advapi32.lib")
/* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
#ifndef OMITBAD
void CWE259_Hard_Coded_Password__w32_wchar_t_54e_badSink(wchar_t * password)
{
{
HANDLE pHandle;
wchar_t * username = L"User";
wchar_t * domain = L"Domain";
/* POTENTIAL FLAW: Attempt to login user with password from the source (which may be hardcoded) */
if (LogonUserW(
username,
domain,
password,
LOGON32_LOGON_NETWORK,
LOGON32_PROVIDER_DEFAULT,
&pHandle) != 0)
{
printLine("User logged in successfully.");
CloseHandle(pHandle);
}
else
{
printLine("Unable to login.");
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE259_Hard_Coded_Password__w32_wchar_t_54e_goodG2BSink(wchar_t * password)
{
{
HANDLE pHandle;
wchar_t * username = L"User";
wchar_t * domain = L"Domain";
/* POTENTIAL FLAW: Attempt to login user with password from the source (which may be hardcoded) */
if (LogonUserW(
username,
domain,
password,
LOGON32_LOGON_NETWORK,
LOGON32_PROVIDER_DEFAULT,
&pHandle) != 0)
{
printLine("User logged in successfully.");
CloseHandle(pHandle);
}
else
{
printLine("Unable to login.");
}
}
}
#endif /* OMITGOOD */
|
{
"content_hash": "1030ed415aa9640dda87e7262b210815",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 157,
"avg_line_length": 29.223529411764705,
"alnum_prop": 0.5599838969404187,
"repo_name": "maurer/tiamat",
"id": "628f4b84db29073c108611b50d10f0f4c5b19eec",
"size": "2484",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "samples/Juliet/testcases/CWE259_Hard_Coded_Password/CWE259_Hard_Coded_Password__w32_wchar_t_54e.c",
"mode": "33188",
"license": "mit",
"language": []
}
|
@interface RegistView : UIView
@property (strong,nonatomic)UITextField * phoneNumberText; //用户名text
@property (strong,nonatomic)UITextField * verificationText; //验证码text
@property (strong,nonatomic)UITextField * passwordText; //密码text
@property (strong,nonatomic)UITextField * passwordText1; //验证密码text
@property (strong,nonatomic)UIButton * registbtn; //注册btn
@property (strong,nonatomic)UIButton * haveBtn; //已有账号btn
@property (strong,nonatomic)UIButton * backBtn; //返回btn
@property (strong,nonatomic)JKCountDownButton * countDownCode; //倒计时btn
@end
|
{
"content_hash": "7902c3e68084557b7cfce18a0fdbbde8",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 71,
"avg_line_length": 34.875,
"alnum_prop": 0.7885304659498208,
"repo_name": "tongyuling/film",
"id": "66106de12c65457f0ec7a66675d676f3b6eb453f",
"size": "788",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "film_app/film_demo/Regist/RegistView.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "692"
},
{
"name": "Objective-C",
"bytes": "803359"
}
]
}
|
require 'watir-webdriver'
require 'spec/watirspec/lib/watirspec'
#
# 1. If example does not start browser, start new one, reuse until example
# finishes and close after
# 2. If example starts browser and assigns it to local variable `browser`,
# it will still be closed
#
def browser
@browser ||= Watir::Browser.start(WatirSpec.url_for('forms_with_input_elements.html'))
end
YARD::Doctest.configure do |doctest|
doctest.skip 'Watir::Browser.start'
doctest.skip 'Watir::Cookies'
doctest.skip 'Watir::Element#to_subtype'
doctest.skip 'Watir::Option'
doctest.skip 'Watir::Screenshot'
doctest.skip 'Watir::Window#size'
doctest.skip 'Watir::Window#position'
%w[text ok close exists?].each do |name|
doctest.before("Watir::Alert##{name}") do
browser.goto WatirSpec.url_for('alerts.html')
browser.button(:id => 'alert').click
end
end
doctest.before('Watir::Alert#set') do
browser.goto WatirSpec.url_for('alerts.html')
browser.button(:id => 'prompt').click
end
doctest.before('Watir::CheckBox#set') do
browser.goto WatirSpec.url_for('forms_with_input_elements.html')
checkbox = browser.checkbox(:id => 'new_user_interests_cars')
end
%w[Watir::Browser#execute_script Watir::Element#drag_and_drop].each do |name|
doctest.before(name) do
browser.goto WatirSpec.url_for('drag_and_drop.html')
end
end
doctest.before('Watir::Element#attribute_value') do
browser.goto WatirSpec.url_for('non_control_elements.html')
end
%w[inner_html outer_html].each do |name|
doctest.before("Watir::Element##{name}") do
browser.goto WatirSpec.url_for('inner_outer.html')
end
end
%w[Watir::HasWindow Watir::Window#== Watir::Window#use].each do |name|
doctest.before(name) do
browser.goto WatirSpec.url_for('window_switching.html')
browser.a(:id => 'open').click
end
end
doctest.after do
browser.quit
@browser = nil
end
end
if ENV['TRAVIS']
ENV['DISPLAY'] = ':99.0'
end
|
{
"content_hash": "097cdb6de4398515c0757789a8cd6c61",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 88,
"avg_line_length": 27.791666666666668,
"alnum_prop": 0.6891554222888556,
"repo_name": "rubygem/website",
"id": "04d6758ae7c24be715a4b942c652cc0f78b0ead7",
"size": "2001",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "gems/ruby/2.2.0/gems/watir-webdriver-0.7.0/support/doctest_helper.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "455330"
},
{
"name": "C",
"bytes": "1730986"
},
{
"name": "C++",
"bytes": "111879"
},
{
"name": "CSS",
"bytes": "782833"
},
{
"name": "CoffeeScript",
"bytes": "91"
},
{
"name": "Cucumber",
"bytes": "22093"
},
{
"name": "Groff",
"bytes": "4034"
},
{
"name": "HTML",
"bytes": "24610"
},
{
"name": "Java",
"bytes": "1129744"
},
{
"name": "JavaScript",
"bytes": "823233"
},
{
"name": "Liquid",
"bytes": "70"
},
{
"name": "Logos",
"bytes": "1171"
},
{
"name": "Makefile",
"bytes": "67894"
},
{
"name": "Ragel in Ruby Host",
"bytes": "140816"
},
{
"name": "Ruby",
"bytes": "9931961"
},
{
"name": "Shell",
"bytes": "377702"
},
{
"name": "TeX",
"bytes": "230259"
}
]
}
|
package cn.aposoft.tutorial.mq.rabbit;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
public class Send {
private final static String QUEUE_NAME = "hello";
public static void main(String[] argv) throws Exception {
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("localhost");
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
channel.queueDeclare(QUEUE_NAME, false, false, false, null);
String message = "Hello World!";
channel.basicPublish("", QUEUE_NAME, null, message.getBytes("UTF-8"));
System.out.println(" [x] Sent '" + message + "'");
channel.close();
connection.close();
}
}
|
{
"content_hash": "4b3b2770291470804ece056317638d52",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 74,
"avg_line_length": 32.25,
"alnum_prop": 0.7144702842377261,
"repo_name": "pipi668/java-tutorials",
"id": "4c6779a9fc4bb34e5aaf81187066dd7b4c3304ed",
"size": "774",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/cn/aposoft/tutorial/mq/rabbit/Send.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1950"
},
{
"name": "HTML",
"bytes": "307"
},
{
"name": "Java",
"bytes": "541450"
}
]
}
|
package com.spectralogic.ds3autogen.net.generators.clientmodels;
import com.google.common.collect.ImmutableList;
import com.spectralogic.ds3autogen.api.models.Ds3Request;
import com.spectralogic.ds3autogen.net.model.client.BaseClient;
@FunctionalInterface
public interface ClientModelGenerator<T extends BaseClient> {
T generate(final ImmutableList<Ds3Request> ds3Requests);
}
|
{
"content_hash": "50a02878d7c0d0c4bcbe6610de21e86c",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 64,
"avg_line_length": 32.083333333333336,
"alnum_prop": 0.8389610389610389,
"repo_name": "rpmoore/ds3_autogen",
"id": "2ecbaa421cee47352407b86b0d5253aea5f628b5",
"size": "1142",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ds3-autogen-net/src/main/java/com/spectralogic/ds3autogen/net/generators/clientmodels/ClientModelGenerator.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "FreeMarker",
"bytes": "79641"
},
{
"name": "Java",
"bytes": "928081"
}
]
}
|
package lab;
import java.io.Serializable;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import org.testng.annotations.*;
import org.xillium.base.Functor;
import org.xillium.base.util.Pair;
public class PairTest {
@SuppressWarnings("serial")
public static class Chain extends Pair<Serializable, Serializable> implements Serializable {
public Chain(Serializable a, Serializable b) {
super(a, b);
}
}
@Test(groups={"pair", "pair-cleansing"})
public void cleansingTest() {
String A0 = "A0";
String A1 = "A1";
String A2 = "A2";
String A3 = "A3";
String A4 = "A4";
String A5 = "A5";
String A6 = "A6";
Chain chain = new Chain(A6, new Chain(A5, new Chain(A4, new Chain(A3, new Chain(A2, new Chain(A1, A0))))));
assert Chain.count(chain) == 7;
assert Chain.includes(chain, A6);
assert Chain.includes(chain, A5);
assert Chain.includes(chain, A4);
assert Chain.includes(chain, A3);
assert Chain.includes(chain, A2);
assert Chain.includes(chain, A1);
assert Chain.includes(chain, A0);
chain = (Chain)Chain.cleanse(chain, A2);
assert Chain.count(chain) == 6;
assert Chain.includes(chain, A6);
assert Chain.includes(chain, A5);
assert Chain.includes(chain, A4);
assert Chain.includes(chain, A3);
assert !Chain.includes(chain, A2);
assert Chain.includes(chain, A1);
assert Chain.includes(chain, A0);
chain = (Chain)Chain.cleanse(chain, A2);
chain = (Chain)Chain.cleanse(chain, A4);
chain = (Chain)Chain.cleanse(chain, A6);
assert Chain.count(chain) == 4;
assert !Chain.includes(chain, A6);
assert Chain.includes(chain, A5);
assert !Chain.includes(chain, A4);
assert Chain.includes(chain, A3);
assert !Chain.includes(chain, A2);
assert Chain.includes(chain, A1);
assert Chain.includes(chain, A0);
}
public static class Holder {
public Serializable chain;
public Holder(Serializable c) {
chain = c;
}
}
@Test(groups={"pair", "pair-concurrency"})
public void concurrencyTest() {
final Random random = new Random();
final AtomicInteger threads = new AtomicInteger();
List<String> tokens = Collections.synchronizedList(new ArrayList<String>());
String A0 = "A0"; tokens.add(A0);
String A1 = "A1"; tokens.add(A1);
String A2 = "A2"; tokens.add(A2);
String A3 = "A3"; tokens.add(A3);
String A4 = "A4"; tokens.add(A4);
String A5 = "A5"; tokens.add(A5);
String A6 = "A6"; tokens.add(A6);
final Holder holder = new Holder(new Chain(A6, new Chain(A5, new Chain(A4, new Chain(A3, new Chain(A2, new Chain(A1, A0)))))));
for (int i = 0; i < 32; ++i) {
new Thread(new Runnable() {
public void run() {
final long[] count = new long[2];
threads.incrementAndGet();
while (Chain.traverse(holder.chain, new Functor<Void, Serializable>() {
public Void invoke(Serializable argument) {
assert argument != null;
++count[0];
try { Thread.sleep(50 + random.nextInt(50)); } catch (InterruptedException x) {}
return null;
}
}) > 0) {
++count[1];
try { Thread.sleep(100); } catch (InterruptedException x) {}
}
threads.decrementAndGet();
System.out.println(Thread.currentThread().getName() + " finished after " + count[1] + " iterations, " + count[0] + " visits");
}
}, "runner-" + i).start();
}
while (threads.get() < 32) try { Thread.sleep(200); } catch (InterruptedException x) {}
System.out.println("Traversal threads running, count = " + threads.get());
for (int i = 0; i < 256; ++i) {
try { Thread.sleep(60); } catch (InterruptedException x) {}
if (random.nextInt(100) < 75) {
String z = "Z" + i;
tokens.add(z);
holder.chain = new Chain(z, holder.chain);
System.out.print("+");
} else {
String a = tokens.remove(random.nextInt(tokens.size()));
holder.chain = Chain.cleanse(holder.chain, a);
System.out.print("-");
}
}
System.out.println("\nAdd/cleanse cycle completed, chain length = " + Chain.count(holder.chain) + ", active traversal threads = " + threads.get());
System.out.print("Cutting down elements in the chain ");
while (tokens.size() > 0) {
String a = tokens.remove(0);
holder.chain = Chain.cleanse(holder.chain, a);
System.out.print(".");
try { Thread.sleep(100); } catch (InterruptedException x) {}
}
System.out.println("\nNow chain length = " + Chain.count(holder.chain));
System.out.println("Waiting for " + threads.get() + " threads to terminate");
while (threads.get() > 0) {
try { Thread.sleep(100); } catch (InterruptedException x) {}
}
}
}
|
{
"content_hash": "0661a63e5a1e01a88a558f16ffbadb85",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 155,
"avg_line_length": 39.24285714285714,
"alnum_prop": 0.5418638514743357,
"repo_name": "brianwhu/xillium",
"id": "69184417d3ffca22070b8598bedeb1372aa11f32",
"size": "5494",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "base/src/test/java/lab/PairTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "1517"
},
{
"name": "Java",
"bytes": "827832"
},
{
"name": "JavaScript",
"bytes": "5622"
},
{
"name": "Shell",
"bytes": "18425"
}
]
}
|
package org.apache.juddi.v3.tck;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
* @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
*/
public class TckPublisher
{
private static Properties tckProperties = new Properties();
public final static String JOE_PUBLISHER_XML = "uddi_data/joepublisher/publisher.xml";
public final static String SAM_SYNDICATOR_XML = "uddi_data/samsyndicator/publisher.xml";
public final static String MARY_PUBLISHER_XML = "uddi_data/marypublisher/publisher.xml";
static {
try {
InputStream inputSteam = TckPublisher.class.getResourceAsStream("/tck.properties");
tckProperties.load(inputSteam);
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
public final static String getRootPublisherId() {
return tckProperties.getProperty(Property.ROOT_PUBLISHER);
}
public final static String getRootPassword() {
return tckProperties.getProperty(Property.ROOT_PASSWORD);
}
public final static String getJoePublisherId() {
return tckProperties.getProperty(Property.JOE_PUBLISHER);
}
public final static String getJoePassword() {
return tckProperties.getProperty(Property.JOE_PASSWORD);
}
public final static String getSamPublisherId() {
return tckProperties.getProperty(Property.SAM_PUBLISHER);
}
public final static String getSamPassword() {
return tckProperties.getProperty(Property.SAM_PASSWORD);
}
public final static String getMaryPublisherId() {
return tckProperties.getProperty(Property.MARY_PUBLISHER);
}
public final static String getMaryPassword() {
return tckProperties.getProperty(Property.MARY_PASSWORD);
}
public final static String getRiftSawPublisherId() {
return tckProperties.getProperty(Property.RIFTSAW_PUBLISHER);
}
public final static String getRiftSawPassword() {
return tckProperties.getProperty(Property.RIFTSAW_PASSWORD);
}
}
|
{
"content_hash": "6daa9a6e51210b2e3061231b874e2d53",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 92,
"avg_line_length": 30.823529411764707,
"alnum_prop": 0.7213740458015268,
"repo_name": "KurtStam/juddi",
"id": "ef1b0cacf314ebeb7717568ad2cf8fffde94d8fb",
"size": "2715",
"binary": false,
"copies": "1",
"ref": "refs/heads/trunk",
"path": "uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckPublisher.java",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null
|
{
"content_hash": "bf7b71e542141c5be27c87c0f5f15081",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "2f78bab77fc6d270db2c6f2f6f74d97f4a97d746",
"size": "195",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Myrtales/Myrtaceae/Myrteola/Myrteola nummularia/ Syn. Eugenia leucomyrtillus/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
package org.dcm4chee.web.war.trash;
import org.apache.wicket.ResourceReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
import org.apache.wicket.ajax.markup.html.form.AjaxCheckBox;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.Model;
import org.dcm4chee.icons.ImageManager;
import org.dcm4chee.icons.behaviours.ImageSizeBehaviour;
import org.dcm4chee.web.common.behaviours.TooltipBehaviour;
public class TrashListHeader extends Panel {
private static final long serialVersionUID = 1L;
private int headerExpandLevel = 1;
private int expandAllLevel = 3;
private Model<Boolean> autoExpand = new Model<Boolean>(false);
private final class Row extends WebMarkupContainer {
private static final long serialVersionUID = 1L;
private final int entityLevel;
public Row(String id, int entityLevel) {
super(id);
this.entityLevel = entityLevel;
}
@Override
public boolean isVisible() {
return TrashListHeader.this.headerExpandLevel >= Row.this.entityLevel;
}
}
private final class Cell extends WebMarkupContainer {
private static final long serialVersionUID = 1L;
private final int entityLevel;
public Cell(String id, int entityLevel) {
super(id);
this.entityLevel = entityLevel;
add(new AjaxFallbackLink<Object>("expand"){
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
headerExpandLevel = headerExpandLevel > Cell.this.entityLevel ?
Cell.this.entityLevel : Cell.this.entityLevel + 1;
if (target != null) {
target.addComponent(TrashListHeader.this);
}
}
}.add( new Image("expandImg", new AbstractReadOnlyModel<ResourceReference>() {
private static final long serialVersionUID = 1L;
@Override
public ResourceReference getObject() {
return TrashListHeader.this.headerExpandLevel <= Cell.this.entityLevel ?
ImageManager.IMAGE_COMMON_EXPAND : ImageManager.IMAGE_COMMON_COLLAPSE;
}
})
.add(new ImageSizeBehaviour())));
}
@Override
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
tag.put("rowspan", 1 + headerExpandLevel - entityLevel);
}
}
public TrashListHeader(String id) {
super(id);
setOutputMarkupId(true);
Cell patCell = new Cell("cell", 0);
patCell.add(new AjaxFallbackLink<Object>("expandAll"){
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
if (target != null) {
headerExpandLevel = expandAllLevel;
target.addComponent(TrashListHeader.this);
}
}
@Override
public boolean isVisible() {
return headerExpandLevel < expandAllLevel;
}
}.add(new Image("expandAllImg", ImageManager.IMAGE_COMMON_EXPAND)
.add(new ImageSizeBehaviour())));
patCell.add(new AjaxCheckBox("autoExpand", autoExpand){
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
if (autoExpand.getObject()) {
headerExpandLevel = expandAllLevel;
target.addComponent(TrashListHeader.this);
}
}}.add(new TooltipBehaviour("trash.search.","autoExpand")));
add(new Row("patient", 0).add(patCell));
add(new Row("study", 1).add(new Cell("cell", 1)));
add(new Row("series", 2).add(new Cell("cell", 2)));
add(new Row("instance", 3));
}
public void setExpandAllLevel(int expandAllLevel) {
this.expandAllLevel = expandAllLevel;
if (autoExpand.getObject())
this.headerExpandLevel = expandAllLevel;
}
public int getExpandAllLevel() {
return expandAllLevel;
}
public void expandToLevel(int level) {
headerExpandLevel = level;
}
}
|
{
"content_hash": "93066795eafe8cb056469f425ecbb7e2",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 98,
"avg_line_length": 34.81751824817518,
"alnum_prop": 0.6123689727463313,
"repo_name": "medicayun/medicayundicom",
"id": "6a9fc46ac20e3d0804e28bde4c626ddcc46549c2",
"size": "4770",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "dcm4chee-web/tags/DCM4CHEE_WEB_3_0_0_TEST2/dcm4chee-web-war/src/main/java/org/dcm4chee/web/war/trash/TrashListHeader.java",
"mode": "33188",
"license": "apache-2.0",
"language": []
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using NPOI.HSSF.UserModel;
using NPOI.HSSF.Model;
using NPOI.DDF;
using TestCases.HSSF.Model;
using NPOI.Util;
using NPOI.HSSF.Record;
namespace TestCases.HSSF.UserModel
{
[TestFixture]
public class TestPolygon
{
[Test]
public void TestResultEqualsToAbstractShape()
{
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sh = wb.CreateSheet() as HSSFSheet;
HSSFPatriarch patriarch = sh.CreateDrawingPatriarch() as HSSFPatriarch;
HSSFPolygon polygon = patriarch.CreatePolygon(new HSSFClientAnchor());
polygon.SetPolygonDrawArea(100, 100);
polygon.SetPoints(new int[] { 0, 90, 50 }, new int[] { 5, 5, 44 });
polygon.ShapeId = (1024);
Assert.AreEqual(polygon.GetEscherContainer().ChildRecords.Count, 4);
//sp record
byte[] expected = TestDrawingAggregate.decompress("H4sIAAAAAAAAAGNi4PrAwQAELEDMxcAAAAU6ZlwQAAAA");
byte[] actual = polygon.GetEscherContainer().GetChild(0).Serialize();
Assert.AreEqual(expected.Length, actual.Length);
Assert.IsTrue(Arrays.Equals(expected, actual));
expected = TestDrawingAggregate.decompress("H4sIAAAAAAAAAGNgEPggxIANAABK4+laGgAAAA==");
actual = polygon.GetEscherContainer().GetChild(2).Serialize();
Assert.AreEqual(expected.Length, actual.Length);
Assert.IsTrue(Arrays.Equals(expected, actual));
expected = TestDrawingAggregate.decompress("H4sIAAAAAAAAAGNgEPzAAAQACl6c5QgAAAA=");
actual = polygon.GetEscherContainer().GetChild(3).Serialize();
Assert.AreEqual(expected.Length, actual.Length);
Assert.IsTrue(Arrays.Equals(expected, actual));
ObjRecord obj = polygon.GetObjRecord();
expected = TestDrawingAggregate.decompress("H4sIAAAAAAAAAItlkGIQZRBikGNgYBBMYEADAOAV/ZkeAAAA");
actual = obj.Serialize();
Assert.AreEqual(expected.Length, actual.Length);
Assert.IsTrue(Arrays.Equals(expected, actual));
wb.Close();
}
[Test]
public void TestPolygonPoints()
{
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sh = wb.CreateSheet() as HSSFSheet;
HSSFPatriarch patriarch = sh.CreateDrawingPatriarch() as HSSFPatriarch;
HSSFPolygon polygon = patriarch.CreatePolygon(new HSSFClientAnchor());
polygon.SetPolygonDrawArea(100, 100);
polygon.SetPoints(new int[] { 0, 90, 50, 90 }, new int[] { 5, 5, 44, 88 });
EscherArrayProperty verticesProp1 = polygon.GetOptRecord().Lookup(EscherProperties.GEOMETRY__VERTICES) as EscherArrayProperty;
String expected =
"<EscherArrayProperty id=\"0x8145\" name=\"geometry.vertices\" blipId=\"false\">" +
"<Element>[00, 00, 05, 00]</Element>" +
"<Element>[5A, 00, 05, 00]</Element>" +
"<Element>[32, 00, 2C, 00]</Element>" +
"<Element>[5A, 00, 58, 00]</Element>" +
"<Element>[00, 00, 05, 00]</Element>" +
"</EscherArrayProperty>";
String actual = verticesProp1.ToXml("").Replace("\r", "").Replace("\n", "").Replace("\t", "");
Assert.AreEqual(verticesProp1.NumberOfElementsInArray, 5);
Assert.AreEqual(expected, actual);
polygon.SetPoints(new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 });
Assert.IsTrue(Arrays.Equals(polygon.XPoints, new int[] { 1, 2, 3 }));
Assert.IsTrue(Arrays.Equals(polygon.YPoints, new int[] { 4, 5, 6 }));
verticesProp1 = polygon.GetOptRecord().Lookup(EscherProperties.GEOMETRY__VERTICES) as EscherArrayProperty;
expected =
"<EscherArrayProperty id=\"0x8145\" name=\"geometry.vertices\" blipId=\"false\">" +
"<Element>[01, 00, 04, 00]</Element>" +
"<Element>[02, 00, 05, 00]</Element>" +
"<Element>[03, 00, 06, 00]</Element>" +
"<Element>[01, 00, 04, 00]</Element>" +
"</EscherArrayProperty>";
actual = verticesProp1.ToXml("").Replace("\r", "").Replace("\n", "").Replace("\t", "");
Assert.AreEqual(verticesProp1.NumberOfElementsInArray, 4);
Assert.AreEqual(expected, actual);
wb.Close();
}
[Test]
public void TestSetGetProperties()
{
HSSFWorkbook wb1 = new HSSFWorkbook();
HSSFSheet sh = wb1.CreateSheet() as HSSFSheet;
HSSFPatriarch patriarch = sh.CreateDrawingPatriarch() as HSSFPatriarch;
HSSFPolygon polygon = patriarch.CreatePolygon(new HSSFClientAnchor());
polygon.SetPolygonDrawArea(102, 101);
polygon.SetPoints(new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 });
Assert.IsTrue(Arrays.Equals(polygon.XPoints, new int[] { 1, 2, 3 }));
Assert.IsTrue(Arrays.Equals(polygon.YPoints, new int[] { 4, 5, 6 }));
Assert.AreEqual(polygon.DrawAreaHeight, 101);
Assert.AreEqual(polygon.DrawAreaWidth, 102);
HSSFWorkbook wb2 = HSSFTestDataSamples.WriteOutAndReadBack(wb1);
wb1.Close();
sh = wb2.GetSheetAt(0) as HSSFSheet;
patriarch = sh.DrawingPatriarch as HSSFPatriarch;
polygon = (HSSFPolygon)patriarch.Children[0];
Assert.IsTrue(Arrays.Equals(polygon.XPoints, new int[] { 1, 2, 3 }));
Assert.IsTrue(Arrays.Equals(polygon.YPoints, new int[] { 4, 5, 6 }));
Assert.AreEqual(polygon.DrawAreaHeight, 101);
Assert.AreEqual(polygon.DrawAreaWidth, 102);
polygon.SetPolygonDrawArea(1021, 1011);
polygon.SetPoints(new int[] { 11, 21, 31 }, new int[] { 41, 51, 61 });
Assert.IsTrue(Arrays.Equals(polygon.XPoints, new int[] { 11, 21, 31 }));
Assert.IsTrue(Arrays.Equals(polygon.YPoints, new int[] { 41, 51, 61 }));
Assert.AreEqual(polygon.DrawAreaHeight, 1011);
Assert.AreEqual(polygon.DrawAreaWidth, 1021);
HSSFWorkbook wb3 = HSSFTestDataSamples.WriteOutAndReadBack(wb2);
wb2.Close();
sh = wb3.GetSheetAt(0) as HSSFSheet;
patriarch = sh.DrawingPatriarch as HSSFPatriarch;
polygon = (HSSFPolygon)patriarch.Children[0];
Assert.IsTrue(Arrays.Equals(polygon.XPoints, new int[] { 11, 21, 31 }));
Assert.IsTrue(Arrays.Equals(polygon.YPoints, new int[] { 41, 51, 61 }));
Assert.AreEqual(polygon.DrawAreaHeight, 1011);
Assert.AreEqual(polygon.DrawAreaWidth, 1021);
wb3.Close();
}
[Test]
public void TestAddToExistingFile()
{
HSSFWorkbook wb1 = new HSSFWorkbook();
HSSFSheet sh = wb1.CreateSheet() as HSSFSheet;
HSSFPatriarch patriarch = sh.CreateDrawingPatriarch() as HSSFPatriarch;
HSSFPolygon polygon = patriarch.CreatePolygon(new HSSFClientAnchor());
polygon.SetPolygonDrawArea(102, 101);
polygon.SetPoints(new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 });
HSSFPolygon polygon1 = patriarch.CreatePolygon(new HSSFClientAnchor());
polygon1.SetPolygonDrawArea(103, 104);
polygon1.SetPoints(new int[] { 11, 12, 13 }, new int[] { 14, 15, 16 });
HSSFWorkbook wb2 = HSSFTestDataSamples.WriteOutAndReadBack(wb1);
wb1.Close();
sh = wb2.GetSheetAt(0) as HSSFSheet;
patriarch = sh.DrawingPatriarch as HSSFPatriarch;
Assert.AreEqual(patriarch.Children.Count, 2);
HSSFPolygon polygon2 = patriarch.CreatePolygon(new HSSFClientAnchor());
polygon2.SetPolygonDrawArea(203, 204);
polygon2.SetPoints(new int[] { 21, 22, 23 }, new int[] { 24, 25, 26 });
HSSFWorkbook wb3 = HSSFTestDataSamples.WriteOutAndReadBack(wb2);
wb2.Close();
sh = wb3.GetSheetAt(0) as HSSFSheet;
patriarch = sh.DrawingPatriarch as HSSFPatriarch;
Assert.AreEqual(patriarch.Children.Count, 3);
polygon = (HSSFPolygon)patriarch.Children[0];
polygon1 = (HSSFPolygon)patriarch.Children[1];
polygon2 = (HSSFPolygon)patriarch.Children[2];
Assert.IsTrue(Arrays.Equals(polygon.XPoints, new int[] { 1, 2, 3 }));
Assert.IsTrue(Arrays.Equals(polygon.YPoints, new int[] { 4, 5, 6 }));
Assert.AreEqual(polygon.DrawAreaHeight, 101);
Assert.AreEqual(polygon.DrawAreaWidth, 102);
Assert.IsTrue(Arrays.Equals(polygon1.XPoints, new int[] { 11, 12, 13 }));
Assert.IsTrue(Arrays.Equals(polygon1.YPoints, new int[] { 14, 15, 16 }));
Assert.AreEqual(polygon1.DrawAreaHeight, 104);
Assert.AreEqual(polygon1.DrawAreaWidth, 103);
Assert.IsTrue(Arrays.Equals(polygon2.XPoints, new int[] { 21, 22, 23 }));
Assert.IsTrue(Arrays.Equals(polygon2.YPoints, new int[] { 24, 25, 26 }));
Assert.AreEqual(polygon2.DrawAreaHeight, 204);
Assert.AreEqual(polygon2.DrawAreaWidth, 203);
wb3.Close();
}
[Test]
public void TestExistingFile()
{
HSSFWorkbook wb = HSSFTestDataSamples.OpenSampleWorkbook("drawings.xls");
HSSFSheet sheet = wb.GetSheet("polygon") as HSSFSheet;
HSSFPatriarch Drawing = sheet.DrawingPatriarch as HSSFPatriarch;
Assert.AreEqual(1, Drawing.Children.Count);
HSSFPolygon polygon = (HSSFPolygon)Drawing.Children[0];
Assert.AreEqual(polygon.DrawAreaHeight, 2466975);
Assert.AreEqual(polygon.DrawAreaWidth, 3686175);
Assert.IsTrue(Arrays.Equals(polygon.XPoints, new int[] { 0, 0, 31479, 16159, 19676, 20502 }));
Assert.IsTrue(Arrays.Equals(polygon.YPoints, new int[] { 0, 0, 36, 56, 34, 18 }));
wb.Close();
}
[Test]
public void TestPolygonType()
{
HSSFWorkbook wb1 = new HSSFWorkbook();
HSSFSheet sh = wb1.CreateSheet() as HSSFSheet;
HSSFPatriarch patriarch = sh.CreateDrawingPatriarch() as HSSFPatriarch;
HSSFPolygon polygon = patriarch.CreatePolygon(new HSSFClientAnchor());
polygon.SetPolygonDrawArea(102, 101);
polygon.SetPoints(new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 });
HSSFWorkbook wb2 = HSSFTestDataSamples.WriteOutAndReadBack(wb1);
wb1.Close();
sh = wb2.GetSheetAt(0) as HSSFSheet;
patriarch = sh.DrawingPatriarch as HSSFPatriarch;
HSSFPolygon polygon1 = patriarch.CreatePolygon(new HSSFClientAnchor());
polygon1.SetPolygonDrawArea(102, 101);
polygon1.SetPoints(new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 });
EscherSpRecord spRecord = polygon1.GetEscherContainer().GetChildById(EscherSpRecord.RECORD_ID) as EscherSpRecord;
spRecord.ShapeType = ((short)77/**RANDOM**/);
HSSFWorkbook wb3 = HSSFTestDataSamples.WriteOutAndReadBack(wb2);
wb2.Close();
sh = wb3.GetSheetAt(0) as HSSFSheet;
patriarch = sh.DrawingPatriarch as HSSFPatriarch;
Assert.AreEqual(patriarch.Children.Count, 2);
Assert.IsTrue(patriarch.Children[0] is HSSFPolygon);
Assert.IsTrue(patriarch.Children[1] is HSSFPolygon);
wb3.Close();
}
}
}
|
{
"content_hash": "420ada0dafe485f66cdb8bc23df31bfc",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 138,
"avg_line_length": 44.13257575757576,
"alnum_prop": 0.6076731611020513,
"repo_name": "tonyqus/npoi",
"id": "1331e6fbbae4e010101cc26cd86bc37a76774061",
"size": "11653",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "testcases/main/HSSF/UserModel/TestPolygon.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1190"
},
{
"name": "C#",
"bytes": "24395543"
},
{
"name": "PowerShell",
"bytes": "168"
},
{
"name": "Smalltalk",
"bytes": "57228"
},
{
"name": "VBA",
"bytes": "816"
}
]
}
|
@extends('app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Reset Password</div>
<div class="panel-body">
@if (session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div>
@endif
@if (count($errors) > 0)
<div class="alert alert-danger">
<strong>Whoops!</strong> There were some problems with your input.<br><br>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form class="form-horizontal" role="form" method="POST" action="{{ url('/password/email') }}">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="form-group">
<label class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input type="email" class="form-control" name="email" value="{{ old('email') }}">
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-default">
Send Password Reset Link
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
|
{
"content_hash": "3c5ec06110327f2b534b689b73ce7b0c",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 99,
"avg_line_length": 27.2,
"alnum_prop": 0.5433823529411764,
"repo_name": "keefo/NOJ",
"id": "eb664227386241afc773fb29028bc93320732cab",
"size": "1360",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "resources/views/auth/password.blade.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "356"
},
{
"name": "CSS",
"bytes": "142674"
},
{
"name": "JavaScript",
"bytes": "1331"
},
{
"name": "PHP",
"bytes": "205683"
}
]
}
|
"use strict";
var visir = visir || {};
function snapPoint(p)
{
p.x += 6; p.y += 6;
p.x = p.x - (p.x % 13);
p.y = p.y - (p.y % 13);
p.x -= 5;
p.y += 3;
}
function toBoardCoords(p)
{
p.x = p.x / 13 | 0;
p.y = p.y / 13 | 0;
}
//////////////////////////////////////////////////////////////////////////////
// Point
visir.Point = function(x,y)
{
this.x = x || 0;
this.y = y || 0;
}
visir.Point.prototype.SnapToGrid = function()
{
this.x += 6; this.y += 6;
this.x = this.x - (this.x % 13);
this.y = this.y - (this.y % 13);
this.x -= 5;
this.y += 3;
}
visir.Point.prototype.Add = function(p)
{
return new visir.Point(this.x + p.x, this.y + p.y);
}
visir.Point.prototype.toString = function()
{
return "(x: " + this.x + " y: " + this.y + ")";
}
//////////////////////////////////////////////////////////////////////////////
// Wire
visir.Wire = function(color)
{
this._color = color;
this._lineWidth = 3.4;
this._start = new visir.Point();
this._end = new visir.Point();
this._mid = new visir.Point();
}
visir.Wire.prototype.SetBentPoints = function(start, end)
{
if (start.x > end.x) {
var p1 = end;
var p2 = start;
}
else {
var p1 = start;
var p2 = end;
}
var diff = { x: p2.x - p1.x, y: p2.y - p1.y };
var cross = { x: diff.y, y: -diff.x };
var scale = 5;
cross.x /= scale;
cross.y /= scale;
var mid = new visir.Point();
mid.x = start.x + (end.x - start.x) / 2;
mid.y = start.y + (end.y - start.y) / 2;
mid.x += cross.x;
mid.y += cross.y;
this.SetPoints(start, mid, end);
}
visir.Wire.prototype.SetPoints = function(start, mid, end)
{
this._start = start;
this._mid = mid;
this._end = end;
}
visir.Wire.prototype.Draw = function(context)
{
this._RawDraw(context, this._color, this._lineWidth);
}
visir.Wire.prototype.DrawShadow = function(context, color, width)
{
var diff = { x: this._end.x - this._start.x, y: this._end.y - this._start.y };
var len = Math.sqrt(diff.x * diff.x + diff.y * diff.y);
var scale = 20.0;
var midx = this._mid.x + len / scale;
var midy = this._mid.y + len / scale;
context.save();
context.shadowBlur=7;
context.shadowColor="black";
context.lineCap = 'round';
context.strokeStyle = 'rgba(0,0,0,0.2)';
context.lineWidth = width-1;
context.beginPath();
context.moveTo(this._start.x, this._start.y);
// +1 is for avoiding having same start and end, which leads to no painting at all
context.quadraticCurveTo(midx, midy, this._end.x+1, this._end.y);
context.stroke();
context.closePath();
context.restore();
}
visir.Wire.prototype._RawDraw = function(context, color, width)
{
context.lineCap = 'round';
context.strokeStyle = color;
context.lineWidth = width;
context.beginPath();
context.moveTo(this._start.x, this._start.y);
// +1 is for avoiding having same start and end, which leads to no painting at all
context.quadraticCurveTo(this._mid.x, this._mid.y, this._end.x+1, this._end.y);
context.stroke();
context.closePath();
}
//////////////////////////////////////////////////////////////////////////////
// Grid
// Ocuppation grid for the bin (to know which positions are available)
visir.Grid = function(componentList, $bin) {
var me = this;
// Being true = "available", and false = "busy"
this._grid = [
// row 0 (y=0): [ true, true, true ... ],
// row 1 (y=1): [ true, true, true ... ],
];
this._rows = 7;
this._cols = 54;
for(var y = 0; y < this._rows; y++) {
var rowOccupation = [];
for(var x = 0; x < this._cols; x++)
rowOccupation.push(true);
this._grid.push(rowOccupation);
}
var bin_position = $bin.position();
var bin_left = bin_position.left;
var bin_top = bin_position.top;
$(componentList).each(function(pos, component) {
var position = component._$elem.position();
var relative_left = Math.floor((position.left - bin_left - 5 + parseInt(component.translation.x)) / 13);
var relative_top = Math.floor((position.top - bin_top - 5 + parseInt(component.translation.y)) / 13);
/*
trace("Marking: " + component._type + " " + component._value);
trace("rel: " + relative_left + " " + relative_top);
trace("size: " + component.widthInPoints() + " " + component.heightInPoints());
*/
var margin = 5;
var wip = Math.ceil((component.width()+margin) / 13);
var hip = Math.ceil((component.height()+margin) / 13);
// trace("Component found in: " + relative_top + ", " + relative_left);
//if(relative_top >= 0 && relative_top < me._rows && relative_left >= 0 && relative_left < me._cols) {
for(var x = relative_left; x < relative_left + wip; x++)
for(var y = relative_top; y < relative_top + hip; y++) {
if (x >= 0 && x<me._cols && y >= 0 && y<me._rows) {
me._set(x,y, false);
}
//trace("Marking busy..." + x + "; " + y + " " + component._type + " " + component._value);
}
//}
});
}
visir.Grid.prototype._get = function(x, y)
{
//trace("Attempting " + x + ", " + y + " " + this._grid[y][x]);
return this._grid[y][x];
}
visir.Grid.prototype._set = function(x, y, value)
{
//trace("Attempting " + x + ", " + y + " " + value);
this._grid[y][x] = value;
}
visir.Grid.prototype._FindSlot = function(height, width)
{
for (var x = 0; x <= this._cols - width; x++) { // x = 0 .. ~54
for (var y = 0; y <= this._rows - height; y++) { // y = 0 .. ~7
if (this._get(x, y)) {
var potentialHole = true;
for (var x2 = x; x2 < this._cols && x2 < x + width && potentialHole; x2++) {
for (var y2 = y; y2 < this._rows && y2 < y + height && potentialHole; y2++) {
//trace("xx: " + x2 + " " + y2);
// trace(this._grid);
if (!this._get(x2, y2))
potentialHole = false;
}
}
if (potentialHole)
return { 'x' : x, 'y' : y };
}
}
}
return { 'x' : 0, 'y' : 0 };
}
//////////////////////////////////////////////////////////////////////////////
// Component
// Component container
visir.Component = function($elem, breadboard, type, value)
{
this._$elem = $elem;
this._breadboard = breadboard;
this._$circle = null;
this._current_step = 0; // current rotation
this.translation = { 'x' : 0, 'y' : 0 };
this.translations = [];
this._pins = []; // one entry per rotation, each entry contains an array of points with offsets to where each pin is located
this._type = type;
this._value = value;
}
visir.Component.prototype.Move = function(x, y)
{
this._$elem.css("left", x).css("top", y);
}
visir.Component.prototype.GetPos = function()
{
return new visir.Point(parseInt(this._$elem.css("left"), 10), parseInt(this._$elem.css("top"), 10));
}
visir.Component.prototype.GetRotation = function()
{
return this._current_step;
}
visir.Component.prototype.width = function()
{
return this._$elem.find('.active').width();
}
visir.Component.prototype.height = function()
{
return this._$elem.find('.active').height();
}
visir.Component.prototype.heightInPoints = function()
{
return Math.ceil(this.height() / 13);
}
visir.Component.prototype.widthInPoints = function()
{
return Math.ceil(this.width() / 13);
}
visir.Component.prototype.remove = function()
{
this._$elem.remove();
this._breadboard._RemoveComponent(this);
this._breadboard.SelectComponent(null);
}
visir.Component.prototype._RemoveCircle = function()
{
if(this._$circle != null) {
this._$circle.remove();
this._$circle = null;
}
}
visir.Component.prototype._PlaceInBin = function()
{
var grid = this._breadboard._BuildOccupationGrid();
var height = this.heightInPoints();
var width = this.widthInPoints();
var availablePos = grid._FindSlot(height, width);
var bin_position = this._breadboard._GetBin().position();
// TODO: Take into account: this.translation.rot
this.Rotate(0);
var new_left = availablePos.x * 13 + bin_position.left + 5 - parseInt(this.translation.x);
var new_top = availablePos.y * 13 + bin_position.top + 5 - parseInt(this.translation.y);
var p = new visir.Point(new_left, new_top);
p.SnapToGrid();
// trace("Available position found: [x=" + availablePos.x + ", y=" + availablePos.y + "] (which is [" + new_left + ", " + new_top + "])");
this._$elem.css({
"left" : p.x,
"top" : p.y,
});
}
visir.Component.prototype.Rotate = function(step)
{
if(step == undefined) {
step = this._current_step + 1;
}
var $imgs = this._$elem.find("img");
if (step >= $imgs.length) step = step % $imgs.length;
// trace("step: " + step);
var idx = 0;
var currentImage = null;
$imgs.each(function() {
if (idx == step) {
$(this).addClass("active");
currentImage = $(this);
} else {
$(this).removeClass("active");
}
idx++;
});
this._current_step = step;
this.translation = this.translations[step];
// trace("New translation: " + this.translation.x + "; " + this.translation.y);
}
visir.Component.prototype._AddCircle = function()
{
var me = this;
// Placed here for math operations
// var CIRCLE_SIZE = 140;
var CIRCLE_SIZE = this.width() + 100;
var ICON_SIZE = 40;
// If the circle may be slightly bigger than the four
// corner icons, since circles don't have corners. This
// constant establishes the level of overlap between the
// square that surrounds a circle and the square that
// surrounds the icons. Example: establishing it to 0
// the circle will not overlap at all; establishing it to
// 1 will overlap completely.
var CIRCLE_OVERLAP = 0.4;
// Where is the component?
var originalTop = parseInt(this._$elem.css('top'), 10);
var originalLeft = parseInt(this._$elem.css('left'), 10);
// Where should be located inside the circle?
var relativeTop = this._$elem.height() / 2;
var relativeLeft = this._$elem.width() / 2;
// Where should the whole circle be located?
var newTop = originalTop - relativeTop;
var newLeft = originalLeft - relativeLeft;
// Overall block
this._$circle = $('<span class="componentcircle"></span>');
this._$circle.width(CIRCLE_SIZE);
this._$circle.height(CIRCLE_SIZE);
var transform = 'translate(-' + (CIRCLE_SIZE / 2) + 'px,-' + (CIRCLE_SIZE / 2) + 'px)';
this._$circle.css({
'position' : 'absolute',
'top' : newTop + 'px',
'left' : newLeft + 'px',
'transform' : transform,
'-moz-transform' : transform,
'-webkit-transform' : transform
});
// Circle
//var $circleImg = $('<img src="instruments/breadboard/images/empty_circle.png"/>');
var $circleImg = $('<div class="circle" />');
$circleImg.width(CIRCLE_SIZE - 2 * (1 - CIRCLE_OVERLAP) * ICON_SIZE);
$circleImg.height(CIRCLE_SIZE - 2 * (1 - CIRCLE_OVERLAP) * ICON_SIZE);
$circleImg.css({
'position' : 'absolute',
'left' : (1 - CIRCLE_OVERLAP) * ICON_SIZE,
'top' : (1 - CIRCLE_OVERLAP) * ICON_SIZE
});
this._$circle.append($circleImg);
// Rotation button
// Public domain
// http://openclipart.org/detail/33685/tango-view-refresh-by-warszawianka
var $rotateImg = $('<img src="' + me._breadboard._BuildImageUrl('rotate.png') + '"/>');
$rotateImg.width(ICON_SIZE);
$rotateImg.height(ICON_SIZE);
$rotateImg.css({
'position' : 'absolute',
'left' : CIRCLE_SIZE - ICON_SIZE,
'top' : CIRCLE_SIZE - ICON_SIZE
});
$rotateImg.click(function() {
me.Rotate();
});
this._$circle.append($rotateImg);
// Drag and drop button
this._breadboard._$elem.find("#comp_circle").append(this._$circle);
// if ($.browser.msie)
// {
// if (parseInt($.browser.version, 10) >= 9) {
// this._breadboard._$elem.find("#comp_circle").find("*").css("z-index", "15");
// }
// }
var handler = this.generateHandler(this._$circle, function() {
// On clicked
me._breadboard.SelectComponent(null);
}, this._$elem, function() {
}, function () {
});
$circleImg.on("mousedown touchstart", handler);
}
visir.Component.prototype.GenCircuitIfUsed = function()
{
var out = this._type + "_X";
var rot = this._current_step;
var pins = this._pins[rot];
if (pins.length == 0) return null; // assert?
for(var i = 0; i< pins.length; i++) {
var p = this._breadboard._GetNodeName(this._GetPinPoint(pins[i]));
if (!p) return null;
out += " " + p;
}
return out + " " + this._value + "\n";
}
visir.Component.prototype._GetPinPoint = function(p)
{
var mx = parseInt(this._$elem.css('left'));
var my = parseInt(this._$elem.css('top'));
//trace("mx/y: " + mx + " " + my + "-" + p);
return new visir.Point(mx + p.x, my + p.y);
}
//////////////////////////////////////////////////////////////////////////////
// Breadboard
var debugbb;
visir.Breadboard = function(id, $elem)
{
var me = this;
debugbb = this;
this._$elem = $elem;
this._$library = null;
this._onLibraryLoaded = null;
this._components = [];
this._wires = [];
this._instruments = [];
this._selectedWire = null; // index in _wires
this._selectedCompnent = null;
this._isTouchDevice = navigator.userAgent.match(/iPhone|iPad|Android/)
if (this._isTouchDevice) this._fingerOffset = new visir.Point(0, -26);
else this._fingerOffset = new visir.Point(0, 0);
this.IMAGE_URL = "instruments/breadboard/images/";
if (visir.BaseLocation) this.IMAGE_URL = visir.BaseLocation + this.IMAGE_URL;
var tpl = '<div class="breadboard">\
<img class="background" src="' + this._BuildImageUrl('breadboard.png') + '" alt="breadboard"/>\
<div class="clickarea"></div>\
<div class="bin">\
<div class="reset">'+visir.Lang.GetMessage('reset')+'</div>\
<div class="teacher">+</div>\
</div>\
<div class="colorpicker">\
<p class="title">'+visir.Lang.GetMessage('wire_sel')+'</p>\
<div class="border">\
<div class="color red"></div>\
<div class="color black"></div>\
<div class="color green"></div>\
<div class="color yellow"></div>\
<div class="color blue"></div>\
<div class="color brown"></div>\
<div class="currentcolor"></div>\
</div>\
</div>\
<div class="indicator"></div>\
<div class="delete"></div>\
<div class="help">?</div>\
<div class="components"></div>\
<div class="instruments">\
<div class="left"></div>\
</div>\
<canvas id="wires" width="715" height="450"></canvas>\
<div id="wire_start" class="wirepoint start" />\
<div id="wire_mid" class="wirepoint mid" />\
<div id="wire_end" class="wirepoint end" />\
<div id="comp_circle" class="comp_circle" />\
<div class="componentbox">\
<div class="componentlist">\
<table class="componentlist-table">\
</table>\
</div>\
<div class="componentbutton">\
<button>'+visir.Lang.GetMessage('close')+'</button>\
</div>\
</div>\
</div>';
//tpl += '<div id="debug"></div>'
$elem.append(tpl);
var $wires = $elem.find("#wires");
if (typeof G_vmlCanvasManager !== "undefined")
{
G_vmlCanvasManager.initElement($wires);
}
var $doc = $(document);
var context = $wires[0].getContext('2d');
this._wireCtx = context;
this._$wires = $wires;
var $click = $elem.find(".clickarea");
$wires.click( function() { trace("Clicked wires"); });
// create offsceen canvas for wire picking
var offscreen_canvas = document.createElement('canvas');
if (typeof G_vmlCanvasManager !== "undefined")
{
G_vmlCanvasManager.initElement(offscreen_canvas);
}
offscreen_canvas.width = 715; //$wires.parent().width();
offscreen_canvas.height = 450; //$wires.parent().height();
this._offWireCtx = offscreen_canvas.getContext('2d');
//$elem.find("#debug").append(offscreen_canvas);
//document.getElementById("debug").appendChild(offscreen_canvas);
// TODO: make it configurable (argument?)
var teacher_mode = (visir.Config) ? visir.Config.Get("teacher") : true;
if(!teacher_mode) $elem.find(".teacher").hide();
$elem.find(".teacher").click(function(e) {
if (!visir.Config.Get("readOnly"))
{
$elem.find(".componentbox").show();
$elem.find(".componentlist-table").empty();
var $components = me._$library.find("component").each(function() {
var img = $(this).find("rotation").attr("image");
var type = $(this).attr("type");
var value = $(this).attr("value");
var img_html = '<tr class="component-list-row">\
<td>\
<img src="' + me._BuildImageUrl(img) + '"/>\
</td>\
<td>' + type + '</td>\
<td>' + value + '</td>\
</tr>';
$elem.find(".componentlist-table").append(img_html);
$($elem.find('.component-list-row').get(-1)).click(function(e){
var comp_obj = me.CreateComponent(type, value);
comp_obj._PlaceInBin();
});
});
}
});
$elem.find(".reset").click( function(e) {
if (!visir.Config.Get("readOnly"))
{
// Send all the components back to the bin
for(var i=0;i<me._components.length;i++) {
me._components[i].Move(500,500); // move away from the bin
}
for(var i=0;i<me._components.length;i++) {
me._components[i]._PlaceInBin();
}
me.SelectWire(null);
me.SelectComponent(null);
me._wires = [];
me._DrawWires();
}
});
$elem.find(".componentbutton button").click(function(e) {
$elem.find(".componentbox").hide();
});
$click.on("mousedown touchstart", function(e) {
if (!visir.Config.Get("readOnly"))
{
trace("touch");
var wires_offset = $wires.offset();
var offset = { x: wires_offset.left, y: wires_offset.top };
if (!me._color) {
// do picking against the wires
// don't care if we got more than one touch
// we can probably do something smarter here, to avoid problems when scrolling etc.
if (e.originalEvent.touches && e.originalEvent.touches.length > 1) return;
var touch = (e.originalEvent.touches) ? e.originalEvent.touches[0] : e;
var start = new visir.Point(touch.pageX - offset.x, touch.pageY - offset.y);
var idx = me._PickWire(start.x, start.y);
if (idx !== null) {
e.preventDefault();
me.SelectWire(idx);
me.SelectComponent(null);
return;
}
// nothing was picked
me.SelectWire(null);
me.SelectComponent(null);
return;
}
//trace("mouse down");
e.preventDefault();
// Draw new wire
var nWire = new visir.Wire(me._color); // XXX: replace with CreateWire
me._wires.push(nWire);
e = (e.originalEvent.touches) ? e.originalEvent.touches[0] : e;
var start = new visir.Point(e.pageX - offset.x, e.pageY - offset.y);
start = start.Add(me._fingerOffset);
start.SnapToGrid();
$click.on("mousemove.rem touchmove.rem", function(e) {
e = (e.originalEvent.touches) ? e.originalEvent.touches[0] : e;
var end = new visir.Point(e.pageX - offset.x, e.pageY - offset.y);
end = end.Add(me._fingerOffset);
end.SnapToGrid();
nWire.SetBentPoints(start, end);
me._DrawWires();
//trace("move")
});
$doc.on("mouseup.rem touchend.rem", function(e) {
trace("mouseup");
$click.off(".rem");
$doc.off(".rem");
// deselect the color picker
me._color = null;
me._$elem.find(".color").removeClass("selected");
});
}
});
$elem.find(".color").click( function() {
if (!visir.Config.Get("readOnly"))
{
me.SelectWire(null);
me.SelectComponent(null);
me._color = $(this).css("background-color");
me._$elem.find(".color").removeClass("selected");
$(this).addClass("selected");
}
});
$elem.find(".delete").click( function() {
if (!visir.Config.Get("readOnly"))
{
if (me._selectedWire !== null) {
me._RemoveWire(me._wires[me._selectedWire]);
me.SelectWire(null);
}
if (me._selectedCompnent) {
me._selectedCompnent._PlaceInBin();
me.SelectComponent(null);
}
}
});
$elem.find(".help").click( function() {
me.ShowHelp(true);
});
function GenWirePointMove(snap, assign)
{
return function($elem, x, y) {
if (me._selectedWire === null) return;
var p = new visir.Point(x, y);
// add a finger offset if on a mobile touch screen device
p = p.Add(me._fingerOffset);
if (snap) p.SnapToGrid();
assign(p);
me._DrawWires();
var retp = new visir.Point(p.x - $elem.width() / 2, p.y - $elem.height() / 2);
return retp;
}
}
$elem.find("#wire_start").draggable( {
move: GenWirePointMove(true, function(p) { me._wires[me._selectedWire]._start = new visir.Point(p.x, p.y); } )
});
$elem.find("#wire_mid").draggable( {
move: GenWirePointMove(false, function(p) { me._wires[me._selectedWire]._mid = new visir.Point(p.x, p.y); } )
});
$elem.find("#wire_end").draggable( {
move: GenWirePointMove(true, function(p) { me._wires[me._selectedWire]._end = new visir.Point(p.x, p.y); } )
});
var libraryxml = "instruments/breadboard/library.xml";
if (visir.BaseLocation) libraryxml = visir.BaseLocation + libraryxml;
if (visir.Config.Get("libraryXml")) libraryxml = visir.Config.Get("libraryXml");
me._ReadLibrary(libraryxml);
me._AddInstrumentConnections();
$("body").on("configChanged", function(e) {
me._AddInstrumentConnections();
});
}
visir.Breadboard.prototype.Clear = function()
{
while(this._components.length > 0) this._components[0].remove();
this._wires = [];
this._DrawWires();
}
visir.Breadboard.prototype._PickWire = function(x, y)
{
var pickWidth = 20;
this._offWireCtx.clearRect(0,0, this._$wires.width(), this._$wires.height());
for(var i=0;i<this._wires.length; i++)
{
this._wires[i]._RawDraw(this._offWireCtx, 'rgba(' + (i+1) + ', 0, 0, 1)', pickWidth);
}
var c = this._offWireCtx.getImageData(x, y, 1, 1).data;
trace("c: " + c[0] + " " + c[1] + " " + c[2] + " " + c[3]);
var r = c[0] - 1;
/*for(var i=0;i<this._wires.length; i++)
{
this._wires[i].Draw(this._offWireCtx);
}
this._offWireCtx.strokeStyle = "#ff0000";
this._offWireCtx.lineWidth = 1;
this._offWireCtx.beginPath();
this._offWireCtx.arc(x, y, 2, 0, Math.PI*2, true);
this._offWireCtx.closePath();
this._offWireCtx.stroke();
*/
return (r >= 0) ? r : null;
}
visir.Breadboard.prototype._DrawWires = function()
{
this._wireCtx.clearRect(0,0, this._$wires.width(), this._$wires.height());
for(var i=0;i<this._wires.length; i++)
{
this._wires[i].DrawShadow(this._wireCtx, "#000", 5);
}
for(var i=0;i<this._wires.length; i++)
{
if (this._selectedWire === i) continue;
this._wires[i].Draw(this._wireCtx);
}
// draw outline if selected
// always draw the selected wired on top
this._wireCtx.save();
if (this._selectedWire !== null) {
this._wires[this._selectedWire]._RawDraw(this._wireCtx, "#000", 5);
this._wires[this._selectedWire].Draw(this._wireCtx);
}
this._wireCtx.restore();
}
visir.Breadboard.prototype.SelectWire = function(idx)
{
trace("selected wire: " + idx);
this._selectedWire = idx;
this._DrawWires();
this._UpdateTrashIcon();
if (idx === null) {
this._$elem.find(".wirepoint").removeClass("enabled");
//this._$elem.find(".delete").removeClass("enabled");
return;
}
this._$elem.find(".wirepoint").addClass("enabled");
//this._$elem.find(".delete").addClass("enabled");
function UpdatePoint($e, p) {
var x = p.x - $e.width() / 2;
var y = p.y - $e.height() / 2;
x = x | 0;
y = y | 0;
$e.css("left", x).css("top", y);
}
var w = this._wires[idx];
UpdatePoint(this._$elem.find("#wire_start"), w._start);
UpdatePoint(this._$elem.find("#wire_mid"), w._mid);
UpdatePoint(this._$elem.find("#wire_end"), w._end);
}
visir.Breadboard.prototype.ShowComponentIndicator = function(comp)
{
var value = "";
if (comp) {
value = comp._type + " " + comp._value;
}
this._$elem.find(".indicator").text(value);
}
visir.Breadboard.prototype.SelectComponent = function(comp)
{
var prev = this._selectedCompnent;
this._selectedCompnent = comp;
this._UpdateTrashIcon();
if (prev) prev._RemoveCircle();
if (comp) {
comp._AddCircle();
this._$elem.find(".indicator").text(comp._type + " " + comp._value);
// deselect wire color
// XXX: Refactor into function?
this._color = null;
this._$elem.find(".color").removeClass("selected");
} else {
this._$elem.find(".indicator").text("");
}
}
visir.Breadboard.prototype._UpdateTrashIcon = function()
{
if (this._selectedCompnent || this._selectedWire !== null) {
this._$elem.find(".delete").addClass("enabled");
} else {
this._$elem.find(".delete").removeClass("enabled");
}
}
visir.Breadboard.prototype._UpdateDisplay = function(ch)
{
}
visir.Breadboard.prototype._ReadLibrary = function(url)
{
var me = this;
$.ajax({
type: "GET",
url: url,
dataType: "xml",
async: true,
success: function(xml) {
me._$library = $(xml);
if (me._onLibraryLoaded) me._onLibraryLoaded();
}
}).fail(function() { alert("failed to read component library"); })
;
}
visir.Breadboard.prototype.CreateComponent = function(type, value)
{
//var BASE_URL = "instruments/breadboard/images/";
//if (visir.BaseLocation) BASE_URL = visir.BaseLocation + BASE_URL;
var me = this;
var $libcomp = this._$library.find('component[type="'+ type+'"][value="'+ value+ '"]');
var $comp = $('<div class="component"></div>');
var comp_obj = new visir.Component($comp, me, type, value);
var idx = 0;
$libcomp.find("rotation").each(function() {
var imgtpl = '<img src="' + me._BuildImageUrl($(this).attr("image")) + '" alt="'+ type + value + '"/>';
var $img = $(imgtpl);
var rot = $(this).attr("rot");
var ox = $(this).attr("ox");
var oy = $(this).attr("oy");
// fix weird library format..
if (rot == 90 || rot == 270) {
var tmp = ox;
ox = oy;
oy = tmp;
}
var transform = "";
transform += ' translate(' + ox + 'px, ' + oy + 'px)';
transform += ' rotate(' + rot + 'deg)';
$img.css( {
'transform': transform,
'-moz-transform': transform,
'-webkit-transform': transform,
// , 'top': oy + 'px'
// , 'left': ox + 'px'
})
var current_translation = { 'x' : ox, 'y' : oy, 'rot' : rot };
comp_obj.translations.push(current_translation);
//trace("Adding " + ox + ", " + oy);
if (idx == 0) {
$img.addClass("active");
comp_obj.translation = current_translation;
}
$comp.append($img);
$(this).find("pin").each( function() {
var x = parseInt($(this).attr("x"));
var y = parseInt($(this).attr("y"));
if (!comp_obj._pins[idx]) comp_obj._pins[idx] = [];
comp_obj._pins[idx].push(new visir.Point(x,y));
});
idx++;
});
me._components.push(comp_obj);
me._AddComponentEvents(comp_obj, $comp);
me._$elem.find(".components").append($comp);
return comp_obj;
}
visir.Breadboard.prototype._AddComponentEvents = function(comp_obj, $comp)
{
var me = this;
var $doc = $(document);
var offset = this._$elem.offset();
var touches = 0;
var initialTouchTime = 0;
var generateHandler = function(component, callbackClicked, internalComponent, callbackPressed, callbackReleased) {
return function(e) {
e.preventDefault();
initialTouchTime = new Date().getTime();
touches = (e.originalEvent.touches) ? e.originalEvent.touches.length : 1;
e = (e.originalEvent.touches) ? e.originalEvent.touches[0] : e;
//var start = { x: e.pageX - offset.x, y: e.pageY - offset.y};
$doc.on("keypress.rem", function(e) {
if (!visir.Config.Get("readOnly"))
{
// trace("key: " + e.which);
if (e.which == 114) // 'r'
comp_obj.Rotate();
}
});
$doc.on("keyup.rem", function(e){
if (!visir.Config.Get("readOnly"))
{
if(e.keyCode == 46)
comp_obj.remove();
}
})
$doc.on("mousemove.rem touchmove.rem", function(e) {
if (!visir.Config.Get("readOnly"))
{
if(callbackPressed != undefined)
callbackPressed();
touches = (e.originalEvent.touches) ? e.originalEvent.touches.length : 1;
var touch = (e.originalEvent.touches) ? e.originalEvent.touches[0] : e;
/*var p = new visir.Point(touch.pageX - offset.left, touch.pageY - offset.top);
p.SnapToGrid();
comp_obj.Move(p.x, p.y);*/
var p = { x: touch.pageX - offset.left, y: touch.pageY - offset.top };
snapPoint(p);
//trace("move");
component.css({
"left": p.x + "px",
"top": p.y + "px"
});
if(internalComponent != undefined) {
internalComponent.css({
"left": p.x + "px",
"top": p.y + "px"
});
}
// if two fingers are down, turn the component around towards the second finger
if (e.originalEvent.touches && e.originalEvent.touches.length > 1) {
var turn = e.originalEvent.touches[1];
var angle = Math.atan2( touch.pageY - turn.pageY, touch.pageX - turn.pageX ) * 180 / Math.PI;
angle = (angle + 360) % 360;
var step = 0;
if (angle < 45 || angle > 315) step = 0;
else if (angle > 45 && angle < 135) step = 1;
else if (angle >135 && angle < 225) step = 2;
else step = 3;
comp_obj.Rotate(step);
}
}
});
$doc.on("mouseup.rem touchend.rem", function(e) {
trace("up: " + touches);
if (touches > 1) {
touches--;
return;
}
var timeSincePressed = new Date().getTime() - initialTouchTime;
trace("Time since pressed: " + timeSincePressed);
if(timeSincePressed < 300) // Less than this time is considered a click
callbackClicked();
if(callbackReleased != undefined)
callbackReleased();
//if (e.originalEvent.touches && e.originalEvent.touches.length > 1) return;
component.off(".rem");
$doc.off(".rem");
});
};
};
$comp.on("mousedown touchstart", generateHandler($comp, function() {
if (!visir.Config.Get("readOnly"))
{
// On clicked, add circle
me.SelectComponent(comp_obj);
me.SelectWire(null);
}
}));
$comp.hover(
function() {
// in
if (!me._selectedCompnent) me.ShowComponentIndicator(comp_obj);
},
function() {
if (!me._selectedCompnent) me.ShowComponentIndicator(null);
}
);
// XXX: this is hackish, we should do something better..
comp_obj.generateHandler = generateHandler;
}
visir.Breadboard.prototype._RemoveWire = function(wire)
{
for (var i = 0; i < this._wires.length; i++) {
if(this._wires[i] == wire) {
this._wires.splice(i, 1);
return;
}
}
}
visir.Breadboard.prototype._RemoveComponent = function(comp_obj)
{
for (var i = 0; i < this._components.length; i++) {
if(this._components[i] == comp_obj) {
this._components.splice(i, 1);
return;
}
}
}
visir.Breadboard.prototype._BuildOccupationGrid = function()
{
return new visir.Grid(this._components, this._GetBin());
}
visir.Breadboard.prototype._GetBin = function()
{
return this._$elem.find(".bin");
}
visir.Breadboard.prototype._DrawHelpOverlay = function(ctx)
{
var color = 'rgba(0,0,0,0.7)';
var radius = 3;
ctx.save();
ctx.lineCap = 'round';
ctx.strokeStyle = color;
ctx.fillStyle = color;
ctx.lineWidth = 2;
var bx = 152;
var by = 146;
function drawHorz(x, y) {
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(x + 13*28,y);
ctx.stroke();
ctx.closePath();
for(var i=0;i<29;i++) {
if (i % 6 == 5) continue;
ctx.beginPath();
ctx.arc(x+i*13, y, radius, 0, 2 * Math.PI, false);
ctx.fill();
ctx.closePath();
}
}
function drawVert(x,y) {
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(x, y+ 13*4);
ctx.stroke();
ctx.closePath();
for(var i=0;i<5; i++) {
ctx.beginPath();
ctx.arc(x, y + 13*i, radius, 0, 2 * Math.PI, false);
ctx.fill();
ctx.closePath();
}
}
drawHorz(bx+13*2, by);
drawHorz(bx+13*2, by+13);
drawHorz(bx+13*2, by+13*20);
drawHorz(bx+13*2, by+13*21);
for(var i=0;i<32;i++) {
// draw vertical bars
var x = bx + i*13;
var y = by + 13*5;
drawVert(x, y);
drawVert(x, y + 13*7);
}
ctx.restore();
}
visir.Breadboard.prototype.ShowHelp = function(show)
{
this._showHelp = show;
if (show) {
this._DrawHelpOverlay(this._wireCtx);
}
}
visir.Breadboard.prototype.CreateInstr = function(instr_type, instr_name)
{
var me = this;
var newinstr = {
_type: instr_type,
_name: instr_name,
_connections: [],
AddConnection: function(board_point, fixed_output) {
//var p = new visir.Point(point.x / 13 | 0, point.y / 13 | 0);
//trace("adding to instr: " + board_point + " " + instr_type);
this._connections.push( { _point: board_point, fixed: fixed_output, marked: false });
return this;
},
GetNameAndMarkIfUsed: function(point) {
//trace("instr: " + this._type + " " + this._name + " " + point);
for(var i=0;i<this._connections.length; i++) {
//trace("checking against: " + this._connections[i]._point);
if (point.x == this._connections[i]._point.x && point.y == this._connections[i]._point.y) {
this._connections[i].marked = true;
return this._ConnectionName(i);
}
}
},
GenInstrIfUsed: function() {
if (this._type == "0") return; // special case for 0/GND instruments
// if any of the points are marked, generate the instrument string
var isUsed = false;
var conStr = "";
for(var i=0;i<this._connections.length; i++) {
conStr += " " + this._ConnectionName(i);
if (this._connections[i].marked) {
isUsed = true;
}
}
if (isUsed) {
return this._type + "_" + this._name + conStr + "\n";
}
return null;
},
ClearMarks: function() {
for(var i=0;i<this._connections.length; i++) {
this._connections[i].marked = false;
}
},
_ConnectionName: function(i) {
if (this._connections[i].fixed) return this._connections[i].fixed;
return this._type + "_" + this._name + "_" + (i+1);
}
};
this._instruments.push(newinstr);
return newinstr;
}
visir.Breadboard.prototype._GetAndMarkInstrNodeName = function(p)
{
for(var i=0;i<this._instruments.length;i++)
{
var r = this._instruments[i].GetNameAndMarkIfUsed(p);
if (r) return r;
}
return null;
}
visir.Breadboard.prototype._GetNodeName = function(p)
{
var px = p.x / 13 | 0;
var py = p.y / 13 | 0;
//trace("px/y: " + px + " " + py);
// upper half, vertical
if (px >= 11 && px <= 42 && py >= 16 && py <= 20) { return "A" + (px - 10); }
// lower half, vertical
if (px >= 11 && px <= 42 && py >= 23 && py <= 27) { return "F" + (px - 10); }
// horizontal rows
if (px >= 13 && px <= 41 && py == 11 && (px % 6 != 0)) { return "X"; }
if (px >= 13 && px <= 41 && py == 12 && (px % 6 != 0)) { return "Y"; }
if (px >= 13 && px <= 41 && py == 31 && (px % 6 != 0)) { return "S"; }
if (px >= 13 && px <= 41 && py == 32 && (px % 6 != 0)) { return "T"; }
var instrp = this._GetAndMarkInstrNodeName(new visir.Point(px, py));
if (instrp) return instrp;
return null;
}
visir.Breadboard.prototype._GenerateCircuit = function()
{
for(var i=0; i < this._instruments.length; i++) {
var r = this._instruments[i].ClearMarks();
}
var out = "";
for (var i = 0; i < this._wires.length; i++) {
var wire = this._wires[i];
var s = this._GetNodeName(wire._start);
var e = this._GetNodeName(wire._end);
if (s && e) out += "W_X " + s + " " + e + "\n";
}
for(var i=0;i < this._components.length; i++) {
var r = this._components[i].GenCircuitIfUsed();
if (r) out += r;
}
for(var i=0; i < this._instruments.length; i++) {
var r = this._instruments[i].GenInstrIfUsed();
if (r) out += r;
}
return out;
}
visir.Breadboard.prototype.WriteRequest = function()
{
var $xml = $('<circuit><circuitlist/></circuit>');
$xml.find("circuitlist").append(this._GenerateCircuit());
return $("<root />").append($xml).html();
}
visir.Breadboard.prototype.ReadResponse = function()
{
}
visir.Breadboard.prototype.ReadSave = function($xml)
{
this.LoadCircuit($xml);
}
visir.Breadboard.prototype.WriteSave = function()
{
return this.SaveCircuit();
}
visir.Breadboard.prototype.LoadCircuit = function(circuit)
{
this.Clear();
var me = this;
if (!this._$library) {
this._onLibraryLoaded = function() { me.LoadCircuit(circuit); }
return; // we have to wait until the library is loaded
}
var offx = -44;
var offy = 3;
var $xml = $(circuit);
$xml.find("component").each(function() {
var t = $(this).text();
var args = t.split(" ");
switch(args[0]) {
case "W":
var c = parseInt(args[1], 10);
var x1 = parseInt(args[2], 10);
var y1 = parseInt(args[3], 10);
var x2 = parseInt(args[4], 10);
var y2 = parseInt(args[5], 10);
var x3 = parseInt(args[6], 10);
var y3 = parseInt(args[7], 10);
var hex = Number(c).toString(16);
hex = "#" + "000000".substr(0, 6 - hex.length) + hex;
//trace("wire: " + hex)
var nWire = new visir.Wire(hex); // XXX
me._wires.push(nWire);
nWire._start.x = x1 + offx;
nWire._start.y = y1 + offy;
nWire._mid.x = x2 + offx;
nWire._mid.y = y2 + offy;
nWire._end.x = x3 + offx;
nWire._end.y = y3 + offy;
me._DrawWires();
break;
default:
var x = parseInt(args[2], 10);
var y = parseInt(args[3], 10);
var rot = parseInt(args[4], 10);
var comp = me.CreateComponent(args[0], args[1]);
comp.Move(x + offx, y + offy);
comp.Rotate(rot);
break;
}
//trace("xxx: " + $(this).text());
});
}
visir.Breadboard.prototype._ColorToNum = function(rgb)
{
var regex = /rgb *\( *([0-9]{1,3}) *, *([0-9]{1,3}) *, *([0-9]{1,3}) *\)/;
var values = regex.exec(rgb);
if(!values || values.length != 4)
{
return parseInt(rgb.slice(1), 16); // fallback to #000000 format
}
var r = Math.round(parseFloat(values[1]));
var g = Math.round(parseFloat(values[2]));
var b = Math.round(parseFloat(values[3]));
return (r << 16) + (g << 8) + b;
}
visir.Breadboard.prototype.SaveCircuit = function(circuit)
{
var offp = new visir.Point(44, -3);
var $xml = $("<circuit><circuitlist/></circuit>");
var $cirlist = $xml.find("circuitlist");
$cirlist = $xml.find("circuitlist");
for(var i=0;i<this._wires.length; i++) {
var w = this._wires[i];
var $wire = $("<component/>");
var c = this._ColorToNum(w._color);
trace("wire color: " + c);
var s = w._start.Add(offp);
var m = w._mid.Add(offp);
var e = w._end.Add(offp);
$wire.text("W " + c + " " + s.x + " " + s.y + " " + m.x + " " + m.y + " " + e.x + " " + e.y);
$cirlist.append($wire);
}
for(var i=0;i<this._components.length; i++) {
var c = this._components[i];
var $comp = $("<component/>");
var p = c.GetPos().Add(offp);
$comp.text(c._type + " " + c._value + " " + p.x + " " + p.y + " " + c.GetRotation());
$cirlist.append($comp);
}
return $("<root />").append($xml).html();
}
//////////////////////////////////////////////////////////////////////////////
// Breadboard Instruments handling
visir.Breadboard.prototype._AddInstrumentConnections = function()
{
this._$elem.find(".instruments .instrument").remove();
this._AddMultimeters(1 + 13*45,8 + 13*21, (visir.Config) ? visir.Config.GetNrInstrOfType("multimeter") : 2);
this._AddOSC(1 + 13*45, 8 + 13 * 16, (visir.Config) ? visir.Config.GetNrInstrOfType("oscilloscope") : 1);
this._AddDCPower(0, 6+13*5, (visir.Config) ? visir.Config.GetNrInstrOfType("dcpower") : 1);
this._AddFGEN(0, 6+13*16, (visir.Config) ? visir.Config.GetNrInstrOfType("functiongenerator") : 1);
this._AddGND(1 + 13*45, 8 + 13 * 30);
}
visir.Breadboard.prototype._AddMultimeters = function(x, y, num)
{
if (num <= 0) return;
var i = 0;
var $dmm = $(
'<div class="instrument dmm">\
</div>'
);
$dmm.css("left", x + "px").css("top", y + "px");
for(i=0;i<num; i++) {
var numstr = ""
if (num > 1) {
numstr = (i+1);
if (i>0) $dmm.append('<div class="connnectionspacer"></div>');
}
$dmm.append(
'<div class="connectionimages">\
<div class="number">' + numstr + '</div>\
<img src="' + this._BuildImageUrl("connections_2.png") + '" draggable="false" />\
<div style="height: 11px"></div>\
<img src="' + this._BuildImageUrl("connections_2.png") + '" draggable="false" />\
</div>'
);
}
$dmm.append(
'<div class="texts">\
<div class="connectiontext"></div>\
<div class="connectiontext">Hi</div>\
<div class="connectiontext">Lo</div>\
<div class="connectiontext"></div>\
<div class="connectiontext">Hi</div>\
<div class="connectiontext">Lo</div>\
</div>\
<div class="title">\
<div>'+visir.Lang.GetMessage('multimeter')+'</div>\
<div class="voltage">V/Ω</div>\
<div class="current">mA</div>\
</div>\
'
);
this._$elem.find(".instruments").append($dmm);
for(i=0;i<num; i++) {
var p = new visir.Point(x / 13 | 0, y / 13 | 0);
var off_x = i * 2;
this.CreateInstr("DMM", i+1).AddConnection(new visir.Point(p.x + off_x, p.y + 2)).AddConnection(new visir.Point(p.x + off_x, p.y + 3));
this.CreateInstr("IPROBE", i+1).AddConnection(new visir.Point(p.x + off_x, p.y + 5)).AddConnection(new visir.Point(p.x + off_x, p.y + 6));
}
}
visir.Breadboard.prototype._AddOSC = function(x, y, num)
{
if (num <= 0) return;
var $osc = $(
'<div class="instrument osc">\
<div class="connectionimages">\
<div style="height: 13px"></div>\
<img src="' + this._BuildImageUrl('connections_1.png') + '" draggable="false" />\
<div style="height: 9px"></div>\
<img src="' + this._BuildImageUrl('connections_1.png') + '" draggable="false" />\
</div>\
<div class="texts">\
<div class="connectiontext"></div>\
<div class="connectiontext">Ch1</div>\
<div class="connectiontext"></div>\
<div class="connectiontext">Ch2</div>\
</div>\
<div class="title">'+visir.Lang.GetMessage('oscilloscope')+'</div>\
</div>'
);
$osc.css("left", x + "px").css("top", y + "px");
this._$elem.find(".instruments").append($osc);
var p = new visir.Point(x / 13 | 0, y / 13 | 0);
this.CreateInstr("PROBE1", 1).AddConnection(new visir.Point(p.x, p.y + 2));
this.CreateInstr("PROBE2", 1).AddConnection(new visir.Point(p.x, p.y + 4));
}
visir.Breadboard.prototype._AddGND = function(x, y)
{
var $gnd = $(
'<div class="instrument gnd">\
<div class="connectionimages">\
<img src="' + this._BuildImageUrl('connections_1.png') + '" />\
</div>\
<div class="texts">\
<div class="connectiontext">GND</div>\
</div>\
</div>');
$gnd.css("left", x + "px").css("top", y + "px");
this._$elem.find(".instruments").append($gnd);
var p = new visir.Point(x / 13 | 0, (y / 13 | 0) + 1)
this.CreateInstr("0").AddConnection(p, "0");
}
visir.Breadboard.prototype._AddDCPower = function(x, y, num)
{
if (num <= 0) return;
var dcPower25 = (visir.Config) ? visir.Config.Get("dcPower25") : true;
var dcPowerM25 = (visir.Config) ? visir.Config.Get("dcPowerM25") : true;
var dcPower6 = (visir.Config) ? visir.Config.Get("dcPower6") : true;
var dcPowerHtml = '<div class="instrument dcpower">\
<div class="title">'+visir.Lang.GetMessage('dc_power')+'</div>\
<div class="texts">\
<div class="connectiontext"></div>\n';
if (dcPower25)
dcPowerHtml += '<div class="connectiontext">+20V</div>\n';
else
dcPowerHtml += '<div class="connectiontext"></div>\n';
if (dcPower25 || dcPowerM25)
dcPowerHtml += '<div class="connectiontext">COM</div>\n';
else
dcPowerHtml += '<div class="connectiontext"></div>\n';
if (dcPowerM25)
dcPowerHtml += '<div class="connectiontext">-20V</div>\n';
else
dcPowerHtml += '<div class="connectiontext"></div>\n';
dcPowerHtml += '<div class="connectiontext"></div>\n'
if (dcPower6) {
dcPowerHtml += '<div class="connectiontext">+6V</div>\n';
dcPowerHtml += '<div class="connectiontext">GND</div>\n';
} else {
dcPowerHtml += '<div class="connectiontext"></div>\n';
dcPowerHtml += '<div class="connectiontext"></div>\n';
}
var upperHeight = 0;
var upperImage = null;
var lowerHeight = 0;
var lowerImage = null;
if (dcPower25) {
upperHeight = 13;
if (dcPowerM25) {
lowerHeight = 10;
upperImage = this._BuildImageUrl('connections_3.png');
} else {
lowerHeight = 10 + 13;
upperImage = this._BuildImageUrl('connections_2.png');
}
} else {
if (dcPowerM25) {
upperHeight = 13 + 13;
lowerHeight = 10;
upperImage = this._BuildImageUrl('connections_2.png');
} else {
// No upperImage: 13 upper + 42 image + 10 lower
lowerHeight = 13 + 42 + 10;
}
}
if (dcPower6) {
lowerImage = this._BuildImageUrl('connections_2.png');
}
dcPowerHtml += '</div>\
<div class="connectionimages">\
<div style="height: ' + upperHeight + 'px"></div>\n';
if (upperImage != null)
dcPowerHtml += '<img src="' + upperImage + '" draggable="false" />\n';
dcPowerHtml += '<div style="height: ' + lowerHeight + 'px"></div>\n';
if (lowerImage != null)
dcPowerHtml += '<img src="' + lowerImage + '" draggable="false" />\n';
dcPowerHtml += '</div>\n';
dcPowerHtml += '</div>\n';
var $dcpower = $(dcPowerHtml);
$dcpower.css("right", x + "px").css("top", y + "px");
this._$elem.find(".instruments .left").append($dcpower);
var p = new visir.Point(x / 13 | 0, y / 13 | 0);
var off_x = 8;
var off_y = 9;
this.CreateInstr("VDC+25V", "1").AddConnection( new visir.Point(p.x + off_x, p.y + off_y + 2));
this.CreateInstr("VDCCOM", "1").AddConnection( new visir.Point(p.x + off_x, p.y + off_y + 3));
this.CreateInstr("VDC-25V", "1").AddConnection( new visir.Point(p.x + off_x, p.y + off_y + 4));
this.CreateInstr("VDC+6V", "1").AddConnection( new visir.Point(p.x + off_x, p.y + off_y + 6));
this.CreateInstr("0").AddConnection(new visir.Point(p.x + off_x, p.y + off_y + 7), "0");
}
visir.Breadboard.prototype._BuildImageUrl = function(img)
{
var imageUrl = this.IMAGE_URL + img;
if (visir.Config.Get("cacheBuster") != null) {
imageUrl = imageUrl + "?cacheBuster=" + visir.Config.Get("cacheBuster");
}
return imageUrl;
}
visir.Breadboard.prototype._AddFGEN = function(x, y, num)
{
if (num <= 0) return;
var $fgen = $(
'<div class="instrument fgen">\
<div class="texts">\
<div class="connectiontext"></div>\
<div class="connectiontext">'+visir.Lang.GetMessage('func_gen')+'</div>\
<div class="connectiontext">GND</div>\
</div>\
<div class="connectionimages">\
<div style="height: 13px"></div>\
<img src="' + this._BuildImageUrl('connections_2.png') + '" draggable="false" />\
</div>\
</div>'
);
$fgen.css("right", x + "px").css("top", y + "px");
this._$elem.find(".instruments .left").append($fgen);
var p = new visir.Point(x / 13 | 0, y / 13 | 0);
var off_x = 8;
var off_y = 9;
this.CreateInstr("VFGENA", 1).AddConnection( new visir.Point(p.x + off_x, p.y + off_y + 2)).AddConnection(new visir.Point(1000,1000),"0");
this.CreateInstr("0").AddConnection(new visir.Point(p.x + off_x, p.y + off_y + 3), "0");
};
|
{
"content_hash": "ed338276bbc5a8214fbdc838aa49adc6",
"timestamp": "",
"source": "github",
"line_count": 1668,
"max_line_length": 140,
"avg_line_length": 27.508992805755394,
"alnum_prop": 0.6031600740982892,
"repo_name": "porduna/weblabdeusto",
"id": "e9ada396a27f566e7d12c25ce50885ac078ee998",
"size": "45885",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "server/src/weblab/core/static/jslabs/visir-html5/instruments/breadboard/breadboard.js",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "ASP",
"bytes": "4785"
},
{
"name": "ActionScript",
"bytes": "8508"
},
{
"name": "Batchfile",
"bytes": "7753"
},
{
"name": "C",
"bytes": "19456"
},
{
"name": "C#",
"bytes": "315160"
},
{
"name": "C++",
"bytes": "9547"
},
{
"name": "CSS",
"bytes": "203478"
},
{
"name": "CoffeeScript",
"bytes": "39146"
},
{
"name": "Go",
"bytes": "7076"
},
{
"name": "HTML",
"bytes": "610251"
},
{
"name": "Java",
"bytes": "856300"
},
{
"name": "JavaScript",
"bytes": "1538963"
},
{
"name": "Makefile",
"bytes": "24995"
},
{
"name": "Mako",
"bytes": "1236"
},
{
"name": "PHP",
"bytes": "159985"
},
{
"name": "Python",
"bytes": "3780070"
},
{
"name": "Shell",
"bytes": "7880"
},
{
"name": "Smarty",
"bytes": "40320"
},
{
"name": "TSQL",
"bytes": "717"
},
{
"name": "VHDL",
"bytes": "5874"
}
]
}
|
End of preview.
No dataset card yet
- Downloads last month
- 4