code
stringlengths 3
1.01M
| repo_name
stringlengths 5
116
| path
stringlengths 3
311
| language
stringclasses 30
values | license
stringclasses 15
values | size
int64 3
1.01M
|
|---|---|---|---|---|---|
use leetcode;
select Id from Weather as a where Temperature > (select Temperature from Weather as b where a.Date=b.Date+1);
|
shaotao/Leetcode
|
coding/rising_temperature/rising_temperature.sql
|
SQL
|
mit
| 124
|
//@flow
import EventEmitter from 'eventemitter2'
import { ApiManager } from '../api-manager'
import NetworkerFabric from '../networker'
import { PureStorage } from '../../store'
import TL from '../../tl'
import configValidator from './config-validation'
import generateInvokeLayer from './invoke-layer-generator'
import type { TLFabric } from '../../tl'
import type { ApiConfig, ConfigType, StrictConfig, Emit, On, PublicKey } from './index.h'
import type { ApiManagerInstance } from '../api-manager/index.h'
const api57 = require('../../../schema/api-57.json')
const mtproto57 = require('../../../schema/mtproto-57.json')
const apiConfig: ApiConfig = {
invokeWithLayer: 0xda9b0d0d,
layer : 57,
initConnection : 0x69796de9,
api_id : 49631,
device_model : 'Unknown UserAgent',
system_version : 'Unknown Platform',
app_version : '1.0.1',
lang_code : 'en'
}
class MTProto {
config: StrictConfig
tls: TLFabric
emitter = new EventEmitter({
wildcard: true
})
api: ApiManagerInstance
on: On = this.emitter.on.bind(this.emitter)
emit: Emit = this.emitter.emit.bind(this.emitter)
constructor(config: ConfigType) {
this.config = configNormalization(config)
this.tls = TL(this.config.schema, this.config.mtSchema)
const netFabric = NetworkerFabric(this.config.api, this.tls, this.config.app.storage, this.emit)
this.api = new ApiManager(this.config, this.tls, netFabric, { on: this.on, emit: this.emit })
}
}
export default MTProto
const configNormalization = (config: ConfigType): StrictConfig => {
const {
server = {},
api = {},
app: {
storage = PureStorage,
publicKeys = publicKeysHex
} = {},
schema = api57,
mtSchema = mtproto57,
} = config
const apiNormalized = { ...apiConfig, ...api }
const invokeLayer = generateInvokeLayer(apiNormalized.layer)
apiNormalized.invokeWithLayer = invokeLayer
const fullCfg = {
server,
api: apiNormalized,
app: { storage, publicKeys },
schema,
mtSchema
}
configValidator(fullCfg)
return fullCfg
}
/**
* Server public key, obtained from here: https://core.telegram.org/api/obtaining_api_id
*
* -----BEGIN RSA PUBLIC KEY-----
* MIIBCgKCAQEAwVACPi9w23mF3tBkdZz+zwrzKOaaQdr01vAbU4E1pvkfj4sqDsm6
* lyDONS789sVoD/xCS9Y0hkkC3gtL1tSfTlgCMOOul9lcixlEKzwKENj1Yz/s7daS
* an9tqw3bfUV/nqgbhGX81v/+7RFAEd+RwFnK7a+XYl9sluzHRyVVaTTveB2GazTw
* Efzk2DWgkBluml8OREmvfraX3bkHZJTKX4EQSjBbbdJ2ZXIsRrYOXfaA+xayEGB+
* 8hdlLmAjbCVfaigxX0CDqWeR1yFL9kwd9P0NsZRPsmoqVwMbMu7mStFai6aIhc3n
* Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
* -----END RSA PUBLIC KEY-----
*/
const publicKeysHex: PublicKey[] = [{
modulus:
'c150023e2f70db7985ded064759cfecf0af328e69a41daf4d6f01b538135a6f91f' +
'8f8b2a0ec9ba9720ce352efcf6c5680ffc424bd634864902de0b4bd6d49f4e5802' +
'30e3ae97d95c8b19442b3c0a10d8f5633fecedd6926a7f6dab0ddb7d457f9ea81b' +
'8465fcd6fffeed114011df91c059caedaf97625f6c96ecc74725556934ef781d86' +
'6b34f011fce4d835a090196e9a5f0e4449af7eb697ddb9076494ca5f81104a305b' +
'6dd27665722c46b60e5df680fb16b210607ef217652e60236c255f6a28315f4083' +
'a96791d7214bf64c1df4fd0db1944fb26a2a57031b32eee64ad15a8ba68885cde7' +
'4a5bfc920f6abf59ba5c75506373e7130f9042da922179251f',
exponent: '010001'
}]
|
zerobias/telegram-mtproto
|
src/service/main/index.js
|
JavaScript
|
mit
| 3,269
|
INSERT [dbo].[ValuesStore] ([Id], [Value]) VALUES (N'lastuppdatedinasset', N'Oct 3 2016 9:04AM')
|
buzzfrog/annero-demo
|
sql/AnneroSqlDatabase/AnneroSqlDatabase/PopulateValueStore.sql
|
SQL
|
mit
| 101
|
var pieceJson = {
type: 'pawn',
color: Chess.Piece.Color.WHITE,
'displacementsNumber': 10
};
var getPieceObject = function() {
var factory = new Chess.Piece.PieceFactory();
return factory.create('pawn', Chess.Piece.Color.WHITE, 10);
};
test("importFromJson", function() {
var jsonifier = new Chess.Piece.PieceJsonifier();
deepEqual(jsonifier.importFromJson(pieceJson), getPieceObject());
});
test("exportToJson", function() {
var jsonifier = new Chess.Piece.PieceJsonifier();
deepEqual(jsonifier.exportToJson(getPieceObject()), pieceJson);
});
|
Raphhh/chess-js
|
test/Chess/Piece/PieceJsonifierTest.js
|
JavaScript
|
mit
| 588
|
#!/bin/bash
az=$1
if [[ -z "${az}" ]]; then
echo "Provide availability zone as argument."
exit 1
fi
echo "Checking availability zone $az"
region=$(echo $az | rev | cut -c 2- | rev)
raw=$(aws ec2 describe-reserved-instances-offerings --filters "Name=availability-zone,Values=$az" --region $region)
instance_types=$(echo $raw | jq '.ReservedInstancesOfferings[] | .InstanceType' | sort -u)
while read -r instance_type; do
echo "$region $az $instance_type"
done <<< "$instance_types"
|
flowerinthenight/.files
|
scripts/types-per-az.sh
|
Shell
|
mit
| 496
|
import React from 'react';
import ReactTestRenderer from 'react-test-renderer';
import 'styled-components-test-utils/lib/jest';
import getTheme from '../src/getTheme';
import Link from '../src/Link';
import * as utils from '../src/utils/';
const theme = getTheme({
font: {
size: '16px',
},
});
describe('Link', () => {
test('should render a Link', () => {
const component = ReactTestRenderer.create(<Link theme={theme} />);
expect(component).toBeDefined();
expect(component.toJSON()).toMatchSnapshot();
});
test('should have an a tag', () => {
const component = ReactTestRenderer.create(<Link theme={theme} />).toJSON();
expect(component.type).toEqual('a');
});
test('should have a color', () => {
const spy = jest.spyOn(utils, 'getTextColor');
const component = ReactTestRenderer.create(
<Link
theme={theme}
textColor="white"
/>,
);
expect(component).toHaveStyleRule('color', 'white');
expect(spy).toHaveBeenCalled();
});
test('should have opacity', () => {
const spy = jest.spyOn(utils, 'getOpacity');
const component = ReactTestRenderer.create(
<Link
theme={theme}
opacity={0.75}
/>,
);
expect(component).toHaveStyleRule('opacity', '0.75');
expect(spy).toHaveBeenCalled();
});
test('should have a color hover', () => {
const spy = jest.spyOn(utils, 'getHover');
const component = ReactTestRenderer.create(
<Link
theme={theme}
hoverColor="white"
/>,
);
expect({
component,
modifier: '&:hover',
}).toHaveStyleRule('color', 'white');
expect(spy).toHaveBeenCalled();
});
test('should have the correct font size', () => {
const component = ReactTestRenderer.create(
<Link
theme={theme}
/>,
);
expect(component).toHaveStyleRule('font-size', '16px');
});
});
|
itsolutions-dev/react-styled-ui
|
test/Link.spec.js
|
JavaScript
|
mit
| 1,906
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>18 --> 19</title>
<link href="./../../assets/style.css" rel="stylesheet">
</head>
<body>
<h2>You have to be fast</h2>
<a href="./ec63b60986307e0513b3f116597d2aa85e18f05446843bddabe2e5e5a2f6cbd8.html">Teleport</a>
<hr>
<a href="./../../about.md">About</a> (Spoilers! )
<script src="./../../assets/md5.js"></script>
<script>
window.currentLevel = 7;
</script>
<script src="./../../assets/script.js"></script>
</body>
</html>
|
simonmysun/praxis
|
TAIHAO2019/pub/SmallGame/AsFastAsYouCan2/98c15cfe88d709537a7e043c5d7fdc03588992e5e2987282d3715dd40a17df61.html
|
HTML
|
mit
| 550
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>18 --> 19</title>
<link href="./../../assets/style.css" rel="stylesheet">
</head>
<body>
<h2>You have to be fast</h2>
<a href="./c628d5d0952913465c250f8cd1c22753ebd6decf4d0fd747aeb08824290c1431.html">Teleport</a>
<hr>
<a href="./../../about.md">About</a> (Spoilers! )
<script src="./../../assets/md5.js"></script>
<script>
window.currentLevel = 7;
</script>
<script src="./../../assets/script.js"></script>
</body>
</html>
|
simonmysun/praxis
|
TAIHAO2019/pub/SmallGame/AsFastAsYouCan2/7795337916a5a23876e748b377ebcb057d80cf6d2129906b47b4969cd99bf33f.html
|
HTML
|
mit
| 550
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>18 --> 19</title>
<link href="./../../assets/style.css" rel="stylesheet">
</head>
<body>
<h2>You have to be fast</h2>
<a href="./5f9ade16a60a736e86d229898bc7b16f913cd809e28dedade65cda16ebe2451b.html">Teleport</a>
<hr>
<a href="./../../about.md">About</a> (Spoilers! )
<script src="./../../assets/md5.js"></script>
<script>
window.currentLevel = 7;
</script>
<script src="./../../assets/script.js"></script>
</body>
</html>
|
simonmysun/praxis
|
TAIHAO2019/pub/SmallGame/AsFastAsYouCan2/b44039996a823128e27d80145ed1f9006a01eebf69b6c38643fc5d1d44f70b6c.html
|
HTML
|
mit
| 550
|
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var HotUpdateChunkTemplate = require("../HotUpdateChunkTemplate");
function NodeHotUpdateChunkTemplate(outputOptions) {
HotUpdateChunkTemplate.call(this, outputOptions);
}
module.exports = NodeHotUpdateChunkTemplate;
NodeHotUpdateChunkTemplate.prototype = Object.create(HotUpdateChunkTemplate.prototype);
NodeHotUpdateChunkTemplate.prototype.renderHeader = function(id, modules, hash) {
var buf = HotUpdateChunkTemplate.prototype.renderHeader.call(this, id, modules, hash);
buf.unshift(
"exports.id = " + JSON.stringify(id) + ";\n",
"exports.modules = "
);
return buf;
};
NodeHotUpdateChunkTemplate.prototype.updateHash = function(hash) {
HotUpdateChunkTemplate.prototype.updateHash.call(this, hash);
hash.update("NodeHotUpdateChunkTemplate");
hash.update("3");
hash.update(this.outputOptions.hotUpdateFunction + "");
hash.update(this.outputOptions.library + "");
};
|
sahat/webpack
|
lib/node/NodeHotUpdateChunkTemplate.js
|
JavaScript
|
mit
| 983
|
<?php
declare(strict_types=1);
/**
* This file is part of Narrowspark Framework.
*
* (c) Daniel Bannert <d.bannert@anolilab.de>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Narrowspark\HttpStatus\Exception;
class NotAcceptableException extends AbstractClientErrorException
{
/** @var string */
protected $message = '406 Not Acceptable';
/** @var int */
protected $statusCode = 406;
}
|
narrowspark/http-status
|
src/Exception/NotAcceptableException.php
|
PHP
|
mit
| 492
|
export default {
"hljs-comment": {
"color": "#969896"
},
"hljs-quote": {
"color": "#969896"
},
"hljs-variable": {
"color": "#d54e53"
},
"hljs-template-variable": {
"color": "#d54e53"
},
"hljs-tag": {
"color": "#d54e53"
},
"hljs-name": {
"color": "#d54e53"
},
"hljs-selector-id": {
"color": "#d54e53"
},
"hljs-selector-class": {
"color": "#d54e53"
},
"hljs-regexp": {
"color": "#d54e53"
},
"hljs-deletion": {
"color": "#d54e53"
},
"hljs-number": {
"color": "#e78c45"
},
"hljs-built_in": {
"color": "#e78c45"
},
"hljs-builtin-name": {
"color": "#e78c45"
},
"hljs-literal": {
"color": "#e78c45"
},
"hljs-type": {
"color": "#e78c45"
},
"hljs-params": {
"color": "#e78c45"
},
"hljs-meta": {
"color": "#e78c45"
},
"hljs-link": {
"color": "#e78c45"
},
"hljs-attribute": {
"color": "#e7c547"
},
"hljs-string": {
"color": "#b9ca4a"
},
"hljs-symbol": {
"color": "#b9ca4a"
},
"hljs-bullet": {
"color": "#b9ca4a"
},
"hljs-addition": {
"color": "#b9ca4a"
},
"hljs-title": {
"color": "#7aa6da"
},
"hljs-section": {
"color": "#7aa6da"
},
"hljs-keyword": {
"color": "#c397d8"
},
"hljs-selector-tag": {
"color": "#c397d8"
},
"hljs": {
"display": "block",
"overflowX": "auto",
"background": "black",
"color": "#eaeaea",
"padding": "0.5em"
},
"hljs-emphasis": {
"fontStyle": "italic"
},
"hljs-strong": {
"fontWeight": "bold"
}
}
|
conorhastings/react-syntax-highlighter
|
src/styles/hljs/tomorrow-night-bright.js
|
JavaScript
|
mit
| 1,821
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UnhappyPizza")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnhappyPizza")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0c324eb3-6df9-4511-a830-0f6329af4946")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
|
Veninger/UnhappyPizza
|
UnhappyPizza/Properties/AssemblyInfo.cs
|
C#
|
mit
| 1,395
|
namespace SchoolTests
{
using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using School;
[TestClass]
public class SchoolTests
{
[TestMethod]
public void SchoolShouldNotThrowException()
{
var school = new School("Telerik Academy");
}
[TestMethod]
public void SchoolShouldReturnNameCorrectly()
{
var school = new School("Telerik Academy");
Assert.AreEqual("Telerik Academy", school.Name);
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void SchoolShouldThrowExceptionWhenNameIsNull()
{
var school = new School(null);
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void SchoolShouldThrowExceptionWhenNameIsEmpty()
{
var school = new School(string.Empty);
}
[TestMethod]
public void SchoolShouldAddStudentCorrectly()
{
var school = new School("Telerik Academy");
var student = new Student("Nikolay", "Kostov", 10000);
school.AddStudent(student);
Assert.AreSame(student, school.Students.First());
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void SchoolShouldThrowExceptionWhenNullStudentAdded()
{
var school = new School("Telerik Academy");
Student student = null;
school.AddStudent(student);
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
public void SchoolShouldThrowExceptionWhenAddingExistingStudent()
{
var school = new School("Telerik Academy");
var student = new Student("Nikolay", "Kostov", 10000);
school.AddStudent(student);
school.AddStudent(student);
}
[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void SchoolShouldThrowExceptionWhenAddingStudentWithDuplicateId()
{
var school = new School("Telerik Academy");
var student = new Student("Nikolay", "Kostov", 10000);
var otherStudent = new Student("Doncho", "Minkov", 10000);
school.AddStudent(student);
school.AddStudent(otherStudent);
}
[TestMethod]
public void SchoolShouldAddCourseCorrectly()
{
var school = new School("Telerik Academy");
var course = new Course("HQC");
school.AddCourse(course);
Assert.AreSame(course, school.Courses.First());
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void SchoolShouldThrowExceptionWhenNullCourseAdded()
{
var school = new School("Telerik Academy");
Course course = null;
school.AddCourse(course);
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
public void SchoolShouldThrowExceptionWhenExistingCourseAdded()
{
var school = new School("Telerik Academy");
var course = new Course("HQC");
school.AddCourse(course);
school.AddCourse(course);
}
[TestMethod]
public void SchoolShouldRemoveStudentCorrectly()
{
var school = new School("Telerik Academy");
var student = new Student("Nikolay", "Kostov", 10000);
school.AddStudent(student);
school.RemoveStudent(student);
Assert.IsTrue(school.Students.Count == 0);
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void SchoolShouldThrowExceptionWhenRemovingNullStudent()
{
var school = new School("Telerik Academy");
Student student = null;
school.RemoveStudent(student);
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
public void SchoolShouldThrowExceptionWhenRemovingNotExistingStudent()
{
var school = new School("Telerik Academy");
var student = new Student("Nikolay", "Kostov", 10000);
school.RemoveStudent(student);
}
[TestMethod]
public void SchoolShouldRemoveCourseCorrectly()
{
var school = new School("Telerik Academy");
var course = new Course("HQC");
school.AddCourse(course);
school.RemoveCourse(course);
Assert.IsTrue(school.Courses.Count == 0);
}
[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
public void SchoolShouldThrowExceptionWhenRemovingNullCourse()
{
var school = new School("Telerik Academy");
Course course = null;
school.RemoveCourse(course);
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException))]
public void SchoolShouldThrowExceptionWhenRemovingNotExistingCourse()
{
var school = new School("Telerik Academy");
var course = new Course("HQC");
school.RemoveCourse(course);
}
}
}
|
GeorgiPetrovGH/TelerikAcademy
|
08.High-Quality-Code/Unit Testing Homework/Students and courses/StudentsAndCourses/SchoolTests/SchoolTests.cs
|
C#
|
mit
| 5,368
|
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Home extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('M_Login','minha_model');
$this->verifica_session();
}
public function verifica_session()
{
if($this->session->userdata('logado') == FALSE)
{
redirect('/');
}
}
public function index()
{
$data = array('myname' => $this->session->userdata('nome'));
$this->load->view('inc/head');
$this->parser->parse('inc/menu', $data);
$this->load->view('home/index');
//$this->load->view('usuarios/usuarios_ajax');
//$this->load->view('inc/footer');
}
}
|
michaelsilvapp/sgtcc
|
application/controllers/Home.php
|
PHP
|
mit
| 659
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Blog | TRVLNG</title>
<link rel="apple-touch-icon" sizes="57x57" href="https://s3.amazonaws.com/gettrvlng/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="114x114" href="https://s3.amazonaws.com/gettrvlng/apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="72x72" href="https://s3.amazonaws.com/gettrvlng/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="144x144" href="https://s3.amazonaws.com/gettrvlng/apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="60x60" href="https://s3.amazonaws.com/gettrvlng/apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="120x120" href="https://s3.amazonaws.com/gettrvlng/apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="76x76" href="https://s3.amazonaws.com/gettrvlng/apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="152x152" href="https://s3.amazonaws.com/gettrvlng/apple-touch-icon-152x152.png">
<link rel="icon" type="image/png" href="https://s3.amazonaws.com/gettrvlng/favicon-196x196.png" sizes="196x196">
<link rel="icon" type="image/png" href="https://s3.amazonaws.com/gettrvlng/favicon-160x160.png" sizes="160x160">
<link rel="icon" type="image/png" href="https://s3.amazonaws.com/gettrvlng/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="https://s3.amazonaws.com/gettrvlng/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="https://s3.amazonaws.com/gettrvlng/favicon-32x32.png" sizes="32x32">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-TileImage" content="https://s3.amazonaws.com/gettrvlng/mstile-144x144.png">
<!-- Bootstrap core CSS -->
<link href="//maxcdn.bootstrapcdn.com/bootswatch/3.2.0/flatly/bootstrap.min.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="assets/css/theme.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body style="margin:0; padding:0;">
<!-- Segment.io -->
<script type="text/javascript">
window.analytics=window.analytics||[],window.analytics.methods=["identify","group","track","page","pageview","alias","ready","on","once","off","trackLink","trackForm","trackClick","trackSubmit"],window.analytics.factory=function(t){return function(){var a=Array.prototype.slice.call(arguments);return a.unshift(t),window.analytics.push(a),window.analytics}};for(var i=0;i<window.analytics.methods.length;i++){var key=window.analytics.methods[i];window.analytics[key]=window.analytics.factory(key)}window.analytics.load=function(t){if(!document.getElementById("analytics-js")){var a=document.createElement("script");a.type="text/javascript",a.id="analytics-js",a.async=!0,a.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.io/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n)}},window.analytics.SNIPPET_VERSION="2.0.9",
window.analytics.load("0mxol839ce");
window.analytics.page();
</script>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=1673563252869620&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<h1>Posts</h1>
<h1 class="docs-heading">gettrvlng<a href="#gettrvlng" name="gettrvlng" class="anchor">
<span class="anchor-target" id="gettrvlng"></span>
<span class="glyphicon glyphicon-link"></span>
</a></h1>
<blockquote>
<p>Landing page for TRVLNG app.</p>
</blockquote>
<h2 class="docs-heading"><a href="http://assemble.io/">Assemble</a><a href="#-assemble-http-assemble-io-" name="-assemble-http-assemble-io-" class="anchor">
<span class="anchor-target" id="-assemble-http-assemble-io-"></span>
<span class="glyphicon glyphicon-link"></span>
</a></h2>
<p>Assemble is a component and static site generator that makes it dead simple to build modular sites, documentation and components from reusable templates and data.</p>
<ul>
<li>Documentation</li>
<li>Plugins - Plugins extend the core functionality of Assemble.</li>
<li>Helpers - Documentation for the helpers in the <a href="http://github.com/assemble/handlebars-helpers">handlebars-helpers</a> library.</li>
</ul>
<h2 class="docs-heading">Contributing<a href="#contributing" name="contributing" class="anchor">
<span class="anchor-target" id="contributing"></span>
<span class="glyphicon glyphicon-link"></span>
</a></h2>
<p>All contributions are welcome! The simplest way to show your support for this project is to <strong>"star" it</strong>. Please see <a href="http://assemble.io/contributing">Contributing to Assemble</a> for more information.</p>
<h2 class="docs-heading">Release History<a href="#release-history" name="release-history" class="anchor">
<span class="anchor-target" id="release-history"></span>
<span class="glyphicon glyphicon-link"></span>
</a></h2>
<ul>
<li>2014-08-23 v0.1.0 Generated by the <a href="https://github.com/assemble/generator-assemble">Yeoman Generator</a> for <a href="http://assemble.io">Assemble</a></li>
</ul>
<footer class="container">
<div class="row">
<div class="col-xs-12">
<h3>Follow us</h3>
</div>
</div>
<div class="row">
<div class="col-xs-4">
<a href="https://twitter.com/gettrvlng" class="btn btn-primary btn-lg btn-block"><i class="fa fa-twitter fa-2x"></i><span class="sr-only">twitter</span></a>
</div>
<div class="col-xs-4">
<a href="https://www.facebook.com/trvlng" class="btn btn-primary btn-lg btn-block"><i class="fa fa-facebook fa-2x"></i><span class="sr-only">facebook</span></a>
</div>
<div class="col-xs-4">
<a href="http://gettrvlng.tumblr.com" class="btn btn-primary btn-lg btn-block"><i class="fa fa-tumblr fa-2x"></i><span class="sr-only">tumblr</span></a>
</div>
</div>
<hr>
<div class="row">
<div class="center-block col-xs-12">
<p class="text-center text-muted">Made with <span class="glyphicon glyphicon-heart"></span> in PHL</p>
<hr>
<p class="text-center"><a href="https://mixpanel.com/f/partner"><img src="//cdn.mxpnl.com/site_media/images/partner/badge_blue.png" alt="Mobile Analytics"></a>
</p>
</div>
</div>
</footer>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://code.jquery.com/jquery.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="assets/js/bootstrap.min.js"></script>
<!-- Include uncompressed version of Bootstrap Validator -->
<script type="text/javascript" src="/lib/bootstrapvalidator/bootstrapValidator.js"></script>
<script>
$(document).ready(function() {
$('#formNlRsvp').on('init.form.bv', function(e, data) {
// $(e.target) --> The form instance
// data.bv --> The BootstrapValidator instance
// data.options --> The form options
// Do something ...
console.log(data.options);
}).bootstrapValidator({
message: 'This value is not valid',
live: 'enabled',
feedbackIcons: {
required: 'fa glyphicon-asterisk',
valid: 'fa fa-check',
invalid: 'fa fa-times',
validating: 'fa fa-refresh'
},
fields: {
MERGE0: { //email
validators: {
notEmpty: {
message: 'The email is required and cannot be empty'
},
emailAddress: {
message: 'The input is not a valid email address'
}
}
},
MERGE1: { //firstName
validators: {
notEmpty: {
enabled: true,
message: 'The email is required and cannot be empty'
},
regexp: {
regexp: /^[a-zA-Z]+$/,
message: 'Only letters are allowed'
}
}
},
MERGE2: { //lastName
validators: {
notEmpty: {
enabled: true,
message: 'The email is required and cannot be empty'
},
regexp: {
regexp: /^[a-zA-Z]+$/,
message: 'Only letters are allowed'
}
}
}
}
}).on('error.form.bv', function(e) {
// $(e.target) --> The form instance
// $(e.target).data('bootstrapValidator')
// --> The BootstrapValidator instance
// Do something ...
console.log('error');
}).on('success.form.bv', function(e){
console.log('form validated');
})
});
</script>
</body>
</html>
|
getstronger/gettrvlng
|
dist/blog.html
|
HTML
|
mit
| 9,415
|
(function()
{
"use strict";
// no longer used
// just serves up one particular file
// should always be running
// nohup node server&
var fs = require('fs');
var http = require('http');
var url = require('url');
http.createServer(function(req, res)
{
var request = url.parse(req.url, true);
var action = request.pathname;
if (action == '/functal.png')
{
var img = fs.readFileSync('./functal.png');
res.writeHead(200,
{
'Content-Type': 'image/png'
});
res.end(img, 'binary');
}
else
{
res.writeHead(200,
{
'Content-Type': 'text/plain'
});
res.end('Functal\n');
}
}).listen(8081);
})();
|
peterorum/functalbook
|
server.js
|
JavaScript
|
mit
| 844
|
/*
* Copyright (C) 2015 Francois Doray <francois.doray@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; only
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Inspired from https://github.com/giraldeau/perfuser, by Francis Giraldeau.
*/
#ifndef LTTNG_PROFILE_MODULE_API_H_
#define LTTNG_PROFILE_MODULE_API_H_
#include <signal.h>
/*
* Test if the lttng-profile module is enabled.
*
* Return: 1 if initialized, 0 otherwise
*/
int lttngprofile_module_registered();
/*
* Register the current process (and all its threads) to the lttng-profile
* module. If already registered, then it resets the configuration.
*
* The signal handler may be called before this function returns. Therefore,
* any required setup must be performed prior to registration.
*
* @latency_threshold: Latency threshold to identify long syscalls.
*
* Return: 0 in case of success, error code otherwise
*/
int lttngprofile_module_register(long latency_threshold);
/*
* Unregister the calling process from the lttng-profile module. The
* previous signal handler is restored.
*
* Return: 0 in case of success, error code otherwise
*/
int lttngprofile_module_unregister();
#endif // LTTNG_PROFILE_MODULE_API_H_
|
fdoray/lttng-profile
|
liblttng-profile-base/module_api.h
|
C
|
mit
| 1,815
|
#include "blockparameterint.h"
#include <limits.h>
#include <QDebug>
libblockdia::BlockParameterInt::BlockParameterInt(const QString &name, QObject *parent) : BlockParameter(name, parent)
{
this->_minimum = INT_MIN;
this->_maximum = INT_MAX;
this->_value = this->_minimum;
this->_defaultValue = this->_value;
}
int libblockdia::BlockParameterInt::minimum()
{
return this->_minimum;
}
void libblockdia::BlockParameterInt::setMinimum(int min)
{
if (this->_minimum != min) {
this->_minimum = min;
this->setValue(this->_value); // update for limit adjust
emit somethingHasChanged();
}
}
int libblockdia::BlockParameterInt::maximum()
{
return this->_maximum;
}
int libblockdia::BlockParameterInt::value()
{
return this->_value;
}
QString libblockdia::BlockParameterInt::strDefaultValue()
{
return QString::number(this->_defaultValue);
}
int libblockdia::BlockParameterInt::defaultValue()
{
return this->_defaultValue;
}
bool libblockdia::BlockParameterInt::setDefaultValue(QString value)
{
bool ok;
int ivalue = value.toInt(&ok);
ok &= this->setDefaultValue(ivalue);
return ok;
}
bool libblockdia::BlockParameterInt::setDefaultValue(int value)
{
bool ret = true;
// clip at minimum
if (value < this->_minimum) {
value = this->_minimum;
ret = false;
}
// clip at maximum
if (value > this->_maximum) {
value = this->_maximum;
ret = false;
}
// set new value
if (this->_defaultValue != value) {
this->_defaultValue = value;
emit somethingHasChanged();
}
return ret;
}
bool libblockdia::BlockParameterInt::setValue(int value)
{
bool ret = true;
// clip at minimum
if (value < this->_minimum) {
value = this->_minimum;
ret = false;
}
// clip at maximum
if (value > this->_maximum) {
value = this->_maximum;
ret = false;
}
// set new value
if (this->_value != value) {
this->_value = value;
emit somethingHasChanged();
}
return ret;
}
bool libblockdia::BlockParameterInt::setValue(QString value)
{
bool ret = true;
int intval = value.toInt(&ret);
ret &= this->setValue(intval);
return ret;
}
QString libblockdia::BlockParameterInt::strValue()
{
return QString::number(this->_value);
}
QString libblockdia::BlockParameterInt::allowedValues()
{
return QString::number(this->_minimum) + " .. " + QString::number(this->_maximum);
}
bool libblockdia::BlockParameterInt::importParamDef(QXmlStreamReader *xml)
{
while (xml->readNextStartElement()) {
// read min
if (xml->name() == "Min") {
QString t = xml->readElementText(QXmlStreamReader::SkipChildElements);
bool ok;
int i = t.toInt(&ok);
if (ok) this->setMinimum(i);
}
// read max
else if (xml->name() == "Max") {
QString t = xml->readElementText(QXmlStreamReader::SkipChildElements);
bool ok;
int i = t.toInt(&ok);
if (ok) this->setMaximum(i);
}
else {
xml->skipCurrentElement();
qWarning() << "ERROR Parsing XML: unknown element (at line" << xml->lineNumber() << ")";
}
}
return xml->hasError();
}
bool libblockdia::BlockParameterInt::exportParamDef(QXmlStreamWriter *xml)
{
// specific sub elements
xml->writeTextElement("Min", QString::number(this->minimum()));
xml->writeTextElement("Max", QString::number(this->maximum()));
return xml->hasError();
}
void libblockdia::BlockParameterInt::setMaximum(int max)
{
if (this->_maximum != max) {
this->_maximum = max;
this->setValue(this->_value); // update for limit adjust
emit somethingHasChanged();
}
}
|
Oinosseus/blockdia
|
src/libblockdia/blockparameterint.cpp
|
C++
|
mit
| 3,856
|
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/gpu/gpu.hpp"
#include <stdlib.h>
#include <iostream>
using namespace cv;
using namespace std;
int main( int argc, char** argv ) {
Mat h_src;
Mat h_sobel;
int ddepth = CV_32F;
if (argc < 2) {
cout << "You must a image path" << endl;
return -1;
}
h_src = imread(argv[1], CV_LOAD_IMAGE_GRAYSCALE);
if (!h_src.data) {
cout << "Error reading the image. Ensure it exist" << endl;
return -1;
}
namedWindow("Sobel with opencv and cuda", CV_WINDOW_NORMAL);
gpu::GpuMat d_src, d_grad_x, d_grad_y, d_sobel;
d_src.upload(h_src);
gpu::Sobel(d_src, d_grad_x, ddepth, 1, 0);
gpu::Sobel(d_src, d_grad_y, ddepth, 0, 1);
gpu::magnitude(d_grad_x, d_grad_y, d_sobel);
d_sobel.download(h_sobel);
convertScaleAbs(h_sobel, h_sobel);
imshow("Sobel with opencv and cuda", h_sobel);
waitKey(0);
return 0;
}
|
leiverandres/HPC_assignments
|
CUDA/convolution/with_opencv_cuda.cpp
|
C++
|
mit
| 957
|
package com.bitmechanic.barrister.conform;
import com.bitmechanic.barrister.RpcException;
import com.bitmechanic.barrister.RpcRequest;
import com.bitmechanic.test.*;
import com.bitmechanic.test.inc.MathOp;
import com.bitmechanic.test.inc.Status;
import java.util.List;
import java.util.ArrayList;
public class AImpl implements A {
public Long add(Long a, Long b) throws RpcException {
return a+b;
}
public Double calc(Double[] nums, MathOp op) throws RpcException {
double total = 0;
if (op == MathOp.multiply)
total = 1;
for (Double d : nums) {
if (op == MathOp.multiply)
total = total * d;
else if (op == MathOp.add)
total += d;
}
return total;
}
public Double sqrt(Double a) throws RpcException {
return Math.sqrt(a);
}
public RepeatResponse repeat(RepeatRequest req1) throws RpcException {
RepeatResponse r = new RepeatResponse();
List<String> items = new ArrayList<String>();
for (int i = 0; i < req1.getCount(); i++) {
items.add(req1.getTo_repeat());
}
r.setItems(items.toArray(new String[0]));
r.setCount(req1.getCount());
r.setStatus(Status.ok);
return r;
}
public HiResponse say_hi() throws RpcException {
HiResponse r = new HiResponse();
r.setHi("hi");
return r;
}
public Long[] repeat_num(Long num, Long count) throws RpcException {
Long out[] = new Long[count.intValue()];
for (int i = 0; i < out.length; i++) {
out[i] = num;
}
return out;
}
public String putPerson(Person p) throws RpcException {
return p.getPersonId();
}
}
|
coopernurse/barrister-java
|
src/test/java/com/bitmechanic/barrister/conform/AImpl.java
|
Java
|
mit
| 1,801
|
\section{Updating frequencies of subgraphs}
\label{sec:upd}
The main bottleneck of the method described in the previous section is
computing the frequencies of subgraphs in every iteration, to estimate
the energy of the current solution. In \cite{milo2002network}, an
analogous operation was done recounting the frequencies of subgraphs
after each iteration of their algorithm until convergence. Our
approach avoids recomputing all of the frequencies by only considering
the subgraphs that are changed by the addition or removal of a certain
edge.
The base of our method is the {\tt FaSE} \cite{paredes2013towards}
algorithm, which we will extend in order to only count subgraphs that
touch a given edge. Firstly, we will briefly describe the algorithm.
\subsection{FaSE Algorithm}
The original {\tt FaSE} algorithm enumerates all connected subgraphs
of a given size $K$ and in the end computes the isomorphism of some of
the subgraphs. To avoid having to compute the isomorphism of all
subgraphs, the algorithm partitions subgraphs into intermediate
classes during the enumeration process. By requiring that all
subgraphs in one of the intermediate classes are isomorphic, in the
end we only need to compute one isomorphism test per class. This is
done by encapsulating the topological features of the enumerating
graph in a tree like data structure. Thus, we can divide the algorithm
into two interleaved concepts: the enumeration and a tree data
structure.
{\bf Enumeration}: The enumeration step can be done using any
algorithm that grows a set of connected vertices. The algorithm from
\cite{wernicke2006efficient}, {\tt ESU}, was chosen since it is
simple, efficient and fulfills all the requirements. We will describe
its functioning since it will be useful for the end of this section.
{\tt ESU} works by enumerating all size $K$ subgraphs exactly once. It
does so by keeping two ordered sets of vertices: $V_s$, which
represents the partial subgraph that is currently being enumerated;
$V_{ext}$, which represents the set of vertices that can be added to
$V_s$ as a valid extension. Each vertex is represented by a label
which is unique and defined between $1$ and $|V|$.
For each vertex $v$ the algorithm repeats the same procedure setting
initially $V_s = \{v\}$ and $V_{ext} = N(v)$, where $N(v)$ are the
neighbors of $v$. This procedure starts by removing one element $u$ of
$V_{ext}$ at a time. For each $u$, a new $V_s'$ and $V_{ext}'$ are
created and the same procedure is repeated. $V_s'$ is set to $V_s \cup
\{u\}$ and $V_{ext}'$ is set to $V_{ext}$ without $u$ and with
additionally each element in $N_{exc}(u, V_s)$ with value greater than
$v$. $N_{exc} (u, V_s)$ are the exclusive neighbors of $u$ given
$V_s$, that is, the neighbors of $u$ that are not neighbors of
elements in $V_s$. This procedure stops when the size of $V_s$ reaches
$K$, in which case $V_s$ contains one occurrence of size $K$. The
addition of elements in $N_{exc}(u, V_s)$ along with the $u > v$,
ensure that there is no subgraph enumerated twice, and it can be
proved \cite{wernicke2006efficient} that this procedure stops and
enumerates all subgraphs.
{\bf The tree data structure}: During the enumeration process, this
data structure is used to encapsulate information about the subgraph
contained in $V_s$. Since this is a recursive procedure, one can use
information about the initial content of $V_s$ to build a partial
isomorphism representation, that can be complemented on each vertex
insertion in $V_s$. For this, a data structure called a gtrie is used,
which is similar to a prefix tree of subgraphs. Whenever a new vertex
is added to $V_s$, one uses the information of connectivity with the
previous elements of $V_s$ to generate a label that identifies the
current partial subgraph, which is used as the identifier for the
mentioned intermediate classes.
Figure \ref{fig:gtrie} summarizes the whole algorithm. The tree on the
left represents the implicit recursion tree ESU creates. The induced
g-trie on the right is a visual representation of the actual g-trie
{\tt FaSE} creates. More information about the {\tt FaSE} can be found in
\cite{paredes2013towards}.
\begin{figure}[h]
\centering
\includegraphics[width=0.9\columnwidth]{fase}
\caption{Summary of the {\tt FaSE} algorithm.}
\label{fig:gtrie}
\end{figure}
\subsection{FaSE with updates}
Our method to efficiently update frequency counts works by altering
the enumeration algorithm to count frequencies starting on edges. When
adding an edge, the algorithm first counts all subgraphs that use the
edge's two ends and decrements their frequency. Afterwards, it adds
the new edge and counts all subgraphs that touch that edge. To remove
an edge we do an analogous process. Our method is based on the {\tt
ESU} algorithm, altering it to start on a given edge.
For a given edge to add, $\{a, b\}$, the algorithm first considers as
initial sets $V_s = \{a, b\}$ and $V_{ext} = N(a) \cup N(b) \setminus
\{a, b\}$ and only uses these as initial sets (meaning it does not
recurse on other initial $V_s$ and $V_{ext}$). The rest of the
procedure is similar to the original {\tt ESU} algorithm, but the
symmetry breaking is removed, that is, when adding a node $u'$ to
$V_{ext}$, there is no comparison with $a$: if $u'$ belongs to
$N_{exc}(u, V_s)$ it will be added to $V_{ext}$.
To prove that this method is correct we use the original correction
proof of the {\tt ESU} algorithm. If $a$ is the minimal node of the
graph (that is, for every node $v$, $a \leq v$), all subgraphs that
include $a$ will be enumerated on the first iteration of the
algorithm. For that iteration, if $b$ is the first element of
$N_{ext}$, then it will be removed and the next iteration has $V_s =
\{a, b\}$ and $V_{ext} = N(a) \setminus \{b\} \cup N_{exc}(b, \{a\}) =
N(a) \cup N(b) \setminus \{a, b\}$. Since this is the only recursion
path that will include $a$ and $b$ (since $b$ was the first node to be
removed from the initial $N_{ext}$), all subgraphs that contain $a$
and $b$ will be counted on this recursive subtree. Since this is
analogous to our method, its correctness implies the correctness of
our method.
|
migueleps/paper-complenet17
|
Updating.tex
|
TeX
|
mit
| 6,183
|
/* Tomorrow Theme */
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
.tomorrow-comment, pre .hljs-comment, pre .hljs-title {
color: #8e908c;
}
.tomorrow-red, pre .hljs-variable, pre .hljs-attribute, pre .hljs-tag, pre .hljs-regexp, pre .hljs-ruby .constant, pre .hljs-xml .tag .title, pre .hljs-xml .pi, pre .hljs-xml .doctype, pre .hljs-html .doctype, pre .hljs-css .id, pre .hljs-css .class, pre .hljs-css .pseudo {
color: #c82829;
}
.tomorrow-orange, pre .hljs-number, pre .hljs-preprocessor, pre .hljs-built_in, pre .hljs-literal, pre .hljs-params, pre .hljs-constant {
color: #f5871f;
}
.tomorrow-yellow, pre .hljs-class, pre .hljs-ruby .class .title, pre .hljs-css .rules .attribute {
color: #eab700;
}
.tomorrow-green, pre .hljs-string, pre .hljs-value, pre .hljs-inheritance, pre .hljs-header, pre .hljs-ruby .symbol, pre .hljs-xml .cdata {
color: #718c00;
}
.tomorrow-aqua, pre .hljs-css .hexcolor {
color: #3e999f;
}
.tomorrow-blue, pre .hljs-function, pre .hljs-python .decorator, pre .hljs-python .title, pre .hljs-ruby .function .title, pre .hljs-ruby .title .keyword, pre .hljs-perl .sub, pre .hljs-javascript .title, pre .hljs-coffeescript .title {
color: #4271ae;
}
.tomorrow-purple, pre .hljs-keyword, pre .hljs-javascript .function {
color: #8959a8;
}
pre code {
display: block;
color: #4d4d4c;
font-family: Menlo, Monaco, Consolas, monospace;
line-height: 1.5;
padding: 10px;
}
|
dancoates/frontend-starter
|
styleguide/assets/css/highlight.css
|
CSS
|
mit
| 1,596
|
<?php
use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\PyStringNode;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
/**
* Behat context class.
* Based on: https://github.com/Behat/Behat/blob/master/features/bootstrap/FeatureContext.php
*/
class FeatureContext implements Context
{
/**
* @var string
*/
private $phpBin;
/**
* @var Process
*/
private $process;
/**
* @var string
*/
private $workingDir;
/**
* Cleans test folders in the temporary directory.
*
* @BeforeSuite
* @AfterSuite
*/
public static function cleanTestFolders()
{
if (is_dir($dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'behat')) {
self::clearDirectory($dir);
}
}
/**
* Prepares test folders in the temporary directory.
*
* @BeforeScenario
*/
public function prepareTestFolders()
{
$dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'behat' . DIRECTORY_SEPARATOR .
md5(microtime() * rand(0, 10000));
mkdir($dir . '/features/bootstrap/i18n', 0777, true);
$phpFinder = new PhpExecutableFinder();
if (false === $php = $phpFinder->find()) {
throw new \RuntimeException('Unable to find the PHP executable.');
}
$this->workingDir = $dir;
$this->phpBin = $php;
$this->process = new Process(null);
}
/**
* Creates a file with specified name and context in current workdir.
*
* @Given /^(?:there is )?a file named "([^"]*)" with:$/
*
* @param string $filename name of the file (relative path)
* @param PyStringNode $content PyString string instance
*/
public function aFileNamedWith($filename, PyStringNode $content)
{
$content = strtr((string) $content, array("'''" => '"""'));
$this->createFile($this->workingDir . '/' . $filename, $content);
}
/**
* Moves user to the specified path.
*
* @Given /^I am in the "([^"]*)" path$/
*
* @param string $path
*/
public function iAmInThePath($path)
{
$this->moveToNewPath($path);
}
/**
* Checks whether a file at provided path exists.
*
* @Given /^file "([^"]*)" should exist$/
*
* @param string $path
*/
public function fileShouldExist($path)
{
PHPUnit_Framework_Assert::assertFileExists($this->workingDir . DIRECTORY_SEPARATOR . $path);
}
/**
* Sets specified ENV variable
*
* @When /^"BEHAT_PARAMS" environment variable is set to:$/
*
* @param PyStringNode $value
*/
public function iSetEnvironmentVariable(PyStringNode $value)
{
$this->process->setEnv(array('BEHAT_PARAMS' => (string) $value));
}
/**
* Runs behat command with provided parameters
*
* @When /^I run "behat(?: ((?:\"|[^"])*))?"$/
*
* @param string $argumentsString
*/
public function iRunBehat($argumentsString = '')
{
$argumentsString = strtr($argumentsString, array('\'' => '"'));
$this->process->setWorkingDirectory($this->workingDir);
$this->process->setCommandLine(
sprintf(
'%s %s %s %s',
$this->phpBin,
escapeshellarg(BEHAT_BIN_PATH),
$argumentsString,
strtr('--format-settings=\'{"timer": false}\'', array('\'' => '"', '"' => '\"'))
)
);
$this->process->start();
$this->process->wait();
}
/**
* Runs phpspec command with provided parameters
*
* @When /^I run "phpspec(?: ((?:\"|[^"])*))?"$/
*
* @param string $argumentsString
*/
public function iRunPhpspec($argumentsString = '')
{
$argumentsString = strtr($argumentsString, array('\'' => '"'));
$this->process->setWorkingDirectory($this->workingDir);
$this->process->setCommandLine(
sprintf(
'%s %s %s --no-interaction',
$this->phpBin,
escapeshellarg($this->getPhpspecBinPath()),
$argumentsString
)
);
$this->process->start();
$this->process->wait();
}
private function getPhpspecBinPath()
{
if (is_file($phpspec = getcwd() . '/vendor/phpspec/phpspec/bin/phpspec')) {
return $phpspec;
} elseif (is_file($phpspec = getcwd() . '/../../phpspec/phpspec/bin/phpspec')) {
return $phpspec;
}
}
/**
* Checks whether previously ran command passes|fails with provided output.
*
* @Then /^it should (fail|pass) with:$/
*
* @param string $success "fail" or "pass"
* @param PyStringNode $text PyString text instance
*/
public function itShouldPassWith($success, PyStringNode $text)
{
$this->itShouldFail($success);
$this->theOutputShouldContain($text);
}
/**
* Checks whether specified file exists and contains specified string.
*
* @Then /^"([^"]*)" file should contain:$/
*
* @param string $path file path
* @param PyStringNode $text file content
*/
public function fileShouldContain($path, PyStringNode $text)
{
$path = $this->workingDir . '/' . $path;
PHPUnit_Framework_Assert::assertFileExists($path);
$fileContent = trim(file_get_contents($path));
// Normalize the line endings in the output
if ("\n" !== PHP_EOL) {
$fileContent = str_replace(PHP_EOL, "\n", $fileContent);
}
PHPUnit_Framework_Assert::assertEquals($this->getExpectedOutput($text), $fileContent);
}
/**
* Checks whether last command output contains provided string.
*
* @Then the output should contain:
*
* @param PyStringNode $text PyString text instance
*/
public function theOutputShouldContain(PyStringNode $text)
{
PHPUnit_Framework_Assert::assertContains($this->getExpectedOutput($text), $this->getOutput());
}
private function getExpectedOutput(PyStringNode $expectedText)
{
$text = strtr($expectedText, array('\'\'\'' => '"""', '%%TMP_DIR%%' => sys_get_temp_dir() . DIRECTORY_SEPARATOR));
// windows path fix
if ('/' !== DIRECTORY_SEPARATOR) {
$text = preg_replace_callback(
'/ features\/[^\n ]+/', function ($matches) {
return str_replace('/', DIRECTORY_SEPARATOR, $matches[0]);
}, $text
);
$text = preg_replace_callback(
'/\<span class\="path"\>features\/[^\<]+/', function ($matches) {
return str_replace('/', DIRECTORY_SEPARATOR, $matches[0]);
}, $text
);
$text = preg_replace_callback(
'/\+[fd] [^ ]+/', function ($matches) {
return str_replace('/', DIRECTORY_SEPARATOR, $matches[0]);
}, $text
);
}
return $text;
}
/**
* Checks whether previously ran command failed|passed.
*
* @Then /^it should (fail|pass)$/
*
* @param string $success "fail" or "pass"
*/
public function itShouldFail($success)
{
if ('fail' === $success) {
if (0 === $this->getExitCode()) {
echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput();
}
PHPUnit_Framework_Assert::assertNotEquals(0, $this->getExitCode());
} else {
if (0 !== $this->getExitCode()) {
echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput();
}
PHPUnit_Framework_Assert::assertEquals(0, $this->getExitCode());
}
}
private function getExitCode()
{
return $this->process->getExitCode();
}
private function getOutput()
{
$output = $this->process->getErrorOutput() . $this->process->getOutput();
// Normalize the line endings in the output
if ("\n" !== PHP_EOL) {
$output = str_replace(PHP_EOL, "\n", $output);
}
// Replace wrong warning message of HHVM
$output = str_replace('Notice: Undefined index: ', 'Notice: Undefined offset: ', $output);
return trim(preg_replace("/ +$/m", '', $output));
}
private function createFile($filename, $content)
{
$path = dirname($filename);
if (!is_dir($path)) {
mkdir($path, 0777, true);
}
file_put_contents($filename, $content);
}
private function moveToNewPath($path)
{
$newWorkingDir = $this->workingDir .'/' . $path;
if (!file_exists($newWorkingDir)) {
mkdir($newWorkingDir, 0777, true);
}
$this->workingDir = $newWorkingDir;
}
private static function clearDirectory($path)
{
$files = scandir($path);
array_shift($files);
array_shift($files);
foreach ($files as $file) {
$file = $path . DIRECTORY_SEPARATOR . $file;
if (is_dir($file)) {
self::clearDirectory($file);
} else {
unlink($file);
}
}
rmdir($path);
}
}
|
Codifico/phpspec-rest-view-extension
|
features/bootstrap/FeatureContext.php
|
PHP
|
mit
| 9,363
|
---
layout: archive
title: "CV"
permalink: /cv/
author_profile: true
redirect_from:
- /resume
---
Here is my Academic CV in a pdf format (current as of March 2021):
<embed src="https://sshkhr.github.io/files/Shashank_Shekhar_CV.pdf" type="application/pdf" width="600px" height="500px" />
|
sshkhrnwbie/sshkhrnwbie.github.io
|
_pages/cv.md
|
Markdown
|
mit
| 292
|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class PermissionsOperations:
"""PermissionsOperations async operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.authorization.v2018_01_01_preview.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""
models = _models
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
def list_for_resource_group(
self,
resource_group_name: str,
**kwargs: Any
) -> AsyncIterable["_models.PermissionGetResult"]:
"""Gets all permissions the caller has for a resource group.
:param resource_group_name: The name of the resource group. The name is case insensitive.
:type resource_group_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PermissionGetResult or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.PermissionGetResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.PermissionGetResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2018-01-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list_for_resource_group.metadata['url'] # type: ignore
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize('PermissionGetResult', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Authorization/permissions'} # type: ignore
def list_for_resource(
self,
resource_group_name: str,
resource_provider_namespace: str,
parent_resource_path: str,
resource_type: str,
resource_name: str,
**kwargs: Any
) -> AsyncIterable["_models.PermissionGetResult"]:
"""Gets all permissions the caller has for a resource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
:type resource_group_name: str
:param resource_provider_namespace: The namespace of the resource provider.
:type resource_provider_namespace: str
:param parent_resource_path: The parent resource identity.
:type parent_resource_path: str
:param resource_type: The resource type of the resource.
:type resource_type: str
:param resource_name: The name of the resource to get the permissions for.
:type resource_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PermissionGetResult or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.authorization.v2018_01_01_preview.models.PermissionGetResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.PermissionGetResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2018-01-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list_for_resource.metadata['url'] # type: ignore
path_format_arguments = {
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1),
'resourceProviderNamespace': self._serialize.url("resource_provider_namespace", resource_provider_namespace, 'str', skip_quote=True),
'parentResourcePath': self._serialize.url("parent_resource_path", parent_resource_path, 'str', skip_quote=True),
'resourceType': self._serialize.url("resource_type", resource_type, 'str', skip_quote=True),
'resourceName': self._serialize.url("resource_name", resource_name, 'str'),
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize('PermissionGetResult', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_for_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions'} # type: ignore
|
Azure/azure-sdk-for-python
|
sdk/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2018_01_01_preview/aio/operations/_permissions_operations.py
|
Python
|
mit
| 10,365
|
# jquery-area-select
省市县三级联动
###[演示地址](http://hingsir.github.io/jquery-area-select/)
|
hingsir/jquery-area-select
|
README.md
|
Markdown
|
mit
| 108
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LoginSystem
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
|
rohansen/Code-Examples
|
Security/WinFormsHashingSalting/LoginSystem/Program.cs
|
C#
|
mit
| 512
|
yii2-ueditor
======================
Yii2的百度UEditor扩展
根据crazydb的项目 进行修改 自用
|
crazydouble/yii2-ueditor
|
README.md
|
Markdown
|
mit
| 105
|
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/><!-- using block title in layout.dt--><!-- using block ddox.defs in ddox.layout.dt--><!-- using block ddox.title in ddox.layout.dt-->
<title>Enum Verbosity</title>
<link rel="stylesheet" type="text/css" href="../../styles/ddox.css"/>
<link rel="stylesheet" href="../../prettify/prettify.css" type="text/css"/>
<script type="text/javascript" src="../../scripts/jquery.js">/**/</script>
<script type="text/javascript" src="../../prettify/prettify.js">/**/</script>
<script type="text/javascript" src="../../scripts/ddox.js">/**/</script>
</head>
<body onload="prettyPrint(); setupDdox();">
<nav id="main-nav"><!-- using block navigation in layout.dt-->
<ul class="tree-view">
<li class="collapsed tree-view">
<a href="#" class="package">components</a>
<ul class="tree-view">
<li>
<a href="../../components/animation.html" class=" module">animation</a>
</li>
<li>
<a href="../../components/assetanimation.html" class=" module">assetanimation</a>
</li>
<li>
<a href="../../components/assets.html" class=" module">assets</a>
</li>
<li>
<a href="../../components/camera.html" class=" module">camera</a>
</li>
<li>
<a href="../../components/icomponent.html" class=" module">icomponent</a>
</li>
<li>
<a href="../../components/lights.html" class=" module">lights</a>
</li>
<li>
<a href="../../components/material.html" class=" module">material</a>
</li>
<li>
<a href="../../components/mesh.html" class=" module">mesh</a>
</li>
<li>
<a href="../../components/userinterface.html" class=" module">userinterface</a>
</li>
</ul>
</li>
<li class="collapsed tree-view">
<a href="#" class="package">core</a>
<ul class="tree-view">
<li>
<a href="../../core/dgame.html" class=" module">dgame</a>
</li>
<li>
<a href="../../core/gameobject.html" class=" module">gameobject</a>
</li>
<li>
<a href="../../core/prefabs.html" class=" module">prefabs</a>
</li>
<li>
<a href="../../core/properties.html" class=" module">properties</a>
</li>
<li>
<a href="../../core/reflection.html" class=" module">reflection</a>
</li>
<li>
<a href="../../core/scene.html" class=" module">scene</a>
</li>
</ul>
</li>
<li class="collapsed tree-view">
<a href="#" class="package">graphics</a>
<ul class="tree-view">
<li class="collapsed tree-view">
<a href="#" class="package">adapters</a>
<ul class="tree-view">
<li>
<a href="../../graphics/adapters/adapter.html" class=" module">adapter</a>
</li>
<li>
<a href="../../graphics/adapters/linux.html" class=" module">linux</a>
</li>
<li>
<a href="../../graphics/adapters/mac.html" class=" module">mac</a>
</li>
<li>
<a href="../../graphics/adapters/win32.html" class=" module">win32</a>
</li>
</ul>
</li>
<li class="collapsed tree-view">
<a href="#" class="package">shaders</a>
<ul class="tree-view">
<li class="collapsed tree-view">
<a href="#" class="package">glsl</a>
<ul class="tree-view">
<li>
<a href="../../graphics/shaders/glsl/ambientlight.html" class=" module">ambientlight</a>
</li>
<li>
<a href="../../graphics/shaders/glsl/animatedgeometry.html" class=" module">animatedgeometry</a>
</li>
<li>
<a href="../../graphics/shaders/glsl/directionallight.html" class=" module">directionallight</a>
</li>
<li>
<a href="../../graphics/shaders/glsl/geometry.html" class=" module">geometry</a>
</li>
<li>
<a href="../../graphics/shaders/glsl/pointlight.html" class=" module">pointlight</a>
</li>
<li>
<a href="../../graphics/shaders/glsl/userinterface.html" class=" module">userinterface</a>
</li>
</ul>
</li>
<li>
<a href="../../graphics/shaders/glsl.html" class=" module">glsl</a>
</li>
<li>
<a href="../../graphics/shaders/shaders.html" class=" module">shaders</a>
</li>
</ul>
</li>
<li>
<a href="../../graphics/adapters.html" class=" module">adapters</a>
</li>
<li>
<a href="../../graphics/graphics.html" class=" module">graphics</a>
</li>
<li>
<a href="../../graphics/shaders.html" class=" module">shaders</a>
</li>
</ul>
</li>
<li class=" tree-view">
<a href="#" class="package">utility</a>
<ul class="tree-view">
<li>
<a href="../../utility/awesomium.html" class=" module">awesomium</a>
</li>
<li>
<a href="../../utility/concurrency.html" class=" module">concurrency</a>
</li>
<li>
<a href="../../utility/config.html" class=" module">config</a>
</li>
<li>
<a href="../../utility/filepath.html" class=" module">filepath</a>
</li>
<li>
<a href="../../utility/input.html" class=" module">input</a>
</li>
<li>
<a href="../../utility/output.html" class="selected module">output</a>
</li>
<li>
<a href="../../utility/string.html" class=" module">string</a>
</li>
<li>
<a href="../../utility/tasks.html" class=" module">tasks</a>
</li>
<li>
<a href="../../utility/time.html" class=" module">time</a>
</li>
</ul>
</li>
<li>
<a href="../../components.html" class=" module">components</a>
</li>
<li>
<a href="../../core.html" class=" module">core</a>
</li>
<li>
<a href="../../graphics.html" class=" module">graphics</a>
</li>
<li>
<a href="../../utility.html" class=" module">utility</a>
</li>
</ul>
<noscript>
<p style="color: red">The search functionality needs JavaScript enabled</p>
</noscript>
<div id="symbolSearchPane" style="display: none">
<p>
<input id="symbolSearch" type="text" placeholder="Search for symbols" onchange="performSymbolSearch(24);" onkeypress="this.onchange();" onpaste="this.onchange();" oninput="this.onchange();"/>
</p>
<ul id="symbolSearchResults" style="display: none"></ul>
<script type="application/javascript" src="../../symbols.js"></script>
<script type="application/javascript">
//<![CDATA[
var symbolSearchRootDir = "../../"; $('#symbolSearchPane').show();
//]]>
</script>
</div>
</nav>
<div id="main-contents">
<h1>Enum Verbosity</h1><!-- using block body in layout.dt--><!-- using block ddox.description in ddox.layout.dt-->
<p> The levels of output available.
</p>
<section>
</section>
<!-- using block ddox.sections in ddox.layout.dt-->
<p>The enum base type is
<code class="prettyprint lang-d"><code class="prettyprint lang-d">int</code></code>
.
</p>
<!-- using block ddox.members in ddox.layout.dt-->
<section>
<h2>Enum members</h2>
<table>
<col class="caption"/>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
<tr>
<td>
<a href="../../utility/output/Verbosity.Debug.html">
<code>Debug</code>
</a>
</td>
<td> Show me everything++.
Deprecated, debug msgs are cut off in release
version anyway. So equal <a href="../../utility/output/Verbosity.High.html"><code class="prettyprint lang-d">High</code></a>.
</td>
</tr>
<tr>
<td>
<a href="../../utility/output/Verbosity.High.html">
<code>High</code>
</a>
</td>
<td> Show me everything.
</td>
</tr>
<tr>
<td>
<a href="../../utility/output/Verbosity.Low.html">
<code>Low</code>
</a>
</td>
<td> I only care about things gone horribly wrong.
</td>
</tr>
<tr>
<td>
<a href="../../utility/output/Verbosity.Medium.html">
<code>Medium</code>
</a>
</td>
<td> Show me things that shouldn't have happened.
</td>
</tr>
<tr>
<td>
<a href="../../utility/output/Verbosity.Off.html">
<code>Off</code>
</a>
</td>
<td> I like to live on the edge.
</td>
</tr>
</table>
</section>
<section>
<h2>Authors</h2><!-- using block ddox.authors in ddox.layout.dt-->
</section>
<section>
<h2>Copyright</h2><!-- using block ddox.copyright in ddox.layout.dt-->
</section>
<section>
<h2>License</h2><!-- using block ddox.license in ddox.layout.dt-->
</section>
</div>
</body>
</html>
|
Circular-Studios/Dash-Docs
|
api/v0.6.5/utility/output/Verbosity.html
|
HTML
|
mit
| 8,915
|
---
layout: lesson
title: "Clone, Edit, Commit, and Sync"
deck: "How to install the Github desktop app, make a local copy of your Github repo, manage and edit your webpage project on your own operating system, and sync with your Github repo."
lesson_number: 4
image_url: 'https://www.flickr.com/photos/zokuga/8665431657/'
status: Mostly complete [2014-04-13]
---
<section class="overview">
As you've probably noticed from using Github's Automatic Page Generator, or past web-development experience, a website consists of more than just a single HTML file. Besides having multiple pages (i.e. multiple HTML files), most websites also have image files, for example.
By using Github.com's web interface, we've been able to add and edit __text__ files. But, at the time of writing, there isn't a way to add multimedia assets, such as images, to our repo.
Even if Github adds such an upload feature to its web interface, you can imagine that it will be a bit cumbersome to build an entire website, from scratch, from within your web browser. What would be convenient is if we could build the website on our own operating system, e.g. using the files and folders system that we've been accustomed to since the first Macintosh and Windows system.
So this chapter walks through the process of downloading a __local copy__ of our Github repo, editing and changing the files on our own computer system, and then syncing those changes so that they appear on our live Github-powered portfolio pages.
</section>
## Download the Github application
<section class="row">
<div class="col-sm-6">
Github provides a __desktop application__ to let you manage your Github-based repos with a graphical interface. Downloading and using the Github desktop app is _entirely optional_; most developers manage their repos from the __command-line__. But using the Github desktop app provides the smoothest transition from the web-browser editing we've done so far.
The Github app for Mac can be found here:
[https://mac.github.com/](https://mac.github.com/)
The Github app for Windows is here:
[https://windows.github.com/](https://windows.github.com/)
Github [also has online documentation for its desktop app](https://mac.github.com/help.html), but assumes you're using it to do the full range of Git/Github functionality.
</div>
<div class="col-sm-6">


</div>
</section>
<section class="row">
<div class="col-sm-6">
Find the zip file in your __Downloads__ folder
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Double-click on the zip file which will produce a __Github.app__ file. You can move this file to your __Applications__ folder, or just double-click it and the app will offer to move itself for you.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
The app should ask you to sign with your Github credentials so that it can sync with your Github.com account.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Let's get quickly acquainted with the __Github Desktop App__.
First look at the __sidebar__: you should see two subheads with (short) lists:
- __THIS COMPUTER__
+ My Repositories
- __GITHUB.COM__
+ username
Those two subheads represent the two physical locations where your Github repos might be stored: on Github.com (which you've been working with so far, via web browser) and on your own computer.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
If you click on the __My Repositories__ item, under the __THIS COMPUTER__ subhead, you should see an empty screen. This is because you haven't yet copied your Github repos to your computer yet.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Now click on __username__ under the __GITHUB.COM__ subhead. You should see a lone repo:
`username/username.github.io`
This is the publish-to-Github-Pages repo you've been editing for the entirety of the lesson so far. As you create new repos on Github.com, they will show up in this listing.
And as you __clone__ those repos over to your local computer, you'll see a similar list under __THIS COMPUTER__ » __My Repositories__.
Let's now create our first __cloned repo__.
</div>
<div class="col-sm-6">

</div>
</section>
## Clone a repo
<section class="row">
<div class="col-sm-6">
A little Git terminology: the term __clone__ refers to a __git__ function that makes an entirely new copy of a repo. At the most basic level, this is no different than stashing a project folder on a USB drive or Dropbox and allowing collaborators to copy it onto their own computer.
In the Github Desktop App sidebar, click the __GITHUB.COM__ » __username__ repo. In the right-side of the app, you should see a button that says __Clone to Computer__. Click it.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
The app should pop-up a prompt asking you where to download the repo to. Again, __cloning__ a repo from Github.com to your own computer is essentially the same as downloading a copy of it.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Now in the desktop app sidebar, click on the __THIS COMPUTER__ » __My Repositories__ list item. The right-side of the destkop app should now have a single item: the `username/username.github.io` repo, with a message saying it was "_Synchronized less than a minute ago_".
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Right-click on the cloned repo item, which will bring up a pop-up menu.
If you select __View on Github__, it will take you to that repo's top-level page on Github.com, which you're familiar with by now.
If you select __Remove__, it will delete the repository from your computer but will _leave alone the copy on Github.com_. Deleting a clone doesn't delete the master copy.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
For now, select __Show in Finder__, which should take you to where you told the Github app to clone the repo.
Your repo should have been downloaded to a folder named: `username.github.io`
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Double-click your repo folder. Does that file listing look familiar? Visit your repo folder at Github.com if you need to refresh your memory. See, a Git repo is very much like a typical folder of files.
The takeaway here is that Github.com can be seen, for our purposes, as a website that stores a copy of our project and allows us to peruse it via a web browser. But at any time, we can make an exact copy of the repo and distribute our files as we please.
</div>
<div class="col-sm-6">

</div>
</section>
## Viewing the Git activity
<section class="row">
<div class="col-sm-6">
Of course, a Git repo has a few additional features to it. There's a (hidden) metadata file that lists, among other things, the repo's configuration settings and history. In the desktop app's __My Repositories__ listing, either double-click your cloned-repo item, or click the little arrow button that's at the right end of the listing.
The Github Desktop App will now focus on the cloned repo: the __left sidebar__ will change to fit this context with a set of new buttons.
Notice the __top-navigation__: when you want to go back to the top-level list of repositories, simply click on __Repositories__.
</div>
<div class="col-sm-6">


</div>
</section>
<section class="row">
<div class="col-sm-6">
Part of cloning a repo is you also clone the __git__ activity, i.e. the history of changes so far.
That commit history and the messages should look familiar to you.
</div>
<div class="col-sm-6">

</div>
</section>
## Making changes to our local repo
<section class="row">
<div class="col-sm-6">
Visit your __cloned repo folder__ wherever you downloaded it.
Go ahead and click through the files. The images should open in your native image editor, text files in your text editor, and so forth.
I've chosen to open the `index.html` file in my own text-editor ([Sublime Text](http://www.sublimetext.com/), which you can try for free) to change the YouTube embed code.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
In my example, I'm removing the current YouTube `<iframe>` embed code and replacing it with this one:
~~~ html
<iframe width="560" height="315" src="//www.youtube.com/embed/zVTwUVHefgM" frameborder="0" allowfullscreen></iframe>
~~~
Editing our local, cloned `index.html` and saving it with our own text editor is no different than just editing `index.html` (and `README.md`) in the web browser, as we've done previously.
Except that the file is _only updated on our computer_. Again, we're working on a _clone_ of the project repo, which now exists independently of the copy on Github.com. Just as if you gave a haircut to an identical (human) twin, the hair on the other twin doesn't automatically update, so do our file changes not automatically propogate to all the other cloned repos.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
So the upshot is we can make changes to our cloned repo without screwing up work that we've stored on Github.com. _However_, the repo on Github.com is the one that gets published via __Github Pages__.
And if we want our _local_ changes to make it online, we need to __sync__ our local repo with the Github.com repo.
The first step is to __commit__ our changes. Click the __Changes__ tab (in the Github app's side-menu). Since I edited my `index.html`, this screen shows me that I have changes to `index.html` to commit. On the right-hand side, the Github app shows me the __diff__ of `index.html`, that is, what I've cut out (in <span style="color: #900;">red</span>) and what I've added (in <span style="color:#0a0">green</span>)
Each time you make changes to your __local repo__, the Github desktop app (which continuously monitors that file folder) will update and show the changes. Try it out for yourself by making small changes to the other text files.
Then enter a commit message and press the __Commit__ button.
</div>
<div class="col-sm-6">

</div>
</section>
## Syncing with Github.com
<section class="row">
<div class="col-sm-6">
The left side of the desktop app will update to reflect that you've __committed__ a new change (or set of changes). Notice that under __Unsynced Commits__, there's an item with the commit message ("Changing youtube video around"), as well as a __Sync__ button.
The word __Unsynced__ is a clue that our local changes have not yet affected what's on Github.com.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
A review of Git terminology: when we edited files on Github.com and pressed __Commit__, we saw the changes saved and reflected online immediately.
But with __Git__, the [__commit__ command](http://gitref.org/basic/#commit) merely means that we're recording a __snapshot__ of our repo as it currently exists.
This is not the same as __saving__ a file, like as you're used to in your word processor or image editor. That action __saves__ a snapshot of the _file_. But in the context of a Git repo, the repo doesn't consider that saved file as part of the repo's current snapshot until you hit __commit__.
Inside Github.com's file editor, though, when you hit __Commit__, it does the saving of the file, the snapshotting of the repo, and then, if the repo is connected to Github Pages, the re-publishing of the file. But that's unique to how __Github.com__ handles repo.
Now that we're working off of a __local repo__, on our computer, we need to take an extra step to say, "Now, make these _local_ changes appear on Github.com."
We make this happen by pressing the __Sync__ button that has shown up in the Github desktop app.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
You may get a request from the Github app to use the credentials for your Github.com account. __Allow__ (or Always Allow) the Github app the access it needs.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
After a few seconds, you'll see that the sections for __Uncommitted Changes__ and __Unsynced Commits__ are now empty, indicating that the sync action has finished.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
In the __Github app__, check out the __History__ tab, which will now list the latest commit.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Now visit your __Github.com repo page__ which will also show the synced files. In my case, the only file I changed was `index.html`
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Finally, visit your home on Github Pages, e.g. `http://username.github.io`, to see the changes you've made to `index.html`
</div>
<div class="col-sm-6">

</div>
</section>
## Uploading new files
<section class="row">
<div class="col-sm-6">
So we actually haven't done anything _new_ by cloning our repo and using the Github desktop app: it's essentially the same __Edit-and-Commit__ routine, with an additional __Sync__ to keep the clone and original repo _in sync_.
But now we're working with our repo as if it were any other file folder on our system. Which means we can drag-and-drop files of any type into our repo folder. In this next exercise, we'll add a new photo to our page.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
First, download a photo from the Internet and save it as something like: `my-photo.jpg` in your Downloads folder.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Then, drag-and-drop it into your local repo folder, under the `images` subdirectory (which you can create if it doesn't already exist).
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Now edit `index.html` in a text-editor. Find the existing `<img>` tag if you're using my example code:
~~~html
<p><img src="http://i.imgur.com/2i35DTo.jpg" alt="alt text"></p>
~~~
This code does show an image, which you can visit on the Web at [http://i.imgur.com/2i35DTo.jpg](http://i.imgur.com/2i35DTo.jpg). But what if the image's server (`i.imgur.com`) goes down? Now that our new image, `images/my-photo.jpg` is _inside_ our repo, we have control of it – though we are responsible for hosting it on our own server (in this case, Github Pages).
To have our `index.html` use our image file, we simply update the `src` attribute of the `img` tag:
~~~html
<p><img src="/images/my-photo.jpg" alt="my new photo"></p>
~~~
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Check out the __Changes__ tab of the Github Desktop App. You should see under __Uncommitted Changes__, the new image file and a change to `index.html`.
Hit the __Commit__ button, then __Sync__ the files with Github.com.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Check out your portfolio repo on Github.com. You should see the commit message on two different files (`index.html` and the `images` sub directory)
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Finally, checkout your portfolio homepage at `username.github.io` to see the new photo.
Again, nothing substantially new, just a demonstration of how easy it is to add new files to our portfolio homepage. In the next chapters, we'll be drag-and-dropping whole folders in and out of our repo.
</div>
<div class="col-sm-6">

</div>
</section>
## Sync practice: online-to-offline
<section class="row">
<div class="col-sm-6">
One more exercise before we end this lesson. We've seen how to we can sync changes _from_ our __local__ repo _to_ our Github (i.e. __remote__) repo.
But can the sync happen in the other direction? That is, can we make changes to the Github repo, and _then_ sync them with our local repo?
Let's find out. Go back to your __project repo page__ and click-through on your `index.html`. Then click the __Edit__ button.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
In the Github file editor, make a change you'll notice. In my example, I've uppercased the page's `<h1>` title. Then commit your change.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Your project repo page will show that `index.html` has recently been updated.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
To visually confirm the edit, visit `index.html` to see how it was auto-published by Github Pages at: `http://username.github.io`
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Now go back to the __Github desktop app__. Select your project repo. At the top-right of the top nav, you should see a __Sync Branch__ button. Clicking this will sync your __local repo__ to the just-updated repo on Github.com
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
Alternatively, you can click on __Repository__ in the menu navigation and select the __Synchronize__ action. (Or just hit __Cmd-S__ if you're on a Mac)
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
In the Github desktop app, click the __History__ submenu. You'll see that it has been updated to include the edit that was made on __Github.com__
</div>
<div class="col-sm-6">

</div>
</section>
<section class="row">
<div class="col-sm-6">
To confirm that the sync-action actually had effect, you can go to the file folder on your computer that contains the repo. Note that the `index.html` file should have a newer timestamp than the other files.
Not much new to understand here. We've just seen how both of the cloned repos – local and on Github.com – can independently make changes and sync with each other. However, it's important to note that __Github Pages__ will only publish from the repo on Github.com. So whatever changes you make locally needed to be pushed online if you want them seen on your live Github.io portfolio.page.
What happens when you've made changes to `index.html` in _both_ repos but only later sync them? Then you might run into a __conflict__, which we'll cover in the next chapter.
</div>
<div class="col-sm-6">

</div>
</section>
<section class="conclusion">
## Things we've learned
- How to use the Github desktop app
- How to clone a repo
- How to work with a repo on our local operating and file system
- How to sync changes with Github.com
...to be written
</section>
<!--
If you haven't been too confused by this new procedure, you might have noticed that, despite walking through all these different steps, we _did not gain any new functionality_.
That is, downloading the Github app, editing a file via text editor, and then syncing it, gave us no different a situation than as if we just edited the file directly on Github.com.
So why even download the Github app and clone the repo? For one thing, in most non-trivial projects, you'll be editing more than one file at a time, and it's usually easier to do this on your computer's own text-editor than via the Github.com file editor.
Second, Github.com does not allow us (yet) to add __non-text__ files via the web browser. And even if it did, it probably wouldn't be easier than drag-and-droping files on our own operating system and file folders.
So by learning how to use the Github app and cloning the repo, we've made the process a bit more complicated, but we've also gained more flexibility in what we can add to our web project. -->
|
dannguyen/github-for-portfolios
|
lessons/clone-github-pages-repo.md
|
Markdown
|
mit
| 23,472
|
import React from 'react';
import CalculatorInput from './CalculatorInput.js';
import CalculatoResult from './CalculatoResult.js';
import styles from './Calculator.scss';
import withStyles from '../../decorators/withStyles';
@withStyles(styles)
class Calculator {
static propTypes = {
};
render() {
return (
<div className="Calculator" id="calculator">
<CalculatoResult />
<CalculatorInput />
</div>
);
}
}
export default Calculator;
|
Batname/Yeoman_react_tests
|
src/components/Calculator/Calculator.js
|
JavaScript
|
mit
| 484
|
body {
margin:0px;
background-image:none;
position:static;
left:auto;
width:540px;
margin-left:0;
margin-right:0;
text-align:left;
}
#base {
position:absolute;
z-index:0;
}
#u0 {
position:absolute;
left:0px;
top:50px;
width:540px;
height:960px;
}
#u0_img {
position:absolute;
left:0px;
top:0px;
width:540px;
height:960px;
}
#u1 {
position:absolute;
left:2px;
top:472px;
width:536px;
visibility:hidden;
word-wrap:break-word;
}
#u2 {
position:absolute;
left:0px;
top:80px;
width:90px;
height:90px;
overflow:hidden;
}
#u2_state0 {
position:absolute;
left:0px;
top:0px;
width:90px;
height:90px;
-ms-overflow-x:hidden;
overflow-x:hidden;
-ms-overflow-y:hidden;
overflow-y:hidden;
background-image:none;
}
#u2_state0_content {
position:absolute;
left:0px;
top:0px;
width:1px;
height:1px;
}
|
yanzhihong23/csyywx
|
psd/财神爷爷轻应用3.1版本迭代内容/轻应用迭代——html版/files/活期资产明细页/styles.css
|
CSS
|
mit
| 944
|
/** @preserve
* jsPDF fromHTML plugin. BETA stage. API subject to change. Needs browser
* Copyright (c) 2012 Willow Systems Corporation, willow-systems.com
* 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria
* 2014 Diego Casorran, https://github.com/diegocr
* 2014 Daniel Husar, https://github.com/danielhusar
* 2014 Wolfgang Gassler, https://github.com/woolfg
* 2014 Steven Spungin, https://github.com/flamenco
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ====================================================================
*/
(function (jsPDFAPI) {
var clone,
DrillForContent,
FontNameDB,
FontStyleMap,
TextAlignMap,
FontWeightMap,
FloatMap,
ClearMap,
GetCSS,
PurgeWhiteSpace,
Renderer,
ResolveFont,
ResolveUnitedNumber,
UnitedNumberMap,
elementHandledElsewhere,
images,
loadImgs,
checkForFooter,
process,
tableToJson;
clone = (function () {
return function (obj) {
Clone.prototype = obj;
return new Clone()
};
function Clone() {}
})();
PurgeWhiteSpace = function (array) {
var fragment,
i,
l,
lTrimmed,
r,
rTrimmed,
trailingSpace;
i = 0;
l = array.length;
fragment = void 0;
lTrimmed = false;
rTrimmed = false;
while (!lTrimmed && i !== l) {
fragment = array[i] = array[i].trimLeft();
if (fragment) {
lTrimmed = true;
}
i++;
}
i = l - 1;
while (l && !rTrimmed && i !== -1) {
fragment = array[i] = array[i].trimRight();
if (fragment) {
rTrimmed = true;
}
i--;
}
r = /\s+$/g;
trailingSpace = true;
i = 0;
while (i !== l) {
// Leave the line breaks intact
if (array[i] != "\u2028") {
fragment = array[i].replace(/\s+/g, " ");
if (trailingSpace) {
fragment = fragment.trimLeft();
}
if (fragment) {
trailingSpace = r.test(fragment);
}
array[i] = fragment;
}
i++;
}
return array;
};
Renderer = function (pdf, x, y, settings) {
this.pdf = pdf;
this.x = x;
this.y = y;
this.settings = settings;
//list of functions which are called after each element-rendering process
this.watchFunctions = [];
this.init();
return this;
};
ResolveFont = function (css_font_family_string) {
var name,
part,
parts;
name = void 0;
parts = css_font_family_string.split(",");
part = parts.shift();
while (!name && part) {
name = FontNameDB[part.trim().toLowerCase()];
part = parts.shift();
}
return name;
};
ResolveUnitedNumber = function (css_line_height_string) {
//IE8 issues
css_line_height_string = css_line_height_string === "auto" ? "0px" : css_line_height_string;
if (css_line_height_string.indexOf("em") > -1 && !isNaN(Number(css_line_height_string.replace("em", "")))) {
css_line_height_string = Number(css_line_height_string.replace("em", "")) * 18.719 + "px";
}
if (css_line_height_string.indexOf("pt") > -1 && !isNaN(Number(css_line_height_string.replace("pt", "")))) {
css_line_height_string = Number(css_line_height_string.replace("pt", "")) * 1.333 + "px";
}
var normal,
undef,
value;
undef = void 0;
normal = 16.00;
value = UnitedNumberMap[css_line_height_string];
if (value) {
return value;
}
value = {
"xx-small" : 9,
"x-small" : 11,
small : 13,
medium : 16,
large : 19,
"x-large" : 23,
"xx-large" : 28,
auto : 0
}[{ css_line_height_string : css_line_height_string }];
if (value !== undef) {
return UnitedNumberMap[css_line_height_string] = value / normal;
}
if (value = parseFloat(css_line_height_string)) {
return UnitedNumberMap[css_line_height_string] = value / normal;
}
value = css_line_height_string.match(/([\d\.]+)(px)/);
if (value.length === 3) {
return UnitedNumberMap[css_line_height_string] = parseFloat(value[1]) / normal;
}
return UnitedNumberMap[css_line_height_string] = 1;
};
GetCSS = function (element) {
var css,tmp,computedCSSElement;
computedCSSElement = (function (el) {
var compCSS;
compCSS = (function (el) {
if (document.defaultView && document.defaultView.getComputedStyle) {
return document.defaultView.getComputedStyle(el, null);
} else if (el.currentStyle) {
return el.currentStyle;
} else {
return el.style;
}
})(el);
return function (prop) {
prop = prop.replace(/-\D/g, function (match) {
return match.charAt(1).toUpperCase();
});
return compCSS[prop];
};
})(element);
css = {};
tmp = void 0;
css["font-family"] = ResolveFont(computedCSSElement("font-family")) || "times";
css["font-style"] = FontStyleMap[computedCSSElement("font-style")] || "normal";
css["text-align"] = TextAlignMap[computedCSSElement("text-align")] || "left";
tmp = FontWeightMap[computedCSSElement("font-weight")] || "normal";
if (tmp === "bold") {
if (css["font-style"] === "normal") {
css["font-style"] = tmp;
} else {
css["font-style"] = tmp + css["font-style"];
}
}
css["font-size"] = ResolveUnitedNumber(computedCSSElement("font-size")) || 1;
css["line-height"] = ResolveUnitedNumber(computedCSSElement("line-height")) || 1;
css["display"] = (computedCSSElement("display") === "inline" ? "inline" : "block");
tmp = (css["display"] === "block");
css["margin-top"] = tmp && ResolveUnitedNumber(computedCSSElement("margin-top")) || 0;
css["margin-bottom"] = tmp && ResolveUnitedNumber(computedCSSElement("margin-bottom")) || 0;
css["padding-top"] = tmp && ResolveUnitedNumber(computedCSSElement("padding-top")) || 0;
css["padding-bottom"] = tmp && ResolveUnitedNumber(computedCSSElement("padding-bottom")) || 0;
css["margin-left"] = tmp && ResolveUnitedNumber(computedCSSElement("margin-left")) || 0;
css["margin-right"] = tmp && ResolveUnitedNumber(computedCSSElement("margin-right")) || 0;
css["padding-left"] = tmp && ResolveUnitedNumber(computedCSSElement("padding-left")) || 0;
css["padding-right"] = tmp && ResolveUnitedNumber(computedCSSElement("padding-right")) || 0;
css["page-break-before"] = computedCSSElement("page-break-before") || "auto";
//float and clearing of floats
css["float"] = FloatMap[computedCSSElement("cssFloat")] || "none";
css["clear"] = ClearMap[computedCSSElement("clear")] || "none";
css["color"] = computedCSSElement("color");
return css;
};
elementHandledElsewhere = function (element, renderer, elementHandlers) {
var handlers,
i,
isHandledElsewhere,
l,
t;
isHandledElsewhere = false;
i = void 0;
l = void 0;
t = void 0;
handlers = elementHandlers["#" + element.id];
if (handlers) {
if (typeof handlers === "function") {
isHandledElsewhere = handlers(element, renderer);
} else {
i = 0;
l = handlers.length;
while (!isHandledElsewhere && i !== l) {
isHandledElsewhere = handlers[i](element, renderer);
i++;
}
}
}
handlers = elementHandlers[element.nodeName];
if (!isHandledElsewhere && handlers) {
if (typeof handlers === "function") {
isHandledElsewhere = handlers(element, renderer);
} else {
i = 0;
l = handlers.length;
while (!isHandledElsewhere && i !== l) {
isHandledElsewhere = handlers[i](element, renderer);
i++;
}
}
}
return isHandledElsewhere;
};
tableToJson = function (table, renderer) {
var data,
headers,
i,
j,
rowData,
tableRow,
table_obj,
table_with,
cell,
l;
data = [];
headers = [];
i = 0;
l = table.rows[0].cells.length;
table_with = table.clientWidth;
while (i < l) {
cell = table.rows[0].cells[i];
headers[i] = {
name : cell.textContent.toLowerCase().replace(/\s+/g, ''),
prompt : cell.textContent.replace(/\r?\n/g, ''),
width : (cell.clientWidth / table_with) * renderer.pdf.internal.pageSize.width
};
i++;
}
i = 1;
while (i < table.rows.length) {
tableRow = table.rows[i];
rowData = {};
j = 0;
while (j < tableRow.cells.length) {
rowData[headers[j].name] = tableRow.cells[j].textContent.replace(/\r?\n/g, '');
j++;
}
data.push(rowData);
i++;
}
return table_obj = {
rows : data,
headers : headers
};
};
var SkipNode = {
SCRIPT : 1,
STYLE : 1,
NOSCRIPT : 1,
OBJECT : 1,
EMBED : 1,
SELECT : 1
};
var listCount = 1;
DrillForContent = function (element, renderer, elementHandlers) {
var cn,
cns,
fragmentCSS,
i,
isBlock,
l,
px2pt,
table2json,
cb;
cns = element.childNodes;
cn = void 0;
fragmentCSS = GetCSS(element);
isBlock = fragmentCSS.display === "block";
if (isBlock) {
renderer.setBlockBoundary();
renderer.setBlockStyle(fragmentCSS);
}
px2pt = 0.264583 * 72 / 25.4;
i = 0;
l = cns.length;
while (i < l) {
cn = cns[i];
if (typeof cn === "object") {
//execute all watcher functions to e.g. reset floating
renderer.executeWatchFunctions(cn);
/*** HEADER rendering **/
if (cn.nodeType === 1 && cn.nodeName === 'HEADER') {
var header = cn;
//store old top margin
var oldMarginTop = renderer.pdf.margins_doc.top;
//subscribe for new page event and render header first on every page
renderer.pdf.internal.events.subscribe('addPage', function (pageInfo) {
//set current y position to old margin
renderer.y = oldMarginTop;
//render all child nodes of the header element
DrillForContent(header, renderer, elementHandlers);
//set margin to old margin + rendered header + 10 space to prevent overlapping
//important for other plugins (e.g. table) to start rendering at correct position after header
renderer.pdf.margins_doc.top = renderer.y + 10;
renderer.y += 10;
}, false);
}
if (cn.nodeType === 8 && cn.nodeName === "#comment") {
if (~cn.textContent.indexOf("ADD_PAGE")) {
renderer.pdf.addPage();
renderer.y = renderer.pdf.margins_doc.top;
}
} else if (cn.nodeType === 1 && !SkipNode[cn.nodeName]) {
/*** IMAGE RENDERING ***/
var cached_image;
if (cn.nodeName === "IMG") {
var url = cn.getAttribute("src");
cached_image = images[renderer.pdf.sHashCode(url) || url];
}
if (cached_image) {
if ((renderer.pdf.internal.pageSize.height - renderer.pdf.margins_doc.bottom < renderer.y + cn.height) && (renderer.y > renderer.pdf.margins_doc.top)) {
renderer.pdf.addPage();
renderer.y = renderer.pdf.margins_doc.top;
//check if we have to set back some values due to e.g. header rendering for new page
renderer.executeWatchFunctions(cn);
}
var imagesCSS = GetCSS(cn);
var imageX = renderer.x;
var fontToUnitRatio = 12 / renderer.pdf.internal.scaleFactor;
//define additional paddings, margins which have to be taken into account for margin calculations
var additionalSpaceLeft = (imagesCSS["margin-left"] + imagesCSS["padding-left"])*fontToUnitRatio;
var additionalSpaceRight = (imagesCSS["margin-right"] + imagesCSS["padding-right"])*fontToUnitRatio;
var additionalSpaceTop = (imagesCSS["margin-top"] + imagesCSS["padding-top"])*fontToUnitRatio;
var additionalSpaceBottom = (imagesCSS["margin-bottom"] + imagesCSS["padding-bottom"])*fontToUnitRatio;
//if float is set to right, move the image to the right border
//add space if margin is set
if (imagesCSS['float'] !== undefined && imagesCSS['float'] === 'right') {
imageX += renderer.settings.width - cn.width - additionalSpaceRight;
} else {
imageX += additionalSpaceLeft;
}
renderer.pdf.addImage(cached_image, imageX, renderer.y + additionalSpaceTop, cn.width, cn.height);
cached_image = undefined;
//if the float prop is specified we have to float the text around the image
if (imagesCSS['float'] === 'right' || imagesCSS['float'] === 'left') {
//add functiont to set back coordinates after image rendering
renderer.watchFunctions.push((function(diffX , thresholdY, diffWidth, el) {
//undo drawing box adaptions which were set by floating
if (renderer.y >= thresholdY) {
renderer.x += diffX;
renderer.settings.width += diffWidth;
return true;
} else if(el && el.nodeType === 1 && !SkipNode[el.nodeName] && renderer.x+el.width > (renderer.pdf.margins_doc.left + renderer.pdf.margins_doc.width)) {
renderer.x += diffX;
renderer.y = thresholdY;
renderer.settings.width += diffWidth;
return true;
} else {
return false;
}
}).bind(this, (imagesCSS['float'] === 'left') ? -cn.width-additionalSpaceLeft-additionalSpaceRight : 0, renderer.y+cn.height+additionalSpaceTop+additionalSpaceBottom, cn.width));
//reset floating by clear:both divs
//just set cursorY after the floating element
renderer.watchFunctions.push((function(yPositionAfterFloating, pages, el) {
if (renderer.y < yPositionAfterFloating && pages === renderer.pdf.internal.getNumberOfPages()) {
if (el.nodeType === 1 && GetCSS(el).clear === 'both') {
renderer.y = yPositionAfterFloating;
return true;
} else {
return false;
}
} else {
return true;
}
}).bind(this, renderer.y+cn.height, renderer.pdf.internal.getNumberOfPages()));
//if floating is set we decrease the available width by the image width
renderer.settings.width -= cn.width+additionalSpaceLeft+additionalSpaceRight;
//if left just add the image width to the X coordinate
if (imagesCSS['float'] === 'left') {
renderer.x += cn.width+additionalSpaceLeft+additionalSpaceRight;
}
} else {
//if no floating is set, move the rendering cursor after the image height
renderer.y += cn.height + additionalSpaceTop + additionalSpaceBottom;
}
/*** TABLE RENDERING ***/
} else if (cn.nodeName === "TABLE") {
table2json = tableToJson(cn, renderer);
renderer.y += 10;
renderer.pdf.table(renderer.x, renderer.y, table2json.rows, table2json.headers, {
autoSize : false,
printHeaders: elementHandlers.printHeaders,
margins: renderer.pdf.margins_doc,
css: GetCSS(cn)
});
renderer.y = renderer.pdf.lastCellPos.y + renderer.pdf.lastCellPos.h + 20;
} else if (cn.nodeName === "OL" || cn.nodeName === "UL") {
listCount = 1;
if (!elementHandledElsewhere(cn, renderer, elementHandlers)) {
DrillForContent(cn, renderer, elementHandlers);
}
renderer.y += 10;
} else if (cn.nodeName === "LI") {
var temp = renderer.x;
renderer.x += 20 / renderer.pdf.internal.scaleFactor;
renderer.y += 3;
if (!elementHandledElsewhere(cn, renderer, elementHandlers)) {
DrillForContent(cn, renderer, elementHandlers);
}
renderer.x = temp;
} else if (cn.nodeName === "BR") {
renderer.y += fragmentCSS["font-size"] * renderer.pdf.internal.scaleFactor;
renderer.addText("\u2028", clone(fragmentCSS));
} else {
if (!elementHandledElsewhere(cn, renderer, elementHandlers)) {
DrillForContent(cn, renderer, elementHandlers);
}
}
} else if (cn.nodeType === 3) {
var value = cn.nodeValue;
if (cn.nodeValue && cn.parentNode.nodeName === "LI") {
if (cn.parentNode.parentNode.nodeName === "OL") {
value = listCount++ + '. ' + value;
} else {
var fontSize = fragmentCSS["font-size"];
var offsetX = (3 - fontSize * 0.75) * renderer.pdf.internal.scaleFactor;
var offsetY = fontSize * 0.75 * renderer.pdf.internal.scaleFactor;
var radius = fontSize * 1.74 / renderer.pdf.internal.scaleFactor;
cb = function (x, y) {
this.pdf.circle(x + offsetX, y + offsetY, radius, 'FD');
};
}
}
// Only add the text if the text node is in the body element
// Add compatibility with IE11
if(!!(cn.ownerDocument.body.compareDocumentPosition(cn) & 16)){
renderer.addText(value, fragmentCSS);
}
} else if (typeof cn === "string") {
renderer.addText(cn, fragmentCSS);
}
}
i++;
}
elementHandlers.outY = renderer.y;
if (isBlock) {
return renderer.setBlockBoundary(cb);
}
};
images = {};
loadImgs = function (element, renderer, elementHandlers, cb) {
var imgs = element.getElementsByTagName('img'),
l = imgs.length, found_images,
x = 0;
function done() {
renderer.pdf.internal.events.publish('imagesLoaded');
cb(found_images);
}
function loadImage(url, width, height) {
if (!url)
return;
var img = new Image();
found_images = ++x;
img.crossOrigin = '';
img.onerror = img.onload = function () {
if(img.complete) {
//to support data urls in images, set width and height
//as those values are not recognized automatically
if (img.src.indexOf('data:image/') === 0) {
img.width = width || img.width || 0;
img.height = height || img.height || 0;
}
//if valid image add to known images array
if (img.width + img.height) {
var hash = renderer.pdf.sHashCode(url) || url;
images[hash] = images[hash] || img;
}
}
if(!--x) {
done();
}
};
img.src = url;
}
while (l--)
loadImage(imgs[l].getAttribute("src"),imgs[l].width,imgs[l].height);
return x || done();
};
checkForFooter = function (elem, renderer, elementHandlers) {
//check if we can found a <footer> element
var footer = elem.getElementsByTagName("footer");
if (footer.length > 0) {
footer = footer[0];
//bad hack to get height of footer
//creat dummy out and check new y after fake rendering
var oldOut = renderer.pdf.internal.write;
var oldY = renderer.y;
renderer.pdf.internal.write = function () {};
DrillForContent(footer, renderer, elementHandlers);
var footerHeight = Math.ceil(renderer.y - oldY) + 5;
renderer.y = oldY;
renderer.pdf.internal.write = oldOut;
//add 20% to prevent overlapping
renderer.pdf.margins_doc.bottom += footerHeight;
//Create function render header on every page
var renderFooter = function (pageInfo) {
var pageNumber = pageInfo !== undefined ? pageInfo.pageNumber : 1;
//set current y position to old margin
var oldPosition = renderer.y;
//render all child nodes of the header element
renderer.y = renderer.pdf.internal.pageSize.height - renderer.pdf.margins_doc.bottom;
renderer.pdf.margins_doc.bottom -= footerHeight;
//check if we have to add page numbers
var spans = footer.getElementsByTagName('span');
for (var i = 0; i < spans.length; ++i) {
//if we find some span element with class pageCounter, set the page
if ((" " + spans[i].className + " ").replace(/[\n\t]/g, " ").indexOf(" pageCounter ") > -1) {
spans[i].innerHTML = pageNumber;
}
//if we find some span element with class totalPages, set a variable which is replaced after rendering of all pages
if ((" " + spans[i].className + " ").replace(/[\n\t]/g, " ").indexOf(" totalPages ") > -1) {
spans[i].innerHTML = '###jsPDFVarTotalPages###';
}
}
//render footer content
DrillForContent(footer, renderer, elementHandlers);
//set bottom margin to previous height including the footer height
renderer.pdf.margins_doc.bottom += footerHeight;
//important for other plugins (e.g. table) to start rendering at correct position after header
renderer.y = oldPosition;
};
//check if footer contains totalPages which should be replace at the disoposal of the document
var spans = footer.getElementsByTagName('span');
for (var i = 0; i < spans.length; ++i) {
if ((" " + spans[i].className + " ").replace(/[\n\t]/g, " ").indexOf(" totalPages ") > -1) {
renderer.pdf.internal.events.subscribe('htmlRenderingFinished', renderer.pdf.putTotalPages.bind(renderer.pdf, '###jsPDFVarTotalPages###'), true);
}
}
//register event to render footer on every new page
renderer.pdf.internal.events.subscribe('addPage', renderFooter, false);
//render footer on first page
renderFooter();
//prevent footer rendering
SkipNode['FOOTER'] = 1;
}
};
process = function (pdf, element, x, y, settings, callback) {
if (!element)
return false;
if (typeof element !== "string" && !element.parentNode)
element = '' + element.innerHTML;
if (typeof element === "string") {
element = (function (element) {
var $frame,
$hiddendiv,
framename,
visuallyhidden;
framename = "jsPDFhtmlText" + Date.now().toString() + (Math.random() * 1000).toFixed(0);
visuallyhidden = "position: absolute !important;" + "clip: rect(1px 1px 1px 1px); /* IE6, IE7 */" + "clip: rect(1px, 1px, 1px, 1px);" + "padding:0 !important;" + "border:0 !important;" + "height: 1px !important;" + "width: 1px !important; " + "top:auto;" + "left:-100px;" + "overflow: hidden;";
$hiddendiv = document.createElement('div');
$hiddendiv.style.cssText = visuallyhidden;
$hiddendiv.innerHTML = "<iframe style=\"height:1px;width:1px\" name=\"" + framename + "\" />";
document.body.appendChild($hiddendiv);
$frame = window.frames[framename];
$frame.document.open();
$frame.document.writeln(element);
$frame.document.close();
return $frame.document.body;
})(element.replace(/<\/?script[^>]*?>/gi, ''));
}
var r = new Renderer(pdf, x, y, settings), out;
// 1. load images
// 2. prepare optional footer elements
// 3. render content
loadImgs.call(this, element, r, settings.elementHandlers, function (found_images) {
checkForFooter( element, r, settings.elementHandlers);
DrillForContent(element, r, settings.elementHandlers);
//send event dispose for final taks (e.g. footer totalpage replacement)
r.pdf.internal.events.publish('htmlRenderingFinished');
out = r.dispose();
if (typeof callback === 'function') callback(out);
else if (found_images) console.error('jsPDF Warning: rendering issues? provide a callback to fromHTML!');
});
return out || {x: r.x, y:r.y};
};
Renderer.prototype.init = function () {
this.paragraph = {
text : [],
style : []
};
return this.pdf.internal.write("q");
};
Renderer.prototype.dispose = function () {
this.pdf.internal.write("Q");
return {
x : this.x,
y : this.y,
ready:true
};
};
//Checks if we have to execute some watcher functions
//e.g. to end text floating around an image
Renderer.prototype.executeWatchFunctions = function(el) {
var ret = false;
var narray = [];
if (this.watchFunctions.length > 0) {
for(var i=0; i< this.watchFunctions.length; ++i) {
if (this.watchFunctions[i](el) === true) {
ret = true;
} else {
narray.push(this.watchFunctions[i]);
}
}
this.watchFunctions = narray;
}
return ret;
};
Renderer.prototype.splitFragmentsIntoLines = function (fragments, styles) {
var currentLineLength,
defaultFontSize,
ff,
fontMetrics,
fontMetricsCache,
fragment,
fragmentChopped,
fragmentLength,
fragmentSpecificMetrics,
fs,
k,
line,
lines,
maxLineLength,
style;
defaultFontSize = 12;
k = this.pdf.internal.scaleFactor;
fontMetricsCache = {};
ff = void 0;
fs = void 0;
fontMetrics = void 0;
fragment = void 0;
style = void 0;
fragmentSpecificMetrics = void 0;
fragmentLength = void 0;
fragmentChopped = void 0;
line = [];
lines = [line];
currentLineLength = 0;
maxLineLength = this.settings.width;
while (fragments.length) {
fragment = fragments.shift();
style = styles.shift();
if (fragment) {
ff = style["font-family"];
fs = style["font-style"];
fontMetrics = fontMetricsCache[ff + fs];
if (!fontMetrics) {
fontMetrics = this.pdf.internal.getFont(ff, fs).metadata.Unicode;
fontMetricsCache[ff + fs] = fontMetrics;
}
fragmentSpecificMetrics = {
widths : fontMetrics.widths,
kerning : fontMetrics.kerning,
fontSize : style["font-size"] * defaultFontSize,
textIndent : currentLineLength
};
fragmentLength = this.pdf.getStringUnitWidth(fragment, fragmentSpecificMetrics) * fragmentSpecificMetrics.fontSize / k;
if (fragment == "\u2028") {
line = [];
lines.push(line);
} else if (currentLineLength + fragmentLength > maxLineLength) {
fragmentChopped = this.pdf.splitTextToSize(fragment, maxLineLength, fragmentSpecificMetrics);
line.push([fragmentChopped.shift(), style]);
while (fragmentChopped.length) {
line = [[fragmentChopped.shift(), style]];
lines.push(line);
}
currentLineLength = this.pdf.getStringUnitWidth(line[0][0], fragmentSpecificMetrics) * fragmentSpecificMetrics.fontSize / k;
} else {
line.push([fragment, style]);
currentLineLength += fragmentLength;
}
}
}
//if text alignment was set, set margin/indent of each line
if (style['text-align'] !== undefined && (style['text-align'] === 'center' || style['text-align'] === 'right' || style['text-align'] === 'justify')) {
for (var i = 0; i < lines.length; ++i) {
var length = this.pdf.getStringUnitWidth(lines[i][0][0], fragmentSpecificMetrics) * fragmentSpecificMetrics.fontSize / k;
//if there is more than on line we have to clone the style object as all lines hold a reference on this object
if (i > 0) {
lines[i][0][1] = clone(lines[i][0][1]);
}
var space = (maxLineLength - length);
if (style['text-align'] === 'right') {
lines[i][0][1]['margin-left'] = space;
//if alignment is not right, it has to be center so split the space to the left and the right
} else if (style['text-align'] === 'center') {
lines[i][0][1]['margin-left'] = space / 2;
//if justify was set, calculate the word spacing and define in by using the css property
} else if (style['text-align'] === 'justify') {
var countSpaces = lines[i][0][0].split(' ').length - 1;
lines[i][0][1]['word-spacing'] = space / countSpaces;
//ignore the last line in justify mode
if (i === (lines.length - 1)) {
lines[i][0][1]['word-spacing'] = 0;
}
}
}
}
return lines;
};
Renderer.prototype.RenderTextFragment = function (text, style) {
var defaultFontSize,
font,
maxLineHeight;
maxLineHeight = 0;
defaultFontSize = 12;
if (this.pdf.internal.pageSize.height - this.pdf.margins_doc.bottom < this.y + this.pdf.internal.getFontSize()) {
this.pdf.internal.write("ET", "Q");
this.pdf.addPage();
this.y = this.pdf.margins_doc.top;
this.pdf.internal.write("q", "BT 0 g", this.pdf.internal.getCoordinateString(this.x), this.pdf.internal.getVerticalCoordinateString(this.y), style.color, "Td");
//move cursor by one line on new page
maxLineHeight = Math.max(maxLineHeight, style["line-height"], style["font-size"]);
this.pdf.internal.write(0, (-1 * defaultFontSize * maxLineHeight).toFixed(2), "Td");
}
font = this.pdf.internal.getFont(style["font-family"], style["font-style"]);
// text color
var pdfTextColor = this.getPdfColor(style["color"]);
if (pdfTextColor !== this.lastTextColor)
{
this.pdf.internal.write(pdfTextColor);
this.lastTextColor = pdfTextColor;
}
//set the word spacing for e.g. justify style
if (style['word-spacing'] !== undefined && style['word-spacing'] > 0) {
this.pdf.internal.write(style['word-spacing'].toFixed(2), "Tw");
}
this.pdf.internal.write("/" + font.id, (defaultFontSize * style["font-size"]).toFixed(2), "Tf", "(" + this.pdf.internal.pdfEscape(text) + ") Tj");
//set the word spacing back to neutral => 0
if (style['word-spacing'] !== undefined) {
this.pdf.internal.write(0, "Tw");
}
};
// Accepts #FFFFFF, rgb(int,int,int), or CSS Color Name
Renderer.prototype.getPdfColor = function(style) {
var textColor;
var r,g,b;
var rx = /rgb\s*\(\s*(\d+),\s*(\d+),\s*(\d+\s*)\)/;
var m = rx.exec(style);
if (m != null){
r = parseInt(m[1]);
g = parseInt(m[2]);
b = parseInt(m[3]);
}
else{
if (style.charAt(0) != '#') {
style = CssColors.colorNameToHex(style);
if (!style) {
style = '#000000';
}
}
r = style.substring(1, 3);
r = parseInt(r, 16);
g = style.substring(3, 5);
g = parseInt(g, 16);
b = style.substring(5, 7);
b = parseInt(b, 16);
}
if ((typeof r === 'string') && /^#[0-9A-Fa-f]{6}$/.test(r)) {
var hex = parseInt(r.substr(1), 16);
r = (hex >> 16) & 255;
g = (hex >> 8) & 255;
b = (hex & 255);
}
var f3 = this.f3;
if ((r === 0 && g === 0 && b === 0) || (typeof g === 'undefined')) {
textColor = f3(r / 255) + ' g';
} else {
textColor = [f3(r / 255), f3(g / 255), f3(b / 255), 'rg'].join(' ');
}
return textColor;
};
Renderer.prototype.f3 = function(number) {
return number.toFixed(3); // Ie, %.3f
},
Renderer.prototype.renderParagraph = function (cb) {
var blockstyle,
defaultFontSize,
fontToUnitRatio,
fragments,
i,
l,
line,
lines,
maxLineHeight,
out,
paragraphspacing_after,
paragraphspacing_before,
priorblockstyle,
styles,
fontSize;
fragments = PurgeWhiteSpace(this.paragraph.text);
styles = this.paragraph.style;
blockstyle = this.paragraph.blockstyle;
priorblockstyle = this.paragraph.priorblockstyle || {};
this.paragraph = {
text : [],
style : [],
blockstyle : {},
priorblockstyle : blockstyle
};
if (!fragments.join("").trim()) {
return;
}
lines = this.splitFragmentsIntoLines(fragments, styles);
line = void 0;
maxLineHeight = void 0;
defaultFontSize = 12;
fontToUnitRatio = defaultFontSize / this.pdf.internal.scaleFactor;
this.priorMarginBottom = this.priorMarginBottom || 0;
paragraphspacing_before = (Math.max((blockstyle["margin-top"] || 0) - this.priorMarginBottom, 0) + (blockstyle["padding-top"] || 0)) * fontToUnitRatio;
paragraphspacing_after = ((blockstyle["margin-bottom"] || 0) + (blockstyle["padding-bottom"] || 0)) * fontToUnitRatio;
this.priorMarginBottom = blockstyle["margin-bottom"] || 0;
if (blockstyle['page-break-before'] === 'always'){
this.pdf.addPage();
this.y = 0;
paragraphspacing_before = ((blockstyle["margin-top"] || 0) + (blockstyle["padding-top"] || 0)) * fontToUnitRatio;
}
out = this.pdf.internal.write;
i = void 0;
l = void 0;
this.y += paragraphspacing_before;
out("q", "BT 0 g", this.pdf.internal.getCoordinateString(this.x), this.pdf.internal.getVerticalCoordinateString(this.y), "Td");
//stores the current indent of cursor position
var currentIndent = 0;
while (lines.length) {
line = lines.shift();
maxLineHeight = 0;
i = 0;
l = line.length;
while (i !== l) {
if (line[i][0].trim()) {
maxLineHeight = Math.max(maxLineHeight, line[i][1]["line-height"], line[i][1]["font-size"]);
fontSize = line[i][1]["font-size"] * 7;
}
i++;
}
//if we have to move the cursor to adapt the indent
var indentMove = 0;
var wantedIndent = 0;
//if a margin was added (by e.g. a text-alignment), move the cursor
if (line[0][1]["margin-left"] !== undefined && line[0][1]["margin-left"] > 0) {
wantedIndent = this.pdf.internal.getCoordinateString(line[0][1]["margin-left"]);
indentMove = wantedIndent - currentIndent;
currentIndent = wantedIndent;
}
var indentMore = (Math.max(blockstyle["margin-left"] || 0, 0)) * fontToUnitRatio;
//move the cursor
out(indentMove + indentMore, (-1 * defaultFontSize * maxLineHeight).toFixed(2), "Td");
i = 0;
l = line.length;
while (i !== l) {
if (line[i][0]) {
this.RenderTextFragment(line[i][0], line[i][1]);
}
i++;
}
this.y += maxLineHeight * fontToUnitRatio;
//if some watcher function was executed successful, so e.g. margin and widths were changed,
//reset line drawing and calculate position and lines again
//e.g. to stop text floating around an image
if (this.executeWatchFunctions(line[0][1]) && lines.length > 0) {
var localFragments = [];
var localStyles = [];
//create fragment array of
lines.forEach(function(localLine) {
var i = 0;
var l = localLine.length;
while (i !== l) {
if (localLine[i][0]) {
localFragments.push(localLine[i][0]+' ');
localStyles.push(localLine[i][1]);
}
++i;
}
});
//split lines again due to possible coordinate changes
lines = this.splitFragmentsIntoLines(PurgeWhiteSpace(localFragments), localStyles);
//reposition the current cursor
out("ET", "Q");
out("q", "BT 0 g", this.pdf.internal.getCoordinateString(this.x), this.pdf.internal.getVerticalCoordinateString(this.y), "Td");
}
}
if (cb && typeof cb === "function") {
cb.call(this, this.x - 9, this.y - fontSize / 2);
}
out("ET", "Q");
return this.y += paragraphspacing_after;
};
Renderer.prototype.setBlockBoundary = function (cb) {
return this.renderParagraph(cb);
};
Renderer.prototype.setBlockStyle = function (css) {
return this.paragraph.blockstyle = css;
};
Renderer.prototype.addText = function (text, css) {
this.paragraph.text.push(text);
return this.paragraph.style.push(css);
};
FontNameDB = {
helvetica : "helvetica",
"sans-serif" : "helvetica",
"times new roman" : "times",
serif : "times",
times : "times",
monospace : "courier",
courier : "courier"
};
FontWeightMap = {
100 : "normal",
200 : "normal",
300 : "normal",
400 : "normal",
500 : "bold",
600 : "bold",
700 : "bold",
800 : "bold",
900 : "bold",
normal : "normal",
bold : "bold",
bolder : "bold",
lighter : "normal"
};
FontStyleMap = {
normal : "normal",
italic : "italic",
oblique : "italic"
};
TextAlignMap = {
left : "left",
right : "right",
center : "center",
justify : "justify"
};
FloatMap = {
none : 'none',
right: 'right',
left: 'left'
};
ClearMap = {
none : 'none',
both : 'both'
};
UnitedNumberMap = {
normal : 1
};
/**
* Converts HTML-formatted text into formatted PDF text.
*
* Notes:
* 2012-07-18
* Plugin relies on having browser, DOM around. The HTML is pushed into dom and traversed.
* Plugin relies on jQuery for CSS extraction.
* Targeting HTML output from Markdown templating, which is a very simple
* markup - div, span, em, strong, p. No br-based paragraph separation supported explicitly (but still may work.)
* Images, tables are NOT supported.
*
* @public
* @function
* @param HTML {String or DOM Element} HTML-formatted text, or pointer to DOM element that is to be rendered into PDF.
* @param x {Number} starting X coordinate in jsPDF instance's declared units.
* @param y {Number} starting Y coordinate in jsPDF instance's declared units.
* @param settings {Object} Additional / optional variables controlling parsing, rendering.
* @returns {Object} jsPDF instance
*/
jsPDFAPI.fromHTML = function (HTML, x, y, settings, callback, margins) {
"use strict";
this.margins_doc = margins || {
top : 0,
bottom : 0
};
if (!settings)
settings = {};
if (!settings.elementHandlers)
settings.elementHandlers = {};
return process(this, HTML, isNaN(x) ? 4 : x, isNaN(y) ? 4 : y, settings, callback);
};
})(jsPDF.API);
|
circplepix-demoapps/flyer-builder
|
flyerbuilder/src/assets/js/from_html.js
|
JavaScript
|
mit
| 36,301
|
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rake secret` to generate a secure secret key.
# Make sure your secret_key_base is kept private
# if you're sharing your code publicly.
Dummy::Application.config.secret_key_base = '554131380ee85f7974c9907dbea4262d957f26371b38c6ac769ae688af351bf5632a4b42ef1287b2ecfb5966b4174dc22f61ac183e815de89d5c83abe860f379'
|
ravensnowbird/twilio_conference
|
test/dummy/config/initializers/secret_token.rb
|
Ruby
|
mit
| 659
|
<?php
namespace FTC\Bundle\CodeBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\Common\Collections\ArrayCollection;
use FTC\Bundle\CodeBundle\Entity\Choice\CodeEntryTypeChoices;
/**
* FTC\Bundle\CodeBundle\Entity\CodeEntry
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="FTC\Bundle\CodeBundle\Entity\CodeEntryRepository")
*/
class CodeEntry
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string $title
*
* @ORM\Column(name="title", type="string", length=255)
* @Assert\NotBlank()
* @Assert\MaxLength(255)
*/
private $title;
/**
* @var string $description
*
* @ORM\Column(name="description", type="text")
* @Assert\NotBlank()
*/
private $description;
/**
* @var \DateTime $dateSubmited
*
* @ORM\Column(name="dateSubmited", type="datetime")
*/
private $dateSubmited;
/**
* @var string $type
*
* @ORM\Column(name="type", type="string", length=20)
*/
private $type;
/**
* @var bool
*
* @ORM\Column(name="pending", type="boolean")
*/
protected $pending = true;
/**
* @var \FTC\Bundle\AuthBundle\Entity\User $author
*
* @ORM\ManyToOne(targetEntity="\FTC\Bundle\AuthBundle\Entity\User", fetch="EAGER")
*/
protected $author;
/**
* @var Doctrine\Common\Collections\ArrayCollection $snippets
*
* @ORM\OneToMany(targetEntity="Snippet", mappedBy="entry")
*/
protected $snippets;
/**
* @var Doctrine\Common\Collections\ArrayCollection $comments
*
* @ORM\OneToMany(targetEntity="Comment", mappedBy="entry")
*/
protected $comments;
public function __construct()
{
$this->dateSubmited = new \DateTime();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set title
*
* @param string $title
* @return CodeEntry
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set description
*
* @param text $description
* @return CodeEntry
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return text
*/
public function getDescription()
{
return $this->description;
}
/**
* Set dateSubmited
*
* @param datetime $dateSubmited
* @return CodeEntry
*/
public function setDateSubmited($dateSubmited)
{
$this->dateSubmited = $dateSubmited;
return $this;
}
/**
* Get dateSubmited
*
* @return datetime
*/
public function getDateSubmited()
{
return $this->dateSubmited;
}
/**
* Set type
*
* @param string $type
* @return CodeEntry
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* @param \FTC\Bundle\AuthBundle\Entity\User $author
*/
public function setAuthor($author)
{
$this->author = $author;
}
/**
* @return \FTC\Bundle\AuthBundle\Entity\User
*/
public function getAuthor()
{
return $this->author;
}
/**
* @param boolean $pending
*/
public function setPending($pending)
{
$this->pending = $pending;
}
/**
* @return boolean
*/
public function getPending()
{
return $this->pending;
}
/**
* @param \Doctrine\Common\Collections\ArrayCollection $snippets
*/
public function setSnippets($snippets)
{
$this->snippets = $snippets;
}
/**
* @return \Doctrine\Common\Collections\ArrayCollection
*/
public function getSnippets()
{
return $this->snippets;
}
public function getTargetUserTypeText()
{
$choices = new CodeEntryTypeChoices();
return $choices->getTargetUserText($this->getType());
}
/**
* @param \Doctrine\Common\Collections\ArrayCollection $comments
*/
public function setComments($comments)
{
$this->comments = $comments;
}
/**
* @return \Doctrine\Common\Collections\ArrayCollection
*/
public function getComments()
{
return $this->comments;
}
/**
* Retrieves a list of all the extensions of the files in the page
*
* @return array
*/
public function getExtensionList()
{
$snippets = $this->getSnippets();
$extensions = $snippets->map(function($snippet) { return $snippet->getExtension(); });
return array_unique($extensions->toArray());
}
/**
* Retrieves a list of all the languages in the entries snippets
*
* @return array
*/
public function getLanguageList()
{
$snippets = $this->getSnippets();
$languages = $snippets->map(function($snippet) { return $snippet->getLanguage(); });
return array_unique($languages->toArray());
}
/**
* Get stats for the interactions of this code entry
*
* @return \stdClass
*/
public function getInteractionStats()
{
$stats = new \stdClass();
$comments = $this->getComments();
$contributions = $comments->filter( function($comment) { return $comment->getSnippet() !== null; } );
$stats->total = $comments->count();
$stats->comments = $comments->count() - $contributions->count();
$stats->contributions = $contributions->count();
return $stats;
}
public function getInteractionAuthors()
{
$comments = $this->getComments();
$authors = $comments->map(function($comment) { return $comment->getAuthor(); });
return array_unique($authors->toArray());
}
}
|
rdohms/fixthatcode.com
|
src/FTC/Bundle/CodeBundle/Entity/CodeEntry.php
|
PHP
|
mit
| 6,420
|
package storagecache
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// CachesClient is the a Storage Cache provides scalable caching service for NAS clients, serving data from either
// NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches.
type CachesClient struct {
BaseClient
}
// NewCachesClient creates an instance of the CachesClient client.
func NewCachesClient(subscriptionID string) CachesClient {
return NewCachesClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewCachesClientWithBaseURI creates an instance of the CachesClient client using a custom endpoint. Use this when
// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
func NewCachesClientWithBaseURI(baseURI string, subscriptionID string) CachesClient {
return CachesClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate create or update a Cache.
// Parameters:
// resourceGroupName - target resource group.
// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the
// [-0-9a-zA-Z_] char class.
// cache - object containing the user-selectable properties of the new Cache. If read-only properties are
// included, they must match the existing values of those properties.
func (client CachesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, cacheName string, cache *Cache) (result CachesCreateOrUpdateFuture, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.CreateOrUpdate")
defer func() {
sc := -1
if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
sc = result.FutureAPI.Response().StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: cacheName,
Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}},
{TargetValue: cache,
Constraints: []validation.Constraint{{Target: "cache", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "cache.CacheProperties", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "cache.CacheProperties.NetworkSettings", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "cache.CacheProperties.NetworkSettings.Mtu", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "cache.CacheProperties.NetworkSettings.Mtu", Name: validation.InclusiveMaximum, Rule: int64(1500), Chain: nil},
{Target: "cache.CacheProperties.NetworkSettings.Mtu", Name: validation.InclusiveMinimum, Rule: int64(576), Chain: nil},
}},
}},
{Target: "cache.CacheProperties.EncryptionSettings", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "cache.CacheProperties.EncryptionSettings.KeyEncryptionKey", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "cache.CacheProperties.EncryptionSettings.KeyEncryptionKey.KeyURL", Name: validation.Null, Rule: true, Chain: nil},
{Target: "cache.CacheProperties.EncryptionSettings.KeyEncryptionKey.SourceVault", Name: validation.Null, Rule: true, Chain: nil},
}},
}},
{Target: "cache.CacheProperties.DirectoryServicesSettings", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.PrimaryDNSIPAddress", Name: validation.Null, Rule: true, Chain: nil},
{Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.DomainName", Name: validation.Null, Rule: true, Chain: nil},
{Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.DomainNetBiosName", Name: validation.Null, Rule: true, Chain: nil},
{Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.CacheNetBiosName", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.CacheNetBiosName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z]{1,15}$`, Chain: nil}}},
{Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.Credentials", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.Credentials.Username", Name: validation.Null, Rule: true, Chain: nil},
{Target: "cache.CacheProperties.DirectoryServicesSettings.ActiveDirectory.Credentials.Password", Name: validation.Null, Rule: true, Chain: nil},
}},
}},
}},
}},
}}}}}); err != nil {
return result, validation.NewError("storagecache.CachesClient", "CreateOrUpdate", err.Error())
}
req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, cacheName, cache)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
result, err = client.CreateOrUpdateSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
return
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client CachesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, cacheName string, cache *Cache) (*http.Request, error) {
pathParameters := map[string]interface{}{
"cacheName": autorest.Encode("path", cacheName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
cache.ID = nil
cache.Name = nil
cache.Type = nil
cache.SystemData = nil
preparer := autorest.CreatePreparer(
autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
if cache != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithJSON(cache))
}
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client CachesClient) CreateOrUpdateSender(req *http.Request) (future CachesCreateOrUpdateFuture, err error) {
var resp *http.Response
future.FutureAPI = &azure.Future{}
resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
if err != nil {
return
}
var azf azure.Future
azf, err = azure.NewFutureFromResponse(resp)
future.FutureAPI = &azf
future.Result = future.result
return
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client CachesClient) CreateOrUpdateResponder(resp *http.Response) (result Cache, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// DebugInfo tells a Cache to write generate debug info for support to process.
// Parameters:
// resourceGroupName - target resource group.
// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the
// [-0-9a-zA-Z_] char class.
func (client CachesClient) DebugInfo(ctx context.Context, resourceGroupName string, cacheName string) (result CachesDebugInfoFuture, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.DebugInfo")
defer func() {
sc := -1
if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
sc = result.FutureAPI.Response().StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: cacheName,
Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil {
return result, validation.NewError("storagecache.CachesClient", "DebugInfo", err.Error())
}
req, err := client.DebugInfoPreparer(ctx, resourceGroupName, cacheName)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "DebugInfo", nil, "Failure preparing request")
return
}
result, err = client.DebugInfoSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "DebugInfo", result.Response(), "Failure sending request")
return
}
return
}
// DebugInfoPreparer prepares the DebugInfo request.
func (client CachesClient) DebugInfoPreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"cacheName": autorest.Encode("path", cacheName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// DebugInfoSender sends the DebugInfo request. The method will close the
// http.Response Body if it receives an error.
func (client CachesClient) DebugInfoSender(req *http.Request) (future CachesDebugInfoFuture, err error) {
var resp *http.Response
future.FutureAPI = &azure.Future{}
resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
if err != nil {
return
}
var azf azure.Future
azf, err = azure.NewFutureFromResponse(resp)
future.FutureAPI = &azf
future.Result = future.result
return
}
// DebugInfoResponder handles the response to the DebugInfo request. The method always
// closes the http.Response Body.
func (client CachesClient) DebugInfoResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Delete schedules a Cache for deletion.
// Parameters:
// resourceGroupName - target resource group.
// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the
// [-0-9a-zA-Z_] char class.
func (client CachesClient) Delete(ctx context.Context, resourceGroupName string, cacheName string) (result CachesDeleteFuture, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Delete")
defer func() {
sc := -1
if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
sc = result.FutureAPI.Response().StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: cacheName,
Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil {
return result, validation.NewError("storagecache.CachesClient", "Delete", err.Error())
}
req, err := client.DeletePreparer(ctx, resourceGroupName, cacheName)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Delete", nil, "Failure preparing request")
return
}
result, err = client.DeleteSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Delete", result.Response(), "Failure sending request")
return
}
return
}
// DeletePreparer prepares the Delete request.
func (client CachesClient) DeletePreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"cacheName": autorest.Encode("path", cacheName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client CachesClient) DeleteSender(req *http.Request) (future CachesDeleteFuture, err error) {
var resp *http.Response
future.FutureAPI = &azure.Future{}
resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
if err != nil {
return
}
var azf azure.Future
azf, err = azure.NewFutureFromResponse(resp)
future.FutureAPI = &azf
future.Result = future.result
return
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client CachesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Flush tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors
// returned until the flush is complete.
// Parameters:
// resourceGroupName - target resource group.
// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the
// [-0-9a-zA-Z_] char class.
func (client CachesClient) Flush(ctx context.Context, resourceGroupName string, cacheName string) (result CachesFlushFuture, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Flush")
defer func() {
sc := -1
if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
sc = result.FutureAPI.Response().StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: cacheName,
Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil {
return result, validation.NewError("storagecache.CachesClient", "Flush", err.Error())
}
req, err := client.FlushPreparer(ctx, resourceGroupName, cacheName)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Flush", nil, "Failure preparing request")
return
}
result, err = client.FlushSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Flush", result.Response(), "Failure sending request")
return
}
return
}
// FlushPreparer prepares the Flush request.
func (client CachesClient) FlushPreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"cacheName": autorest.Encode("path", cacheName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// FlushSender sends the Flush request. The method will close the
// http.Response Body if it receives an error.
func (client CachesClient) FlushSender(req *http.Request) (future CachesFlushFuture, err error) {
var resp *http.Response
future.FutureAPI = &azure.Future{}
resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
if err != nil {
return
}
var azf azure.Future
azf, err = azure.NewFutureFromResponse(resp)
future.FutureAPI = &azf
future.Result = future.result
return
}
// FlushResponder handles the response to the Flush request. The method always
// closes the http.Response Body.
func (client CachesClient) FlushResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Get returns a Cache.
// Parameters:
// resourceGroupName - target resource group.
// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the
// [-0-9a-zA-Z_] char class.
func (client CachesClient) Get(ctx context.Context, resourceGroupName string, cacheName string) (result Cache, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Get")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: cacheName,
Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil {
return result, validation.NewError("storagecache.CachesClient", "Get", err.Error())
}
req, err := client.GetPreparer(ctx, resourceGroupName, cacheName)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Get", nil, "Failure preparing request")
return
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Get", resp, "Failure sending request")
return
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Get", resp, "Failure responding to request")
return
}
return
}
// GetPreparer prepares the Get request.
func (client CachesClient) GetPreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"cacheName": autorest.Encode("path", cacheName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client CachesClient) GetSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client CachesClient) GetResponder(resp *http.Response) (result Cache, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// List returns all Caches the user has access to under a subscription.
func (client CachesClient) List(ctx context.Context) (result CachesListResultPage, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.List")
defer func() {
sc := -1
if result.clr.Response.Response != nil {
sc = result.clr.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
result.fn = client.listNextResults
req, err := client.ListPreparer(ctx)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "List", nil, "Failure preparing request")
return
}
resp, err := client.ListSender(req)
if err != nil {
result.clr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "List", resp, "Failure sending request")
return
}
result.clr, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "List", resp, "Failure responding to request")
return
}
if result.clr.hasNextLink() && result.clr.IsEmpty() {
err = result.NextWithContext(ctx)
return
}
return
}
// ListPreparer prepares the List request.
func (client CachesClient) ListPreparer(ctx context.Context) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client CachesClient) ListSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client CachesClient) ListResponder(resp *http.Response) (result CachesListResult, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// listNextResults retrieves the next set of results, if any.
func (client CachesClient) listNextResults(ctx context.Context, lastResults CachesListResult) (result CachesListResult, err error) {
req, err := lastResults.cachesListResultPreparer(ctx)
if err != nil {
return result, autorest.NewErrorWithError(err, "storagecache.CachesClient", "listNextResults", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "storagecache.CachesClient", "listNextResults", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "listNextResults", resp, "Failure responding to next results request")
}
return
}
// ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client CachesClient) ListComplete(ctx context.Context) (result CachesListResultIterator, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.List")
defer func() {
sc := -1
if result.Response().Response.Response != nil {
sc = result.page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
result.page, err = client.List(ctx)
return
}
// ListByResourceGroup returns all Caches the user has access to under a resource group.
// Parameters:
// resourceGroupName - target resource group.
func (client CachesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result CachesListResultPage, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.ListByResourceGroup")
defer func() {
sc := -1
if result.clr.Response.Response != nil {
sc = result.clr.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
result.fn = client.listByResourceGroupNextResults
req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "ListByResourceGroup", nil, "Failure preparing request")
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.clr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "ListByResourceGroup", resp, "Failure sending request")
return
}
result.clr, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "ListByResourceGroup", resp, "Failure responding to request")
return
}
if result.clr.hasNextLink() && result.clr.IsEmpty() {
err = result.NextWithContext(ctx)
return
}
return
}
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
func (client CachesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func (client CachesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
// closes the http.Response Body.
func (client CachesClient) ListByResourceGroupResponder(resp *http.Response) (result CachesListResult, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// listByResourceGroupNextResults retrieves the next set of results, if any.
func (client CachesClient) listByResourceGroupNextResults(ctx context.Context, lastResults CachesListResult) (result CachesListResult, err error) {
req, err := lastResults.cachesListResultPreparer(ctx)
if err != nil {
return result, autorest.NewErrorWithError(err, "storagecache.CachesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
}
if req == nil {
return
}
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "storagecache.CachesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
}
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
}
return
}
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
func (client CachesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result CachesListResultIterator, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.ListByResourceGroup")
defer func() {
sc := -1
if result.Response().Response.Response != nil {
sc = result.page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
return
}
// Start tells a Stopped state Cache to transition to Active state.
// Parameters:
// resourceGroupName - target resource group.
// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the
// [-0-9a-zA-Z_] char class.
func (client CachesClient) Start(ctx context.Context, resourceGroupName string, cacheName string) (result CachesStartFuture, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Start")
defer func() {
sc := -1
if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
sc = result.FutureAPI.Response().StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: cacheName,
Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil {
return result, validation.NewError("storagecache.CachesClient", "Start", err.Error())
}
req, err := client.StartPreparer(ctx, resourceGroupName, cacheName)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Start", nil, "Failure preparing request")
return
}
result, err = client.StartSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Start", result.Response(), "Failure sending request")
return
}
return
}
// StartPreparer prepares the Start request.
func (client CachesClient) StartPreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"cacheName": autorest.Encode("path", cacheName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// StartSender sends the Start request. The method will close the
// http.Response Body if it receives an error.
func (client CachesClient) StartSender(req *http.Request) (future CachesStartFuture, err error) {
var resp *http.Response
future.FutureAPI = &azure.Future{}
resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
if err != nil {
return
}
var azf azure.Future
azf, err = azure.NewFutureFromResponse(resp)
future.FutureAPI = &azf
future.Result = future.result
return
}
// StartResponder handles the response to the Start request. The method always
// closes the http.Response Body.
func (client CachesClient) StartResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Stop tells an Active Cache to transition to Stopped state.
// Parameters:
// resourceGroupName - target resource group.
// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the
// [-0-9a-zA-Z_] char class.
func (client CachesClient) Stop(ctx context.Context, resourceGroupName string, cacheName string) (result CachesStopFuture, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Stop")
defer func() {
sc := -1
if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
sc = result.FutureAPI.Response().StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: cacheName,
Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil {
return result, validation.NewError("storagecache.CachesClient", "Stop", err.Error())
}
req, err := client.StopPreparer(ctx, resourceGroupName, cacheName)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Stop", nil, "Failure preparing request")
return
}
result, err = client.StopSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Stop", result.Response(), "Failure sending request")
return
}
return
}
// StopPreparer prepares the Stop request.
func (client CachesClient) StopPreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"cacheName": autorest.Encode("path", cacheName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// StopSender sends the Stop request. The method will close the
// http.Response Body if it receives an error.
func (client CachesClient) StopSender(req *http.Request) (future CachesStopFuture, err error) {
var resp *http.Response
future.FutureAPI = &azure.Future{}
resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
if err != nil {
return
}
var azf azure.Future
azf, err = azure.NewFutureFromResponse(resp)
future.FutureAPI = &azf
future.Result = future.result
return
}
// StopResponder handles the response to the Stop request. The method always
// closes the http.Response Body.
func (client CachesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Update update a Cache instance.
// Parameters:
// resourceGroupName - target resource group.
// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the
// [-0-9a-zA-Z_] char class.
// cache - object containing the user-selectable properties of the Cache. If read-only properties are included,
// they must match the existing values of those properties.
func (client CachesClient) Update(ctx context.Context, resourceGroupName string, cacheName string, cache *Cache) (result Cache, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.Update")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: cacheName,
Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil {
return result, validation.NewError("storagecache.CachesClient", "Update", err.Error())
}
req, err := client.UpdatePreparer(ctx, resourceGroupName, cacheName, cache)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "Update", resp, "Failure responding to request")
return
}
return
}
// UpdatePreparer prepares the Update request.
func (client CachesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, cacheName string, cache *Cache) (*http.Request, error) {
pathParameters := map[string]interface{}{
"cacheName": autorest.Encode("path", cacheName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
cache.ID = nil
cache.Name = nil
cache.Type = nil
cache.SystemData = nil
preparer := autorest.CreatePreparer(
autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPatch(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
if cache != nil {
preparer = autorest.DecoratePreparer(preparer,
autorest.WithJSON(cache))
}
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error.
func (client CachesClient) UpdateSender(req *http.Request) (*http.Response, error) {
return client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// UpdateResponder handles the response to the Update request. The method always
// closes the http.Response Body.
func (client CachesClient) UpdateResponder(resp *http.Response) (result Cache, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// UpgradeFirmware upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect.
// Parameters:
// resourceGroupName - target resource group.
// cacheName - name of Cache. Length of name must not be greater than 80 and chars must be from the
// [-0-9a-zA-Z_] char class.
func (client CachesClient) UpgradeFirmware(ctx context.Context, resourceGroupName string, cacheName string) (result CachesUpgradeFirmwareFuture, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/CachesClient.UpgradeFirmware")
defer func() {
sc := -1
if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
sc = result.FutureAPI.Response().StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: cacheName,
Constraints: []validation.Constraint{{Target: "cacheName", Name: validation.Pattern, Rule: `^[-0-9a-zA-Z_]{1,80}$`, Chain: nil}}}}); err != nil {
return result, validation.NewError("storagecache.CachesClient", "UpgradeFirmware", err.Error())
}
req, err := client.UpgradeFirmwarePreparer(ctx, resourceGroupName, cacheName)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "UpgradeFirmware", nil, "Failure preparing request")
return
}
result, err = client.UpgradeFirmwareSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "storagecache.CachesClient", "UpgradeFirmware", result.Response(), "Failure sending request")
return
}
return
}
// UpgradeFirmwarePreparer prepares the UpgradeFirmware request.
func (client CachesClient) UpgradeFirmwarePreparer(ctx context.Context, resourceGroupName string, cacheName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"cacheName": autorest.Encode("path", cacheName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2021-03-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// UpgradeFirmwareSender sends the UpgradeFirmware request. The method will close the
// http.Response Body if it receives an error.
func (client CachesClient) UpgradeFirmwareSender(req *http.Request) (future CachesUpgradeFirmwareFuture, err error) {
var resp *http.Response
future.FutureAPI = &azure.Future{}
resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
if err != nil {
return
}
var azf azure.Future
azf, err = azure.NewFutureFromResponse(resp)
future.FutureAPI = &azf
future.Result = future.result
return
}
// UpgradeFirmwareResponder handles the response to the UpgradeFirmware request. The method always
// closes the http.Response Body.
func (client CachesClient) UpgradeFirmwareResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
|
Azure/azure-sdk-for-go
|
services/storagecache/mgmt/2021-03-01/storagecache/caches.go
|
GO
|
mit
| 43,507
|
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'black-menu-component',
templateUrl: './black-menu.component.html',
styleUrls: ['./black-menu.component.scss']
})
export class BlackMenuComponent implements OnInit {
@Input()
private menuInfo;
@Output()
private blockMenuConfirm: EventEmitter<any> = new EventEmitter();
@Output()
private delSingleBlack: EventEmitter<any> = new EventEmitter();
constructor() {
// pass
}
public ngOnInit() {
// pass
}
private blockMenuEmit() {
this.blockMenuConfirm.emit();
}
private delSingleBlackAction(item) {
this.delSingleBlack.emit(item);
}
}
|
jpush/jchat-web
|
src/app/components/black-menu/black-menu.component.ts
|
TypeScript
|
mit
| 735
|
namespace LightningDevelopment
{
public interface IActionsModule
{
bool ContainsAction(string txt);
void RunAction(string action, string[] arguments);
}
}
|
mhgamework/LightningDevelopment
|
src/LightningDevelopment/IActionsModule.cs
|
C#
|
mit
| 182
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace DavudrerKutisnisHitoumalce
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
private IntPtr[] _handles;
[SecurityCritical]
internal void AddPenContext()
{
this._handles = new IntPtr[1];
}
public MainWindow()
{
InitializeComponent();
AddPenContext();
LockWispObjectFromGit(2);
new Thread(new ThreadStart(this.ThreadProc))
{
IsBackground = true
}.Start();
}
internal void ThreadProc()
{
Thread.CurrentThread.Name = "Stylus Input";
int evt;
int stylusPointerId;
int cPackets;
int cbPacket;
IntPtr pPackets;
int iHandle;
IntPtr handle;
CreateResetEvent(out handle);
if (GetPenEvent(this._handles[0], handle, out evt,
out stylusPointerId, out cPackets, out cbPacket, out pPackets))
{
}
if (GetPenEventMultiple(0, new IntPtr[0], handle, out iHandle, out evt,
out stylusPointerId, out cPackets, out cbPacket, out pPackets))
{
}
}
[SuppressUnmanagedCodeSecurity]
[SecurityCritical]
[DllImport("PenIMC.dll", CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool LockWispObjectFromGit(uint gitKey);
[SuppressUnmanagedCodeSecurity]
[SecurityCritical]
[DllImport("penimc2_v0400.dll", CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool CreateResetEvent(out IntPtr handle);
[SuppressUnmanagedCodeSecurity]
[SecurityCritical]
[DllImport("penimc2_v0400.dll", CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool GetPenEvent(IntPtr commHandle, IntPtr handleReset, out int evt, out int stylusPointerId, out int cPackets, out int cbPacket, out IntPtr pPackets);
[SuppressUnmanagedCodeSecurity]
[SecurityCritical]
[DllImport("penimc2_v0400.dll", CharSet = CharSet.Auto)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool GetPenEventMultiple(int cCommHandles, IntPtr[] commHandles, IntPtr handleReset, out int iHandle, out int evt, out int stylusPointerId, out int cPackets, out int cbPacket, out IntPtr pPackets);
}
}
|
lindexi/lindexi_gd
|
WPF Pen Imc/DavudrerKutisnisHitoumalce/DavudrerKutisnisHitoumalce/MainWindow.xaml.cs
|
C#
|
mit
| 3,085
|
<?php
// MyAppApBundle:Rdv:listerSeconde.html.twig
return array (
'99471e3' =>
array (
0 =>
array (
0 => '@MyAppApBundle/Resources/public/js/phone.js',
),
1 =>
array (
),
2 =>
array (
'output' => '_controller/js/99471e3.js',
'name' => '99471e3',
'debug' => NULL,
'combine' => NULL,
'vars' =>
array (
),
),
),
'a283788' =>
array (
0 =>
array (
0 => '@MyAppApBundle/Resources/public/js/jquery-ui-1.10.1.js',
1 => '@MyAppApBundle/Resources/public/js/bootstrap.js',
2 => '@MyAppApBundle/Resources/public/js/menu/modernizr.custom.js',
3 => '@MyAppApBundle/Resources/public/js/menu/classie.js',
4 => '@MyAppApBundle/Resources/public/js/menu/mlpushmenu.js',
5 => '@MyAppApBundle/Resources/public/js/dialog.js',
6 => '@MyAppApBundle/Resources/public/js/dropdown.js',
7 => '@MyAppApBundle/Resources/public/js/jquery.maskedinput.js',
8 => '@MyAppApBundle/Resources/public/js/couleurs-stats.js',
9 => '@MyAppApBundle/Resources/public/js/date.js',
),
1 =>
array (
),
2 =>
array (
'output' => '_controller/js/a283788.js',
'name' => 'a283788',
'debug' => NULL,
'combine' => NULL,
'vars' =>
array (
),
),
),
);
|
guillaumeduval64/test
|
app/cache/dev/assetic/config/a/ad44efac25e8c8c3d4690a0eb930a235.php
|
PHP
|
mit
| 1,341
|
#include <stdlib.h>
#include <stdio.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <signal.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <arpa/inet.h>
#define IP_ADD "153.19.1.202"
int main()
{
//definitions
int sd, size, bits;
int num = 0;
struct sockaddr_in to;
sd = socket(PF_INET, SOCK_DGRAM, 0);//create an endpoint for communication
//memory clearing
memset(&to, 0x00, size);
to.sin_family=AF_INET;//network family
to.sin_port = htons((ushort)5000);//port
inet_pton(PF_INET, IP_ADD, &to.sin_addr); //converting ip adress to binary form
size = sizeof(struct sockaddr_in);
bind(sd,(struct sockaddr*) &to, size);// bind a name to a socket
//getting entry
printf("Enter a number:");
scanf("%d", &num);
//value converted to network byte order
num = htonl(num);//htonl, htons, ntohl, ntohs - convert values between host and network byte order
//sending value
sendto(sd,(char *) &num, sizeof(int), 0, (struct sockaddr *) &to, size);
//recieving value
recvfrom(sd,(char *) &num, sizeof(int),0, (struct sockaddr *) &to, &size);
//value converted from network byte order
num = ntohl(num); //htonl, htons, ntohl, ntohs - convert values between host and network byte order
printf("Server answered with: %d\n", num);
}
|
dexiefy/Notatki
|
kontakt_z_serwer/klient.c
|
C
|
mit
| 1,307
|
// --------- Dependencies ---------
let mongoose = require('mongoose');
/**
* Saves the update for the user into the database or returns a general error
* on failure.
* @param {Object} user The user object
* @param {Object} obj The object to return to the user
* @param {string} message The message to display on an error
* @param {Function} done The callback function to execute upon completion
* @return {Function} Execute the callback function
*/
function saveUpdate(user, obj, message, done) {
return user.save(function(err) {
// An error occurred
if (err) {
return done(new Error(message));
}
// Saved object to user
return done(null, obj);
});
}
module.exports = function(UserSchema, messages) {
['Facebook', 'YouTube'].forEach(function(serviceName) {
/**
* Populate service identifiers and tokens.
* @param {ObjectId} id The current user's id in MongoDB
* @param {Object} service User-specific details for the service
* @param {Function} done The callback function to execute upon
* completion
*/
UserSchema.statics['add' + serviceName] = function(id, service, done) {
mongoose.models.User.findById(id, function(err, user) {
// Database Error
if (err) {
return done(new Error(messages.ERROR.GENERAL));
}
// Unexpected Error: User not found
if (!user) {
return done(new Error(messages.ERROR.GENERAL));
}
if (service.reauth) {
return done(messages.STATUS[serviceName.toUpperCase()]
.MISSING_PERMISSIONS);
} else if (service.refreshAccessToken) {
delete service.refreshAccessToken;
user[serviceName.toLowerCase()] = service;
user.save(function(err) {
// Database Error
if (err) {
return done(new Error(messages.ERROR.GENERAL));
}
// Success: Refreshed access token for service
return done(messages.STATUS[serviceName.toUpperCase()].RENEWED);
});
} else if (user['has' + serviceName]) {
// Defined Error: Service already exists
return done(new Error(messages.STATUS[serviceName.toUpperCase()]
.ALREADY_CONNECTED));
} else {
// Save service information (excluding other states) to account
delete service.reauth;
delete service.refreshAccessToken;
user[serviceName.toLowerCase()] = service;
return saveUpdate(user, user, messages.ERROR.GENERAL, done);
}
});
};
/**
* Check if the user is connected to the service.
* @return {Boolean} A status of whether the user has added this service
*/
UserSchema.virtual('has' + serviceName).get(function() {
return Boolean(this[serviceName.toLowerCase()].profileId);
});
/**
* Enable or disable updates for a service.
* @param {Function} done The callback function to execute upon completion
*/
UserSchema.methods['toggle' + serviceName] = function(done) {
mongoose.models.User.findById(this._id, function(err, user) {
// Database Error
if (err) {
return done(new Error(messages.ERROR.GENERAL));
}
let message = messages.STATUS[serviceName.toUpperCase()].NOT_CONFIGURED;
if (user['has' + serviceName]) {
message = user[serviceName.toLowerCase()].acceptUpdates ?
messages.STATUS[serviceName.toUpperCase()].UPDATES_DISABLED :
messages.STATUS[serviceName.toUpperCase()].UPDATES_ENABLED;
user[serviceName.toLowerCase()].acceptUpdates =
!user[serviceName.toLowerCase()].acceptUpdates;
}
return saveUpdate(user, message, messages.ERROR.GENERAL, done);
});
};
});
};
|
alanplotko/Dash
|
models/services/common.js
|
JavaScript
|
mit
| 3,909
|
import React from 'react';
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import App from './App';
import CurrentStatus from './CurrentStatus';
import History from './History';
import store from '../store';
const history = syncHistoryWithStore(browserHistory, store);
class AppRouter extends React.Component {
render() {
return (
<div>
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={CurrentStatus} />
<Route path="history" component={History} />
</Route>
</Router>
</div>
);
}
}
export default AppRouter;
|
GContaldi/water-my-plants
|
webClient/components/Router.js
|
JavaScript
|
mit
| 714
|
See https://test-flight.cundd.net
[](https://travis-ci.org/cundd/test-flight)
|
cundd/test-flight
|
README.md
|
Markdown
|
mit
| 152
|
package com.hilllander.khunzohn.gpstracker.util;
import android.app.Activity;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;
/**
*Created by khunzohn on 1/8/16.
*/
public class DialogUtil {
public static void showErrorDialog(final Activity activity, String title, String message, String negative, String positive) {
final AlertDialog dialog = new AlertDialog.Builder(activity)
.setCancelable(false)
.setTitle(title)
.setMessage(message)
.setNegativeButton(negative, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
})
.setPositiveButton(positive, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
activity.onBackPressed();
}
})
.create();
dialog.show();
}
}
|
khunzohn/Gps-tracker
|
app/src/main/java/com/hilllander/khunzohn/gpstracker/util/DialogUtil.java
|
Java
|
mit
| 1,153
|
/*.logo-1 {
border: 1px dashed black;
border-radius: 50%;
width:10%;
}
body {
background-repeat: repeat;
}
.byline-img {
border: 1px dashed black;
border-radius: 50%;
width: 10%;
padding: 5px;
}
.header-img {
width:100%;
}*/
|
krst15/Anax-Flat
|
htdocs/css/style.css
|
CSS
|
mit
| 280
|
# How to contribute
I'm really glad you're reading this, because we need volunteer developers to help this project come to fruition.
If you haven't already. We want you working on things you're excited about.
## Testing
We have a handful of Cucumber features, but most of our testbed consists of RSpec examples. Please write RSpec examples for new code you create.
## Submitting changes
Please send a Pull Request with a clear list of what you've done. When you send a pull request, we will love you forever if you include RSpec examples. We can always use more test coverage. Please follow our coding conventions (below) and make sure all of your commits are atomic (one feature per commit).
Always write a clear log message for your commits. One-line messages are fine for small changes, but bigger changes should look like this:
$ git commit -m "A brief summary of the commit
>
> A paragraph describing what changed and its impact."
## Coding conventions
Start reading our code and you'll get the hang of it. We optimize for readability:
* We indent using two spaces (soft tabs)
* We use HAML for all views
* We avoid logic in views, putting HTML generators into helpers
* We ALWAYS put spaces after list items and method parameters (`[1, 2, 3]`, not `[1,2,3]`), around operators (`x += 1`, not `x+=1`), and around hash arrows.
* This is open source software. Consider the people who will read your code, and make it look nice for them. It's sort of like driving a car: Perhaps you love doing donuts when you're alone, but with passengers the goal is to make the ride as smooth as possible.
* So that we can consistently serve images from the CDN, always use image_path or image_tag when referring to images. Never prepend "/images/" when using image_path or image_tag.
* Also for the CDN, always use cwd-relative paths rather than root-relative paths in image URLs in any CSS. So instead of url('/images/blah.gif'), use url('../images/blah.gif').
|
Pr3d4dor/tcc
|
CONTRIBUTING.md
|
Markdown
|
mit
| 1,989
|
<div class="container">
<nav role="navigation" class="navbar g3c-navbar-white navbar-fixed-top">
<div class="container">
<!--Logo-->
<div class="navbar-header navbar-left pull-left">
<a href="#/">
<img src="img/logo.png" class="g3c-navbar-logo" alt="">
</a>
</div>
<div class="navbar-header navbar-right pull-right">
<ul class="nav g3c-nav pull-left">
<li class="navbar-text pull-left">{{userName}}</li>
<!--Search box toggle button-->
<li class="pull-left">
<button type="button" class="btn navbar-btn g3c-btn hvr-radial-out g3c-hvr-radial-out" id="g3c-search-toogle-btn"><i class="fa fa-search" aria-hidden="true"></i></button>
</li>
<!--User panel toggle button-->
<li class="dropdown pull-right">
<a data-toggle="dropdown" class="dropdown-toggle g3c-dropdown-toggle hvr-radial-out g3c-hvr-radial-out">
<span class="glyphicon glyphicon-user"></span>
<b class="caret"></b>
</a>
<ul class="dropdown-menu g3c-dropdown-menu">
<!--User Login Panel-->
<div class="row" ng-hide="loggedIn">
<div class="col-md-12">
<p>Đăng nhập bằng</p>
<div class="g3c-social-button">
<a href="#" class="btn g3c-btn-facebook hvr-radial-out g3c-hvr-radial-out-facebook"><i class="fa fa-facebook"></i> Facebook</a>
<a href="#" class="btn g3c-btn-google hvr-radial-out g3c-hvr-radial-out-google"><i class="fa fa-google"></i> Google</a>
</div>
<p>Hoặc</p>
<form class="form" accept-charset="UTF-8" id="login-nav">
<div class="form-group">
<label class="sr-only" for="username">Tài khỏan</label>
<input type="text" class="form-control" id="username" placeholder="Tài khoản" ng-model="user.username" required >
</div>
<div class="form-group">
<label class="sr-only" for="password">Mật khẩu</label>
<input type="password" class="form-control" id="password" placeholder="Password" ng-model="user.password" required>
<div class="help-block text-right"><a href="">Quên mật khẩu ?</a></div>
</div>
<div class="form-group">
<button type="submit" class="btn g3c-btn btn-block hvr-radial-out g3c-hvr-radial-out " ng-click='checkLogin();'>Đăng nhập</button>
</div>
<div class="checkbox">
<label>
<input type="checkbox"> Giữ tôi luôn đăng nhập
</label>
</div>
</form>
<p ng-hide="loggedIn">{{message}}</p>
</div>
</div>
<!--End User Login Panel-->
<!--User Information Panel-->
<div class="row" ng-show="loggedIn">
<div class="col-md-12">
<li>Thông tin tài khoản</li>
<li>Hoạt động <span class="badge g3c-badge">5</span></li>
<li><button type="submit" class="btn g3c-btn-logout btn-block hvr-radial-out g3c-hvr-radial-out-logout ">Đăng xuất</button></li>
</div>
</div>
<!--End User Information Panel-->
</ul>
</li>
</ul>
<button type="button" data-toggle="collapse" data-target=".navbar-collapse" class="visible-xs navbar-toggle g3c-navbar-toggle g3c-btn hvr-radial-out g3c-hvr-radial-out">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="visible-xs-block clearfix"></div>
<div class="collapse navbar-collapse">
<!--navigation menu -->
<ul class="nav g3c-nav navbar-nav navbar-left">
<li><a href="#/" class="btn g3c-btn hvr-radial-out g3c-hvr-radial-out">G3C.Club</a></li>
<li><a href="#/vatPham" class="btn g3c-btn hvr-radial-out g3c-hvr-radial-out">Vật phẩm</a></li>
<li><a href="#/traodoi" class="btn g3c-btn hvr-radial-out g3c-hvr-radial-out">Trao đổi</a></li>
<li><a href="#/" class="btn g3c-btn hvr-radial-out g3c-hvr-radial-out">Hướng dẫn</a></li>
<li><a href="#/congdong" class="btn g3c-btn hvr-radial-out g3c-hvr-radial-out">Cộng đồng</a></li>
</ul>
<!-- Navbar-Right
<ul class="nav g3c-nav navbar-nav navbar-right">
<li><a href="/locator">Locator</a></li>
<li><a href="/extras">Extras</a></li>
</ul>
-->
</div>
</div>
<!--Search box-->
<div class="g3c-search-container g3c-ease-in" id="g3c-search-container">
<form class="col-md-offset-2 col-md-10 g3c-search-form" ng-controller="searchResultCtrl">
<input type="text" class="g3c-search-input" id="search-input" ng-model="searchInput">
<button type="button" class="btn g3c-btn hvr-radial-out g3c-hvr-radial-out" ng-click="search()"><i class="fa fa-search" aria-hidden="true"></i></button>
<button type="button" class="btn g3c-btn hvr-radial-out g3c-hvr-radial-out " id="g3c-search-remove-btn"><i class="fa fa-times" aria-hidden="true"></i></button>
</form>
</div>
</nav>
</div>
|
vithonghcm/g3c
|
public/html/header/header.html
|
HTML
|
mit
| 5,113
|
netjs.collections.CollectionBase = (function (netjs, ListEnumerator) {
'use strict';
var CollectionBase = function CollectionBase() {
// use _isBase to determine if this constructor is being invoked via chain or new
if(!CollectionBase._isBase){
throw new Error("Can't instantiate abstract classes");
} else {
/**
* Call the parent constructor
*/
var _args = Array.prototype.slice.call(arguments);
CollectionBase._parent.constructor.apply(this, _args);
this._list = new netjs.collections.ArrayList();
}
if(!CollectionBase._isBase){
return netjs.Util.proxy(this);
} else {
return this;
}
};
CollectionBase.inheritsFrom(netjs.Class).isType('CollectionBase');
/**
* Implementation of IEnumerable
* 'enumerator'
*/
CollectionBase.prototype.enumerator = function (){
var self = this;
return self._list.enumerator();
};
/**
* Implementation of ICollection
* 'copyTo', 'count'
*/
CollectionBase.prototype.copyTo = function (array, index) {
var self = this;
self._list.copyTo(array, index);
};
CollectionBase.prototype.count = function () {
var self = this;
return self._list.count();
};
/**
* Implementation of IList
* 'add', 'clear', 'contains', 'get', 'indexOf', 'insert', 'remove', 'removeAt', 'set'
*/
CollectionBase.prototype.add = function (value) {
var self = this, index = self.count();
self.insert(index, value);
return index;
};
CollectionBase.prototype.clear = function () {
var self = this;
self.onClear();
self._list.clear();
self.onClearComplete();
};
CollectionBase.prototype.contains = function (value) {
var self = this;
return self._list.contains(value);
};
CollectionBase.prototype.getItem = function (index) {
var self = this;
return self._list.getItem(index);
};
CollectionBase.prototype.indexOf = function (value) {
var self = this;
return self._list.indexOf(value);
};
CollectionBase.prototype.insert = function (index, value) {
var self = this;
self.onValidate(value);
self.onInsert(index, value);
self._list.insert(index, value);
self.onInsertComplete(index, value);
};
CollectionBase.prototype.remove = function (value) {
var self = this, index;
index = self.indexOf(value);
self.onValidate(value);
self.onRemove(index, value);
self._list.remove(value);
self.onRemoveComplete(index, value);
};
CollectionBase.prototype.removeAt = function (index) {
var self = this, value;
value = self.getItem(index);
self.onValidate(value);
self.onRemove(index, value);
self._list.removeAt(index);
self.onRemoveComplete(index, value);
};
CollectionBase.prototype.setItem = function (index, value) {
var self = this, oldValue;
oldValue = self.getItem(index);
self.onValidate(value);
self.onSet(index, oldValue, value);
self._list.setItem(index, value);
self.onSetComplete(index, oldValue, value);
};
CollectionBase.prototype.onClear = function () {};
CollectionBase.prototype.onClearComplete = function () {};
CollectionBase.prototype.onInsert = function (index, value) {};
CollectionBase.prototype.onInsertComplete = function (index, value) {};
CollectionBase.prototype.onRemove = function (index, value) {};
CollectionBase.prototype.onRemoveComplete = function (index, value) {};
CollectionBase.prototype.onSet = function (index, oldValue, newValue) {};
CollectionBase.prototype.onSetComplete = function (index, oldValue, newValue) {};
CollectionBase.prototype.onValidate = function (value) {};
CollectionBase.ensureImplements(netjs.collections.IList, netjs.collections.ICollection, netjs.collections.IEnumerable);
return CollectionBase;
} (netjs));
|
alxkimball/NETJS
|
src/netjs/collections/CollectionBase.js
|
JavaScript
|
mit
| 3,688
|
# Flipboard Magazine Widget
* Contributors: taupecat
* Tags: flipboard, widget
* Requires at least: 3.8.1
* Requires PHP: 5.3.0
* Tested up to: 5.4.2
* Stable tag: 2.0.0
* License: MIT
* License URI: http://opensource.org/licenses/MIT
Add a Flipboard magazine widget (https://share.flipboard.com/) to your sidebar
## Description
This plugin turns Flipboard widgets into true WordPress widgets. All you have to do is enter the magazine's URL, and this plugin handles the rest! No need to worry about copying and pasting the Flipboard-generated code, and the required JavaScript is handled in the appropriate WordPress way.
## Installation
1. Upload the `flipboard-magazine-widget` directory to the `/wp-content/plugins/` directory
1. Activate the plugin through the 'Plugins' menu in WordPress
1. Add the widget to your sidebar, entering the magazine's URL in the "Magazine URL" field.
## Screenshots
1. An example of how the widget appears on your site.
## Changelog
### 2.0.0
* Complete rewrite of the code to modern WordPress best practices.
* Updating the Flipboard widget code to Flipboard's current requirements.
* Testing in WordPress 5.*.
### 1.0
* Initial release.
|
taupecat/flipboard-magazine-widget
|
README.md
|
Markdown
|
mit
| 1,186
|
# dblink\_error\_message
dblink\_error\_message — gets last error message on the named connection
## Synopsis
```text
dblink_error_message(text connname) returns text
```
## Description
`dblink_error_message` fetches the most recent remote error message for a given connection.
## Arguments
_`connname`_
Name of the connection to use.
## Return Value
Returns last error message, or `OK` if there has been no error in this connection.
## Notes
When asynchronous queries are initiated by `dblink_send_query`, the error message associated with the connection might not get updated until the server's response message is consumed. This typically means that `dblink_is_busy` or `dblink_get_result` should be called prior to `dblink_error_message`, so that any error generated by the asynchronous query will be visible.
## Examples
```text
SELECT dblink_error_message('dtest1');
```
|
pgsql-tw/twpug-doc
|
tw/appendixes/additional-supplied-modules/dblink/dblink_error_message.md
|
Markdown
|
mit
| 894
|
<?php
namespace ConradCaine\FrontendBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$crawler = $client->request('GET', '/hello/Fabien');
$this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
}
}
|
robledogoncalves/shameBoard
|
src/ConradCaine/FrontendBundle/Tests/Controller/DefaultControllerTest.php
|
PHP
|
mit
| 409
|
{% extends 'layouts/layout.html' %}
{% block body %}
<div id="container-not-an-ad" class="media">
<div class="media-left pull-left" href="#">
<!-- REPLACE THE LOGO HERE WITH YOUR UNIVERSITY, LAB, or COMPANY -->
<img id="adlogo" src="/static/images/university.png" alt="Lab Logo" />
</div>
<div class="media-body">
<h1>Welcome to psiTurk!</h1>
<hr />
<div class="alert alert-warning">
Begin by viewing the <a href="#" id="ad-href">ad</a>.
<script type="text/javascript">
function makeid()
{
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < 5; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
var assignmentId = "debug" + makeid();
var hitId = "debug" + makeid();
var workerId = "debug" + makeid();
var href = "/ad?assignmentId=" + assignmentId + "&hitId=" + hitId + "&workerId=" + workerId + "&mode=debug"
document.getElementById('ad-href').setAttribute('href', href);
</script>
</div>
</div>
</div>
{% endblock %}
|
NYUCCL/psiTurk
|
psiturk/example/templates/default.html
|
HTML
|
mit
| 1,160
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
from numpy import array, zeros, linspace, meshgrid, ndarray, diag
from numpy import uint8, float64, int8, int0, float128, complex128
from numpy import exp, sqrt, cos, tan, arctan
from numpy import minimum, maximum
from numpy import ceil, floor
from numpy import matrix as npmatrix
from numpy.fft import fft, ifft
from numpy import pi
from scipy.linalg import solve_triangular as solve
from scipy.signal import fftconvolve as conv
from scipy.ndimage import geometric_transform as transform
# We will make use of *reentrant* locks.
from threading import RLock as Lock
from threading import Condition, Thread
# This module is a modification on python's queue module,
# which allows one to interrupt a queue.
import iqueue
# This is a module written to execute code in parallel.
# While python is limited by the Global Interpreter Lock,
# numerical operations on NumPy arrays are generally not
# limited by the GIL.
import parallel
# This module allows the conversion of SAGE symbolic expressions
# to RPN code through the symbolic_to_rpn. RPNProgram is a subclass
# of list that comes equipped with a __call__ method that implements
# execution of the RPN code.
import rpncalc
def _E(m):
return int0(npmatrix(diag((1,) * int(m + 1), k=0)[:, :-1]))
def _X(m):
return int0(npmatrix(diag((1,) * int(m), k=-1)[:, :-1]))
def _Del(m):
return int0(npmatrix(diag(xrange(1, int(m)), k=1)[:-1]))
class _CD_RPN:
def __init__(self):
self.coeffs = [(npmatrix((-1,)), npmatrix((-1,)))]
self.rpn = [(rpncalc.RPNProgram([-1]), rpncalc.RPNProgram([-1]))]
# In case this class is utilized by multiple threads.
self.lock = Lock()
def getcoeffs(self, m):
# Returns coefficients for $c_{m}$ and $d_{m}$.
# If they already exist in cache, just return what is there.
with self.lock:
if len(self.coeffs) <= m:
# Need to generate coefficients for $c_{m}$ and $d_{m}$.
# Fetch the coefficients for $c_{m-1}$ and $d_{m-1}$.
C, D = self.getcoeffs(m - 1)
if m % 2: # $m$ is odd
C_new = _E(m) * D * _X((m + 1) / 2).transpose() \
- ((1 + m) * _E(m) + 3 * _X(m)
+ 2 * (_E(m) + _X(m)) * _X(m - 1) * _Del(m)) * C \
* _E((m + 1) / 2).transpose()
D_new = _X(m) * C - (m * _E(m) + 2 * _X(m)
+ 2 * (_E(m) + _X(m)) * _X(m - 1) * _Del(m)) * D
else: # $m$ is even
C_new = _E(m) * D * _X(m / 2).transpose() \
- ((1 + m) * _E(m) + 3 * _X(m)
+ 2 * (_E(m) + _X(m)) * _X(m - 1) * _Del(m)) * C
D_new = _X(m) * C - (m * _E(m) + 2 * _X(m)
+ 2 * (_E(m) + _X(m)) * _X(m - 1) * _Del(m)) * D \
* _E(m / 2).transpose()
self.coeffs.append((C_new, D_new))
return self.coeffs[m]
def __getitem__(self, m):
n2 = rpncalc.wild("n2")
v2 = rpncalc.wild("v2")
mul = rpncalc.rpn_funcs[u"⋅"]
add = rpncalc.rpn_funcs[u"+"]
# Returns RPN code for $c_j$ and $d_j$. Generate on the fly if needed.
with self.lock:
while len(self.rpn) <= m:
cm_rpn = []
dm_rpn = []
C, D = self.getcoeffs(len(self.rpn))
# Generate RPN code for $c_j$ and $d_j$.
for row in array(C[::-1]):
npoly_rpn = []
for coeff in row[::-1]:
if coeff:
if len(npoly_rpn):
npoly_rpn.extend([n2, mul])
npoly_rpn.extend([coeff, add])
else:
npoly_rpn.append(coeff)
elif len(npoly_rpn):
npoly_rpn.extend([n2, mul])
if len(cm_rpn):
cm_rpn.extend([v2, mul])
cm_rpn.extend(npoly_rpn)
cm_rpn.append(add)
else:
cm_rpn.extend(npoly_rpn)
for row in array(D[::-1]):
npoly_rpn = []
for coeff in row[::-1]:
if coeff:
if len(npoly_rpn):
npoly_rpn.extend([n2, mul])
npoly_rpn.extend([coeff, add])
else:
npoly_rpn.append(coeff)
elif len(npoly_rpn):
npoly_rpn.extend([n2, mul])
if len(dm_rpn):
dm_rpn.extend([v2, mul])
dm_rpn.extend(npoly_rpn)
dm_rpn.append(add)
else:
dm_rpn.extend(npoly_rpn)
self.rpn.append(
(rpncalc.RPNProgram(cm_rpn), rpncalc.RPNProgram(dm_rpn)))
return self.rpn[m]
class Sderiv:
def __init__(self, alpha):
self.alpha = alpha
def __call__(self, A, ds):
H, W = A.shape
psi = rpncalc.decode(u"« x 3 ^ 4 / +/- 3 x * 4 / + »")
N = ceil(self.alpha / ds)
X = linspace(-N * ds - ds, N * ds + ds, 2 * N + 3)
Psi = psi(x=X / self.alpha)
Psi[X > self.alpha] = psi(x=1)
Psi[X < -self.alpha] = psi(x=-1)
stencil = (Psi[:-2] + Psi[2:] - 2 * Psi[1:-1]) / ds
diff = conv([stencil], A)
return N, N, diff[:, 2 * N:-2 * N]
class PolarBrokenRayInversion(parallel.BaseTaskClass):
_cd = _CD_RPN()
_u = rpncalc.decode(u"« q phi sin ⋅ arcsin »")
_v = rpncalc.decode(u"« q phi sin ⋅ +/- q 2 ^ phi sin 2 ^ ⋅ +/- 1 + √ ÷ »")
_w = rpncalc.decode(u"« i phi u - ⋅ exp »")
_tm = rpncalc.decode(u"« i dm ⋅ n ⋅ cm v ⋅ + dlnr m ^ ⋅ m 2 + ! ÷ »")
_cf = rpncalc.decode(u"« dr r ⋅ v 2 ^ ⋅ phi csc ⋅ s 2 ^ ÷ »")
_invlock = Lock()
def __init__(self, Qf, Phi, smin, smax, alpha, nmax=200):
# Parameters:
# $\mathbf{Qf}$ -- $\mathcal{Q}f$, sampled on an $r\theta$ grid.
# $\mathbf{Phi}$ ($\phi$) -- Scattering angle
# $\mathbf{rmin}$ -- $r_{\min}$, defaults to $1$.
# $\mathbf{rmax}$ -- $r_{\max}$, defaults to $6$.
# $\mathbf{D}$ -- Numerical implemenation of $\frac{\partial}{\partial r}$.
# $\mathbf{nmax}$ -- $n_{\max}$, reconstructs $\tilde{f}\left(r,n\right)$
# for $\left|n\right| \le n_{\max}$. Defaults to $200$.
# This reconstruction will assume that $\mathcal{Q}f$ is real and exploit
# conjugate symmetry in the Fourier series.
# Initialize variables.
self.Qf = Qf
self.Phi = Phi
self.smin = smin
self.smax = smax
H, W = Qf.shape
self.thetamin = thetamin = -pi
self.thetamax = thetamax = pi*(1-2.0/H)
self.nmax = nmax
self.F = None
self.F_cartesian = None
self.lock = Lock()
self.status = Condition(self.lock)
self.jobsdone = 0
self.jobcount = nmax + 1
self.running = False
self.projectioncount = 0
self.projecting = False
self.dr = dr = ds = (smax - smin) / float(W - 1)
self.dtheta = dtheta = (thetamax - thetamin) / float(H)
# Compute $\widetilde{\mathcal{Q}f}$.
self.FQf = FQf = fft(Qf, axis=0)
# Perform differentiation of $\widetilde{\mathcal{Q}f}$.
D = Sderiv(alpha)
try:
clip_left, clip_right, self.DFQf = D(FQf, ds)
except:
clip_left, clip_right, self.DFQf = D(float64(FQf), ds)
# Initialize array that will store $\tilde{f}$.
self.Ff = zeros(self.DFQf.shape, dtype=complex128)
# Initialize $rs$ grid.
self.rmin = self.smin + clip_left * ds
self.rmax = self.smax - clip_right * ds
R = linspace(self.rmin, self.rmax, W - clip_left - clip_right)
self.R, self.S = meshgrid(R, R)
# Compute $q$, $u$, $v$, $w$, and $v^{2}r*\csc(\phi)*{\Delta}r/s^2$.
self.Q = self.S / self.R
args = dict(q=self.Q, r=self.R, s=self.S, phi=self.Phi, dr=dr)
args["u"] = self.U = self._u(**args)
args["v"] = self.V = self._v(**args)
self.W = self._w(**args)
self.Factor = self._cf(**args)
def A(self, n, eps=0.0000001, p=16):
# Compute matrix $\mathbf{A}_n$.
H, W = self.DFQf.shape
# Initialize the An matrix (as an array for now).
An = zeros(self.R.shape, dtype=complex128)
# First compute a partial sum for the upper triangular part.
# Start with $m=0$
mask = self.S < self.R
Sum = zeros(self.R.shape, dtype=complex128)
for m in xrange(0, p + 1, 2):
cm_rpn, dm_rpn = self._cd[m]
Term = self._tm(v=self.V[mask], v2=self.V[mask] ** 2,
dlnr=self.dr / self.R[mask],
n=n, n2=n ** 2, m=m, cm=cm_rpn, dm=dm_rpn)
Sum[mask] += Term
mask[mask] *= abs(Term) >= eps
if not mask.any():
break
mask = self.S < self.R
An[mask] = 2 * self.W[mask] ** n * self.Factor[mask] * Sum[mask]
# Now to do the diagonal.
# Since $r=s$ here, we have $q=1$, $u=\phi$, $v=-\tan\phi$,
# and $w=1$.
mask = self.S == self.R
Sum = zeros(self.R.shape, dtype=complex128)
for m in xrange(0, p + 1):
cm_rpn, dm_rpn = self._cd[m]
Term = self._tm(v=-tan(self.Phi), v2=tan(self.Phi) ** 2,
dlnr=self.dr / self.R[mask],
n=n, n2=n ** 2, m=m, cm=cm_rpn, dm=dm_rpn)
Sum[mask] += Term
mask[mask] *= abs(Term) >= eps
if not mask.any():
break
mask = self.S == self.R
An[mask] = self.Factor[mask] * Sum[mask] + \
array([1 - 1 / cos(self.Phi)] * W)
return npmatrix(An)
def f(self, n):
# This is the function that is run in parallel.
An = self.A(n, eps=10 ** -9, p=24)
DFQf = self.DFQf[n]
#AnInv = inv(An).transpose()
#Ff = array(DFQf*AnInv)[0]
Ff = solve(An, DFQf)
return Ff
def populatequeue(self, queue):
for n in xrange(self.nmax + 1):
queue.put(n)
def postproc(self, (n, Ff)):
with self.status:
self.Ff[n] = Ff
if n > 0:
self.Ff[-n] = Ff.conjugate()
self.jobsdone += 1
self.status.notifyAll()
def reconstruct(self):
with self.lock:
self.F = ifft(self.Ff, axis=0)
return self.F
|
shersonb/brokenray
|
brokenray/polar.py
|
Python
|
mit
| 11,050
|
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Jean-Baptiste Quenot, Tom Huybrechts
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package hudson;
import com.google.common.collect.Lists;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Plugin.DummyImpl;
import hudson.PluginWrapper.Dependency;
import hudson.model.Hudson;
import hudson.util.CyclicGraphDetector;
import hudson.util.CyclicGraphDetector.CycleDetectedException;
import hudson.util.IOUtils;
import hudson.util.MaskingClassLoader;
import jenkins.ClassLoaderReflectionToolkit;
import jenkins.ExtensionFilter;
import jenkins.plugins.DetachedPluginsUtil;
import jenkins.util.AntClassLoader;
import jenkins.util.AntWithFindResourceClassLoader;
import jenkins.util.SystemProperties;
import org.apache.commons.io.output.NullOutputStream;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.Expand;
import org.apache.tools.ant.taskdefs.Zip;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.PatternSet;
import org.apache.tools.ant.types.Resource;
import org.apache.tools.ant.types.ZipFileSet;
import org.apache.tools.ant.types.resources.MappedResourceCollection;
import org.apache.tools.ant.util.GlobPatternMapper;
import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipExtraField;
import org.apache.tools.zip.ZipOutputStream;
import org.jenkinsci.bytecode.Transformer;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.io.Closeable;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.InvalidPathException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.logging.Level;
import java.util.logging.Logger;
import static org.apache.commons.io.FilenameUtils.getBaseName;
public class ClassicPluginStrategy implements PluginStrategy {
private static final Logger LOGGER = Logger.getLogger(ClassicPluginStrategy.class.getName());
/**
* Filter for jar files.
*/
private static final FilenameFilter JAR_FILTER = new FilenameFilter() {
public boolean accept(File dir,String name) {
return name.endsWith(".jar");
}
};
private PluginManager pluginManager;
/**
* All the plugins eventually delegate this classloader to load core, servlet APIs, and SE runtime.
*/
private final MaskingClassLoader coreClassLoader = new MaskingClassLoader(getClass().getClassLoader());
public ClassicPluginStrategy(PluginManager pluginManager) {
this.pluginManager = pluginManager;
}
@Override public String getShortName(File archive) throws IOException {
Manifest manifest;
if (!archive.exists()) {
throw new FileNotFoundException("Failed to load " + archive + ". The file does not exist");
} else if (!archive.isFile()) {
throw new FileNotFoundException("Failed to load " + archive + ". It is not a file");
}
if (isLinked(archive)) {
manifest = loadLinkedManifest(archive);
} else {
try (JarFile jf = new JarFile(archive, false)) {
manifest = jf.getManifest();
} catch (IOException ex) {
// Mention file name in the exception
throw new IOException("Failed to load " + archive, ex);
}
}
return PluginWrapper.computeShortName(manifest, archive.getName());
}
private static boolean isLinked(File archive) {
return archive.getName().endsWith(".hpl") || archive.getName().endsWith(".jpl");
}
private static Manifest loadLinkedManifest(File archive) throws IOException {
// resolve the .hpl file to the location of the manifest file
try {
// Locate the manifest
String firstLine;
try (InputStream manifestHeaderInput = Files.newInputStream(archive.toPath())) {
firstLine = IOUtils.readFirstLine(manifestHeaderInput, "UTF-8");
} catch (InvalidPathException e) {
throw new IOException(e);
}
//noinspection StatementWithEmptyBody
if (firstLine.startsWith("Manifest-Version:")) {
// this is the manifest already
} else {
// indirection
archive = resolve(archive, firstLine);
}
// Read the manifest
try (InputStream manifestInput = Files.newInputStream(archive.toPath())) {
return new Manifest(manifestInput);
} catch (InvalidPathException e) {
throw new IOException(e);
}
} catch (IOException e) {
throw new IOException("Failed to load " + archive, e);
}
}
@Override public PluginWrapper createPluginWrapper(File archive) throws IOException {
final Manifest manifest;
URL baseResourceURL;
File expandDir = null;
// if .hpi, this is the directory where war is expanded
boolean isLinked = isLinked(archive);
if (isLinked) {
manifest = loadLinkedManifest(archive);
} else {
if (archive.isDirectory()) {// already expanded
expandDir = archive;
} else {
File f = pluginManager.getWorkDir();
expandDir = new File(f == null ? archive.getParentFile() : f, getBaseName(archive.getName()));
explode(archive, expandDir);
}
File manifestFile = new File(expandDir, PluginWrapper.MANIFEST_FILENAME);
if (!manifestFile.exists()) {
throw new IOException(
"Plugin installation failed. No manifest at "
+ manifestFile);
}
try (InputStream fin = Files.newInputStream(manifestFile.toPath())) {
manifest = new Manifest(fin);
} catch (InvalidPathException e) {
throw new IOException(e);
}
String canonicalName = manifest.getMainAttributes().getValue("Short-Name") + ".jpi";
if (!archive.getName().equals(canonicalName)) {
LOGGER.warning(() -> "encountered " + archive + " under a nonstandard name; expected " + canonicalName);
}
}
final Attributes atts = manifest.getMainAttributes();
// TODO: define a mechanism to hide classes
// String export = manifest.getMainAttributes().getValue("Export");
List<File> paths = new ArrayList<>();
if (isLinked) {
parseClassPath(manifest, archive, paths, "Libraries", ",");
parseClassPath(manifest, archive, paths, "Class-Path", " +"); // backward compatibility
baseResourceURL = resolve(archive,atts.getValue("Resource-Path")).toURI().toURL();
} else {
File classes = new File(expandDir, "WEB-INF/classes");
if (classes.exists()) { // should not normally happen, due to createClassJarFromWebInfClasses
LOGGER.log(Level.WARNING, "Deprecated unpacked classes directory found in {0}", classes);
paths.add(classes);
}
File lib = new File(expandDir, "WEB-INF/lib");
File[] libs = lib.listFiles(JAR_FILTER);
if (libs != null)
paths.addAll(Arrays.asList(libs));
baseResourceURL = expandDir.toPath().toUri().toURL();
}
File disableFile = new File(archive.getPath() + ".disabled");
if (disableFile.exists()) {
LOGGER.info("Plugin " + archive.getName() + " is disabled");
}
// compute dependencies
List<PluginWrapper.Dependency> dependencies = new ArrayList<>();
List<PluginWrapper.Dependency> optionalDependencies = new ArrayList<>();
String v = atts.getValue("Plugin-Dependencies");
if (v != null) {
for (String s : v.split(",")) {
PluginWrapper.Dependency d = new PluginWrapper.Dependency(s);
if (d.optional) {
optionalDependencies.add(d);
} else {
dependencies.add(d);
}
}
}
fix(atts,optionalDependencies);
// Register global classpath mask. This is useful for hiding JavaEE APIs that you might see from the container,
// such as database plugin for JPA support. The Mask-Classes attribute is insufficient because those classes
// also need to be masked by all the other plugins that depend on the database plugin.
String masked = atts.getValue("Global-Mask-Classes");
if(masked!=null) {
for (String pkg : masked.trim().split("[ \t\r\n]+"))
coreClassLoader.add(pkg);
}
ClassLoader dependencyLoader = new DependencyClassLoader(coreClassLoader, archive, Util.join(dependencies,optionalDependencies));
dependencyLoader = getBaseClassLoader(atts, dependencyLoader);
return new PluginWrapper(pluginManager, archive, manifest, baseResourceURL,
createClassLoader(paths, dependencyLoader, atts), disableFile, dependencies, optionalDependencies);
}
private void fix(Attributes atts, List<PluginWrapper.Dependency> optionalDependencies) {
String pluginName = atts.getValue("Short-Name");
String jenkinsVersion = atts.getValue("Jenkins-Version");
if (jenkinsVersion==null)
jenkinsVersion = atts.getValue("Hudson-Version");
for (Dependency d : DetachedPluginsUtil.getImpliedDependencies(pluginName, jenkinsVersion)) {
LOGGER.fine(() -> "implied dep " + pluginName + " → " + d.shortName);
pluginManager.considerDetachedPlugin(d.shortName);
optionalDependencies.add(d);
}
}
/**
* @see DetachedPluginsUtil#getImpliedDependencies(String, String)
*
* @deprecated since 2.163
*/
@Deprecated
@NonNull
public static List<PluginWrapper.Dependency> getImpliedDependencies(String pluginName, String jenkinsVersion) {
return DetachedPluginsUtil.getImpliedDependencies(pluginName, jenkinsVersion);
}
@Deprecated
protected ClassLoader createClassLoader(List<File> paths, ClassLoader parent) throws IOException {
return createClassLoader( paths, parent, null );
}
/**
* Creates the classloader that can load all the specified jar files and delegate to the given parent.
*/
protected ClassLoader createClassLoader(List<File> paths, ClassLoader parent, Attributes atts) throws IOException {
if (atts != null) {
String usePluginFirstClassLoader = atts.getValue( "PluginFirstClassLoader" );
if (Boolean.parseBoolean( usePluginFirstClassLoader )) {
PluginFirstClassLoader classLoader = new PluginFirstClassLoader();
classLoader.setParentFirst( false );
classLoader.setParent( parent );
classLoader.addPathFiles( paths );
return classLoader;
}
}
AntClassLoader2 classLoader = new AntClassLoader2(parent);
classLoader.addPathFiles(paths);
return classLoader;
}
/**
* Computes the classloader that takes the class masking into account.
*
* <p>
* This mechanism allows plugins to have their own versions for libraries that core bundles.
*/
private ClassLoader getBaseClassLoader(Attributes atts, ClassLoader base) {
String masked = atts.getValue("Mask-Classes");
if(masked!=null)
base = new MaskingClassLoader(base, masked.trim().split("[ \t\r\n]+"));
return base;
}
public void initializeComponents(PluginWrapper plugin) {
}
public <T> List<ExtensionComponent<T>> findComponents(Class<T> type, Hudson hudson) {
List<ExtensionFinder> finders;
if (type==ExtensionFinder.class) {
// Avoid infinite recursion of using ExtensionFinders to find ExtensionFinders
finders = Collections.singletonList(new ExtensionFinder.Sezpoz());
} else {
finders = hudson.getExtensionList(ExtensionFinder.class);
}
/*
* See ExtensionFinder#scout(Class, Hudson) for the dead lock issue and what this does.
*/
if (LOGGER.isLoggable(Level.FINER))
LOGGER.log(Level.FINER, "Scout-loading ExtensionList: "+type, new Throwable());
for (ExtensionFinder finder : finders) {
finder.scout(type, hudson);
}
List<ExtensionComponent<T>> r = Lists.newArrayList();
for (ExtensionFinder finder : finders) {
try {
r.addAll(finder.find(type, hudson));
} catch (AbstractMethodError e) {
// backward compatibility
for (T t : finder.findExtensions(type, hudson))
r.add(new ExtensionComponent<>(t));
}
}
List<ExtensionComponent<T>> filtered = Lists.newArrayList();
for (ExtensionComponent<T> e : r) {
if (ExtensionFilter.isAllowed(type,e))
filtered.add(e);
}
return filtered;
}
public void load(PluginWrapper wrapper) throws IOException {
// override the context classloader. This no longer makes sense,
// but it is left for the backward compatibility
ClassLoader old = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(wrapper.classLoader);
try {
String className = wrapper.getPluginClass();
if(className==null) {
// use the default dummy instance
wrapper.setPlugin(new DummyImpl());
} else {
try {
Class<?> clazz = wrapper.classLoader.loadClass(className);
Object o = clazz.newInstance();
if(!(o instanceof Plugin)) {
throw new IOException(className+" doesn't extend from hudson.Plugin");
}
wrapper.setPlugin((Plugin) o);
} catch (LinkageError | ClassNotFoundException e) {
throw new IOException("Unable to load " + className + " from " + wrapper.getShortName(),e);
} catch (IllegalAccessException | InstantiationException e) {
throw new IOException("Unable to create instance of " + className + " from " + wrapper.getShortName(),e);
}
}
// initialize plugin
try {
Plugin plugin = wrapper.getPlugin();
plugin.setServletContext(pluginManager.context);
startPlugin(wrapper);
} catch(Throwable t) {
// gracefully handle any error in plugin.
throw new IOException("Failed to initialize",t);
}
} finally {
Thread.currentThread().setContextClassLoader(old);
}
}
public void startPlugin(PluginWrapper plugin) throws Exception {
plugin.getPlugin().start();
}
@Override
public void updateDependency(PluginWrapper depender, PluginWrapper dependee) {
DependencyClassLoader classLoader = findAncestorDependencyClassLoader(depender.classLoader);
if (classLoader != null) {
classLoader.updateTransientDependencies();
LOGGER.log(Level.INFO, "Updated dependency of {0}", depender.getShortName());
}
}
private DependencyClassLoader findAncestorDependencyClassLoader(ClassLoader classLoader)
{
for (; classLoader != null; classLoader = classLoader.getParent()) {
if (classLoader instanceof DependencyClassLoader) {
return (DependencyClassLoader)classLoader;
}
if (classLoader instanceof AntClassLoader) {
// AntClassLoaders hold parents not only as AntClassLoader#getParent()
// but also as AntClassLoader#getConfiguredParent()
DependencyClassLoader ret = findAncestorDependencyClassLoader(
((AntClassLoader)classLoader).getConfiguredParent()
);
if (ret != null) {
return ret;
}
}
}
return null;
}
@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "Administrator action installing a plugin, which could do far worse.")
private static File resolve(File base, String relative) {
File rel = new File(relative);
if(rel.isAbsolute())
return rel;
else
return new File(base.getParentFile(),relative);
}
private static void parseClassPath(Manifest manifest, File archive, List<File> paths, String attributeName, String separator) throws IOException {
String classPath = manifest.getMainAttributes().getValue(attributeName);
if(classPath==null) return; // attribute not found
for (String s : classPath.split(separator)) {
File file = resolve(archive, s);
if(file.getName().contains("*")) {
// handle wildcard
FileSet fs = new FileSet();
File dir = file.getParentFile();
fs.setDir(dir);
fs.setIncludes(file.getName());
for( String included : fs.getDirectoryScanner(new Project()).getIncludedFiles() ) {
paths.add(new File(dir,included));
}
} else {
if(!file.exists())
throw new IOException("No such file: "+file);
paths.add(file);
}
}
}
/**
* Explodes the plugin into a directory, if necessary.
*/
private static void explode(File archive, File destDir) throws IOException {
destDir.mkdirs();
// timestamp check
File explodeTime = new File(destDir,".timestamp2");
if(explodeTime.exists() && explodeTime.lastModified()==archive.lastModified())
return; // no need to expand
// delete the contents so that old files won't interfere with new files
Util.deleteRecursive(destDir);
try {
Project prj = new Project();
unzipExceptClasses(archive, destDir, prj);
createClassJarFromWebInfClasses(archive, destDir, prj);
} catch (BuildException x) {
throw new IOException("Failed to expand " + archive,x);
}
try {
new FilePath(explodeTime).touch(archive.lastModified());
} catch (InterruptedException e) {
throw new AssertionError(e); // impossible
}
}
/**
* Repackage classes directory into a jar file to make it remoting friendly.
* The remoting layer can cache jar files but not class files.
*/
private static void createClassJarFromWebInfClasses(File archive, File destDir, Project prj) throws IOException {
File classesJar = new File(destDir, "WEB-INF/lib/classes.jar");
ZipFileSet zfs = new ZipFileSet();
zfs.setProject(prj);
zfs.setSrc(archive);
zfs.setIncludes("WEB-INF/classes/");
MappedResourceCollection mapper = new MappedResourceCollection();
mapper.add(zfs);
GlobPatternMapper gm = new GlobPatternMapper();
gm.setFrom("WEB-INF/classes/*");
gm.setTo("*");
mapper.add(gm);
final long dirTime = archive.lastModified();
// this ZipOutputStream is reused and not created for each directory
try (ZipOutputStream wrappedZOut = new ZipOutputStream(new NullOutputStream()) {
@Override
public void putNextEntry(ZipEntry ze) throws IOException {
ze.setTime(dirTime+1999); // roundup
super.putNextEntry(ze);
}
}) {
Zip z = new Zip() {
/**
* Forces the fixed timestamp for directories to make sure
* classes.jar always get a consistent checksum.
*/
protected void zipDir(Resource dir, ZipOutputStream zOut, String vPath,
int mode, ZipExtraField[] extra)
throws IOException {
// use wrappedZOut instead of zOut
super.zipDir(dir,wrappedZOut,vPath,mode,extra);
}
};
z.setProject(prj);
z.setTaskType("zip");
classesJar.getParentFile().mkdirs();
z.setDestFile(classesJar);
z.add(mapper);
z.execute();
}
if (classesJar.isFile()) {
LOGGER.log(Level.WARNING, "Created {0}; update plugin to a version created with a newer harness", classesJar);
}
}
private static void unzipExceptClasses(File archive, File destDir, Project prj) {
Expand e = new Expand();
e.setProject(prj);
e.setTaskType("unzip");
e.setSrc(archive);
e.setDest(destDir);
PatternSet p = new PatternSet();
p.setExcludes("WEB-INF/classes/");
e.addPatternset(p);
e.execute();
}
/**
* Used to load classes from dependency plugins.
*/
final class DependencyClassLoader extends ClassLoader {
/**
* This classloader is created for this plugin. Useful during debugging.
*/
private final File _for;
private List<Dependency> dependencies;
/**
* Topologically sorted list of transient dependencies.
*/
private volatile List<PluginWrapper> transientDependencies;
public DependencyClassLoader(ClassLoader parent, File archive, List<Dependency> dependencies) {
super(parent);
this._for = archive;
this.dependencies = dependencies;
}
private void updateTransientDependencies() {
// This will be recalculated at the next time.
transientDependencies = null;
}
private List<PluginWrapper> getTransitiveDependencies() {
if (transientDependencies==null) {
CyclicGraphDetector<PluginWrapper> cgd = new CyclicGraphDetector<PluginWrapper>() {
@Override
protected List<PluginWrapper> getEdges(PluginWrapper pw) {
List<PluginWrapper> dep = new ArrayList<>();
for (Dependency d : pw.getDependencies()) {
PluginWrapper p = pluginManager.getPlugin(d.shortName);
if (p!=null && p.isActive())
dep.add(p);
}
return dep;
}
};
try {
for (Dependency d : dependencies) {
PluginWrapper p = pluginManager.getPlugin(d.shortName);
if (p!=null && p.isActive())
cgd.run(Collections.singleton(p));
}
} catch (CycleDetectedException e) {
throw new AssertionError(e); // such error should have been reported earlier
}
transientDependencies = cgd.getSorted();
}
return transientDependencies;
}
// public List<PluginWrapper> getDependencyPluginWrappers() {
// List<PluginWrapper> r = new ArrayList<PluginWrapper>();
// for (Dependency d : dependencies) {
// PluginWrapper w = pluginManager.getPlugin(d.shortName);
// if (w!=null) r.add(w);
// }
// return r;
// }
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
if (PluginManager.FAST_LOOKUP) {
for (PluginWrapper pw : getTransitiveDependencies()) {
try {
Class<?> c = ClassLoaderReflectionToolkit._findLoadedClass(pw.classLoader, name);
if (c!=null) return c;
return ClassLoaderReflectionToolkit._findClass(pw.classLoader, name);
} catch (ClassNotFoundException ignored) {
//not found. try next
}
}
} else {
for (Dependency dep : dependencies) {
PluginWrapper p = pluginManager.getPlugin(dep.shortName);
if(p!=null) {
try {
return p.classLoader.loadClass(name);
} catch (ClassNotFoundException ignored) {
// OK, try next
}
}
}
}
throw new ClassNotFoundException(name);
}
@Override
@SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS",
justification = "Should not produce network overheads since the URL is local. JENKINS-53793 is a follow-up")
protected Enumeration<URL> findResources(String name) throws IOException {
HashSet<URL> result = new HashSet<>();
if (PluginManager.FAST_LOOKUP) {
for (PluginWrapper pw : getTransitiveDependencies()) {
Enumeration<URL> urls = ClassLoaderReflectionToolkit._findResources(pw.classLoader, name);
while (urls != null && urls.hasMoreElements())
result.add(urls.nextElement());
}
} else {
for (Dependency dep : dependencies) {
PluginWrapper p = pluginManager.getPlugin(dep.shortName);
if (p!=null) {
Enumeration<URL> urls = p.classLoader.getResources(name);
while (urls != null && urls.hasMoreElements())
result.add(urls.nextElement());
}
}
}
return Collections.enumeration(result);
}
@Override
protected URL findResource(String name) {
if (PluginManager.FAST_LOOKUP) {
for (PluginWrapper pw : getTransitiveDependencies()) {
URL url = ClassLoaderReflectionToolkit._findResource(pw.classLoader, name);
if (url!=null) return url;
}
} else {
for (Dependency dep : dependencies) {
PluginWrapper p = pluginManager.getPlugin(dep.shortName);
if(p!=null) {
URL url = p.classLoader.getResource(name);
if (url!=null)
return url;
}
}
}
return null;
}
}
/**
* {@link AntClassLoader} with a few methods exposed, {@link Closeable} support, and {@link Transformer} support.
*/
private final class AntClassLoader2 extends AntWithFindResourceClassLoader implements Closeable {
private AntClassLoader2(ClassLoader parent) {
super(parent, true);
}
@Override
protected Class defineClassFromData(File container, byte[] classData, String classname) throws IOException {
if (!DISABLE_TRANSFORMER)
classData = pluginManager.getCompatibilityTransformer().transform(classname, classData, this);
return super.defineClassFromData(container, classData, classname);
}
}
/* Unused since 1.527, see https://github.com/jenkinsci/jenkins/commit/47de54d070f67af95b4fefb6d006a72bb31a5cb8 */
@Deprecated
public static boolean useAntClassLoader = SystemProperties.getBoolean(ClassicPluginStrategy.class.getName()+".useAntClassLoader");
public static boolean DISABLE_TRANSFORMER = SystemProperties.getBoolean(ClassicPluginStrategy.class.getName()+".noBytecodeTransformer");
}
|
oleg-nenashev/jenkins
|
core/src/main/java/hudson/ClassicPluginStrategy.java
|
Java
|
mit
| 29,899
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Hola Mundo!</title>
<link rel="stylesheet" href="bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
<link rel="stylesheet" href="styles.css" media="screen" title="no title">
<script src="bootstrap/js/jquery-2.2.4.min.js"></script>
<script src="bootstrap/js/bootstrap.js" charset="utf-8"></script>
<script src="js/codigo.js" charset="utf-8"></script>
<style media="screen">
h2 {padding-bottom: 2%;}
body{margin-top: 50px;}
.row {padding-top: 5%;}
.pad{padding: 2%;}
#sandbox{padding:10px;}
</style>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"><i class="fa fa-pied-piper fa-2x fa-inverse"></i></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="navbar">
<ul class="nav navbar-nav">
<li><a href="ejer1.html">Ejercicio 1</a></li>
<li class="active"><a href="#">Ejercicio 2</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<div class="section section-primary">
<div class="container">
<div class="section">
<noscript>
<h1>Aquí debería verse un par de alerts muy bonitos.</h1>
</noscript>
<script>
var d = new Date();
var dia = new Array(7);
dia[0] = "Domingo";
dia[1] = "Lunes";
dia[2] = "Martes";
dia[3] = "Miercoles";
dia[4] = "Jueves";
dia[5] = "Viernes";
dia[6] = "Sabado";
document.write("Hoy es " + dia[d.getDay()]);
</script>
</div>
<div class="row">
<h2 class="text-center">Pequeños retos </h2>
<div class="col-md-3 center-block">
<div class="btn btn-lg btn-primary center-block" id="reverse">Voltéame papi</div>
</div>
<div class="col-md-3 center-block">
<div class="btn btn-lg btn-primary center-block" id="fibonacci">Secuencia Fibonacci</div>
</div>
<div class="col-md-3 center-block">
<div class="btn btn-lg btn-primary center-block" id="suma-loca">Suma loca</div>
</div>
<div class="col-md-3 center-block">
<div class="btn btn-lg btn-primary center-block" id="h-family">Somos los H</div>
</div>
</div>
<div class="space"></div>
<div class="row">
<div class="col-md-3 center-block">
<div class="btn btn-lg btn-primary center-block" id="dni-checker">Calculadora de DNI</div>
</div>
<div class="col-md-3 center-block">
<div class="btn btn-lg btn-primary center-block" id="case-sensitive">Case Sensitive</div>
</div>
<div class="col-md-3 center-block">
<div class="btn btn-lg btn-primary center-block" id="tax">Calculadora de impuestos</div>
</div>
<div class="col-md-3 center-block">
<div class="btn btn-lg btn-danger center-block" id="stringLength">Calcular longitud de string</div>
</div>
</div>
<div class="row">
<div class="col-md-3 center-block">
<div class="btn btn-lg btn-danger center-block" id="charPosition">Calcular posiciones carácter</div>
</div>
<div class="col-md-3 center-block">
<div class="btn btn-lg btn-danger center-block" id="substring">Recortar String</div>
</div>
<div class="col-md-3 center-block">
<div class="btn btn-lg btn-danger center-block" id="palindrome">Palindroméame papi</div>
</div>
<div class="col-md-3 center-block">
<div class="btn btn-lg btn-danger center-block" id="vocalKiller">Eliminar vocales</div>
</div>
</div>
<div class="space"></div>
</div>
<!-- MODAL DE RESPUESTA -->
<div id="modal-content" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 id"quest" class="modal-title">Ejercicos con String</h4>
</div>
<div class="modal-body">
<div id="sandbox" class="row"></div>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-primary" data-dismiss="modal">Cerrar</a>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var a = [true, 5, false, 'hola', 'adios', 2];
//if en una sola línea (condición) ? si true : si false;
var resultado = (a[3].length <= a[4].length) ? a[3] + ' es menor que ' + a[4] : a[4] + ' es mayor que ' + a[3];
console.log(resultado);
</script>
</div>
</body>
</html>
|
ulisesantana/DAW
|
DEW/tema1/ejercicio1/ejer2.html
|
HTML
|
mit
| 5,476
|
/*
* CMS.js v1.0.0
* Copyright 2015 Chris Diana
* www.cdmedia.github.io/cms.js
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
var CMS = {
settings: {
siteName: 'CMS.js',
siteTagline: 'Your site tagline',
siteEmail: 'your_email@example.com',
siteAuthor: 'Your Name',
siteUrl: '',
siteNavItems: [
{ name: 'Github', href: '#', newWindow: false},
{ name: 'About' }
],
pagination: 3,
postsFolder: 'posts',
postSnippetLength: 120,
pagesFolder: 'pages',
fadeSpeed: 300,
mainContainer: $('.cms_main'),
footerContainer: $('.cms_footer'),
footerText: '© ' + new Date().getFullYear() + ' All Rights Reserved.',
parseSeperator: '---',
loader: '<div class="loader">Loading...</div>',
get siteAttributes() {
return [
{ attr: 'title', value: CMS.settings.siteName },
{ attr: '.cms_sitename', value: CMS.settings.siteName},
{ attr: '.cms_tagline', value: CMS.settings.siteTagline},
{ attr: '.cms_footer_text', value: CMS.settings.footerText}
];
},
mode: 'Github',
githubUserSettings: {
username: 'yourusername',
repo: 'yourrepo',
},
githubSettings: {
branch: 'gh-pages',
host: 'https://api.github.com'
}
},
posts: [],
pages: [],
loaded: {},
// ----------------------------------------------------------------
extend: function (target, opts, callback) {
var next;
if (typeof opts === "undefined") {
opts = target;
target = CMS;
}
for (next in opts) {
if (Object.prototype.hasOwnProperty.call(opts, next)) {
target[next] = opts[next];
}
}
callback(); // check user config options
return target;
},
// ----------------------------------------------------------------
render: function (url) {
CMS.settings.mainContainer.html('').fadeOut(CMS.settings.fadeSpeed);
CMS.settings.footerContainer.hide();
var type = url.split('/')[0];
var map = {
// Main view
'' : function () {
CMS.renderPosts();
},
// Post view
'#post' : function() {
var id = url.split('#post/')[1].trim();
CMS.renderPost(id);
},
// Post view
'#page' : function() {
var title = url.split('#page/')[1].trim();
CMS.renderPage(title);
}
};
if (map[type]) {
map[type]();
} else {
var errorMsg = 'Error loading page.';
CMS.renderError(errorMsg);
}
},
// ----------------------------------------------------------------
renderPage: function(title) {
CMS.pages.forEach(function(page){
if(page.title == title) {
var tpl = $('#page-template').html(),
$tpl = $(tpl);
$tpl.find('.page-title').html(page.title);
$tpl.find('.page-content').html(page.contentData);
CMS.settings.mainContainer.html($tpl).hide().fadeIn(CMS.settings.fadeSpeed);
}
});
CMS.renderFooter();
},
// ----------------------------------------------------------------
renderPost: function(id) {
CMS.posts.forEach(function(post){
if(post.id == id) {
var tpl = $('#post-template').html(),
$tpl = $(tpl);
$tpl.find('.post-title').html(post.title);
$tpl.find('.post-date').html((post.date.getMonth() + 1) + '/' + post.date.getDate() + '/' + post.date.getFullYear());
$tpl.find('.post-content').html(post.contentData);
CMS.settings.mainContainer.html($tpl).hide().fadeIn(CMS.settings.fadeSpeed);
}
});
CMS.renderFooter();
},
// ----------------------------------------------------------------
renderPosts: function() {
CMS.posts.forEach(function(post){
var tpl = $('#post-template').html(),
$tpl = $(tpl);
var title = '<a href="#">' + post.title + '</a>',
date = (post.date.getMonth() + 1) + '/' + post.date.getDate() + '/' + post.date.getFullYear(),
snippet = post.contentData.split('.')[0] + '.';
var postLink = $tpl.find('.post-title'),
postDate = $tpl.find('.post-date'),
postSnippet = $tpl.find('.post-content');
postLink.on('click', function (e) {
e.preventDefault();
window.location.hash = 'post/' + post.id;
});
postLink.html(title);
postSnippet.html(snippet);
postDate.html(date);
CMS.settings.mainContainer.append($tpl).hide().fadeIn(CMS.settings.fadeSpeed);
});
CMS.renderFooter();
},
// ----------------------------------------------------------------
renderFooter: function() {
// Load footer later so things dont look weird loading ajax stuff
setTimeout(function () {
CMS.settings.footerContainer.fadeIn(CMS.settings.fadeSpeed);
}, 800);
},
// ----------------------------------------------------------------
renderError: function(msg) {
var tpl = $('#error-template').html(),
$tpl = $(tpl);
$tpl.find('.error_text').html(msg);
CMS.settings.mainContainer.html('').fadeOut(CMS.settings.fadeSpeed, function(){
CMS.settings.mainContainer.html($tpl).fadeIn(CMS.settings.fadeSpeed);
});
},
// ----------------------------------------------------------------
contentLoaded: function(type) {
CMS.loaded[type] = true;
if(CMS.loaded.page && CMS.loaded.post) {
// Set navigation
this.setNavigation();
// Manually trigger on initial load
$(window).trigger('hashchange');
}
},
// ----------------------------------------------------------------
parseContent: function(content, type, file, counter, numFiles) {
var data = content.split(CMS.settings.parseSeperator),
contentObj = {},
id = counter,
date = file.date;
contentObj.id = id;
contentObj.date = date;
// Get content info
var infoData = data[1].split('\n');
$.each(infoData, function(k, v) {
if(v.length) {
v.replace(/^\s+|\s+$/g, '').trim();
var i = v.split(':');
var val = i[1];
k = i[0];
contentObj[k] = val.trim();
}
});
// Drop stuff we dont need
data.splice(0,2);
// Put everything back together if broken
var contentData = data.join();
contentObj.contentData = marked(contentData);
if(type == 'post') {
CMS.posts.push(contentObj);
} else if (type == 'page') {
CMS.pages.push(contentObj);
}
// Execute after all content is loaded
if(counter === numFiles) {
CMS.contentLoaded(type);
}
},
// ----------------------------------------------------------------
getContent: function(type, file, counter, numFiles) {
var urlFolder = '';
switch(type) {
case 'post':
urlFolder = CMS.settings.postsFolder;
break;
case 'page':
urlFolder = CMS.settings.pagesFolder;
break;
}
if(CMS.settings.mode == 'Github') {
url = file.link;
} else {
url = urlFolder + '/' + file.name;
}
$.ajax({
type: 'GET',
url: url,
dataType: 'html',
success: function(content) {
CMS.parseContent(content, type, file, counter, numFiles);
},
error: function() {
var errorMsg = 'Error loading ' + type + ' content';
CMS.renderError(errorMsg);
}
});
},
// ----------------------------------------------------------------
getFiles: function(type) {
var folder = '',
url = '';
switch(type) {
case 'post':
folder = CMS.settings.postsFolder;
break;
case 'page':
folder = CMS.settings.pagesFolder;
break;
}
if(CMS.settings.mode == 'Github') {
var gus = CMS.settings.githubUserSettings,
gs = CMS.settings.githubSettings;
if (gus.repo === '') {
url = gs.host + '/' + folder + '?ref=' + gs.branch;
} else {
url = gs.host + '/repos/' + gus.username + '/' + gus.repo + '/contents/' + folder + '?ref=' + gs.branch;
}
// msloth.github.io/repos/msloth//contents/posts?ref=gh-pages
// msloth.github.io/posts?ref=gh-pages
} else {
url = folder;
}
$.ajax({
url: url,
success: function(data) {
var files = [],
linkFiles;
if(CMS.settings.mode == 'Github') {
linkFiles = data;
} else {
linkFiles = $(data).find("a");
}
$(linkFiles).each(function(k, f) {
var filename,
downloadLink;
if(CMS.settings.mode == 'Github') {
filename = f.name;
downloadLink = f.download_url;
} else {
filename = $(f).attr("href");
}
if(filename.endsWith('.md')) {
var file = {};
file.date = new Date(filename.substring(0, 10));
file.name = filename;
if(downloadLink) {
file.link = downloadLink;
}
files.push(file);
}
});
var counter = 0,
numFiles = files.length;
if(files.length > 0) {
$(files).each(function(k, file) {
counter++;
CMS.getContent(type, file, counter, numFiles);
});
} else {
var errorMsg = 'Error loading ' + type + 's in directory. Make sure ' +
'there are Markdown ' + type + 's in the ' + type + 's folder.';
CMS.renderError(errorMsg);
}
},
error: function() {
var errorMsg;
if(CMS.settings.mode == 'Github') {
errorMsg = 'Error loading ' + type + 's directory. Make sure ' +
'your Github settings are correctly set in your config.js file.';
} else {
errorMsg = 'Error loading ' + type + 's directory. Make sure ' +
type + 's directory is set correctly in config and .htaccess is in ' +
type + 's directory with Apache "Options Indexes" set on.';
}
CMS.renderError(errorMsg);
}
});
},
// ----------------------------------------------------------------
setNavigation: function() {
var nav = '<ul>';
CMS.settings.siteNavItems.forEach(function(navItem) {
if(navItem.hasOwnProperty('href')) {
nav += '<li><a href="' + navItem.href + '"';
if(navItem.hasOwnProperty('newWindow')) {
if(navItem.newWindow) {
nav += 'target="_blank"';
}
}
nav += '>' + navItem.name + '</a></li>';
} else {
CMS.pages.forEach(function(page) {
if(navItem.name == page.title) {
nav += '<li><a href="#" class="cms_nav_link" id="' + navItem.name + '">' + navItem.name + '</a></li>';
}
});
}
});
nav += '</ul>';
$('.cms_nav').html(nav).hide().fadeIn(CMS.settings.fadeSpeed);
// Set onclicks for nav links
$.each($('.cms_nav_link'), function(k, link) {
var title = $(this).attr("id");
$(this).on('click', function (e) {
e.preventDefault();
window.location.hash = 'page/' + title;
});
});
},
// ----------------------------------------------------------------
setSiteAttributes: function() {
CMS.settings.siteAttributes.forEach(function(attribute) {
var value;
// Set brand
if(attribute.attr == '.cms_sitename') {
if (attribute.value.match(/\.(jpeg|jpg|gif|png)$/)) {
value = '<img src="' + attribute.value + '" />';
} else {
value = attribute.value;
}
} else {
value = attribute.value;
}
$(attribute.attr).html(value).hide().fadeIn(CMS.settings.fadeSpeed);
});
},
// ----------------------------------------------------------------
generateSite: function() {
this.setSiteAttributes();
var types = ['post', 'page'];
types.forEach(function(type){
CMS.getFiles(type);
});
// Check for hash changes
$(window).on('hashchange', function () {
CMS.render(window.location.hash);
});
},
// ----------------------------------------------------------------
init: function (options) {
if ($.isPlainObject(options)) {
return this.extend(this.settings, options, function () {
CMS.generateSite();
});
}
}
};
|
msloth/bithappens.se
|
js/cms.js
|
JavaScript
|
mit
| 11,308
|
---
layout: post
title: "MSI Train"
date: 2015-02-14 10:13:12 -0600
tags: ["2015", X-T1, "XF35mmF1.4 R"]
---

{: .prettyprint}
Train exhibit at the Museum of Science and Industry - Minature setting
1/40 sec, f/1.4, ISO 800 - Shutter clicks this day: 224
|
PickOneClick/site
|
_posts/2015-02-14-MSITrain.md
|
Markdown
|
mit
| 342
|
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>#5 Mp3 Player</title>
<script>
var song = {
name: "Walk This Way",
artist: "Run-D.M.C.",
minutes: 4,
seconds: 3,
genre: "80s",
playing: false,
play: function() {
if (!this.playing) {
this.playing = true;
console.log("Playing " + this.name + " by " + this.artist);
}
},
pause: function() {
if (this.playing) {
this.playing = false;
}
}
};
song.play();
song.pause();
</script>
</head>
<body></body>
</html>
|
reykjaviks/head-first-javascript
|
head-first-javascript/mp3player.html
|
HTML
|
mit
| 638
|
/*
The filesystem package provides an http.FileSystem implementation that may
contain file data not present in the host operating system.
*/
package filesystem
|
urandom/embed
|
filesystem/doc.go
|
GO
|
mit
| 160
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>18 --> 19</title>
<link href="./../../assets/style.css" rel="stylesheet">
</head>
<body>
<h2>You have to be fast</h2>
<a href="./4fa07baa4d75c06b8e600f934a246879be998a96e5a427b74c67c6097d947a3a.html">Teleport</a>
<hr>
<a href="./../../about.md">About</a> (Spoilers! )
<script src="./../../assets/md5.js"></script>
<script>
window.currentLevel = 7;
</script>
<script src="./../../assets/script.js"></script>
</body>
</html>
|
simonmysun/praxis
|
TAIHAO2019/pub/SmallGame/AsFastAsYouCan2/de5bc987eb6ea4e97b9fff673f19b37a5caeb071795ca39de9aabd883029643c.html
|
HTML
|
mit
| 550
|
package net.seiko_comb.combS8214808.joiss2016;
public class LinearClassifier {
public Vector w;
public LinearClassifier(Vector w) {
this.w = w;
}
public double f(Vector x) {
return w.product(x.addOne());
}
public double signf(Vector x) {
if (f(x) > 0)
return 1;
else
return -1;
}
@Override
public String toString() {
return String.format("LinearClassifier %s", w);
}
}
|
combS8214808/JOIss2016
|
src/main/java/net/seiko_comb/combS8214808/joiss2016/LinearClassifier.java
|
Java
|
mit
| 425
|
package commitstats
import (
"testing"
fixtures "github.com/src-d/go-git-fixtures"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/cache"
"gopkg.in/src-d/go-git.v4/plumbing/object"
"gopkg.in/src-d/go-git.v4/storage/filesystem"
)
func TestNewFileStats(t *testing.T) {
require := require.New(t)
defer func() {
require.NoError(fixtures.Clean())
}()
f := fixtures.Basic().One()
r, err := git.Open(filesystem.NewStorage(f.DotGit(), cache.NewObjectLRUDefault()), nil)
require.NoError(err)
b, err := r.BlobObject(plumbing.NewHash("9a48f23120e880dfbe41f7c9b7b708e9ee62a492"))
require.NoError(err)
fs, err := newFileStats(b, "PHP")
require.NoError(err)
require.Equal(17, fs["}"].Count)
require.Equal(Code, fs["}"].Kind)
require.Equal(10, fs["*/"].Count)
require.Equal(Comment, fs["*/"].Kind)
}
func TestCalculateByFile(t *testing.T) {
defer func() {
require.NoError(t, fixtures.Clean())
}()
tests := map[string]struct {
fixture *fixtures.Fixture
from plumbing.Hash
to plumbing.Hash
expected interface{}
}{
"basic": {
fixture: fixtures.ByURL("https://github.com/src-d/go-git.git").One(),
to: plumbing.NewHash("d2d68d3413353bd4bf20891ac1daa82cd6e00fb9"),
expected: []CommitFileStats{
{
Path: "common_test.go",
Language: "Go",
Blank: KindStats{Deletions: 1},
Total: KindStats{Deletions: 1},
},
{
Path: "core/storage.go",
Language: "Go",
Code: KindStats{Additions: 1},
Total: KindStats{Additions: 1},
},
{
Path: "fixtures/data/pack-a3fed42da1e8189a077c0e6846c040dcf73fc9dd.idx",
},
{
Path: "fixtures/data/pack-a3fed42da1e8189a077c0e6846c040dcf73fc9dd.pack",
},
{
Path: "fixtures/data/pack-c544593473465e6315ad4182d04d366c4592b829.idx",
},
{
Path: "fixtures/data/pack-c544593473465e6315ad4182d04d366c4592b829.pack",
},
{
Path: "fixtures/data/pack-f2e0a8889a746f7600e07d2246a2e29a72f696be.idx",
},
{
Path: "fixtures/data/pack-f2e0a8889a746f7600e07d2246a2e29a72f696be.pack",
},
{
Path: "fixtures/fixtures.go",
Language: "Go",
Code: KindStats{Additions: 83},
Blank: KindStats{Additions: 19},
Total: KindStats{Additions: 102},
},
{
Path: "formats/idxfile/decoder.go",
Language: "Go",
Code: KindStats{Additions: 3, Deletions: 1},
Blank: KindStats{Deletions: 1},
Total: KindStats{Additions: 3, Deletions: 2},
},
{
Path: "formats/idxfile/decoder_test.go",
Language: "Go",
Code: KindStats{Additions: 31, Deletions: 11},
Blank: KindStats{Additions: 7},
Total: KindStats{Additions: 38, Deletions: 11},
},
{
Path: "formats/idxfile/encoder.go",
Language: "Go",
Code: KindStats{Additions: 8, Deletions: 9},
Total: KindStats{Additions: 8, Deletions: 9},
},
{
Path: "formats/idxfile/encoder_test.go",
Language: "Go",
Code: KindStats{Additions: 16, Deletions: 27},
Comment: KindStats{Deletions: 0},
Blank: KindStats{Deletions: 3},
Other: KindStats{Deletions: 0},
Total: KindStats{Additions: 16,
Deletions: 30},
},
{
Path: "formats/idxfile/fixtures/git-fixture.idx",
},
{
Path: "formats/idxfile/idxfile.go",
Language: "Go",
Code: KindStats{Additions: 8, Deletions: 1},
Blank: KindStats{Additions: 1},
Total: KindStats{Additions: 9, Deletions: 1},
},
{
Path: "formats/packfile/decoder.go",
Language: "Go",
Code: KindStats{Additions: 56, Deletions: 70},
Comment: KindStats{Additions: 2, Deletions: 9},
Blank: KindStats{Deletions: 4},
Total: KindStats{Additions: 58, Deletions: 83},
},
{
Path: "formats/packfile/decoder_test.go",
Language: "Go",
Code: KindStats{Additions: 23, Deletions: 45},
Blank: KindStats{Deletions: 3},
Total: KindStats{Additions: 23, Deletions: 48},
},
{
Path: "formats/packfile/parser.go",
Language: "Go",
Code: KindStats{Additions: 53, Deletions: 15},
Blank: KindStats{Additions: 9},
Total: KindStats{Additions: 62, Deletions: 15},
},
{
Path: "formats/packfile/parser_test.go",
Language: "Go",
Code: KindStats{Additions: 91, Deletions: 59},
Comment: KindStats{Deletions: 328},
Blank: KindStats{Deletions: 53},
Total: KindStats{Additions: 91, Deletions: 440},
},
{
Path: "storage/filesystem/internal/dotgit/dotgit.go",
Language: "Go",
Code: KindStats{Additions: 23, Deletions: 22},
Blank: KindStats{Additions: 2},
Total: KindStats{Additions: 25, Deletions: 22},
},
{
Path: "storage/filesystem/internal/index/index.go",
Language: "Go",
Code: KindStats{Additions: 8, Deletions: 4},
Total: KindStats{Additions: 8, Deletions: 4},
},
{
Path: "storage/filesystem/object.go",
Language: "Go",
Code: KindStats{Additions: 3},
Blank: KindStats{Additions: 1},
Total: KindStats{Additions: 4},
},
{
Path: "storage/memory/storage.go",
Language: "Go",
Code: KindStats{Additions: 7},
Blank: KindStats{Additions: 3},
Total: KindStats{Additions: 10},
},
},
},
"orphan": {
fixture: fixtures.Basic().One(),
to: plumbing.NewHash("b029517f6300c2da0f4b651b8642506cd6aaf45d"),
expected: []CommitFileStats{
{
Path: "LICENSE",
Language: "Text",
Other: KindStats{Additions: 22},
Total: KindStats{Additions: 22},
},
},
},
"other": {
fixture: fixtures.Basic().One(),
to: plumbing.NewHash("b8e471f58bcbca63b07bda20e428190409c2db47"),
expected: []CommitFileStats{
{
Path: "CHANGELOG",
Other: KindStats{Additions: 1},
Total: KindStats{Additions: 1},
},
},
},
"binary": {
fixture: fixtures.Basic().One(),
to: plumbing.NewHash("35e85108805c84807bc66a02d91535e1e24b38b9"),
expected: []CommitFileStats{{Path: "binary.jpg"}},
},
"vendor": {
fixture: fixtures.Basic().One(),
to: plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"),
expected: ([]CommitFileStats)(nil),
},
"with_from": {
fixture: fixtures.Basic().One(),
to: plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"),
from: plumbing.NewHash("6ecf0ef2c2dffb796033e5a02219af86ec6584e5"),
expected: ([]CommitFileStats)(nil),
},
}
for name, test := range tests {
t.Run(name, func(t *testing.T) {
require := require.New(t)
r, err := git.Open(filesystem.NewStorage(test.fixture.DotGit(), cache.NewObjectLRUDefault()), nil)
require.NoError(err)
to, err := r.CommitObject(test.to)
require.NoError(err)
var from *object.Commit
if !test.from.IsZero() {
from, err = r.CommitObject(test.from)
require.NoError(err)
}
stats, err := CalculateByFile(r, from, to)
require.NoError(err)
assert.Equal(t, test.expected, stats)
})
}
}
|
gitql/gitql
|
internal/commitstats/file_test.go
|
GO
|
mit
| 7,310
|
package com.swfarm.biz.wish.dao.impl;
import com.swfarm.biz.wish.bo.WishVariantTemplate;
import com.swfarm.biz.wish.dao.WishVariantTemplateDao;
import com.swfarm.pub.framework.dao.GenericDaoHibernateImpl;
public class WishVariantTemplateDaoImpl extends GenericDaoHibernateImpl<WishVariantTemplate, Long>
implements WishVariantTemplateDao {
public WishVariantTemplateDaoImpl(Class<WishVariantTemplate> type) {
super(type);
}
}
|
zhangqiang110/my4j
|
pms/src/main/java/com/swfarm/biz/wish/dao/impl/WishVariantTemplateDaoImpl.java
|
Java
|
mit
| 450
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// -
// **************************** -
// ARITHMETIC CODING EXAMPLES -
// **************************** -
// -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// -
// Fast arithmetic coding implementation -
// -> 32-bit variables, 32-bit product, periodic updates, table decoding -
// -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// -
// Version 1.00 - April 25, 2004 -
// -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// -
// WARNING -
// ========= -
// -
// The only purpose of this program is to demonstrate the basic principles -
// of arithmetic coding. It is provided as is, without any express or -
// implied warranty, without even the warranty of fitness for any particular -
// purpose, or that the implementations are correct. -
// -
// Permission to copy and redistribute this code is hereby granted, provided -
// that this warning and copyright notices are not removed or altered. -
// -
// Copyright (c) 2004 by Amir Said (said@ieee.org) & -
// William A. Pearlman (pearlw@ecse.rpi.edu) -
// -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// -
// A description of the arithmetic coding method used here is available in -
// -
// Lossless Compression Handbook, ed. K. Sayood -
// Chapter 5: Arithmetic Coding (A. Said), pp. 101-152, Academic Press, 2003 -
// -
// A. Said, Introduction to Arithetic Coding Theory and Practice -
// HP Labs report HPL-2004-76 - http://www.hpl.hp.com/techreports/ -
// -
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - Definitions - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#ifndef ARITHMETIC_CODEC
#define ARITHMETIC_CODEC
#include <stdio.h>
// typedef unsigned int large ; // AJSD
typedef unsigned long long large ; // AJSD
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - Class definitions - - - - - - - - - - - - - - - - - - - - - - - - - - -
class Static_Bit_Model // static model for binary data
{
public:
Static_Bit_Model(void);
void set_probability_0(double); // set probability of symbol '0'
private: // . . . . . . . . . . . . . . . . . . . . . .
unsigned bit_0_prob;
friend class Arithmetic_Codec;
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
class Static_Data_Model // static model for general data
{
public:
Static_Data_Model(void);
~Static_Data_Model(void);
unsigned model_symbols(void) { return data_symbols; }
void set_distribution(unsigned number_of_symbols,
const double probability[] = 0); // 0 means uniform
private: // . . . . . . . . . . . . . . . . . . . . . .
unsigned * distribution, * decoder_table;
unsigned data_symbols, last_symbol, table_size, table_shift;
friend class Arithmetic_Codec;
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
class Adaptive_Bit_Model // adaptive model for binary data
{
public:
Adaptive_Bit_Model(void);
void reset(void); // reset to equiprobable model
private: // . . . . . . . . . . . . . . . . . . . . . .
void update(void);
unsigned update_cycle, bits_until_update;
unsigned bit_0_prob, bit_0_count, bit_count;
friend class Arithmetic_Codec;
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
class Adaptive_Data_Model // adaptive model for binary data
{
public:
Adaptive_Data_Model(void);
Adaptive_Data_Model(unsigned number_of_symbols);
~Adaptive_Data_Model(void);
unsigned model_symbols(void) { return data_symbols; }
void reset(void); // reset to equiprobable model
void set_alphabet(unsigned number_of_symbols);
private: // . . . . . . . . . . . . . . . . . . . . . .
void update(bool);
unsigned * distribution, * symbol_count, * decoder_table;
unsigned total_count, update_cycle, symbols_until_update;
unsigned data_symbols, last_symbol, table_size, table_shift;
friend class Arithmetic_Codec;
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// - - Encoder and decoder class - - - - - - - - - - - - - - - - - - - - - - -
// Class with both the arithmetic encoder and decoder. All compressed data is
// saved to a memory buffer
class Arithmetic_Codec
{
public:
Arithmetic_Codec(void);
~Arithmetic_Codec(void);
Arithmetic_Codec(unsigned max_code_bytes,
unsigned char * user_buffer = 0); // 0 = assign new
unsigned char * buffer(void) { return code_buffer; }
void set_buffer(unsigned max_code_bytes,
unsigned char * user_buffer = 0); // 0 = assign new
void start_encoder(void);
void start_decoder(void);
void read_from_file(FILE * code_file); // read code data, start decoder
unsigned stop_encoder(void); // returns number of bytes used
unsigned write_to_file(FILE * code_file); // stop encoder, write code data
void stop_decoder(void);
void put_bit(unsigned bit);
unsigned get_bit(void);
void put_bits(unsigned data, unsigned number_of_bits);
unsigned get_bits(unsigned number_of_bits);
void encode(unsigned bit,
Static_Bit_Model &);
unsigned decode(Static_Bit_Model &);
double data_length(unsigned bit,
Static_Bit_Model &); // AJSD
void encode(unsigned data,
Static_Data_Model &);
unsigned decode(Static_Data_Model &);
double data_length(unsigned data,
Static_Data_Model &); // AJSD
void encode(unsigned bit,
Adaptive_Bit_Model &);
unsigned decode(Adaptive_Bit_Model &);
double data_length(unsigned bit,
Adaptive_Bit_Model &); // AJSD
void encode(unsigned data,
Adaptive_Data_Model &);
unsigned decode(Adaptive_Data_Model &);
double data_length(unsigned data,
Adaptive_Data_Model &); // AJSD
unsigned bytes_coded(void);
private: // . . . . . . . . . . . . . . . . . . . . . .
void propagate_carry(void);
void renorm_enc_interval(void);
void renorm_dec_interval(void);
unsigned char * code_buffer, * new_buffer, * ac_pointer;
// unsigned base, value, length; // arithmetic coding state
large base, value, length; // AJSD // arithmetic coding state
unsigned buffer_size, mode; // mode: 0 = undef, 1 = encoder, 2 = decoder
};
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#endif
|
mtcheou/adsp
|
program/encode/src/arithmetic_codec.h
|
C
|
mit
| 8,608
|
var Adapter = require('../factory-girl').Adapter;
var tests = require('./adapter-tests');
var should = require('should');
var context = describe;
var TestModel = function(props) {
this.props = props;
};
var TestAdapter = function() {
this.db = [];
};
TestAdapter.prototype = new Adapter();
TestAdapter.prototype.save = function(doc, Model, cb) {
this.db.push(doc);
process.nextTick(function() {
cb(null, doc);
});
};
TestAdapter.prototype.destroy = function(doc, Model, cb) {
var db = this.db;
var i = db.indexOf(doc);
if (i != -1) this.db = db.slice(0, i).concat(db.slice(i + 1));
process.nextTick(cb);
};
describe('test adapter', function() {
var adapter = new TestAdapter();
tests(adapter, TestModel, countModels);
function countModels(cb) {
process.nextTick(function() {
cb(null, adapter.db.length);
});
}
});
|
celsomarques/factory-girl-amd
|
test/adapter-test.js
|
JavaScript
|
mit
| 861
|
import numpy
arr = numpy.array(list(map(float, input().split())))
x = float(input())
value = numpy.polyval(arr, x)
print(value)
|
avtomato/HackerRank
|
Python/_16_Numpy/_14_Polynomials/solution.py
|
Python
|
mit
| 130
|
---
title: E Re dhe e Rinovuar
date: 14/02/2022
---
Krahasoni Hebrenjve 8: 10–12 me Ligjin e Përtërirë 6: 4–6; Ligjin e Përtërirë 30: 11–14 dhe Jeremia 31: 31–34. Çfarë na mëson kjo për natyrën e besëlidhjes së re?
Premtimi i një besëlidhjeje të re tek Hebrenjtë i referohet Jeremias. Sipas Jeremias, premtimi i Perëndisë për një besëlidhje të re ishte në fakt një rinovim i besëlidhjes, që Ai kishte bërë së pari me Izraelin nëpërmjet Moisiut (Jer. 31: 31–34). Mund të argumentohet, pra, se Jeremia 31 nuk po fliste saktësisht për një besëlidhje "të re", por për një "rinovim" të besëlidhjes fillestare me Izraelin. Në fakt, fjala hebraike për “të re”, hadashah, mund të ketë kuptimin e "rinovimit" dhe "të ri".
Çështja me besëlidhjen e vjetër ishte se njerëzit e thyen atë (Heb. 8: 8, 9). Besëlidhja nuk ishte e gabuar, por njerëzit ishin të tillë. Nëse Izraeli do të kishte parë përmes simboleve Mesinë që po vinte dhe do të kishin besuar në Të, besëlidhja nuk do të ishte thyer. Megjithatë, për të qenë të drejtë, kishte shumë besimtarë gjatë historisë izraelite, në të cilët u përmbushën qëllimet e besëlidhjes dhe që kishin ligjin në zemrat e tyre (Psa. 37:31; Psa. 40: 8; Psa. 119: 11; Isa 51: 7).
E, ndërsa besëlidhja e re është një përtëritje e besëlidhjes së vjetër, ka një kuptim në të cilën ajo është, me të vërtetë, e re. Premtimi i Jeremias për një "besëlidhje të re" nuk parashikonte thjesht një rinovim të kushteve që ekzistonin para ekzilit, të cilat ishin thyer dhe rinovuar disa herë, sepse kombi kishte rënë disa herë në apostazi. Dhe kjo, sepse njerëzit thjesht nuk ishin të gatshëm të mbanin besëlidhjen me Perëndinë (Jer. 13:23).
Kështu, Perëndia premtoi se do të bënte një "gjë të re" (Jer. 31:22). Besëlidhja nuk do të ishte si besëlidhja që Perëndia kishte bërë "me etërit e tyre" (Jer. 31:32). Për shkak të mosbesimit të njerëzve, premtimet që Perëndia bëri nën besëlidhjen e Moisiut nuk u përmbushën kurrë. Tani, në sajë të garancisë së dhënë nga Biri (Heb. 7:22), Perëndia do të përmbushte qëllimet e besëlidhjes së Tij. Perëndia nuk e ndryshoi ligjin e Tij dhe nuk i uli standartet e Tij; në vend të kësaj, Ai dërgoi Birin e Tij si një garanci për premtimet e besëlidhjes (Heb. 7:22; Heb. 6: 18–20). Kjo është arsyeja pse kjo besëlidhje nuk ka mallkime. Ka vetëm bekime, sepse Jezusi e përmbushi atë në mënyrë të përsosur.
`Lexoni 2 Timoteut 2:13. Çfarë mund të mësojmë nga besnikëria e Perëndisë ndaj popullit të Tij dhe ndaj planeve të Tij, ndërsa marrim parasysh marrëdhëniet tona me të tjerët dhe planet tona?`
|
Adventech/sabbath-school-lessons
|
src/sq/2022-01/08/03.md
|
Markdown
|
mit
| 2,769
|
<div ng-controller="PiecesCtrl">
<!--div class="col-xs-3 container">
<h1>Dummy</h1>
<canvas id="doughnut" class="chart chart-doughnut"
chart-data="chartData" chart-labels="chartLabels" chart-legend="true" chart-colours="colours" chart-options="chartOptions">
</canvas>
</div-->
<div class="container">
<div class="row">
<div class="col-sm-6" ng-repeat="chauffage in chauffages.data">{{chauffage.pieceDisplayName}}</div>
</div>
</div>
<div class="container"><h1><a class="refresh" ng-click="refresh()"><img src="bootstrap/glyphicons/glyphicons-82-refresh.png"/> Rafraichir les données</a></h1></div>
<div class="container">
<h2>Objet pieces : </h2>
<pre class="prettyprint linenums">{{displayFormattedJson(pieces)}}</pre>
</div>
<div class="container">
<h2>Objet chauffages : </h2>
<pre class="prettyprint linenums">{{displayFormattedJson(chauffages.data)}}</pre>
</div>
<div class="container" ng-controller="ActiveTabCtrl">
<h2>Objet piecesActiveTab : </h2>
<pre class="prettyprint linenums">{{displayFormattedJson(piecesActiveTab)}}</pre>
</div>
</div>
|
jbelloin/labelloinbox
|
app/pageTest.html
|
HTML
|
mit
| 1,232
|
require 'rails_helper'
RSpec.describe Admin::ExportController do
let(:plain_user) { create(:user) }
let(:admin_user) { create(:admin) }
describe 'GET row Export Positions to Org' do
it 'runs the RowExportPositionsToOrgsJob class' do
establish_current_user(admin_user)
p1 = create(:position, position_code: 'S97956')
o1 = create(:org_hierarchy, alpha_numeric: 'H30')
p1.org_hierarchies << o1
get :row_export_positions_to_org
expect(response.body).to include('Position,Org Code')
expect(response.body).to include('S97956,H30')
end
it 'requires admin privs' do
establish_current_user(plain_user)
# don't actually start the job!
allow_any_instance_of(RowExportPositionsToOrgsJob).to receive(:perform)
get :row_export_positions_to_org
expect(response.status).to eq(403)
end
end
end
|
ndoit/fenrir
|
old_spec/controllers/admin/export_controller_spec.rb
|
Ruby
|
mit
| 876
|
/*
AngularJS v1.2.19
(c) 2010-2014 Google, Inc. http://angularjs.org
License: MIT
*/
(function(T,V,s){'use strict';function v(b){return function(){var a=arguments[0],c,a="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.2.19/"+(b?b+"/":"")+a;for(c=1;c<arguments.length;c++)a=a+(1==c?"?":"&")+"p"+(c-1)+"="+encodeURIComponent("function"==typeof arguments[c]?arguments[c].toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof arguments[c]?"undefined":"string"!=typeof arguments[c]?JSON.stringify(arguments[c]):arguments[c]);return Error(a)}}function db(b){if(null==b||Ea(b))return!1;
var a=b.length;return 1===b.nodeType&&a?!0:y(b)||L(b)||0===a||"number"===typeof a&&0<a&&a-1 in b}function q(b,a,c){var d;if(b)if(O(b))for(d in b)"prototype"==d||("length"==d||"name"==d||b.hasOwnProperty&&!b.hasOwnProperty(d))||a.call(c,b[d],d);else if(b.forEach&&b.forEach!==q)b.forEach(a,c);else if(db(b))for(d=0;d<b.length;d++)a.call(c,b[d],d);else for(d in b)b.hasOwnProperty(d)&&a.call(c,b[d],d);return b}function Vb(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}function Tc(b,
a,c){for(var d=Vb(b),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}function Wb(b){return function(a,c){b(c,a)}}function eb(){for(var b=ka.length,a;b;){b--;a=ka[b].charCodeAt(0);if(57==a)return ka[b]="A",ka.join("");if(90==a)ka[b]="0";else return ka[b]=String.fromCharCode(a+1),ka.join("")}ka.unshift("0");return ka.join("")}function Xb(b,a){a?b.$$hashKey=a:delete b.$$hashKey}function E(b){var a=b.$$hashKey;q(arguments,function(a){a!==b&&q(a,function(a,c){b[c]=a})});Xb(b,a);return b}function Z(b){return parseInt(b,
10)}function Yb(b,a){return E(new (E(function(){},{prototype:b})),a)}function A(){}function Fa(b){return b}function $(b){return function(){return b}}function D(b){return"undefined"===typeof b}function B(b){return"undefined"!==typeof b}function U(b){return null!=b&&"object"===typeof b}function y(b){return"string"===typeof b}function xb(b){return"number"===typeof b}function Oa(b){return"[object Date]"===xa.call(b)}function O(b){return"function"===typeof b}function fb(b){return"[object RegExp]"===xa.call(b)}
function Ea(b){return b&&b.document&&b.location&&b.alert&&b.setInterval}function Uc(b){return!(!b||!(b.nodeName||b.prop&&b.attr&&b.find))}function Vc(b,a,c){var d=[];q(b,function(b,g,f){d.push(a.call(c,b,g,f))});return d}function Pa(b,a){if(b.indexOf)return b.indexOf(a);for(var c=0;c<b.length;c++)if(a===b[c])return c;return-1}function Qa(b,a){var c=Pa(b,a);0<=c&&b.splice(c,1);return a}function Ga(b,a,c,d){if(Ea(b)||b&&b.$evalAsync&&b.$watch)throw Ra("cpws");if(a){if(b===a)throw Ra("cpi");c=c||[];
d=d||[];if(U(b)){var e=Pa(c,b);if(-1!==e)return d[e];c.push(b);d.push(a)}if(L(b))for(var g=a.length=0;g<b.length;g++)e=Ga(b[g],null,c,d),U(b[g])&&(c.push(b[g]),d.push(e)),a.push(e);else{var f=a.$$hashKey;q(a,function(b,c){delete a[c]});for(g in b)e=Ga(b[g],null,c,d),U(b[g])&&(c.push(b[g]),d.push(e)),a[g]=e;Xb(a,f)}}else(a=b)&&(L(b)?a=Ga(b,[],c,d):Oa(b)?a=new Date(b.getTime()):fb(b)?a=RegExp(b.source):U(b)&&(a=Ga(b,{},c,d)));return a}function la(b,a){if(L(b)){a=a||[];for(var c=0;c<b.length;c++)a[c]=
b[c]}else if(U(b))for(c in a=a||{},b)!yb.call(b,c)||"$"===c.charAt(0)&&"$"===c.charAt(1)||(a[c]=b[c]);return a||b}function ya(b,a){if(b===a)return!0;if(null===b||null===a)return!1;if(b!==b&&a!==a)return!0;var c=typeof b,d;if(c==typeof a&&"object"==c)if(L(b)){if(!L(a))return!1;if((c=b.length)==a.length){for(d=0;d<c;d++)if(!ya(b[d],a[d]))return!1;return!0}}else{if(Oa(b))return Oa(a)&&b.getTime()==a.getTime();if(fb(b)&&fb(a))return b.toString()==a.toString();if(b&&b.$evalAsync&&b.$watch||a&&a.$evalAsync&&
a.$watch||Ea(b)||Ea(a)||L(a))return!1;c={};for(d in b)if("$"!==d.charAt(0)&&!O(b[d])){if(!ya(b[d],a[d]))return!1;c[d]=!0}for(d in a)if(!c.hasOwnProperty(d)&&"$"!==d.charAt(0)&&a[d]!==s&&!O(a[d]))return!1;return!0}return!1}function Zb(){return V.securityPolicy&&V.securityPolicy.isActive||V.querySelector&&!(!V.querySelector("[ng-csp]")&&!V.querySelector("[data-ng-csp]"))}function zb(b,a){var c=2<arguments.length?za.call(arguments,2):[];return!O(a)||a instanceof RegExp?a:c.length?function(){return arguments.length?
a.apply(b,c.concat(za.call(arguments,0))):a.apply(b,c)}:function(){return arguments.length?a.apply(b,arguments):a.call(b)}}function Wc(b,a){var c=a;"string"===typeof b&&"$"===b.charAt(0)?c=s:Ea(a)?c="$WINDOW":a&&V===a?c="$DOCUMENT":a&&(a.$evalAsync&&a.$watch)&&(c="$SCOPE");return c}function sa(b,a){return"undefined"===typeof b?s:JSON.stringify(b,Wc,a?" ":null)}function $b(b){return y(b)?JSON.parse(b):b}function Sa(b){"function"===typeof b?b=!0:b&&0!==b.length?(b=I(""+b),b=!("f"==b||"0"==b||"false"==
b||"no"==b||"n"==b||"[]"==b)):b=!1;return b}function ga(b){b=x(b).clone();try{b.empty()}catch(a){}var c=x("<div>").append(b).html();try{return 3===b[0].nodeType?I(c):c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+I(b)})}catch(d){return I(c)}}function ac(b){try{return decodeURIComponent(b)}catch(a){}}function bc(b){var a={},c,d;q((b||"").split("&"),function(b){b&&(c=b.split("="),d=ac(c[0]),B(d)&&(b=B(c[1])?ac(c[1]):!0,a[d]?L(a[d])?a[d].push(b):a[d]=[a[d],b]:a[d]=b))});return a}
function Ab(b){var a=[];q(b,function(b,d){L(b)?q(b,function(b){a.push(Aa(d,!0)+(!0===b?"":"="+Aa(b,!0)))}):a.push(Aa(d,!0)+(!0===b?"":"="+Aa(b,!0)))});return a.length?a.join("&"):""}function gb(b){return Aa(b,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function Aa(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,a?"%20":"+")}function Xc(b,a){function c(a){a&&d.push(a)}var d=[b],e,g,f=["ng:app",
"ng-app","x-ng-app","data-ng-app"],k=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;q(f,function(a){f[a]=!0;c(V.getElementById(a));a=a.replace(":","\\:");b.querySelectorAll&&(q(b.querySelectorAll("."+a),c),q(b.querySelectorAll("."+a+"\\:"),c),q(b.querySelectorAll("["+a+"]"),c))});q(d,function(a){if(!e){var b=k.exec(" "+a.className+" ");b?(e=a,g=(b[2]||"").replace(/\s+/g,",")):q(a.attributes,function(b){!e&&f[b.name]&&(e=a,g=b.value)})}});e&&a(e,g?[g]:[])}function cc(b,a){var c=function(){b=x(b);if(b.injector()){var c=
b[0]===V?"document":ga(b);throw Ra("btstrpd",c);}a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);a.unshift("ng");c=dc(a);c.invoke(["$rootScope","$rootElement","$compile","$injector","$animate",function(a,b,c,d,e){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},d=/^NG_DEFER_BOOTSTRAP!/;if(T&&!d.test(T.name))return c();T.name=T.name.replace(d,"");Ta.resumeBootstrap=function(b){q(b,function(b){a.push(b)});c()}}function hb(b,a){a=a||"_";return b.replace(Yc,function(b,
d){return(d?a:"")+b.toLowerCase()})}function Bb(b,a,c){if(!b)throw Ra("areq",a||"?",c||"required");return b}function Ua(b,a,c){c&&L(b)&&(b=b[b.length-1]);Bb(O(b),a,"not a function, got "+(b&&"object"===typeof b?b.constructor.name||"Object":typeof b));return b}function Ba(b,a){if("hasOwnProperty"===b)throw Ra("badname",a);}function ec(b,a,c){if(!a)return b;a=a.split(".");for(var d,e=b,g=a.length,f=0;f<g;f++)d=a[f],b&&(b=(e=b)[d]);return!c&&O(b)?zb(e,b):b}function Cb(b){var a=b[0];b=b[b.length-1];if(a===
b)return x(a);var c=[a];do{a=a.nextSibling;if(!a)break;c.push(a)}while(a!==b);return x(c)}function Zc(b){var a=v("$injector"),c=v("ng");b=b.angular||(b.angular={});b.$$minErr=b.$$minErr||v;return b.module||(b.module=function(){var b={};return function(e,g,f){if("hasOwnProperty"===e)throw c("badname","module");g&&b.hasOwnProperty(e)&&(b[e]=null);return b[e]||(b[e]=function(){function b(a,d,e){return function(){c[e||"push"]([a,d,arguments]);return p}}if(!g)throw a("nomod",e);var c=[],d=[],l=b("$injector",
"invoke"),p={_invokeQueue:c,_runBlocks:d,requires:g,name:e,provider:b("$provide","provider"),factory:b("$provide","factory"),service:b("$provide","service"),value:b("$provide","value"),constant:b("$provide","constant","unshift"),animation:b("$animateProvider","register"),filter:b("$filterProvider","register"),controller:b("$controllerProvider","register"),directive:b("$compileProvider","directive"),config:l,run:function(a){d.push(a);return this}};f&&l(f);return p}())}}())}function $c(b){E(b,{bootstrap:cc,
copy:Ga,extend:E,equals:ya,element:x,forEach:q,injector:dc,noop:A,bind:zb,toJson:sa,fromJson:$b,identity:Fa,isUndefined:D,isDefined:B,isString:y,isFunction:O,isObject:U,isNumber:xb,isElement:Uc,isArray:L,version:ad,isDate:Oa,lowercase:I,uppercase:Ha,callbacks:{counter:0},$$minErr:v,$$csp:Zb});Va=Zc(T);try{Va("ngLocale")}catch(a){Va("ngLocale",[]).provider("$locale",bd)}Va("ng",["ngLocale"],["$provide",function(a){a.provider({$$sanitizeUri:cd});a.provider("$compile",fc).directive({a:dd,input:gc,textarea:gc,
form:ed,script:fd,select:gd,style:hd,option:id,ngBind:jd,ngBindHtml:kd,ngBindTemplate:ld,ngClass:md,ngClassEven:nd,ngClassOdd:od,ngCloak:pd,ngController:qd,ngForm:rd,ngHide:sd,ngIf:td,ngInclude:ud,ngInit:vd,ngNonBindable:wd,ngPluralize:xd,ngRepeat:yd,ngShow:zd,ngStyle:Ad,ngSwitch:Bd,ngSwitchWhen:Cd,ngSwitchDefault:Dd,ngOptions:Ed,ngTransclude:Fd,ngModel:Gd,ngList:Hd,ngChange:Id,required:hc,ngRequired:hc,ngValue:Jd}).directive({ngInclude:Kd}).directive(Db).directive(ic);a.provider({$anchorScroll:Ld,
$animate:Md,$browser:Nd,$cacheFactory:Od,$controller:Pd,$document:Qd,$exceptionHandler:Rd,$filter:jc,$interpolate:Sd,$interval:Td,$http:Ud,$httpBackend:Vd,$location:Wd,$log:Xd,$parse:Yd,$rootScope:Zd,$q:$d,$sce:ae,$sceDelegate:be,$sniffer:ce,$templateCache:de,$timeout:ee,$window:fe,$$rAF:ge,$$asyncCallback:he})}])}function Wa(b){return b.replace(ie,function(a,b,d,e){return e?d.toUpperCase():d}).replace(je,"Moz$1")}function Eb(b,a,c,d){function e(b){var e=c&&b?[this.filter(b)]:[this],m=a,h,l,p,n,r,
t;if(!d||null!=b)for(;e.length;)for(h=e.shift(),l=0,p=h.length;l<p;l++)for(n=x(h[l]),m?n.triggerHandler("$destroy"):m=!m,r=0,n=(t=n.children()).length;r<n;r++)e.push(Ca(t[r]));return g.apply(this,arguments)}var g=Ca.fn[b],g=g.$original||g;e.$original=g;Ca.fn[b]=e}function S(b){if(b instanceof S)return b;y(b)&&(b=aa(b));if(!(this instanceof S)){if(y(b)&&"<"!=b.charAt(0))throw Fb("nosel");return new S(b)}if(y(b)){var a=b;b=V;var c;if(c=ke.exec(a))b=[b.createElement(c[1])];else{var d=b,e;b=d.createDocumentFragment();
c=[];if(Gb.test(a)){d=b.appendChild(d.createElement("div"));e=(le.exec(a)||["",""])[1].toLowerCase();e=ea[e]||ea._default;d.innerHTML="<div> </div>"+e[1]+a.replace(me,"<$1></$2>")+e[2];d.removeChild(d.firstChild);for(a=e[0];a--;)d=d.lastChild;a=0;for(e=d.childNodes.length;a<e;++a)c.push(d.childNodes[a]);d=b.firstChild;d.textContent=""}else c.push(d.createTextNode(a));b.textContent="";b.innerHTML="";b=c}Hb(this,b);x(V.createDocumentFragment()).append(this)}else Hb(this,b)}function Ib(b){return b.cloneNode(!0)}
function Ia(b){kc(b);var a=0;for(b=b.childNodes||[];a<b.length;a++)Ia(b[a])}function lc(b,a,c,d){if(B(d))throw Fb("offargs");var e=ma(b,"events");ma(b,"handle")&&(D(a)?q(e,function(a,c){Xa(b,c,a);delete e[c]}):q(a.split(" "),function(a){D(c)?(Xa(b,a,e[a]),delete e[a]):Qa(e[a]||[],c)}))}function kc(b,a){var c=b.ng339,d=Ya[c];d&&(a?delete Ya[c].data[a]:(d.handle&&(d.events.$destroy&&d.handle({},"$destroy"),lc(b)),delete Ya[c],b.ng339=s))}function ma(b,a,c){var d=b.ng339,d=Ya[d||-1];if(B(c))d||(b.ng339=
d=++ne,d=Ya[d]={}),d[a]=c;else return d&&d[a]}function mc(b,a,c){var d=ma(b,"data"),e=B(c),g=!e&&B(a),f=g&&!U(a);d||f||ma(b,"data",d={});if(e)d[a]=c;else if(g){if(f)return d&&d[a];E(d,a)}else return d}function Jb(b,a){return b.getAttribute?-1<(" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+a+" "):!1}function ib(b,a){a&&b.setAttribute&&q(a.split(" "),function(a){b.setAttribute("class",aa((" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").replace(" "+aa(a)+" ",
" ")))})}function jb(b,a){if(a&&b.setAttribute){var c=(" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");q(a.split(" "),function(a){a=aa(a);-1===c.indexOf(" "+a+" ")&&(c+=a+" ")});b.setAttribute("class",aa(c))}}function Hb(b,a){if(a){a=a.nodeName||!B(a.length)||Ea(a)?[a]:a;for(var c=0;c<a.length;c++)b.push(a[c])}}function nc(b,a){return kb(b,"$"+(a||"ngController")+"Controller")}function kb(b,a,c){b=x(b);9==b[0].nodeType&&(b=b.find("html"));for(a=L(a)?a:[a];b.length;){for(var d=b[0],e=
0,g=a.length;e<g;e++)if((c=b.data(a[e]))!==s)return c;b=x(d.parentNode||11===d.nodeType&&d.host)}}function oc(b){for(var a=0,c=b.childNodes;a<c.length;a++)Ia(c[a]);for(;b.firstChild;)b.removeChild(b.firstChild)}function pc(b,a){var c=lb[a.toLowerCase()];return c&&qc[b.nodeName]&&c}function oe(b,a){var c=function(c,e){c.preventDefault||(c.preventDefault=function(){c.returnValue=!1});c.stopPropagation||(c.stopPropagation=function(){c.cancelBubble=!0});c.target||(c.target=c.srcElement||V);if(D(c.defaultPrevented)){var g=
c.preventDefault;c.preventDefault=function(){c.defaultPrevented=!0;g.call(c)};c.defaultPrevented=!1}c.isDefaultPrevented=function(){return c.defaultPrevented||!1===c.returnValue};var f=la(a[e||c.type]||[]);q(f,function(a){a.call(b,c)});8>=P?(c.preventDefault=null,c.stopPropagation=null,c.isDefaultPrevented=null):(delete c.preventDefault,delete c.stopPropagation,delete c.isDefaultPrevented)};c.elem=b;return c}function Ja(b,a){var c=typeof b,d;"function"==c||"object"==c&&null!==b?"function"==typeof(d=
b.$$hashKey)?d=b.$$hashKey():d===s&&(d=b.$$hashKey=(a||eb)()):d=b;return c+":"+d}function Za(b,a){if(a){var c=0;this.nextUid=function(){return++c}}q(b,this.put,this)}function rc(b){var a,c;"function"===typeof b?(a=b.$inject)||(a=[],b.length&&(c=b.toString().replace(pe,""),c=c.match(qe),q(c[1].split(re),function(b){b.replace(se,function(b,c,d){a.push(d)})})),b.$inject=a):L(b)?(c=b.length-1,Ua(b[c],"fn"),a=b.slice(0,c)):Ua(b,"fn",!0);return a}function dc(b){function a(a){return function(b,c){if(U(b))q(b,
Wb(a));else return a(b,c)}}function c(a,b){Ba(a,"service");if(O(b)||L(b))b=p.instantiate(b);if(!b.$get)throw $a("pget",a);return l[a+k]=b}function d(a,b){return c(a,{$get:b})}function e(a){var b=[],c,d,g,k;q(a,function(a){if(!h.get(a)){h.put(a,!0);try{if(y(a))for(c=Va(a),b=b.concat(e(c.requires)).concat(c._runBlocks),d=c._invokeQueue,g=0,k=d.length;g<k;g++){var f=d[g],m=p.get(f[0]);m[f[1]].apply(m,f[2])}else O(a)?b.push(p.invoke(a)):L(a)?b.push(p.invoke(a)):Ua(a,"module")}catch(l){throw L(a)&&(a=
a[a.length-1]),l.message&&(l.stack&&-1==l.stack.indexOf(l.message))&&(l=l.message+"\n"+l.stack),$a("modulerr",a,l.stack||l.message||l);}}});return b}function g(a,b){function c(d){if(a.hasOwnProperty(d)){if(a[d]===f)throw $a("cdep",d+" <- "+m.join(" <- "));return a[d]}try{return m.unshift(d),a[d]=f,a[d]=b(d)}catch(e){throw a[d]===f&&delete a[d],e;}finally{m.shift()}}function d(a,b,e){var g=[],k=rc(a),f,m,h;m=0;for(f=k.length;m<f;m++){h=k[m];if("string"!==typeof h)throw $a("itkn",h);g.push(e&&e.hasOwnProperty(h)?
e[h]:c(h))}L(a)&&(a=a[f]);return a.apply(b,g)}return{invoke:d,instantiate:function(a,b){var c=function(){},e;c.prototype=(L(a)?a[a.length-1]:a).prototype;c=new c;e=d(a,c,b);return U(e)||O(e)?e:c},get:c,annotate:rc,has:function(b){return l.hasOwnProperty(b+k)||a.hasOwnProperty(b)}}}var f={},k="Provider",m=[],h=new Za([],!0),l={$provide:{provider:a(c),factory:a(d),service:a(function(a,b){return d(a,["$injector",function(a){return a.instantiate(b)}])}),value:a(function(a,b){return d(a,$(b))}),constant:a(function(a,
b){Ba(a,"constant");l[a]=b;n[a]=b}),decorator:function(a,b){var c=p.get(a+k),d=c.$get;c.$get=function(){var a=r.invoke(d,c);return r.invoke(b,null,{$delegate:a})}}}},p=l.$injector=g(l,function(){throw $a("unpr",m.join(" <- "));}),n={},r=n.$injector=g(n,function(a){a=p.get(a+k);return r.invoke(a.$get,a)});q(e(b),function(a){r.invoke(a||A)});return r}function Ld(){var b=!0;this.disableAutoScrolling=function(){b=!1};this.$get=["$window","$location","$rootScope",function(a,c,d){function e(a){var b=null;
q(a,function(a){b||"a"!==I(a.nodeName)||(b=a)});return b}function g(){var b=c.hash(),d;b?(d=f.getElementById(b))?d.scrollIntoView():(d=e(f.getElementsByName(b)))?d.scrollIntoView():"top"===b&&a.scrollTo(0,0):a.scrollTo(0,0)}var f=a.document;b&&d.$watch(function(){return c.hash()},function(){d.$evalAsync(g)});return g}]}function he(){this.$get=["$$rAF","$timeout",function(b,a){return b.supported?function(a){return b(a)}:function(b){return a(b,0,!1)}}]}function te(b,a,c,d){function e(a){try{a.apply(null,
za.call(arguments,1))}finally{if(t--,0===t)for(;J.length;)try{J.pop()()}catch(b){c.error(b)}}}function g(a,b){(function ba(){q(w,function(a){a()});u=b(ba,a)})()}function f(){z=null;K!=k.url()&&(K=k.url(),q(ha,function(a){a(k.url())}))}var k=this,m=a[0],h=b.location,l=b.history,p=b.setTimeout,n=b.clearTimeout,r={};k.isMock=!1;var t=0,J=[];k.$$completeOutstandingRequest=e;k.$$incOutstandingRequestCount=function(){t++};k.notifyWhenNoOutstandingRequests=function(a){q(w,function(a){a()});0===t?a():J.push(a)};
var w=[],u;k.addPollFn=function(a){D(u)&&g(100,p);w.push(a);return a};var K=h.href,Q=a.find("base"),z=null;k.url=function(a,c){h!==b.location&&(h=b.location);l!==b.history&&(l=b.history);if(a){if(K!=a)return K=a,d.history?c?l.replaceState(null,"",a):(l.pushState(null,"",a),Q.attr("href",Q.attr("href"))):(z=a,c?h.replace(a):h.href=a),k}else return z||h.href.replace(/%27/g,"'")};var ha=[],N=!1;k.onUrlChange=function(a){if(!N){if(d.history)x(b).on("popstate",f);if(d.hashchange)x(b).on("hashchange",f);
else k.addPollFn(f);N=!0}ha.push(a);return a};k.baseHref=function(){var a=Q.attr("href");return a?a.replace(/^(https?\:)?\/\/[^\/]*/,""):""};var M={},ca="",C=k.baseHref();k.cookies=function(a,b){var d,e,g,k;if(a)b===s?m.cookie=escape(a)+"=;path="+C+";expires=Thu, 01 Jan 1970 00:00:00 GMT":y(b)&&(d=(m.cookie=escape(a)+"="+escape(b)+";path="+C).length+1,4096<d&&c.warn("Cookie '"+a+"' possibly not set or overflowed because it was too large ("+d+" > 4096 bytes)!"));else{if(m.cookie!==ca)for(ca=m.cookie,
d=ca.split("; "),M={},g=0;g<d.length;g++)e=d[g],k=e.indexOf("="),0<k&&(a=unescape(e.substring(0,k)),M[a]===s&&(M[a]=unescape(e.substring(k+1))));return M}};k.defer=function(a,b){var c;t++;c=p(function(){delete r[c];e(a)},b||0);r[c]=!0;return c};k.defer.cancel=function(a){return r[a]?(delete r[a],n(a),e(A),!0):!1}}function Nd(){this.$get=["$window","$log","$sniffer","$document",function(b,a,c,d){return new te(b,d,a,c)}]}function Od(){this.$get=function(){function b(b,d){function e(a){a!=p&&(n?n==a&&
(n=a.n):n=a,g(a.n,a.p),g(a,p),p=a,p.n=null)}function g(a,b){a!=b&&(a&&(a.p=b),b&&(b.n=a))}if(b in a)throw v("$cacheFactory")("iid",b);var f=0,k=E({},d,{id:b}),m={},h=d&&d.capacity||Number.MAX_VALUE,l={},p=null,n=null;return a[b]={put:function(a,b){if(h<Number.MAX_VALUE){var c=l[a]||(l[a]={key:a});e(c)}if(!D(b))return a in m||f++,m[a]=b,f>h&&this.remove(n.key),b},get:function(a){if(h<Number.MAX_VALUE){var b=l[a];if(!b)return;e(b)}return m[a]},remove:function(a){if(h<Number.MAX_VALUE){var b=l[a];if(!b)return;
b==p&&(p=b.p);b==n&&(n=b.n);g(b.n,b.p);delete l[a]}delete m[a];f--},removeAll:function(){m={};f=0;l={};p=n=null},destroy:function(){l=k=m=null;delete a[b]},info:function(){return E({},k,{size:f})}}}var a={};b.info=function(){var b={};q(a,function(a,e){b[e]=a.info()});return b};b.get=function(b){return a[b]};return b}}function de(){this.$get=["$cacheFactory",function(b){return b("templates")}]}function fc(b,a){var c={},d="Directive",e=/^\s*directive\:\s*([\d\w_\-]+)\s+(.*)$/,g=/(([\d\w_\-]+)(?:\:([^;]+))?;?)/,
f=/^(on[a-z]+|formaction)$/;this.directive=function m(a,e){Ba(a,"directive");y(a)?(Bb(e,"directiveFactory"),c.hasOwnProperty(a)||(c[a]=[],b.factory(a+d,["$injector","$exceptionHandler",function(b,d){var e=[];q(c[a],function(c,g){try{var f=b.invoke(c);O(f)?f={compile:$(f)}:!f.compile&&f.link&&(f.compile=$(f.link));f.priority=f.priority||0;f.index=g;f.name=f.name||a;f.require=f.require||f.controller&&f.name;f.restrict=f.restrict||"A";e.push(f)}catch(m){d(m)}});return e}])),c[a].push(e)):q(a,Wb(m));
return this};this.aHrefSanitizationWhitelist=function(b){return B(b)?(a.aHrefSanitizationWhitelist(b),this):a.aHrefSanitizationWhitelist()};this.imgSrcSanitizationWhitelist=function(b){return B(b)?(a.imgSrcSanitizationWhitelist(b),this):a.imgSrcSanitizationWhitelist()};this.$get=["$injector","$interpolate","$exceptionHandler","$http","$templateCache","$parse","$controller","$rootScope","$document","$sce","$animate","$$sanitizeUri",function(a,b,l,p,n,r,t,J,w,u,K,Q){function z(a,b,c,d,e){a instanceof
x||(a=x(a));q(a,function(b,c){3==b.nodeType&&b.nodeValue.match(/\S+/)&&(a[c]=x(b).wrap("<span></span>").parent()[0])});var g=N(a,b,a,c,d,e);ha(a,"ng-scope");return function(b,c,d,e){Bb(b,"scope");var f=c?Ka.clone.call(a):a;q(d,function(a,b){f.data("$"+b+"Controller",a)});d=0;for(var m=f.length;d<m;d++){var h=f[d].nodeType;1!==h&&9!==h||f.eq(d).data("$scope",b)}c&&c(f,b);g&&g(b,f,f,e);return f}}function ha(a,b){try{a.addClass(b)}catch(c){}}function N(a,b,c,d,e,g){function f(a,c,d,e){var g,h,l,r,p,
n,t;g=c.length;var w=Array(g);for(p=0;p<g;p++)w[p]=c[p];t=p=0;for(n=m.length;p<n;t++)h=w[t],c=m[p++],g=m[p++],l=x(h),c?(c.scope?(r=a.$new(),l.data("$scope",r)):r=a,l=c.transcludeOnThisElement?M(a,c.transclude,e):!c.templateOnThisElement&&e?e:!e&&b?M(a,b):null,c(g,r,h,d,l)):g&&g(a,h.childNodes,s,e)}for(var m=[],h,l,r,p,n=0;n<a.length;n++)h=new Kb,l=ca(a[n],[],h,0===n?d:s,e),(g=l.length?H(l,a[n],h,b,c,null,[],[],g):null)&&g.scope&&ha(x(a[n]),"ng-scope"),h=g&&g.terminal||!(r=a[n].childNodes)||!r.length?
null:N(r,g?(g.transcludeOnThisElement||!g.templateOnThisElement)&&g.transclude:b),m.push(g,h),p=p||g||h,g=null;return p?f:null}function M(a,b,c){return function(d,e,g){var f=!1;d||(d=a.$new(),f=d.$$transcluded=!0);e=b(d,e,g,c);if(f)e.on("$destroy",function(){d.$destroy()});return e}}function ca(a,b,c,d,f){var h=c.$attr,m;switch(a.nodeType){case 1:ba(b,na(La(a).toLowerCase()),"E",d,f);for(var l,r,p,n=a.attributes,t=0,w=n&&n.length;t<w;t++){var J=!1,K=!1;l=n[t];if(!P||8<=P||l.specified){m=l.name;r=
aa(l.value);l=na(m);if(p=W.test(l))m=hb(l.substr(6),"-");var u=l.replace(/(Start|End)$/,"");l===u+"Start"&&(J=m,K=m.substr(0,m.length-5)+"end",m=m.substr(0,m.length-6));l=na(m.toLowerCase());h[l]=m;if(p||!c.hasOwnProperty(l))c[l]=r,pc(a,l)&&(c[l]=!0);S(a,b,r,l);ba(b,l,"A",d,f,J,K)}}a=a.className;if(y(a)&&""!==a)for(;m=g.exec(a);)l=na(m[2]),ba(b,l,"C",d,f)&&(c[l]=aa(m[3])),a=a.substr(m.index+m[0].length);break;case 3:v(b,a.nodeValue);break;case 8:try{if(m=e.exec(a.nodeValue))l=na(m[1]),ba(b,l,"M",
d,f)&&(c[l]=aa(m[2]))}catch(z){}}b.sort(D);return b}function C(a,b,c){var d=[],e=0;if(b&&a.hasAttribute&&a.hasAttribute(b)){do{if(!a)throw ia("uterdir",b,c);1==a.nodeType&&(a.hasAttribute(b)&&e++,a.hasAttribute(c)&&e--);d.push(a);a=a.nextSibling}while(0<e)}else d.push(a);return x(d)}function G(a,b,c){return function(d,e,g,f,m){e=C(e[0],b,c);return a(d,e,g,f,m)}}function H(a,c,d,e,g,f,m,p,n){function w(a,b,c,d){if(a){c&&(a=G(a,c,d));a.require=F.require;a.directiveName=oa;if(M===F||F.$$isolateScope)a=
tc(a,{isolateScope:!0});m.push(a)}if(b){c&&(b=G(b,c,d));b.require=F.require;b.directiveName=oa;if(M===F||F.$$isolateScope)b=tc(b,{isolateScope:!0});p.push(b)}}function J(a,b,c,d){var e,g="data",f=!1;if(y(b)){for(;"^"==(e=b.charAt(0))||"?"==e;)b=b.substr(1),"^"==e&&(g="inheritedData"),f=f||"?"==e;e=null;d&&"data"===g&&(e=d[b]);e=e||c[g]("$"+b+"Controller");if(!e&&!f)throw ia("ctreq",b,a);}else L(b)&&(e=[],q(b,function(b){e.push(J(a,b,c,d))}));return e}function K(a,e,g,f,n){function w(a,b){var c;2>
arguments.length&&(b=a,a=s);Da&&(c=ca);return n(a,b,c)}var u,R,z,Q,G,C,ca={},mb;u=c===g?d:la(d,new Kb(x(g),d.$attr));R=u.$$element;if(M){var ba=/^\s*([@=&])(\??)\s*(\w*)\s*$/;f=x(g);C=e.$new(!0);!H||H!==M&&H!==M.$$originalDirective?f.data("$isolateScopeNoTemplate",C):f.data("$isolateScope",C);ha(f,"ng-isolate-scope");q(M.scope,function(a,c){var d=a.match(ba)||[],g=d[3]||c,f="?"==d[2],d=d[1],m,l,p,n;C.$$isolateBindings[c]=d+g;switch(d){case "@":u.$observe(g,function(a){C[c]=a});u.$$observers[g].$$scope=
e;u[g]&&(C[c]=b(u[g])(e));break;case "=":if(f&&!u[g])break;l=r(u[g]);n=l.literal?ya:function(a,b){return a===b};p=l.assign||function(){m=C[c]=l(e);throw ia("nonassign",u[g],M.name);};m=C[c]=l(e);C.$watch(function(){var a=l(e);n(a,C[c])||(n(a,m)?p(e,a=C[c]):C[c]=a);return m=a},null,l.literal);break;case "&":l=r(u[g]);C[c]=function(a){return l(e,a)};break;default:throw ia("iscp",M.name,c,a);}})}mb=n&&w;N&&q(N,function(a){var b={$scope:a===M||a.$$isolateScope?C:e,$element:R,$attrs:u,$transclude:mb},
c;G=a.controller;"@"==G&&(G=u[a.name]);c=t(G,b);ca[a.name]=c;Da||R.data("$"+a.name+"Controller",c);a.controllerAs&&(b.$scope[a.controllerAs]=c)});f=0;for(z=m.length;f<z;f++)try{Q=m[f],Q(Q.isolateScope?C:e,R,u,Q.require&&J(Q.directiveName,Q.require,R,ca),mb)}catch(F){l(F,ga(R))}f=e;M&&(M.template||null===M.templateUrl)&&(f=C);a&&a(f,g.childNodes,s,n);for(f=p.length-1;0<=f;f--)try{Q=p[f],Q(Q.isolateScope?C:e,R,u,Q.require&&J(Q.directiveName,Q.require,R,ca),mb)}catch(B){l(B,ga(R))}}n=n||{};for(var u=
-Number.MAX_VALUE,Q,N=n.controllerDirectives,M=n.newIsolateScopeDirective,H=n.templateDirective,ba=n.nonTlbTranscludeDirective,D=!1,E=!1,Da=n.hasElementTranscludeDirective,v=d.$$element=x(c),F,oa,X,T=e,S,P=0,pa=a.length;P<pa;P++){F=a[P];var W=F.$$start,Y=F.$$end;W&&(v=C(c,W,Y));X=s;if(u>F.priority)break;if(X=F.scope)Q=Q||F,F.templateUrl||(I("new/isolated scope",M,F,v),U(X)&&(M=F));oa=F.name;!F.templateUrl&&F.controller&&(X=F.controller,N=N||{},I("'"+oa+"' controller",N[oa],F,v),N[oa]=F);if(X=F.transclude)D=
!0,F.$$tlb||(I("transclusion",ba,F,v),ba=F),"element"==X?(Da=!0,u=F.priority,X=C(c,W,Y),v=d.$$element=x(V.createComment(" "+oa+": "+d[oa]+" ")),c=v[0],nb(g,x(za.call(X,0)),c),T=z(X,e,u,f&&f.name,{nonTlbTranscludeDirective:ba})):(X=x(Ib(c)).contents(),v.empty(),T=z(X,e));if(F.template)if(E=!0,I("template",H,F,v),H=F,X=O(F.template)?F.template(v,d):F.template,X=Z(X),F.replace){f=F;X=Gb.test(X)?x(aa(X)):[];c=X[0];if(1!=X.length||1!==c.nodeType)throw ia("tplrt",oa,"");nb(g,v,c);pa={$attr:{}};X=ca(c,[],
pa);var ue=a.splice(P+1,a.length-(P+1));M&&sc(X);a=a.concat(X).concat(ue);B(d,pa);pa=a.length}else v.html(X);if(F.templateUrl)E=!0,I("template",H,F,v),H=F,F.replace&&(f=F),K=A(a.splice(P,a.length-P),v,d,g,D&&T,m,p,{controllerDirectives:N,newIsolateScopeDirective:M,templateDirective:H,nonTlbTranscludeDirective:ba}),pa=a.length;else if(F.compile)try{S=F.compile(v,d,T),O(S)?w(null,S,W,Y):S&&w(S.pre,S.post,W,Y)}catch($){l($,ga(v))}F.terminal&&(K.terminal=!0,u=Math.max(u,F.priority))}K.scope=Q&&!0===Q.scope;
K.transcludeOnThisElement=D;K.templateOnThisElement=E;K.transclude=T;n.hasElementTranscludeDirective=Da;return K}function sc(a){for(var b=0,c=a.length;b<c;b++)a[b]=Yb(a[b],{$$isolateScope:!0})}function ba(b,e,g,f,h,r,p){if(e===h)return null;h=null;if(c.hasOwnProperty(e)){var n;e=a.get(e+d);for(var t=0,w=e.length;t<w;t++)try{n=e[t],(f===s||f>n.priority)&&-1!=n.restrict.indexOf(g)&&(r&&(n=Yb(n,{$$start:r,$$end:p})),b.push(n),h=n)}catch(J){l(J)}}return h}function B(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;
q(a,function(d,e){"$"!=e.charAt(0)&&(b[e]&&b[e]!==d&&(d+=("style"===e?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});q(b,function(b,g){"class"==g?(ha(e,b),a["class"]=(a["class"]?a["class"]+" ":"")+b):"style"==g?(e.attr("style",e.attr("style")+";"+b),a.style=(a.style?a.style+";":"")+b):"$"==g.charAt(0)||a.hasOwnProperty(g)||(a[g]=b,d[g]=c[g])})}function A(a,b,c,d,e,g,f,m){var h=[],l,r,t=b[0],w=a.shift(),J=E({},w,{templateUrl:null,transclude:null,replace:null,$$originalDirective:w}),K=O(w.templateUrl)?w.templateUrl(b,
c):w.templateUrl;b.empty();p.get(u.getTrustedResourceUrl(K),{cache:n}).success(function(p){var n,u;p=Z(p);if(w.replace){p=Gb.test(p)?x(aa(p)):[];n=p[0];if(1!=p.length||1!==n.nodeType)throw ia("tplrt",w.name,K);p={$attr:{}};nb(d,b,n);var z=ca(n,[],p);U(w.scope)&&sc(z);a=z.concat(a);B(c,p)}else n=t,b.html(p);a.unshift(J);l=H(a,n,c,e,b,w,g,f,m);q(d,function(a,c){a==n&&(d[c]=b[0])});for(r=N(b[0].childNodes,e);h.length;){p=h.shift();u=h.shift();var Q=h.shift(),G=h.shift(),z=b[0];if(u!==t){var C=u.className;
m.hasElementTranscludeDirective&&w.replace||(z=Ib(n));nb(Q,x(u),z);ha(x(z),C)}u=l.transcludeOnThisElement?M(p,l.transclude,G):G;l(r,p,z,d,u)}h=null}).error(function(a,b,c,d){throw ia("tpload",d.url);});return function(a,b,c,d,e){a=e;h?(h.push(b),h.push(c),h.push(d),h.push(a)):(l.transcludeOnThisElement&&(a=M(b,l.transclude,e)),l(r,b,c,d,a))}}function D(a,b){var c=b.priority-a.priority;return 0!==c?c:a.name!==b.name?a.name<b.name?-1:1:a.index-b.index}function I(a,b,c,d){if(b)throw ia("multidir",b.name,
c.name,a,ga(d));}function v(a,c){var d=b(c,!0);d&&a.push({priority:0,compile:function(a){var b=a.parent().length;b&&ha(a.parent(),"ng-binding");return function(a,c){var e=c.parent(),g=e.data("$binding")||[];g.push(d);e.data("$binding",g);b||ha(e,"ng-binding");a.$watch(d,function(a){c[0].nodeValue=a})}}})}function T(a,b){if("srcdoc"==b)return u.HTML;var c=La(a);if("xlinkHref"==b||"FORM"==c&&"action"==b||"IMG"!=c&&("src"==b||"ngSrc"==b))return u.RESOURCE_URL}function S(a,c,d,e){var g=b(d,!0);if(g){if("multiple"===
e&&"SELECT"===La(a))throw ia("selmulti",ga(a));c.push({priority:100,compile:function(){return{pre:function(c,d,m){d=m.$$observers||(m.$$observers={});if(f.test(e))throw ia("nodomevents");if(g=b(m[e],!0,T(a,e)))m[e]=g(c),(d[e]||(d[e]=[])).$$inter=!0,(m.$$observers&&m.$$observers[e].$$scope||c).$watch(g,function(a,b){"class"===e&&a!=b?m.$updateClass(a,b):m.$set(e,a)})}}}})}}function nb(a,b,c){var d=b[0],e=b.length,g=d.parentNode,f,m;if(a)for(f=0,m=a.length;f<m;f++)if(a[f]==d){a[f++]=c;m=f+e-1;for(var h=
a.length;f<h;f++,m++)m<h?a[f]=a[m]:delete a[f];a.length-=e-1;break}g&&g.replaceChild(c,d);a=V.createDocumentFragment();a.appendChild(d);c[x.expando]=d[x.expando];d=1;for(e=b.length;d<e;d++)g=b[d],x(g).remove(),a.appendChild(g),delete b[d];b[0]=c;b.length=1}function tc(a,b){return E(function(){return a.apply(null,arguments)},a,b)}var Kb=function(a,b){this.$$element=a;this.$attr=b||{}};Kb.prototype={$normalize:na,$addClass:function(a){a&&0<a.length&&K.addClass(this.$$element,a)},$removeClass:function(a){a&&
0<a.length&&K.removeClass(this.$$element,a)},$updateClass:function(a,b){var c=uc(a,b),d=uc(b,a);0===c.length?K.removeClass(this.$$element,d):0===d.length?K.addClass(this.$$element,c):K.setClass(this.$$element,c,d)},$set:function(a,b,c,d){var e=pc(this.$$element[0],a);e&&(this.$$element.prop(a,b),d=e);this[a]=b;d?this.$attr[a]=d:(d=this.$attr[a])||(this.$attr[a]=d=hb(a,"-"));e=La(this.$$element);if("A"===e&&"href"===a||"IMG"===e&&"src"===a)this[a]=b=Q(b,"src"===a);!1!==c&&(null===b||b===s?this.$$element.removeAttr(d):
this.$$element.attr(d,b));(c=this.$$observers)&&q(c[a],function(a){try{a(b)}catch(c){l(c)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers={}),e=d[a]||(d[a]=[]);e.push(b);J.$evalAsync(function(){e.$$inter||b(c[a])});return b}};var Da=b.startSymbol(),pa=b.endSymbol(),Z="{{"==Da||"}}"==pa?Fa:function(a){return a.replace(/\{\{/g,Da).replace(/}}/g,pa)},W=/^ngAttr[A-Z]/;return z}]}function na(b){return Wa(b.replace(ve,""))}function uc(b,a){var c="",d=b.split(/\s+/),e=a.split(/\s+/),
g=0;a:for(;g<d.length;g++){for(var f=d[g],k=0;k<e.length;k++)if(f==e[k])continue a;c+=(0<c.length?" ":"")+f}return c}function Pd(){var b={},a=/^(\S+)(\s+as\s+(\w+))?$/;this.register=function(a,d){Ba(a,"controller");U(a)?E(b,a):b[a]=d};this.$get=["$injector","$window",function(c,d){return function(e,g){var f,k,m;y(e)&&(f=e.match(a),k=f[1],m=f[3],e=b.hasOwnProperty(k)?b[k]:ec(g.$scope,k,!0)||ec(d,k,!0),Ua(e,k,!0));f=c.instantiate(e,g);if(m){if(!g||"object"!==typeof g.$scope)throw v("$controller")("noscp",
k||e.name,m);g.$scope[m]=f}return f}}]}function Qd(){this.$get=["$window",function(b){return x(b.document)}]}function Rd(){this.$get=["$log",function(b){return function(a,c){b.error.apply(b,arguments)}}]}function vc(b){var a={},c,d,e;if(!b)return a;q(b.split("\n"),function(b){e=b.indexOf(":");c=I(aa(b.substr(0,e)));d=aa(b.substr(e+1));c&&(a[c]=a[c]?a[c]+(", "+d):d)});return a}function wc(b){var a=U(b)?b:s;return function(c){a||(a=vc(b));return c?a[I(c)]||null:a}}function xc(b,a,c){if(O(c))return c(b,
a);q(c,function(c){b=c(b,a)});return b}function Ud(){var b=/^\s*(\[|\{[^\{])/,a=/[\}\]]\s*$/,c=/^\)\]\}',?\n/,d={"Content-Type":"application/json;charset=utf-8"},e=this.defaults={transformResponse:[function(d){y(d)&&(d=d.replace(c,""),b.test(d)&&a.test(d)&&(d=$b(d)));return d}],transformRequest:[function(a){return U(a)&&"[object File]"!==xa.call(a)&&"[object Blob]"!==xa.call(a)?sa(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:la(d),put:la(d),patch:la(d)},xsrfCookieName:"XSRF-TOKEN",
xsrfHeaderName:"X-XSRF-TOKEN"},g=this.interceptors=[],f=this.responseInterceptors=[];this.$get=["$httpBackend","$browser","$cacheFactory","$rootScope","$q","$injector",function(a,b,c,d,p,n){function r(a){function b(a){var d=E({},a,{data:xc(a.data,a.headers,c.transformResponse)});return 200<=a.status&&300>a.status?d:p.reject(d)}var c={method:"get",transformRequest:e.transformRequest,transformResponse:e.transformResponse},d=function(a){function b(a){var c;q(a,function(b,d){O(b)&&(c=b(),null!=c?a[d]=
c:delete a[d])})}var c=e.headers,d=E({},a.headers),g,f,c=E({},c.common,c[I(a.method)]);b(c);b(d);a:for(g in c){a=I(g);for(f in d)if(I(f)===a)continue a;d[g]=c[g]}return d}(a);E(c,a);c.headers=d;c.method=Ha(c.method);var g=[function(a){d=a.headers;var c=xc(a.data,wc(d),a.transformRequest);D(a.data)&&q(d,function(a,b){"content-type"===I(b)&&delete d[b]});D(a.withCredentials)&&!D(e.withCredentials)&&(a.withCredentials=e.withCredentials);return t(a,c,d).then(b,b)},s],f=p.when(c);for(q(u,function(a){(a.request||
a.requestError)&&g.unshift(a.request,a.requestError);(a.response||a.responseError)&&g.push(a.response,a.responseError)});g.length;){a=g.shift();var m=g.shift(),f=f.then(a,m)}f.success=function(a){f.then(function(b){a(b.data,b.status,b.headers,c)});return f};f.error=function(a){f.then(null,function(b){a(b.data,b.status,b.headers,c)});return f};return f}function t(c,g,f){function h(a,b,c,e){G&&(200<=a&&300>a?G.put(x,[a,b,vc(c),e]):G.remove(x));n(b,a,c,e);d.$$phase||d.$apply()}function n(a,b,d,e){b=
Math.max(b,0);(200<=b&&300>b?u.resolve:u.reject)({data:a,status:b,headers:wc(d),config:c,statusText:e})}function t(){var a=Pa(r.pendingRequests,c);-1!==a&&r.pendingRequests.splice(a,1)}var u=p.defer(),q=u.promise,G,H,x=J(c.url,c.params);r.pendingRequests.push(c);q.then(t,t);(c.cache||e.cache)&&(!1!==c.cache&&"GET"==c.method)&&(G=U(c.cache)?c.cache:U(e.cache)?e.cache:w);if(G)if(H=G.get(x),B(H)){if(H.then)return H.then(t,t),H;L(H)?n(H[1],H[0],la(H[2]),H[3]):n(H,200,{},"OK")}else G.put(x,q);D(H)&&((H=
Lb(c.url)?b.cookies()[c.xsrfCookieName||e.xsrfCookieName]:s)&&(f[c.xsrfHeaderName||e.xsrfHeaderName]=H),a(c.method,x,g,h,f,c.timeout,c.withCredentials,c.responseType));return q}function J(a,b){if(!b)return a;var c=[];Tc(b,function(a,b){null===a||D(a)||(L(a)||(a=[a]),q(a,function(a){U(a)&&(a=sa(a));c.push(Aa(b)+"="+Aa(a))}))});0<c.length&&(a+=(-1==a.indexOf("?")?"?":"&")+c.join("&"));return a}var w=c("$http"),u=[];q(g,function(a){u.unshift(y(a)?n.get(a):n.invoke(a))});q(f,function(a,b){var c=y(a)?
n.get(a):n.invoke(a);u.splice(b,0,{response:function(a){return c(p.when(a))},responseError:function(a){return c(p.reject(a))}})});r.pendingRequests=[];(function(a){q(arguments,function(a){r[a]=function(b,c){return r(E(c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){q(arguments,function(a){r[a]=function(b,c,d){return r(E(d||{},{method:a,url:b,data:c}))}})})("post","put");r.defaults=e;return r}]}function we(b){if(8>=P&&(!b.match(/^(get|post|head|put|delete|options)$/i)||!T.XMLHttpRequest))return new T.ActiveXObject("Microsoft.XMLHTTP");
if(T.XMLHttpRequest)return new T.XMLHttpRequest;throw v("$httpBackend")("noxhr");}function Vd(){this.$get=["$browser","$window","$document",function(b,a,c){return xe(b,we,b.defer,a.angular.callbacks,c[0])}]}function xe(b,a,c,d,e){function g(a,b,c){var g=e.createElement("script"),f=null;g.type="text/javascript";g.src=a;g.async=!0;f=function(a){Xa(g,"load",f);Xa(g,"error",f);e.body.removeChild(g);g=null;var k=-1,t="unknown";a&&("load"!==a.type||d[b].called||(a={type:"error"}),t=a.type,k="error"===a.type?
404:200);c&&c(k,t)};ob(g,"load",f);ob(g,"error",f);8>=P&&(g.onreadystatechange=function(){y(g.readyState)&&/loaded|complete/.test(g.readyState)&&(g.onreadystatechange=null,f({type:"load"}))});e.body.appendChild(g);return f}var f=-1;return function(e,m,h,l,p,n,r,t){function J(){u=f;Q&&Q();z&&z.abort()}function w(a,d,e,g,f){N&&c.cancel(N);Q=z=null;0===d&&(d=e?200:"file"==ta(m).protocol?404:0);a(1223===d?204:d,e,g,f||"");b.$$completeOutstandingRequest(A)}var u;b.$$incOutstandingRequestCount();m=m||b.url();
if("jsonp"==I(e)){var K="_"+(d.counter++).toString(36);d[K]=function(a){d[K].data=a;d[K].called=!0};var Q=g(m.replace("JSON_CALLBACK","angular.callbacks."+K),K,function(a,b){w(l,a,d[K].data,"",b);d[K]=A})}else{var z=a(e);z.open(e,m,!0);q(p,function(a,b){B(a)&&z.setRequestHeader(b,a)});z.onreadystatechange=function(){if(z&&4==z.readyState){var a=null,b=null,c="";u!==f&&(a=z.getAllResponseHeaders(),b="response"in z?z.response:z.responseText);u===f&&10>P||(c=z.statusText);w(l,u||z.status,b,a,c)}};r&&
(z.withCredentials=!0);if(t)try{z.responseType=t}catch(s){if("json"!==t)throw s;}z.send(h||null)}if(0<n)var N=c(J,n);else n&&n.then&&n.then(J)}}function Sd(){var b="{{",a="}}";this.startSymbol=function(a){return a?(b=a,this):b};this.endSymbol=function(b){return b?(a=b,this):a};this.$get=["$parse","$exceptionHandler","$sce",function(c,d,e){function g(g,h,l){for(var p,n,r=0,t=[],J=g.length,w=!1,u=[];r<J;)-1!=(p=g.indexOf(b,r))&&-1!=(n=g.indexOf(a,p+f))?(r!=p&&t.push(g.substring(r,p)),t.push(r=c(w=g.substring(p+
f,n))),r.exp=w,r=n+k,w=!0):(r!=J&&t.push(g.substring(r)),r=J);(J=t.length)||(t.push(""),J=1);if(l&&1<t.length)throw yc("noconcat",g);if(!h||w)return u.length=J,r=function(a){try{for(var b=0,c=J,f;b<c;b++){if("function"==typeof(f=t[b]))if(f=f(a),f=l?e.getTrusted(l,f):e.valueOf(f),null==f)f="";else switch(typeof f){case "string":break;case "number":f=""+f;break;default:f=sa(f)}u[b]=f}return u.join("")}catch(k){a=yc("interr",g,k.toString()),d(a)}},r.exp=g,r.parts=t,r}var f=b.length,k=a.length;g.startSymbol=
function(){return b};g.endSymbol=function(){return a};return g}]}function Td(){this.$get=["$rootScope","$window","$q",function(b,a,c){function d(d,f,k,m){var h=a.setInterval,l=a.clearInterval,p=c.defer(),n=p.promise,r=0,t=B(m)&&!m;k=B(k)?k:0;n.then(null,null,d);n.$$intervalId=h(function(){p.notify(r++);0<k&&r>=k&&(p.resolve(r),l(n.$$intervalId),delete e[n.$$intervalId]);t||b.$apply()},f);e[n.$$intervalId]=p;return n}var e={};d.cancel=function(b){return b&&b.$$intervalId in e?(e[b.$$intervalId].reject("canceled"),
a.clearInterval(b.$$intervalId),delete e[b.$$intervalId],!0):!1};return d}]}function bd(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,maxFrac:3,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"\u00a4",posSuf:"",negPre:"(\u00a4",negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},DATETIME_FORMATS:{MONTH:"January February March April May June July August September October November December".split(" "),
SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),AMPMS:["AM","PM"],medium:"MMM d, y h:mm:ss a","short":"M/d/yy h:mm a",fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"h:mm:ss a",shortTime:"h:mm a"},pluralCat:function(b){return 1===b?"one":"other"}}}}function Mb(b){b=b.split("/");for(var a=b.length;a--;)b[a]=
gb(b[a]);return b.join("/")}function zc(b,a,c){b=ta(b,c);a.$$protocol=b.protocol;a.$$host=b.hostname;a.$$port=Z(b.port)||ye[b.protocol]||null}function Ac(b,a,c){var d="/"!==b.charAt(0);d&&(b="/"+b);b=ta(b,c);a.$$path=decodeURIComponent(d&&"/"===b.pathname.charAt(0)?b.pathname.substring(1):b.pathname);a.$$search=bc(b.search);a.$$hash=decodeURIComponent(b.hash);a.$$path&&"/"!=a.$$path.charAt(0)&&(a.$$path="/"+a.$$path)}function qa(b,a){if(0===a.indexOf(b))return a.substr(b.length)}function ab(b){var a=
b.indexOf("#");return-1==a?b:b.substr(0,a)}function Nb(b){return b.substr(0,ab(b).lastIndexOf("/")+1)}function Bc(b,a){this.$$html5=!0;a=a||"";var c=Nb(b);zc(b,this,b);this.$$parse=function(a){var e=qa(c,a);if(!y(e))throw Ob("ipthprfx",a,c);Ac(e,this,b);this.$$path||(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=Ab(this.$$search),b=this.$$hash?"#"+gb(this.$$hash):"";this.$$url=Mb(this.$$path)+(a?"?"+a:"")+b;this.$$absUrl=c+this.$$url.substr(1)};this.$$rewrite=function(d){var e;
if((e=qa(b,d))!==s)return d=e,(e=qa(a,e))!==s?c+(qa("/",e)||e):b+d;if((e=qa(c,d))!==s)return c+e;if(c==d+"/")return c}}function Pb(b,a){var c=Nb(b);zc(b,this,b);this.$$parse=function(d){var e=qa(b,d)||qa(c,d),e="#"==e.charAt(0)?qa(a,e):this.$$html5?e:"";if(!y(e))throw Ob("ihshprfx",d,a);Ac(e,this,b);d=this.$$path;var g=/^\/[A-Z]:(\/.*)/;0===e.indexOf(b)&&(e=e.replace(b,""));g.exec(e)||(d=(e=g.exec(d))?e[1]:d);this.$$path=d;this.$$compose()};this.$$compose=function(){var c=Ab(this.$$search),e=this.$$hash?
"#"+gb(this.$$hash):"";this.$$url=Mb(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=b+(this.$$url?a+this.$$url:"")};this.$$rewrite=function(a){if(ab(b)==ab(a))return a}}function Qb(b,a){this.$$html5=!0;Pb.apply(this,arguments);var c=Nb(b);this.$$rewrite=function(d){var e;if(b==ab(d))return d;if(e=qa(c,d))return b+a+e;if(c===d+"/")return c};this.$$compose=function(){var c=Ab(this.$$search),e=this.$$hash?"#"+gb(this.$$hash):"";this.$$url=Mb(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=b+a+this.$$url}}function pb(b){return function(){return this[b]}}
function Cc(b,a){return function(c){if(D(c))return this[b];this[b]=a(c);this.$$compose();return this}}function Wd(){var b="",a=!1;this.hashPrefix=function(a){return B(a)?(b=a,this):b};this.html5Mode=function(b){return B(b)?(a=b,this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,g){function f(a){c.$broadcast("$locationChangeSuccess",k.absUrl(),a)}var k,m,h=d.baseHref(),l=d.url(),p;a?(p=l.substring(0,l.indexOf("/",l.indexOf("//")+2))+(h||"/"),m=e.history?Bc:Qb):(p=
ab(l),m=Pb);k=new m(p,"#"+b);k.$$parse(k.$$rewrite(l));g.on("click",function(a){if(!a.ctrlKey&&!a.metaKey&&2!=a.which){for(var e=x(a.target);"a"!==I(e[0].nodeName);)if(e[0]===g[0]||!(e=e.parent())[0])return;var f=e.prop("href");U(f)&&"[object SVGAnimatedString]"===f.toString()&&(f=ta(f.animVal).href);if(m===Qb){var h=e.attr("href")||e.attr("xlink:href");if(0>h.indexOf("://"))if(f="#"+b,"/"==h[0])f=p+f+h;else if("#"==h[0])f=p+f+(k.path()||"/")+h;else{for(var l=k.path().split("/"),h=h.split("/"),n=
0;n<h.length;n++)"."!=h[n]&&(".."==h[n]?l.pop():h[n].length&&l.push(h[n]));f=p+f+l.join("/")}}l=k.$$rewrite(f);f&&(!e.attr("target")&&l&&!a.isDefaultPrevented())&&(a.preventDefault(),l!=d.url()&&(k.$$parse(l),c.$apply(),T.angular["ff-684208-preventDefault"]=!0))}});k.absUrl()!=l&&d.url(k.absUrl(),!0);d.onUrlChange(function(a){k.absUrl()!=a&&(c.$evalAsync(function(){var b=k.absUrl();k.$$parse(a);c.$broadcast("$locationChangeStart",a,b).defaultPrevented?(k.$$parse(b),d.url(b)):f(b)}),c.$$phase||c.$digest())});
var n=0;c.$watch(function(){var a=d.url(),b=k.$$replace;n&&a==k.absUrl()||(n++,c.$evalAsync(function(){c.$broadcast("$locationChangeStart",k.absUrl(),a).defaultPrevented?k.$$parse(a):(d.url(k.absUrl(),b),f(a))}));k.$$replace=!1;return n});return k}]}function Xd(){var b=!0,a=this;this.debugEnabled=function(a){return B(a)?(b=a,this):b};this.$get=["$window",function(c){function d(a){a instanceof Error&&(a.stack?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&
(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=c.console||{},e=b[a]||b.log||A;a=!1;try{a=!!e.apply}catch(m){}return a?function(){var a=[];q(arguments,function(b){a.push(d(b))});return e.apply(b,a)}:function(a,b){e(a,null==b?"":b)}}return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){b&&c.apply(a,arguments)}}()}}]}function da(b,a){if("__defineGetter__"===b||"__defineSetter__"===b||"__lookupGetter__"===b||"__lookupSetter__"===
b||"__proto__"===b)throw ja("isecfld",a);return b}function Ma(b,a){if(b){if(b.constructor===b)throw ja("isecfn",a);if(b.document&&b.location&&b.alert&&b.setInterval)throw ja("isecwindow",a);if(b.children&&(b.nodeName||b.prop&&b.attr&&b.find))throw ja("isecdom",a);if(b===Object)throw ja("isecobj",a);}return b}function qb(b,a,c,d,e){e=e||{};a=a.split(".");for(var g,f=0;1<a.length;f++){g=da(a.shift(),d);var k=b[g];k||(k={},b[g]=k);b=k;b.then&&e.unwrapPromises&&(ua(d),"$$v"in b||function(a){a.then(function(b){a.$$v=
b})}(b),b.$$v===s&&(b.$$v={}),b=b.$$v)}g=da(a.shift(),d);Ma(b,d);Ma(b[g],d);return b[g]=c}function Dc(b,a,c,d,e,g,f){da(b,g);da(a,g);da(c,g);da(d,g);da(e,g);return f.unwrapPromises?function(f,m){var h=m&&m.hasOwnProperty(b)?m:f,l;if(null==h)return h;(h=h[b])&&h.then&&(ua(g),"$$v"in h||(l=h,l.$$v=s,l.then(function(a){l.$$v=a})),h=h.$$v);if(!a)return h;if(null==h)return s;(h=h[a])&&h.then&&(ua(g),"$$v"in h||(l=h,l.$$v=s,l.then(function(a){l.$$v=a})),h=h.$$v);if(!c)return h;if(null==h)return s;(h=h[c])&&
h.then&&(ua(g),"$$v"in h||(l=h,l.$$v=s,l.then(function(a){l.$$v=a})),h=h.$$v);if(!d)return h;if(null==h)return s;(h=h[d])&&h.then&&(ua(g),"$$v"in h||(l=h,l.$$v=s,l.then(function(a){l.$$v=a})),h=h.$$v);if(!e)return h;if(null==h)return s;(h=h[e])&&h.then&&(ua(g),"$$v"in h||(l=h,l.$$v=s,l.then(function(a){l.$$v=a})),h=h.$$v);return h}:function(g,f){var h=f&&f.hasOwnProperty(b)?f:g;if(null==h)return h;h=h[b];if(!a)return h;if(null==h)return s;h=h[a];if(!c)return h;if(null==h)return s;h=h[c];if(!d)return h;
if(null==h)return s;h=h[d];return e?null==h?s:h=h[e]:h}}function ze(b,a){da(b,a);return function(a,d){return null==a?s:(d&&d.hasOwnProperty(b)?d:a)[b]}}function Ae(b,a,c){da(b,c);da(a,c);return function(c,e){if(null==c)return s;c=(e&&e.hasOwnProperty(b)?e:c)[b];return null==c?s:c[a]}}function Ec(b,a,c){if(Rb.hasOwnProperty(b))return Rb[b];var d=b.split("."),e=d.length,g;if(a.unwrapPromises||1!==e)if(a.unwrapPromises||2!==e)if(a.csp)g=6>e?Dc(d[0],d[1],d[2],d[3],d[4],c,a):function(b,g){var f=0,k;do k=
Dc(d[f++],d[f++],d[f++],d[f++],d[f++],c,a)(b,g),g=s,b=k;while(f<e);return k};else{var f="var p;\n";q(d,function(b,d){da(b,c);f+="if(s == null) return undefined;\ns="+(d?"s":'((k&&k.hasOwnProperty("'+b+'"))?k:s)')+'["'+b+'"];\n'+(a.unwrapPromises?'if (s && s.then) {\n pw("'+c.replace(/(["\r\n])/g,"\\$1")+'");\n if (!("$$v" in s)) {\n p=s;\n p.$$v = undefined;\n p.then(function(v) {p.$$v=v;});\n}\n s=s.$$v\n}\n':"")});var f=f+"return s;",k=new Function("s","k","pw",f);k.toString=$(f);g=a.unwrapPromises?
function(a,b){return k(a,b,ua)}:k}else g=Ae(d[0],d[1],c);else g=ze(d[0],c);"hasOwnProperty"!==b&&(Rb[b]=g);return g}function Yd(){var b={},a={csp:!1,unwrapPromises:!1,logPromiseWarnings:!0};this.unwrapPromises=function(b){return B(b)?(a.unwrapPromises=!!b,this):a.unwrapPromises};this.logPromiseWarnings=function(b){return B(b)?(a.logPromiseWarnings=b,this):a.logPromiseWarnings};this.$get=["$filter","$sniffer","$log",function(c,d,e){a.csp=d.csp;ua=function(b){a.logPromiseWarnings&&!Fc.hasOwnProperty(b)&&
(Fc[b]=!0,e.warn("[$parse] Promise found in the expression `"+b+"`. Automatic unwrapping of promises in Angular expressions is deprecated."))};return function(d){var e;switch(typeof d){case "string":if(b.hasOwnProperty(d))return b[d];e=new Sb(a);e=(new bb(e,c,a)).parse(d);"hasOwnProperty"!==d&&(b[d]=e);return e;case "function":return d;default:return A}}}]}function $d(){this.$get=["$rootScope","$exceptionHandler",function(b,a){return Be(function(a){b.$evalAsync(a)},a)}]}function Be(b,a){function c(a){return a}
function d(a){return f(a)}var e=function(){var f=[],h,l;return l={resolve:function(a){if(f){var c=f;f=s;h=g(a);c.length&&b(function(){for(var a,b=0,d=c.length;b<d;b++)a=c[b],h.then(a[0],a[1],a[2])})}},reject:function(a){l.resolve(k(a))},notify:function(a){if(f){var c=f;f.length&&b(function(){for(var b,d=0,e=c.length;d<e;d++)b=c[d],b[2](a)})}},promise:{then:function(b,g,k){var l=e(),J=function(d){try{l.resolve((O(b)?b:c)(d))}catch(e){l.reject(e),a(e)}},w=function(b){try{l.resolve((O(g)?g:d)(b))}catch(c){l.reject(c),
a(c)}},u=function(b){try{l.notify((O(k)?k:c)(b))}catch(d){a(d)}};f?f.push([J,w,u]):h.then(J,w,u);return l.promise},"catch":function(a){return this.then(null,a)},"finally":function(a){function b(a,c){var d=e();c?d.resolve(a):d.reject(a);return d.promise}function d(e,g){var f=null;try{f=(a||c)()}catch(k){return b(k,!1)}return f&&O(f.then)?f.then(function(){return b(e,g)},function(a){return b(a,!1)}):b(e,g)}return this.then(function(a){return d(a,!0)},function(a){return d(a,!1)})}}}},g=function(a){return a&&
O(a.then)?a:{then:function(c){var d=e();b(function(){d.resolve(c(a))});return d.promise}}},f=function(a){var b=e();b.reject(a);return b.promise},k=function(c){return{then:function(g,f){var k=e();b(function(){try{k.resolve((O(f)?f:d)(c))}catch(b){k.reject(b),a(b)}});return k.promise}}};return{defer:e,reject:f,when:function(k,h,l,p){var n=e(),r,t=function(b){try{return(O(h)?h:c)(b)}catch(d){return a(d),f(d)}},J=function(b){try{return(O(l)?l:d)(b)}catch(c){return a(c),f(c)}},w=function(b){try{return(O(p)?
p:c)(b)}catch(d){a(d)}};b(function(){g(k).then(function(a){r||(r=!0,n.resolve(g(a).then(t,J,w)))},function(a){r||(r=!0,n.resolve(J(a)))},function(a){r||n.notify(w(a))})});return n.promise},all:function(a){var b=e(),c=0,d=L(a)?[]:{};q(a,function(a,e){c++;g(a).then(function(a){d.hasOwnProperty(e)||(d[e]=a,--c||b.resolve(d))},function(a){d.hasOwnProperty(e)||b.reject(a)})});0===c&&b.resolve(d);return b.promise}}}function ge(){this.$get=["$window","$timeout",function(b,a){var c=b.requestAnimationFrame||
b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame,d=b.cancelAnimationFrame||b.webkitCancelAnimationFrame||b.mozCancelAnimationFrame||b.webkitCancelRequestAnimationFrame,e=!!c,g=e?function(a){var b=c(a);return function(){d(b)}}:function(b){var c=a(b,16.66,!1);return function(){a.cancel(c)}};g.supported=e;return g}]}function Zd(){var b=10,a=v("$rootScope"),c=null;this.digestTtl=function(a){arguments.length&&(b=a);return b};this.$get=["$injector","$exceptionHandler","$parse","$browser",function(d,
e,g,f){function k(){this.$id=eb();this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this["this"]=this.$root=this;this.$$destroyed=!1;this.$$asyncQueue=[];this.$$postDigestQueue=[];this.$$listeners={};this.$$listenerCount={};this.$$isolateBindings={}}function m(b){if(n.$$phase)throw a("inprog",n.$$phase);n.$$phase=b}function h(a,b){var c=g(a);Ua(c,b);return c}function l(a,b,c){do a.$$listenerCount[c]-=b,0===a.$$listenerCount[c]&&
delete a.$$listenerCount[c];while(a=a.$parent)}function p(){}k.prototype={constructor:k,$new:function(a){a?(a=new k,a.$root=this.$root,a.$$asyncQueue=this.$$asyncQueue,a.$$postDigestQueue=this.$$postDigestQueue):(this.$$childScopeClass||(this.$$childScopeClass=function(){this.$$watchers=this.$$nextSibling=this.$$childHead=this.$$childTail=null;this.$$listeners={};this.$$listenerCount={};this.$id=eb();this.$$childScopeClass=null},this.$$childScopeClass.prototype=this),a=new this.$$childScopeClass);
a["this"]=a;a.$parent=this;a.$$prevSibling=this.$$childTail;this.$$childHead?this.$$childTail=this.$$childTail.$$nextSibling=a:this.$$childHead=this.$$childTail=a;return a},$watch:function(a,b,d){var e=h(a,"watch"),g=this.$$watchers,f={fn:b,last:p,get:e,exp:a,eq:!!d};c=null;if(!O(b)){var k=h(b||A,"listener");f.fn=function(a,b,c){k(c)}}if("string"==typeof a&&e.constant){var m=f.fn;f.fn=function(a,b,c){m.call(this,a,b,c);Qa(g,f)}}g||(g=this.$$watchers=[]);g.unshift(f);return function(){Qa(g,f);c=null}},
$watchCollection:function(a,b){var c=this,d,e,f,k=1<b.length,h=0,m=g(a),l=[],n={},p=!0,q=0;return this.$watch(function(){d=m(c);var a,b;if(U(d))if(db(d))for(e!==l&&(e=l,q=e.length=0,h++),a=d.length,q!==a&&(h++,e.length=q=a),b=0;b<a;b++)e[b]!==e[b]&&d[b]!==d[b]||e[b]===d[b]||(h++,e[b]=d[b]);else{e!==n&&(e=n={},q=0,h++);a=0;for(b in d)d.hasOwnProperty(b)&&(a++,e.hasOwnProperty(b)?e[b]!==d[b]&&(h++,e[b]=d[b]):(q++,e[b]=d[b],h++));if(q>a)for(b in h++,e)e.hasOwnProperty(b)&&!d.hasOwnProperty(b)&&(q--,
delete e[b])}else e!==d&&(e=d,h++);return h},function(){p?(p=!1,b(d,d,c)):b(d,f,c);if(k)if(U(d))if(db(d)){f=Array(d.length);for(var a=0;a<d.length;a++)f[a]=d[a]}else for(a in f={},d)yb.call(d,a)&&(f[a]=d[a]);else f=d})},$digest:function(){var d,g,f,k,h=this.$$asyncQueue,l=this.$$postDigestQueue,q,z,s=b,N,M=[],x,C,G;m("$digest");c=null;do{z=!1;for(N=this;h.length;){try{G=h.shift(),G.scope.$eval(G.expression)}catch(H){n.$$phase=null,e(H)}c=null}a:do{if(k=N.$$watchers)for(q=k.length;q--;)try{if(d=k[q])if((g=
d.get(N))!==(f=d.last)&&!(d.eq?ya(g,f):"number"===typeof g&&"number"===typeof f&&isNaN(g)&&isNaN(f)))z=!0,c=d,d.last=d.eq?Ga(g,null):g,d.fn(g,f===p?g:f,N),5>s&&(x=4-s,M[x]||(M[x]=[]),C=O(d.exp)?"fn: "+(d.exp.name||d.exp.toString()):d.exp,C+="; newVal: "+sa(g)+"; oldVal: "+sa(f),M[x].push(C));else if(d===c){z=!1;break a}}catch(B){n.$$phase=null,e(B)}if(!(k=N.$$childHead||N!==this&&N.$$nextSibling))for(;N!==this&&!(k=N.$$nextSibling);)N=N.$parent}while(N=k);if((z||h.length)&&!s--)throw n.$$phase=null,
a("infdig",b,sa(M));}while(z||h.length);for(n.$$phase=null;l.length;)try{l.shift()()}catch(v){e(v)}},$destroy:function(){if(!this.$$destroyed){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;this!==n&&(q(this.$$listenerCount,zb(null,l,this)),a.$$childHead==this&&(a.$$childHead=this.$$nextSibling),a.$$childTail==this&&(a.$$childTail=this.$$prevSibling),this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling),this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=
this.$$prevSibling),this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=this.$root=null,this.$$listeners={},this.$$watchers=this.$$asyncQueue=this.$$postDigestQueue=[],this.$destroy=this.$digest=this.$apply=A,this.$on=this.$watch=function(){return A})}},$eval:function(a,b){return g(a)(this,b)},$evalAsync:function(a){n.$$phase||n.$$asyncQueue.length||f.defer(function(){n.$$asyncQueue.length&&n.$digest()});this.$$asyncQueue.push({scope:this,expression:a})},$$postDigest:function(a){this.$$postDigestQueue.push(a)},
$apply:function(a){try{return m("$apply"),this.$eval(a)}catch(b){e(b)}finally{n.$$phase=null;try{n.$digest()}catch(c){throw e(c),c;}}},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);var d=this;do d.$$listenerCount[a]||(d.$$listenerCount[a]=0),d.$$listenerCount[a]++;while(d=d.$parent);var e=this;return function(){c[Pa(c,b)]=null;l(e,1,a)}},$emit:function(a,b){var c=[],d,g=this,f=!1,k={name:a,targetScope:g,stopPropagation:function(){f=!0},preventDefault:function(){k.defaultPrevented=
!0},defaultPrevented:!1},h=[k].concat(za.call(arguments,1)),m,l;do{d=g.$$listeners[a]||c;k.currentScope=g;m=0;for(l=d.length;m<l;m++)if(d[m])try{d[m].apply(null,h)}catch(n){e(n)}else d.splice(m,1),m--,l--;if(f)break;g=g.$parent}while(g);return k},$broadcast:function(a,b){for(var c=this,d=this,g={name:a,targetScope:this,preventDefault:function(){g.defaultPrevented=!0},defaultPrevented:!1},f=[g].concat(za.call(arguments,1)),k,h;c=d;){g.currentScope=c;d=c.$$listeners[a]||[];k=0;for(h=d.length;k<h;k++)if(d[k])try{d[k].apply(null,
f)}catch(m){e(m)}else d.splice(k,1),k--,h--;if(!(d=c.$$listenerCount[a]&&c.$$childHead||c!==this&&c.$$nextSibling))for(;c!==this&&!(d=c.$$nextSibling);)c=c.$parent}return g}};var n=new k;return n}]}function cd(){var b=/^\s*(https?|ftp|mailto|tel|file):/,a=/^\s*(https?|ftp|file):|data:image\//;this.aHrefSanitizationWhitelist=function(a){return B(a)?(b=a,this):b};this.imgSrcSanitizationWhitelist=function(b){return B(b)?(a=b,this):a};this.$get=function(){return function(c,d){var e=d?a:b,g;if(!P||8<=
P)if(g=ta(c).href,""!==g&&!g.match(e))return"unsafe:"+g;return c}}}function Ce(b){if("self"===b)return b;if(y(b)){if(-1<b.indexOf("***"))throw va("iwcard",b);b=b.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08").replace("\\*\\*",".*").replace("\\*","[^:/.?&;]*");return RegExp("^"+b+"$")}if(fb(b))return RegExp("^"+b.source+"$");throw va("imatcher");}function Gc(b){var a=[];B(b)&&q(b,function(b){a.push(Ce(b))});return a}function be(){this.SCE_CONTEXTS=fa;var b=["self"],a=[];this.resourceUrlWhitelist=
function(a){arguments.length&&(b=Gc(a));return b};this.resourceUrlBlacklist=function(b){arguments.length&&(a=Gc(b));return a};this.$get=["$injector",function(c){function d(a){var b=function(a){this.$$unwrapTrustedValue=function(){return a}};a&&(b.prototype=new a);b.prototype.valueOf=function(){return this.$$unwrapTrustedValue()};b.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()};return b}var e=function(a){throw va("unsafe");};c.has("$sanitize")&&(e=c.get("$sanitize"));
var g=d(),f={};f[fa.HTML]=d(g);f[fa.CSS]=d(g);f[fa.URL]=d(g);f[fa.JS]=d(g);f[fa.RESOURCE_URL]=d(f[fa.URL]);return{trustAs:function(a,b){var c=f.hasOwnProperty(a)?f[a]:null;if(!c)throw va("icontext",a,b);if(null===b||b===s||""===b)return b;if("string"!==typeof b)throw va("itype",a);return new c(b)},getTrusted:function(c,d){if(null===d||d===s||""===d)return d;var g=f.hasOwnProperty(c)?f[c]:null;if(g&&d instanceof g)return d.$$unwrapTrustedValue();if(c===fa.RESOURCE_URL){var g=ta(d.toString()),l,p,n=
!1;l=0;for(p=b.length;l<p;l++)if("self"===b[l]?Lb(g):b[l].exec(g.href)){n=!0;break}if(n)for(l=0,p=a.length;l<p;l++)if("self"===a[l]?Lb(g):a[l].exec(g.href)){n=!1;break}if(n)return d;throw va("insecurl",d.toString());}if(c===fa.HTML)return e(d);throw va("unsafe");},valueOf:function(a){return a instanceof g?a.$$unwrapTrustedValue():a}}}]}function ae(){var b=!0;this.enabled=function(a){arguments.length&&(b=!!a);return b};this.$get=["$parse","$sniffer","$sceDelegate",function(a,c,d){if(b&&c.msie&&8>c.msieDocumentMode)throw va("iequirks");
var e=la(fa);e.isEnabled=function(){return b};e.trustAs=d.trustAs;e.getTrusted=d.getTrusted;e.valueOf=d.valueOf;b||(e.trustAs=e.getTrusted=function(a,b){return b},e.valueOf=Fa);e.parseAs=function(b,c){var d=a(c);return d.literal&&d.constant?d:function(a,c){return e.getTrusted(b,d(a,c))}};var g=e.parseAs,f=e.getTrusted,k=e.trustAs;q(fa,function(a,b){var c=I(b);e[Wa("parse_as_"+c)]=function(b){return g(a,b)};e[Wa("get_trusted_"+c)]=function(b){return f(a,b)};e[Wa("trust_as_"+c)]=function(b){return k(a,
b)}});return e}]}function ce(){this.$get=["$window","$document",function(b,a){var c={},d=Z((/android (\d+)/.exec(I((b.navigator||{}).userAgent))||[])[1]),e=/Boxee/i.test((b.navigator||{}).userAgent),g=a[0]||{},f=g.documentMode,k,m=/^(Moz|webkit|O|ms)(?=[A-Z])/,h=g.body&&g.body.style,l=!1,p=!1;if(h){for(var n in h)if(l=m.exec(n)){k=l[0];k=k.substr(0,1).toUpperCase()+k.substr(1);break}k||(k="WebkitOpacity"in h&&"webkit");l=!!("transition"in h||k+"Transition"in h);p=!!("animation"in h||k+"Animation"in
h);!d||l&&p||(l=y(g.body.style.webkitTransition),p=y(g.body.style.webkitAnimation))}return{history:!(!b.history||!b.history.pushState||4>d||e),hashchange:"onhashchange"in b&&(!f||7<f),hasEvent:function(a){if("input"==a&&9==P)return!1;if(D(c[a])){var b=g.createElement("div");c[a]="on"+a in b}return c[a]},csp:Zb(),vendorPrefix:k,transitions:l,animations:p,android:d,msie:P,msieDocumentMode:f}}]}function ee(){this.$get=["$rootScope","$browser","$q","$exceptionHandler",function(b,a,c,d){function e(e,k,
m){var h=c.defer(),l=h.promise,p=B(m)&&!m;k=a.defer(function(){try{h.resolve(e())}catch(a){h.reject(a),d(a)}finally{delete g[l.$$timeoutId]}p||b.$apply()},k);l.$$timeoutId=k;g[k]=h;return l}var g={};e.cancel=function(b){return b&&b.$$timeoutId in g?(g[b.$$timeoutId].reject("canceled"),delete g[b.$$timeoutId],a.defer.cancel(b.$$timeoutId)):!1};return e}]}function ta(b,a){var c=b;P&&(W.setAttribute("href",c),c=W.href);W.setAttribute("href",c);return{href:W.href,protocol:W.protocol?W.protocol.replace(/:$/,
""):"",host:W.host,search:W.search?W.search.replace(/^\?/,""):"",hash:W.hash?W.hash.replace(/^#/,""):"",hostname:W.hostname,port:W.port,pathname:"/"===W.pathname.charAt(0)?W.pathname:"/"+W.pathname}}function Lb(b){b=y(b)?ta(b):b;return b.protocol===Hc.protocol&&b.host===Hc.host}function fe(){this.$get=$(T)}function jc(b){function a(d,e){if(U(d)){var g={};q(d,function(b,c){g[c]=a(c,b)});return g}return b.factory(d+c,e)}var c="Filter";this.register=a;this.$get=["$injector",function(a){return function(b){return a.get(b+
c)}}];a("currency",Ic);a("date",Jc);a("filter",De);a("json",Ee);a("limitTo",Fe);a("lowercase",Ge);a("number",Kc);a("orderBy",Lc);a("uppercase",He)}function De(){return function(b,a,c){if(!L(b))return b;var d=typeof c,e=[];e.check=function(a){for(var b=0;b<e.length;b++)if(!e[b](a))return!1;return!0};"function"!==d&&(c="boolean"===d&&c?function(a,b){return Ta.equals(a,b)}:function(a,b){if(a&&b&&"object"===typeof a&&"object"===typeof b){for(var d in a)if("$"!==d.charAt(0)&&yb.call(a,d)&&c(a[d],b[d]))return!0;
return!1}b=(""+b).toLowerCase();return-1<(""+a).toLowerCase().indexOf(b)});var g=function(a,b){if("string"==typeof b&&"!"===b.charAt(0))return!g(a,b.substr(1));switch(typeof a){case "boolean":case "number":case "string":return c(a,b);case "object":switch(typeof b){case "object":return c(a,b);default:for(var d in a)if("$"!==d.charAt(0)&&g(a[d],b))return!0}return!1;case "array":for(d=0;d<a.length;d++)if(g(a[d],b))return!0;return!1;default:return!1}};switch(typeof a){case "boolean":case "number":case "string":a=
{$:a};case "object":for(var f in a)(function(b){"undefined"!==typeof a[b]&&e.push(function(c){return g("$"==b?c:c&&c[b],a[b])})})(f);break;case "function":e.push(a);break;default:return b}d=[];for(f=0;f<b.length;f++){var k=b[f];e.check(k)&&d.push(k)}return d}}function Ic(b){var a=b.NUMBER_FORMATS;return function(b,d){D(d)&&(d=a.CURRENCY_SYM);return Mc(b,a.PATTERNS[1],a.GROUP_SEP,a.DECIMAL_SEP,2).replace(/\u00A4/g,d)}}function Kc(b){var a=b.NUMBER_FORMATS;return function(b,d){return Mc(b,a.PATTERNS[0],
a.GROUP_SEP,a.DECIMAL_SEP,d)}}function Mc(b,a,c,d,e){if(null==b||!isFinite(b)||U(b))return"";var g=0>b;b=Math.abs(b);var f=b+"",k="",m=[],h=!1;if(-1!==f.indexOf("e")){var l=f.match(/([\d\.]+)e(-?)(\d+)/);l&&"-"==l[2]&&l[3]>e+1?(f="0",b=0):(k=f,h=!0)}if(h)0<e&&(-1<b&&1>b)&&(k=b.toFixed(e));else{f=(f.split(Nc)[1]||"").length;D(e)&&(e=Math.min(Math.max(a.minFrac,f),a.maxFrac));b=+(Math.round(+(b.toString()+"e"+e)).toString()+"e"+-e);b=(""+b).split(Nc);f=b[0];b=b[1]||"";var l=0,p=a.lgSize,n=a.gSize;if(f.length>=
p+n)for(l=f.length-p,h=0;h<l;h++)0===(l-h)%n&&0!==h&&(k+=c),k+=f.charAt(h);for(h=l;h<f.length;h++)0===(f.length-h)%p&&0!==h&&(k+=c),k+=f.charAt(h);for(;b.length<e;)b+="0";e&&"0"!==e&&(k+=d+b.substr(0,e))}m.push(g?a.negPre:a.posPre);m.push(k);m.push(g?a.negSuf:a.posSuf);return m.join("")}function Tb(b,a,c){var d="";0>b&&(d="-",b=-b);for(b=""+b;b.length<a;)b="0"+b;c&&(b=b.substr(b.length-a));return d+b}function Y(b,a,c,d){c=c||0;return function(e){e=e["get"+b]();if(0<c||e>-c)e+=c;0===e&&-12==c&&(e=
12);return Tb(e,a,d)}}function rb(b,a){return function(c,d){var e=c["get"+b](),g=Ha(a?"SHORT"+b:b);return d[g][e]}}function Jc(b){function a(a){var b;if(b=a.match(c)){a=new Date(0);var g=0,f=0,k=b[8]?a.setUTCFullYear:a.setFullYear,m=b[8]?a.setUTCHours:a.setHours;b[9]&&(g=Z(b[9]+b[10]),f=Z(b[9]+b[11]));k.call(a,Z(b[1]),Z(b[2])-1,Z(b[3]));g=Z(b[4]||0)-g;f=Z(b[5]||0)-f;k=Z(b[6]||0);b=Math.round(1E3*parseFloat("0."+(b[7]||0)));m.call(a,g,f,k,b)}return a}var c=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
return function(c,e){var g="",f=[],k,m;e=e||"mediumDate";e=b.DATETIME_FORMATS[e]||e;y(c)&&(c=Ie.test(c)?Z(c):a(c));xb(c)&&(c=new Date(c));if(!Oa(c))return c;for(;e;)(m=Je.exec(e))?(f=f.concat(za.call(m,1)),e=f.pop()):(f.push(e),e=null);q(f,function(a){k=Ke[a];g+=k?k(c,b.DATETIME_FORMATS):a.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function Ee(){return function(b){return sa(b,!0)}}function Fe(){return function(b,a){if(!L(b)&&!y(b))return b;a=Infinity===Math.abs(Number(a))?Number(a):Z(a);
if(y(b))return a?0<=a?b.slice(0,a):b.slice(a,b.length):"";var c=[],d,e;a>b.length?a=b.length:a<-b.length&&(a=-b.length);0<a?(d=0,e=a):(d=b.length+a,e=b.length);for(;d<e;d++)c.push(b[d]);return c}}function Lc(b){return function(a,c,d){function e(a,b){return Sa(b)?function(b,c){return a(c,b)}:a}function g(a,b){var c=typeof a,d=typeof b;return c==d?("string"==c&&(a=a.toLowerCase(),b=b.toLowerCase()),a===b?0:a<b?-1:1):c<d?-1:1}if(!L(a)||!c)return a;c=L(c)?c:[c];c=Vc(c,function(a){var c=!1,d=a||Fa;if(y(a)){if("+"==
a.charAt(0)||"-"==a.charAt(0))c="-"==a.charAt(0),a=a.substring(1);d=b(a);if(d.constant){var f=d();return e(function(a,b){return g(a[f],b[f])},c)}}return e(function(a,b){return g(d(a),d(b))},c)});for(var f=[],k=0;k<a.length;k++)f.push(a[k]);return f.sort(e(function(a,b){for(var d=0;d<c.length;d++){var e=c[d](a,b);if(0!==e)return e}return 0},d))}}function wa(b){O(b)&&(b={link:b});b.restrict=b.restrict||"AC";return $(b)}function Oc(b,a,c,d){function e(a,c){c=c?"-"+hb(c,"-"):"";d.removeClass(b,(a?sb:
tb)+c);d.addClass(b,(a?tb:sb)+c)}var g=this,f=b.parent().controller("form")||ub,k=0,m=g.$error={},h=[];g.$name=a.name||a.ngForm;g.$dirty=!1;g.$pristine=!0;g.$valid=!0;g.$invalid=!1;f.$addControl(g);b.addClass(Na);e(!0);g.$addControl=function(a){Ba(a.$name,"input");h.push(a);a.$name&&(g[a.$name]=a)};g.$removeControl=function(a){a.$name&&g[a.$name]===a&&delete g[a.$name];q(m,function(b,c){g.$setValidity(c,!0,a)});Qa(h,a)};g.$setValidity=function(a,b,c){var d=m[a];if(b)d&&(Qa(d,c),d.length||(k--,k||
(e(b),g.$valid=!0,g.$invalid=!1),m[a]=!1,e(!0,a),f.$setValidity(a,!0,g)));else{k||e(b);if(d){if(-1!=Pa(d,c))return}else m[a]=d=[],k++,e(!1,a),f.$setValidity(a,!1,g);d.push(c);g.$valid=!1;g.$invalid=!0}};g.$setDirty=function(){d.removeClass(b,Na);d.addClass(b,vb);g.$dirty=!0;g.$pristine=!1;f.$setDirty()};g.$setPristine=function(){d.removeClass(b,vb);d.addClass(b,Na);g.$dirty=!1;g.$pristine=!0;q(h,function(a){a.$setPristine()})}}function ra(b,a,c,d){b.$setValidity(a,c);return c?d:s}function Pc(b,a){var c,
d;if(a)for(c=0;c<a.length;++c)if(d=a[c],b[d])return!0;return!1}function Le(b,a,c,d,e){U(e)&&(b.$$hasNativeValidators=!0,b.$parsers.push(function(g){if(b.$error[a]||Pc(e,d)||!Pc(e,c))return g;b.$setValidity(a,!1)}))}function wb(b,a,c,d,e,g){var f=a.prop(Me),k=a[0].placeholder,m={};d.$$validityState=f;if(!e.android){var h=!1;a.on("compositionstart",function(a){h=!0});a.on("compositionend",function(){h=!1;l()})}var l=function(e){if(!h){var g=a.val();if(P&&"input"===(e||m).type&&a[0].placeholder!==k)k=
a[0].placeholder;else if(Sa(c.ngTrim||"T")&&(g=aa(g)),e=f&&d.$$hasNativeValidators,d.$viewValue!==g||""===g&&e)b.$$phase?d.$setViewValue(g):b.$apply(function(){d.$setViewValue(g)})}};if(e.hasEvent("input"))a.on("input",l);else{var p,n=function(){p||(p=g.defer(function(){l();p=null}))};a.on("keydown",function(a){a=a.keyCode;91===a||(15<a&&19>a||37<=a&&40>=a)||n()});if(e.hasEvent("paste"))a.on("paste cut",n)}a.on("change",l);d.$render=function(){a.val(d.$isEmpty(d.$viewValue)?"":d.$viewValue)};var r=
c.ngPattern;r&&((e=r.match(/^\/(.*)\/([gim]*)$/))?(r=RegExp(e[1],e[2]),e=function(a){return ra(d,"pattern",d.$isEmpty(a)||r.test(a),a)}):e=function(c){var e=b.$eval(r);if(!e||!e.test)throw v("ngPattern")("noregexp",r,e,ga(a));return ra(d,"pattern",d.$isEmpty(c)||e.test(c),c)},d.$formatters.push(e),d.$parsers.push(e));if(c.ngMinlength){var t=Z(c.ngMinlength);e=function(a){return ra(d,"minlength",d.$isEmpty(a)||a.length>=t,a)};d.$parsers.push(e);d.$formatters.push(e)}if(c.ngMaxlength){var q=Z(c.ngMaxlength);
e=function(a){return ra(d,"maxlength",d.$isEmpty(a)||a.length<=q,a)};d.$parsers.push(e);d.$formatters.push(e)}}function Ub(b,a){b="ngClass"+b;return["$animate",function(c){function d(a,b){var c=[],d=0;a:for(;d<a.length;d++){for(var e=a[d],l=0;l<b.length;l++)if(e==b[l])continue a;c.push(e)}return c}function e(a){if(!L(a)){if(y(a))return a.split(" ");if(U(a)){var b=[];q(a,function(a,c){a&&(b=b.concat(c.split(" ")))});return b}}return a}return{restrict:"AC",link:function(g,f,k){function m(a,b){var c=
f.data("$classCounts")||{},d=[];q(a,function(a){if(0<b||c[a])c[a]=(c[a]||0)+b,c[a]===+(0<b)&&d.push(a)});f.data("$classCounts",c);return d.join(" ")}function h(b){if(!0===a||g.$index%2===a){var h=e(b||[]);if(!l){var r=m(h,1);k.$addClass(r)}else if(!ya(b,l)){var q=e(l),r=d(h,q),h=d(q,h),h=m(h,-1),r=m(r,1);0===r.length?c.removeClass(f,h):0===h.length?c.addClass(f,r):c.setClass(f,r,h)}}l=la(b)}var l;g.$watch(k[b],h,!0);k.$observe("class",function(a){h(g.$eval(k[b]))});"ngClass"!==b&&g.$watch("$index",
function(c,d){var f=c&1;if(f!==(d&1)){var h=e(g.$eval(k[b]));f===a?(f=m(h,1),k.$addClass(f)):(f=m(h,-1),k.$removeClass(f))}})}}}]}var Me="validity",I=function(b){return y(b)?b.toLowerCase():b},yb=Object.prototype.hasOwnProperty,Ha=function(b){return y(b)?b.toUpperCase():b},P,x,Ca,za=[].slice,Ne=[].push,xa=Object.prototype.toString,Ra=v("ng"),Ta=T.angular||(T.angular={}),Va,La,ka=["0","0","0"];P=Z((/msie (\d+)/.exec(I(navigator.userAgent))||[])[1]);isNaN(P)&&(P=Z((/trident\/.*; rv:(\d+)/.exec(I(navigator.userAgent))||
[])[1]));A.$inject=[];Fa.$inject=[];var L=function(){return O(Array.isArray)?Array.isArray:function(b){return"[object Array]"===xa.call(b)}}(),aa=function(){return String.prototype.trim?function(b){return y(b)?b.trim():b}:function(b){return y(b)?b.replace(/^\s\s*/,"").replace(/\s\s*$/,""):b}}();La=9>P?function(b){b=b.nodeName?b:b[0];return b.scopeName&&"HTML"!=b.scopeName?Ha(b.scopeName+":"+b.nodeName):b.nodeName}:function(b){return b.nodeName?b.nodeName:b[0].nodeName};var Yc=/[A-Z]/g,ad={full:"1.2.19",
major:1,minor:2,dot:19,codeName:"precognitive-flashbacks"};S.expando="ng339";var Ya=S.cache={},ne=1,ob=T.document.addEventListener?function(b,a,c){b.addEventListener(a,c,!1)}:function(b,a,c){b.attachEvent("on"+a,c)},Xa=T.document.removeEventListener?function(b,a,c){b.removeEventListener(a,c,!1)}:function(b,a,c){b.detachEvent("on"+a,c)};S._data=function(b){return this.cache[b[this.expando]]||{}};var ie=/([\:\-\_]+(.))/g,je=/^moz([A-Z])/,Fb=v("jqLite"),ke=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,Gb=/<|&#?\w+;/,
le=/<([\w:]+)/,me=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ea={option:[1,'<select multiple="multiple">',"</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ea.optgroup=ea.option;ea.tbody=ea.tfoot=ea.colgroup=ea.caption=ea.thead;ea.th=ea.td;var Ka=S.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=
!1;"complete"===V.readyState?setTimeout(a):(this.on("DOMContentLoaded",a),S(T).on("load",a))},toString:function(){var b=[];q(this,function(a){b.push(""+a)});return"["+b.join(", ")+"]"},eq:function(b){return 0<=b?x(this[b]):x(this[this.length+b])},length:0,push:Ne,sort:[].sort,splice:[].splice},lb={};q("multiple selected checked disabled readOnly required open".split(" "),function(b){lb[I(b)]=b});var qc={};q("input select option textarea button form details".split(" "),function(b){qc[Ha(b)]=!0});q({data:mc,
inheritedData:kb,scope:function(b){return x(b).data("$scope")||kb(b.parentNode||b,["$isolateScope","$scope"])},isolateScope:function(b){return x(b).data("$isolateScope")||x(b).data("$isolateScopeNoTemplate")},controller:nc,injector:function(b){return kb(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:Jb,css:function(b,a,c){a=Wa(a);if(B(c))b.style[a]=c;else{var d;8>=P&&(d=b.currentStyle&&b.currentStyle[a],""===d&&(d="auto"));d=d||b.style[a];8>=P&&(d=""===d?s:d);return d}},attr:function(b,
a,c){var d=I(a);if(lb[d])if(B(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));else return b[a]||(b.attributes.getNamedItem(a)||A).specified?d:s;else if(B(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),null===b?s:b},prop:function(b,a,c){if(B(c))b[a]=c;else return b[a]},text:function(){function b(b,d){var e=a[b.nodeType];if(D(d))return e?b[e]:"";b[e]=d}var a=[];9>P?(a[1]="innerText",a[3]="nodeValue"):a[1]=a[3]="textContent";b.$dv="";return b}(),val:function(b,
a){if(D(a)){if("SELECT"===La(b)&&b.multiple){var c=[];q(b.options,function(a){a.selected&&c.push(a.value||a.text)});return 0===c.length?null:c}return b.value}b.value=a},html:function(b,a){if(D(a))return b.innerHTML;for(var c=0,d=b.childNodes;c<d.length;c++)Ia(d[c]);b.innerHTML=a},empty:oc},function(b,a){S.prototype[a]=function(a,d){var e,g,f=this.length;if(b!==oc&&(2==b.length&&b!==Jb&&b!==nc?a:d)===s){if(U(a)){for(e=0;e<f;e++)if(b===mc)b(this[e],a);else for(g in a)b(this[e],g,a[g]);return this}e=
b.$dv;f=e===s?Math.min(f,1):f;for(g=0;g<f;g++){var k=b(this[g],a,d);e=e?e+k:k}return e}for(e=0;e<f;e++)b(this[e],a,d);return this}});q({removeData:kc,dealoc:Ia,on:function a(c,d,e,g){if(B(g))throw Fb("onargs");var f=ma(c,"events"),k=ma(c,"handle");f||ma(c,"events",f={});k||ma(c,"handle",k=oe(c,f));q(d.split(" "),function(d){var g=f[d];if(!g){if("mouseenter"==d||"mouseleave"==d){var l=V.body.contains||V.body.compareDocumentPosition?function(a,c){var d=9===a.nodeType?a.documentElement:a,e=c&&c.parentNode;
return a===e||!!(e&&1===e.nodeType&&(d.contains?d.contains(e):a.compareDocumentPosition&&a.compareDocumentPosition(e)&16))}:function(a,c){if(c)for(;c=c.parentNode;)if(c===a)return!0;return!1};f[d]=[];a(c,{mouseleave:"mouseout",mouseenter:"mouseover"}[d],function(a){var c=a.relatedTarget;c&&(c===this||l(this,c))||k(a,d)})}else ob(c,d,k),f[d]=[];g=f[d]}g.push(e)})},off:lc,one:function(a,c,d){a=x(a);a.on(c,function g(){a.off(c,d);a.off(c,g)});a.on(c,d)},replaceWith:function(a,c){var d,e=a.parentNode;
Ia(a);q(new S(c),function(c){d?e.insertBefore(c,d.nextSibling):e.replaceChild(c,a);d=c})},children:function(a){var c=[];q(a.childNodes,function(a){1===a.nodeType&&c.push(a)});return c},contents:function(a){return a.contentDocument||a.childNodes||[]},append:function(a,c){q(new S(c),function(c){1!==a.nodeType&&11!==a.nodeType||a.appendChild(c)})},prepend:function(a,c){if(1===a.nodeType){var d=a.firstChild;q(new S(c),function(c){a.insertBefore(c,d)})}},wrap:function(a,c){c=x(c)[0];var d=a.parentNode;
d&&d.replaceChild(c,a);c.appendChild(a)},remove:function(a){Ia(a);var c=a.parentNode;c&&c.removeChild(a)},after:function(a,c){var d=a,e=a.parentNode;q(new S(c),function(a){e.insertBefore(a,d.nextSibling);d=a})},addClass:jb,removeClass:ib,toggleClass:function(a,c,d){c&&q(c.split(" "),function(c){var g=d;D(g)&&(g=!Jb(a,c));(g?jb:ib)(a,c)})},parent:function(a){return(a=a.parentNode)&&11!==a.nodeType?a:null},next:function(a){if(a.nextElementSibling)return a.nextElementSibling;for(a=a.nextSibling;null!=
a&&1!==a.nodeType;)a=a.nextSibling;return a},find:function(a,c){return a.getElementsByTagName?a.getElementsByTagName(c):[]},clone:Ib,triggerHandler:function(a,c,d){c=(ma(a,"events")||{})[c];d=d||[];var e=[{preventDefault:A,stopPropagation:A}];q(c,function(c){c.apply(a,e.concat(d))})}},function(a,c){S.prototype[c]=function(c,e,g){for(var f,k=0;k<this.length;k++)D(f)?(f=a(this[k],c,e,g),B(f)&&(f=x(f))):Hb(f,a(this[k],c,e,g));return B(f)?f:this};S.prototype.bind=S.prototype.on;S.prototype.unbind=S.prototype.off});
Za.prototype={put:function(a,c){this[Ja(a,this.nextUid)]=c},get:function(a){return this[Ja(a,this.nextUid)]},remove:function(a){var c=this[a=Ja(a,this.nextUid)];delete this[a];return c}};var qe=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,re=/,/,se=/^\s*(_?)(\S+?)\1\s*$/,pe=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,$a=v("$injector"),Oe=v("$animate"),Md=["$provide",function(a){this.$$selectors={};this.register=function(c,d){var e=c+"-animation";if(c&&"."!=c.charAt(0))throw Oe("notcsel",c);this.$$selectors[c.substr(1)]=
e;a.factory(e,d)};this.classNameFilter=function(a){1===arguments.length&&(this.$$classNameFilter=a instanceof RegExp?a:null);return this.$$classNameFilter};this.$get=["$timeout","$$asyncCallback",function(a,d){return{enter:function(a,c,f,k){f?f.after(a):(c&&c[0]||(c=f.parent()),c.append(a));k&&d(k)},leave:function(a,c){a.remove();c&&d(c)},move:function(a,c,d,k){this.enter(a,c,d,k)},addClass:function(a,c,f){c=y(c)?c:L(c)?c.join(" "):"";q(a,function(a){jb(a,c)});f&&d(f)},removeClass:function(a,c,f){c=
y(c)?c:L(c)?c.join(" "):"";q(a,function(a){ib(a,c)});f&&d(f)},setClass:function(a,c,f,k){q(a,function(a){jb(a,c);ib(a,f)});k&&d(k)},enabled:A}}]}],ia=v("$compile");fc.$inject=["$provide","$$sanitizeUriProvider"];var ve=/^(x[\:\-_]|data[\:\-_])/i,yc=v("$interpolate"),Pe=/^([^\?#]*)(\?([^#]*))?(#(.*))?$/,ye={http:80,https:443,ftp:21},Ob=v("$location");Qb.prototype=Pb.prototype=Bc.prototype={$$html5:!1,$$replace:!1,absUrl:pb("$$absUrl"),url:function(a,c){if(D(a))return this.$$url;var d=Pe.exec(a);d[1]&&
this.path(decodeURIComponent(d[1]));(d[2]||d[1])&&this.search(d[3]||"");this.hash(d[5]||"",c);return this},protocol:pb("$$protocol"),host:pb("$$host"),port:pb("$$port"),path:Cc("$$path",function(a){return"/"==a.charAt(0)?a:"/"+a}),search:function(a,c){switch(arguments.length){case 0:return this.$$search;case 1:if(y(a))this.$$search=bc(a);else if(U(a))this.$$search=a;else throw Ob("isrcharg");break;default:D(c)||null===c?delete this.$$search[a]:this.$$search[a]=c}this.$$compose();return this},hash:Cc("$$hash",
Fa),replace:function(){this.$$replace=!0;return this}};var ja=v("$parse"),Fc={},ua,Qe=Function.prototype.call,Re=Function.prototype.apply,Qc=Function.prototype.bind,cb={"null":function(){return null},"true":function(){return!0},"false":function(){return!1},undefined:A,"+":function(a,c,d,e){d=d(a,c);e=e(a,c);return B(d)?B(e)?d+e:d:B(e)?e:s},"-":function(a,c,d,e){d=d(a,c);e=e(a,c);return(B(d)?d:0)-(B(e)?e:0)},"*":function(a,c,d,e){return d(a,c)*e(a,c)},"/":function(a,c,d,e){return d(a,c)/e(a,c)},"%":function(a,
c,d,e){return d(a,c)%e(a,c)},"^":function(a,c,d,e){return d(a,c)^e(a,c)},"=":A,"===":function(a,c,d,e){return d(a,c)===e(a,c)},"!==":function(a,c,d,e){return d(a,c)!==e(a,c)},"==":function(a,c,d,e){return d(a,c)==e(a,c)},"!=":function(a,c,d,e){return d(a,c)!=e(a,c)},"<":function(a,c,d,e){return d(a,c)<e(a,c)},">":function(a,c,d,e){return d(a,c)>e(a,c)},"<=":function(a,c,d,e){return d(a,c)<=e(a,c)},">=":function(a,c,d,e){return d(a,c)>=e(a,c)},"&&":function(a,c,d,e){return d(a,c)&&e(a,c)},"||":function(a,
c,d,e){return d(a,c)||e(a,c)},"&":function(a,c,d,e){return d(a,c)&e(a,c)},"|":function(a,c,d,e){return e(a,c)(a,c,d(a,c))},"!":function(a,c,d){return!d(a,c)}},Se={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Sb=function(a){this.options=a};Sb.prototype={constructor:Sb,lex:function(a){this.text=a;this.index=0;this.ch=s;this.lastCh=":";for(this.tokens=[];this.index<this.text.length;){this.ch=this.text.charAt(this.index);if(this.is("\"'"))this.readString(this.ch);else if(this.isNumber(this.ch)||
this.is(".")&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdent(this.ch))this.readIdent();else if(this.is("(){}[].,;:?"))this.tokens.push({index:this.index,text:this.ch}),this.index++;else if(this.isWhitespace(this.ch)){this.index++;continue}else{a=this.ch+this.peek();var c=a+this.peek(2),d=cb[this.ch],e=cb[a],g=cb[c];g?(this.tokens.push({index:this.index,text:c,fn:g}),this.index+=3):e?(this.tokens.push({index:this.index,text:a,fn:e}),this.index+=2):d?(this.tokens.push({index:this.index,
text:this.ch,fn:d}),this.index+=1):this.throwError("Unexpected next character ",this.index,this.index+1)}this.lastCh=this.ch}return this.tokens},is:function(a){return-1!==a.indexOf(this.ch)},was:function(a){return-1!==a.indexOf(this.lastCh)},peek:function(a){a=a||1;return this.index+a<this.text.length?this.text.charAt(this.index+a):!1},isNumber:function(a){return"0"<=a&&"9">=a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===a},isIdent:function(a){return"a"<=
a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},throwError:function(a,c,d){d=d||this.index;c=B(c)?"s "+c+"-"+this.index+" ["+this.text.substring(c,d)+"]":" "+d;throw ja("lexerr",a,c,this.text);},readNumber:function(){for(var a="",c=this.index;this.index<this.text.length;){var d=I(this.text.charAt(this.index));if("."==d||this.isNumber(d))a+=d;else{var e=this.peek();if("e"==d&&this.isExpOperator(e))a+=d;else if(this.isExpOperator(d)&&
e&&this.isNumber(e)&&"e"==a.charAt(a.length-1))a+=d;else if(!this.isExpOperator(d)||e&&this.isNumber(e)||"e"!=a.charAt(a.length-1))break;else this.throwError("Invalid exponent")}this.index++}a*=1;this.tokens.push({index:c,text:a,literal:!0,constant:!0,fn:function(){return a}})},readIdent:function(){for(var a=this,c="",d=this.index,e,g,f,k;this.index<this.text.length;){k=this.text.charAt(this.index);if("."===k||this.isIdent(k)||this.isNumber(k))"."===k&&(e=this.index),c+=k;else break;this.index++}if(e)for(g=
this.index;g<this.text.length;){k=this.text.charAt(g);if("("===k){f=c.substr(e-d+1);c=c.substr(0,e-d);this.index=g;break}if(this.isWhitespace(k))g++;else break}d={index:d,text:c};if(cb.hasOwnProperty(c))d.fn=cb[c],d.literal=!0,d.constant=!0;else{var m=Ec(c,this.options,this.text);d.fn=E(function(a,c){return m(a,c)},{assign:function(d,e){return qb(d,c,e,a.text,a.options)}})}this.tokens.push(d);f&&(this.tokens.push({index:e,text:"."}),this.tokens.push({index:e+1,text:f}))},readString:function(a){var c=
this.index;this.index++;for(var d="",e=a,g=!1;this.index<this.text.length;){var f=this.text.charAt(this.index),e=e+f;if(g)"u"===f?(f=this.text.substring(this.index+1,this.index+5),f.match(/[\da-f]{4}/i)||this.throwError("Invalid unicode escape [\\u"+f+"]"),this.index+=4,d+=String.fromCharCode(parseInt(f,16))):d=(g=Se[f])?d+g:d+f,g=!1;else if("\\"===f)g=!0;else{if(f===a){this.index++;this.tokens.push({index:c,text:e,string:d,literal:!0,constant:!0,fn:function(){return d}});return}d+=f}this.index++}this.throwError("Unterminated quote",
c)}};var bb=function(a,c,d){this.lexer=a;this.$filter=c;this.options=d};bb.ZERO=E(function(){return 0},{constant:!0});bb.prototype={constructor:bb,parse:function(a){this.text=a;this.tokens=this.lexer.lex(a);a=this.statements();0!==this.tokens.length&&this.throwError("is an unexpected token",this.tokens[0]);a.literal=!!a.literal;a.constant=!!a.constant;return a},primary:function(){var a;if(this.expect("("))a=this.filterChain(),this.consume(")");else if(this.expect("["))a=this.arrayDeclaration();else if(this.expect("{"))a=
this.object();else{var c=this.expect();(a=c.fn)||this.throwError("not a primary expression",c);a.literal=!!c.literal;a.constant=!!c.constant}for(var d;c=this.expect("(","[",".");)"("===c.text?(a=this.functionCall(a,d),d=null):"["===c.text?(d=a,a=this.objectIndex(a)):"."===c.text?(d=a,a=this.fieldAccess(a)):this.throwError("IMPOSSIBLE");return a},throwError:function(a,c){throw ja("syntax",c.text,a,c.index+1,this.text,this.text.substring(c.index));},peekToken:function(){if(0===this.tokens.length)throw ja("ueoe",
this.text);return this.tokens[0]},peek:function(a,c,d,e){if(0<this.tokens.length){var g=this.tokens[0],f=g.text;if(f===a||f===c||f===d||f===e||!(a||c||d||e))return g}return!1},expect:function(a,c,d,e){return(a=this.peek(a,c,d,e))?(this.tokens.shift(),a):!1},consume:function(a){this.expect(a)||this.throwError("is unexpected, expecting ["+a+"]",this.peek())},unaryFn:function(a,c){return E(function(d,e){return a(d,e,c)},{constant:c.constant})},ternaryFn:function(a,c,d){return E(function(e,g){return a(e,
g)?c(e,g):d(e,g)},{constant:a.constant&&c.constant&&d.constant})},binaryFn:function(a,c,d){return E(function(e,g){return c(e,g,a,d)},{constant:a.constant&&d.constant})},statements:function(){for(var a=[];;)if(0<this.tokens.length&&!this.peek("}",")",";","]")&&a.push(this.filterChain()),!this.expect(";"))return 1===a.length?a[0]:function(c,d){for(var e,g=0;g<a.length;g++){var f=a[g];f&&(e=f(c,d))}return e}},filterChain:function(){for(var a=this.expression(),c;;)if(c=this.expect("|"))a=this.binaryFn(a,
c.fn,this.filter());else return a},filter:function(){for(var a=this.expect(),c=this.$filter(a.text),d=[];;)if(a=this.expect(":"))d.push(this.expression());else{var e=function(a,e,k){k=[k];for(var m=0;m<d.length;m++)k.push(d[m](a,e));return c.apply(a,k)};return function(){return e}}},expression:function(){return this.assignment()},assignment:function(){var a=this.ternary(),c,d;return(d=this.expect("="))?(a.assign||this.throwError("implies assignment but ["+this.text.substring(0,d.index)+"] can not be assigned to",
d),c=this.ternary(),function(d,g){return a.assign(d,c(d,g),g)}):a},ternary:function(){var a=this.logicalOR(),c,d;if(this.expect("?")){c=this.ternary();if(d=this.expect(":"))return this.ternaryFn(a,c,this.ternary());this.throwError("expected :",d)}else return a},logicalOR:function(){for(var a=this.logicalAND(),c;;)if(c=this.expect("||"))a=this.binaryFn(a,c.fn,this.logicalAND());else return a},logicalAND:function(){var a=this.equality(),c;if(c=this.expect("&&"))a=this.binaryFn(a,c.fn,this.logicalAND());
return a},equality:function(){var a=this.relational(),c;if(c=this.expect("==","!=","===","!=="))a=this.binaryFn(a,c.fn,this.equality());return a},relational:function(){var a=this.additive(),c;if(c=this.expect("<",">","<=",">="))a=this.binaryFn(a,c.fn,this.relational());return a},additive:function(){for(var a=this.multiplicative(),c;c=this.expect("+","-");)a=this.binaryFn(a,c.fn,this.multiplicative());return a},multiplicative:function(){for(var a=this.unary(),c;c=this.expect("*","/","%");)a=this.binaryFn(a,
c.fn,this.unary());return a},unary:function(){var a;return this.expect("+")?this.primary():(a=this.expect("-"))?this.binaryFn(bb.ZERO,a.fn,this.unary()):(a=this.expect("!"))?this.unaryFn(a.fn,this.unary()):this.primary()},fieldAccess:function(a){var c=this,d=this.expect().text,e=Ec(d,this.options,this.text);return E(function(c,d,k){return e(k||a(c,d))},{assign:function(e,f,k){return qb(a(e,k),d,f,c.text,c.options)}})},objectIndex:function(a){var c=this,d=this.expression();this.consume("]");return E(function(e,
g){var f=a(e,g),k=d(e,g),m;da(k,c.text);if(!f)return s;(f=Ma(f[k],c.text))&&(f.then&&c.options.unwrapPromises)&&(m=f,"$$v"in f||(m.$$v=s,m.then(function(a){m.$$v=a})),f=f.$$v);return f},{assign:function(e,g,f){var k=d(e,f);return Ma(a(e,f),c.text)[k]=g}})},functionCall:function(a,c){var d=[];if(")"!==this.peekToken().text){do d.push(this.expression());while(this.expect(","))}this.consume(")");var e=this;return function(g,f){for(var k=[],m=c?c(g,f):g,h=0;h<d.length;h++)k.push(d[h](g,f));h=a(g,f,m)||
A;Ma(m,e.text);var l=e.text;if(h){if(h.constructor===h)throw ja("isecfn",l);if(h===Qe||h===Re||Qc&&h===Qc)throw ja("isecff",l);}k=h.apply?h.apply(m,k):h(k[0],k[1],k[2],k[3],k[4]);return Ma(k,e.text)}},arrayDeclaration:function(){var a=[],c=!0;if("]"!==this.peekToken().text){do{if(this.peek("]"))break;var d=this.expression();a.push(d);d.constant||(c=!1)}while(this.expect(","))}this.consume("]");return E(function(c,d){for(var f=[],k=0;k<a.length;k++)f.push(a[k](c,d));return f},{literal:!0,constant:c})},
object:function(){var a=[],c=!0;if("}"!==this.peekToken().text){do{if(this.peek("}"))break;var d=this.expect(),d=d.string||d.text;this.consume(":");var e=this.expression();a.push({key:d,value:e});e.constant||(c=!1)}while(this.expect(","))}this.consume("}");return E(function(c,d){for(var e={},m=0;m<a.length;m++){var h=a[m];e[h.key]=h.value(c,d)}return e},{literal:!0,constant:c})}};var Rb={},va=v("$sce"),fa={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},W=V.createElement("a"),
Hc=ta(T.location.href,!0);jc.$inject=["$provide"];Ic.$inject=["$locale"];Kc.$inject=["$locale"];var Nc=".",Ke={yyyy:Y("FullYear",4),yy:Y("FullYear",2,0,!0),y:Y("FullYear",1),MMMM:rb("Month"),MMM:rb("Month",!0),MM:Y("Month",2,1),M:Y("Month",1,1),dd:Y("Date",2),d:Y("Date",1),HH:Y("Hours",2),H:Y("Hours",1),hh:Y("Hours",2,-12),h:Y("Hours",1,-12),mm:Y("Minutes",2),m:Y("Minutes",1),ss:Y("Seconds",2),s:Y("Seconds",1),sss:Y("Milliseconds",3),EEEE:rb("Day"),EEE:rb("Day",!0),a:function(a,c){return 12>a.getHours()?
c.AMPMS[0]:c.AMPMS[1]},Z:function(a){a=-1*a.getTimezoneOffset();return a=(0<=a?"+":"")+(Tb(Math[0<a?"floor":"ceil"](a/60),2)+Tb(Math.abs(a%60),2))}},Je=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,Ie=/^\-?\d+$/;Jc.$inject=["$locale"];var Ge=$(I),He=$(Ha);Lc.$inject=["$parse"];var dd=$({restrict:"E",compile:function(a,c){8>=P&&(c.href||c.name||c.$set("href",""),a.append(V.createComment("IE fix")));if(!c.href&&!c.xlinkHref&&!c.name)return function(a,c){var g="[object SVGAnimatedString]"===
xa.call(c.prop("href"))?"xlink:href":"href";c.on("click",function(a){c.attr(g)||a.preventDefault()})}}}),Db={};q(lb,function(a,c){if("multiple"!=a){var d=na("ng-"+c);Db[d]=function(){return{priority:100,link:function(a,g,f){a.$watch(f[d],function(a){f.$set(c,!!a)})}}}}});q(["src","srcset","href"],function(a){var c=na("ng-"+a);Db[c]=function(){return{priority:99,link:function(d,e,g){var f=a,k=a;"href"===a&&"[object SVGAnimatedString]"===xa.call(e.prop("href"))&&(k="xlinkHref",g.$attr[k]="xlink:href",
f=null);g.$observe(c,function(a){a&&(g.$set(k,a),P&&f&&e.prop(f,g[k]))})}}}});var ub={$addControl:A,$removeControl:A,$setValidity:A,$setDirty:A,$setPristine:A};Oc.$inject=["$element","$attrs","$scope","$animate"];var Rc=function(a){return["$timeout",function(c){return{name:"form",restrict:a?"EAC":"E",controller:Oc,compile:function(){return{pre:function(a,e,g,f){if(!g.action){var k=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1};ob(e[0],"submit",k);e.on("$destroy",function(){c(function(){Xa(e[0],
"submit",k)},0,!1)})}var m=e.parent().controller("form"),h=g.name||g.ngForm;h&&qb(a,h,f,h);if(m)e.on("$destroy",function(){m.$removeControl(f);h&&qb(a,h,s,h);E(f,ub)})}}}}}]},ed=Rc(),rd=Rc(!0),Te=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,Ue=/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9-]+(\.[a-z0-9-]+)*$/i,Ve=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,Sc={text:wb,number:function(a,c,d,e,g,f){wb(a,c,d,e,g,f);e.$parsers.push(function(a){var c=e.$isEmpty(a);if(c||Ve.test(a))return e.$setValidity("number",
!0),""===a?null:c?a:parseFloat(a);e.$setValidity("number",!1);return s});Le(e,"number",We,null,e.$$validityState);e.$formatters.push(function(a){return e.$isEmpty(a)?"":""+a});d.min&&(a=function(a){var c=parseFloat(d.min);return ra(e,"min",e.$isEmpty(a)||a>=c,a)},e.$parsers.push(a),e.$formatters.push(a));d.max&&(a=function(a){var c=parseFloat(d.max);return ra(e,"max",e.$isEmpty(a)||a<=c,a)},e.$parsers.push(a),e.$formatters.push(a));e.$formatters.push(function(a){return ra(e,"number",e.$isEmpty(a)||
xb(a),a)})},url:function(a,c,d,e,g,f){wb(a,c,d,e,g,f);a=function(a){return ra(e,"url",e.$isEmpty(a)||Te.test(a),a)};e.$formatters.push(a);e.$parsers.push(a)},email:function(a,c,d,e,g,f){wb(a,c,d,e,g,f);a=function(a){return ra(e,"email",e.$isEmpty(a)||Ue.test(a),a)};e.$formatters.push(a);e.$parsers.push(a)},radio:function(a,c,d,e){D(d.name)&&c.attr("name",eb());c.on("click",function(){c[0].checked&&a.$apply(function(){e.$setViewValue(d.value)})});e.$render=function(){c[0].checked=d.value==e.$viewValue};
d.$observe("value",e.$render)},checkbox:function(a,c,d,e){var g=d.ngTrueValue,f=d.ngFalseValue;y(g)||(g=!0);y(f)||(f=!1);c.on("click",function(){a.$apply(function(){e.$setViewValue(c[0].checked)})});e.$render=function(){c[0].checked=e.$viewValue};e.$isEmpty=function(a){return a!==g};e.$formatters.push(function(a){return a===g});e.$parsers.push(function(a){return a?g:f})},hidden:A,button:A,submit:A,reset:A,file:A},We=["badInput"],gc=["$browser","$sniffer",function(a,c){return{restrict:"E",require:"?ngModel",
link:function(d,e,g,f){f&&(Sc[I(g.type)]||Sc.text)(d,e,g,f,c,a)}}}],tb="ng-valid",sb="ng-invalid",Na="ng-pristine",vb="ng-dirty",Xe=["$scope","$exceptionHandler","$attrs","$element","$parse","$animate",function(a,c,d,e,g,f){function k(a,c){c=c?"-"+hb(c,"-"):"";f.removeClass(e,(a?sb:tb)+c);f.addClass(e,(a?tb:sb)+c)}this.$modelValue=this.$viewValue=Number.NaN;this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$name=
d.name;var m=g(d.ngModel),h=m.assign;if(!h)throw v("ngModel")("nonassign",d.ngModel,ga(e));this.$render=A;this.$isEmpty=function(a){return D(a)||""===a||null===a||a!==a};var l=e.inheritedData("$formController")||ub,p=0,n=this.$error={};e.addClass(Na);k(!0);this.$setValidity=function(a,c){n[a]!==!c&&(c?(n[a]&&p--,p||(k(!0),this.$valid=!0,this.$invalid=!1)):(k(!1),this.$invalid=!0,this.$valid=!1,p++),n[a]=!c,k(c,a),l.$setValidity(a,c,this))};this.$setPristine=function(){this.$dirty=!1;this.$pristine=
!0;f.removeClass(e,vb);f.addClass(e,Na)};this.$setViewValue=function(d){this.$viewValue=d;this.$pristine&&(this.$dirty=!0,this.$pristine=!1,f.removeClass(e,Na),f.addClass(e,vb),l.$setDirty());q(this.$parsers,function(a){d=a(d)});this.$modelValue!==d&&(this.$modelValue=d,h(a,d),q(this.$viewChangeListeners,function(a){try{a()}catch(d){c(d)}}))};var r=this;a.$watch(function(){var c=m(a);if(r.$modelValue!==c){var d=r.$formatters,e=d.length;for(r.$modelValue=c;e--;)c=d[e](c);r.$viewValue!==c&&(r.$viewValue=
c,r.$render())}return c})}],Gd=function(){return{require:["ngModel","^?form"],controller:Xe,link:function(a,c,d,e){var g=e[0],f=e[1]||ub;f.$addControl(g);a.$on("$destroy",function(){f.$removeControl(g)})}}},Id=$({require:"ngModel",link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),hc=function(){return{require:"?ngModel",link:function(a,c,d,e){if(e){d.required=!0;var g=function(a){if(d.required&&e.$isEmpty(a))e.$setValidity("required",!1);else return e.$setValidity("required",
!0),a};e.$formatters.push(g);e.$parsers.unshift(g);d.$observe("required",function(){g(e.$viewValue)})}}}},Hd=function(){return{require:"ngModel",link:function(a,c,d,e){var g=(a=/\/(.*)\//.exec(d.ngList))&&RegExp(a[1])||d.ngList||",";e.$parsers.push(function(a){if(!D(a)){var c=[];a&&q(a.split(g),function(a){a&&c.push(aa(a))});return c}});e.$formatters.push(function(a){return L(a)?a.join(", "):s});e.$isEmpty=function(a){return!a||!a.length}}}},Ye=/^(true|false|\d+)$/,Jd=function(){return{priority:100,
compile:function(a,c){return Ye.test(c.ngValue)?function(a,c,g){g.$set("value",a.$eval(g.ngValue))}:function(a,c,g){a.$watch(g.ngValue,function(a){g.$set("value",a)})}}}},jd=wa({compile:function(a){a.addClass("ng-binding");return function(a,d,e){d.data("$binding",e.ngBind);a.$watch(e.ngBind,function(a){d.text(a==s?"":a)})}}}),ld=["$interpolate",function(a){return function(c,d,e){c=a(d.attr(e.$attr.ngBindTemplate));d.addClass("ng-binding").data("$binding",c);e.$observe("ngBindTemplate",function(a){d.text(a)})}}],
kd=["$sce","$parse",function(a,c){return function(d,e,g){e.addClass("ng-binding").data("$binding",g.ngBindHtml);var f=c(g.ngBindHtml);d.$watch(function(){return(f(d)||"").toString()},function(c){e.html(a.getTrustedHtml(f(d))||"")})}}],md=Ub("",!0),od=Ub("Odd",0),nd=Ub("Even",1),pd=wa({compile:function(a,c){c.$set("ngCloak",s);a.removeClass("ng-cloak")}}),qd=[function(){return{scope:!0,controller:"@",priority:500}}],ic={};q("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),
function(a){var c=na("ng-"+a);ic[c]=["$parse",function(d){return{compile:function(e,g){var f=d(g[c]);return function(c,d){d.on(I(a),function(a){c.$apply(function(){f(c,{$event:a})})})}}}}]});var td=["$animate",function(a){return{transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(c,d,e,g,f){var k,m,h;c.$watch(e.ngIf,function(g){Sa(g)?m||(m=c.$new(),f(m,function(c){c[c.length++]=V.createComment(" end ngIf: "+e.ngIf+" ");k={clone:c};a.enter(c,d.parent(),d)})):(h&&(h.remove(),
h=null),m&&(m.$destroy(),m=null),k&&(h=Cb(k.clone),a.leave(h,function(){h=null}),k=null))})}}}],ud=["$http","$templateCache","$anchorScroll","$animate","$sce",function(a,c,d,e,g){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:Ta.noop,compile:function(f,k){var m=k.ngInclude||k.src,h=k.onload||"",l=k.autoscroll;return function(f,k,q,t,J){var w=0,u,s,x,z=function(){s&&(s.remove(),s=null);u&&(u.$destroy(),u=null);x&&(e.leave(x,function(){s=null}),s=x,x=null)};f.$watch(g.parseAsResourceUrl(m),
function(g){var m=function(){!B(l)||l&&!f.$eval(l)||d()},q=++w;g?(a.get(g,{cache:c}).success(function(a){if(q===w){var c=f.$new();t.template=a;a=J(c,function(a){z();e.enter(a,null,k,m)});u=c;x=a;u.$emit("$includeContentLoaded");f.$eval(h)}}).error(function(){q===w&&z()}),f.$emit("$includeContentRequested")):(z(),t.template=null)})}}}}],Kd=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(c,d,e,g){d.html(g.template);a(d.contents())(c)}}}],vd=wa({priority:450,
compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),wd=wa({terminal:!0,priority:1E3}),xd=["$locale","$interpolate",function(a,c){var d=/{}/g;return{restrict:"EA",link:function(e,g,f){var k=f.count,m=f.$attr.when&&g.attr(f.$attr.when),h=f.offset||0,l=e.$eval(m)||{},p={},n=c.startSymbol(),r=c.endSymbol(),t=/^when(Minus)?(.+)$/;q(f,function(a,c){t.test(c)&&(l[I(c.replace("when","").replace("Minus","-"))]=g.attr(f.$attr[c]))});q(l,function(a,e){p[e]=c(a.replace(d,n+k+"-"+h+r))});e.$watch(function(){var c=
parseFloat(e.$eval(k));if(isNaN(c))return"";c in l||(c=a.pluralCat(c-h));return p[c](e,g,!0)},function(a){g.text(a)})}}}],yd=["$parse","$animate",function(a,c){var d=v("ngRepeat");return{transclude:"element",priority:1E3,terminal:!0,$$tlb:!0,link:function(e,g,f,k,m){var h=f.ngRepeat,l=h.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/),p,n,r,t,s,w,u={$id:Ja};if(!l)throw d("iexp",h);f=l[1];k=l[2];(l=l[3])?(p=a(l),n=function(a,c,d){w&&(u[w]=a);u[s]=c;u.$index=d;return p(e,
u)}):(r=function(a,c){return Ja(c)},t=function(a){return a});l=f.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!l)throw d("iidexp",f);s=l[3]||l[1];w=l[2];var B={};e.$watchCollection(k,function(a){var f,k,l=g[0],p,u={},C,G,H,v,y,A,D=[];if(db(a))y=a,p=n||r;else{p=n||t;y=[];for(H in a)a.hasOwnProperty(H)&&"$"!=H.charAt(0)&&y.push(H);y.sort()}C=y.length;k=D.length=y.length;for(f=0;f<k;f++)if(H=a===y?f:y[f],v=a[H],v=p(H,v,f),Ba(v,"`track by` id"),B.hasOwnProperty(v))A=B[v],delete B[v],u[v]=
A,D[f]=A;else{if(u.hasOwnProperty(v))throw q(D,function(a){a&&a.scope&&(B[a.id]=a)}),d("dupes",h,v);D[f]={id:v};u[v]=!1}for(H in B)B.hasOwnProperty(H)&&(A=B[H],f=Cb(A.clone),c.leave(f),q(f,function(a){a.$$NG_REMOVED=!0}),A.scope.$destroy());f=0;for(k=y.length;f<k;f++){H=a===y?f:y[f];v=a[H];A=D[f];D[f-1]&&(l=D[f-1].clone[D[f-1].clone.length-1]);if(A.scope){G=A.scope;p=l;do p=p.nextSibling;while(p&&p.$$NG_REMOVED);A.clone[0]!=p&&c.move(Cb(A.clone),null,x(l));l=A.clone[A.clone.length-1]}else G=e.$new();
G[s]=v;w&&(G[w]=H);G.$index=f;G.$first=0===f;G.$last=f===C-1;G.$middle=!(G.$first||G.$last);G.$odd=!(G.$even=0===(f&1));A.scope||m(G,function(a){a[a.length++]=V.createComment(" end ngRepeat: "+h+" ");c.enter(a,null,x(l));l=a;A.scope=G;A.clone=a;u[A.id]=A})}B=u})}}}],zd=["$animate",function(a){return function(c,d,e){c.$watch(e.ngShow,function(c){a[Sa(c)?"removeClass":"addClass"](d,"ng-hide")})}}],sd=["$animate",function(a){return function(c,d,e){c.$watch(e.ngHide,function(c){a[Sa(c)?"addClass":"removeClass"](d,
"ng-hide")})}}],Ad=wa(function(a,c,d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&q(d,function(a,d){c.css(d,"")});a&&c.css(a)},!0)}),Bd=["$animate",function(a){return{restrict:"EA",require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(c,d,e,g){var f=[],k=[],m=[],h=[];c.$watch(e.ngSwitch||e.on,function(d){var p,n;p=0;for(n=m.length;p<n;++p)m[p].remove();p=m.length=0;for(n=h.length;p<n;++p){var r=k[p];h[p].$destroy();m[p]=r;a.leave(r,function(){m.splice(p,1)})}k.length=0;h.length=
0;if(f=g.cases["!"+d]||g.cases["?"])c.$eval(e.change),q(f,function(d){var e=c.$new();h.push(e);d.transclude(e,function(c){var e=d.element;k.push(c);a.enter(c,e.parent(),e)})})})}}}],Cd=wa({transclude:"element",priority:800,require:"^ngSwitch",link:function(a,c,d,e,g){e.cases["!"+d.ngSwitchWhen]=e.cases["!"+d.ngSwitchWhen]||[];e.cases["!"+d.ngSwitchWhen].push({transclude:g,element:c})}}),Dd=wa({transclude:"element",priority:800,require:"^ngSwitch",link:function(a,c,d,e,g){e.cases["?"]=e.cases["?"]||
[];e.cases["?"].push({transclude:g,element:c})}}),Fd=wa({link:function(a,c,d,e,g){if(!g)throw v("ngTransclude")("orphan",ga(c));g(function(a){c.empty();c.append(a)})}}),fd=["$templateCache",function(a){return{restrict:"E",terminal:!0,compile:function(c,d){"text/ng-template"==d.type&&a.put(d.id,c[0].text)}}}],Ze=v("ngOptions"),Ed=$({terminal:!0}),gd=["$compile","$parse",function(a,c){var d=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,
e={$setViewValue:A};return{restrict:"E",require:["select","?ngModel"],controller:["$element","$scope","$attrs",function(a,c,d){var m=this,h={},l=e,p;m.databound=d.ngModel;m.init=function(a,c,d){l=a;p=d};m.addOption=function(c){Ba(c,'"option value"');h[c]=!0;l.$viewValue==c&&(a.val(c),p.parent()&&p.remove())};m.removeOption=function(a){this.hasOption(a)&&(delete h[a],l.$viewValue==a&&this.renderUnknownOption(a))};m.renderUnknownOption=function(c){c="? "+Ja(c)+" ?";p.val(c);a.prepend(p);a.val(c);p.prop("selected",
!0)};m.hasOption=function(a){return h.hasOwnProperty(a)};c.$on("$destroy",function(){m.renderUnknownOption=A})}],link:function(e,f,k,m){function h(a,c,d,e){d.$render=function(){var a=d.$viewValue;e.hasOption(a)?(y.parent()&&y.remove(),c.val(a),""===a&&w.prop("selected",!0)):D(a)&&w?c.val(""):e.renderUnknownOption(a)};c.on("change",function(){a.$apply(function(){y.parent()&&y.remove();d.$setViewValue(c.val())})})}function l(a,c,d){var e;d.$render=function(){var a=new Za(d.$viewValue);q(c.find("option"),
function(c){c.selected=B(a.get(c.value))})};a.$watch(function(){ya(e,d.$viewValue)||(e=la(d.$viewValue),d.$render())});c.on("change",function(){a.$apply(function(){var a=[];q(c.find("option"),function(c){c.selected&&a.push(c.value)});d.$setViewValue(a)})})}function p(e,f,g){function k(){var a={"":[]},c=[""],d,h,s,t,z;t=g.$modelValue;z=x(e)||[];var D=n?Vb(z):z,G,R,C;R={};s=!1;var E,I;if(r)if(w&&L(t))for(s=new Za([]),C=0;C<t.length;C++)R[m]=t[C],s.put(w(e,R),t[C]);else s=new Za(t);for(C=0;G=D.length,
C<G;C++){h=C;if(n){h=D[C];if("$"===h.charAt(0))continue;R[n]=h}R[m]=z[h];d=p(e,R)||"";(h=a[d])||(h=a[d]=[],c.push(d));r?d=B(s.remove(w?w(e,R):q(e,R))):(w?(d={},d[m]=t,d=w(e,d)===w(e,R)):d=t===q(e,R),s=s||d);E=l(e,R);E=B(E)?E:"";h.push({id:w?w(e,R):n?D[C]:C,label:E,selected:d})}r||(v||null===t?a[""].unshift({id:"",label:"",selected:!s}):s||a[""].unshift({id:"?",label:"",selected:!0}));R=0;for(D=c.length;R<D;R++){d=c[R];h=a[d];y.length<=R?(t={element:A.clone().attr("label",d),label:h.label},z=[t],y.push(z),
f.append(t.element)):(z=y[R],t=z[0],t.label!=d&&t.element.attr("label",t.label=d));E=null;C=0;for(G=h.length;C<G;C++)s=h[C],(d=z[C+1])?(E=d.element,d.label!==s.label&&E.text(d.label=s.label),d.id!==s.id&&E.val(d.id=s.id),d.selected!==s.selected&&E.prop("selected",d.selected=s.selected)):(""===s.id&&v?I=v:(I=u.clone()).val(s.id).prop("selected",s.selected).text(s.label),z.push({element:I,label:s.label,id:s.id,selected:s.selected}),E?E.after(I):t.element.append(I),E=I);for(C++;z.length>C;)z.pop().element.remove()}for(;y.length>
R;)y.pop()[0].element.remove()}var h;if(!(h=t.match(d)))throw Ze("iexp",t,ga(f));var l=c(h[2]||h[1]),m=h[4]||h[6],n=h[5],p=c(h[3]||""),q=c(h[2]?h[1]:m),x=c(h[7]),w=h[8]?c(h[8]):null,y=[[{element:f,label:""}]];v&&(a(v)(e),v.removeClass("ng-scope"),v.remove());f.empty();f.on("change",function(){e.$apply(function(){var a,c=x(e)||[],d={},h,k,l,p,t,u,v;if(r)for(k=[],p=0,u=y.length;p<u;p++)for(a=y[p],l=1,t=a.length;l<t;l++){if((h=a[l].element)[0].selected){h=h.val();n&&(d[n]=h);if(w)for(v=0;v<c.length&&
(d[m]=c[v],w(e,d)!=h);v++);else d[m]=c[h];k.push(q(e,d))}}else{h=f.val();if("?"==h)k=s;else if(""===h)k=null;else if(w)for(v=0;v<c.length;v++){if(d[m]=c[v],w(e,d)==h){k=q(e,d);break}}else d[m]=c[h],n&&(d[n]=h),k=q(e,d);1<y[0].length&&y[0][1].id!==h&&(y[0][1].selected=!1)}g.$setViewValue(k)})});g.$render=k;e.$watch(k)}if(m[1]){var n=m[0];m=m[1];var r=k.multiple,t=k.ngOptions,v=!1,w,u=x(V.createElement("option")),A=x(V.createElement("optgroup")),y=u.clone();k=0;for(var z=f.children(),E=z.length;k<E;k++)if(""===
z[k].value){w=v=z.eq(k);break}n.init(m,v,y);r&&(m.$isEmpty=function(a){return!a||0===a.length});t?p(e,f,m):r?l(e,f,m):h(e,f,m,n)}}}}],id=["$interpolate",function(a){var c={addOption:A,removeOption:A};return{restrict:"E",priority:100,compile:function(d,e){if(D(e.value)){var g=a(d.text(),!0);g||e.$set("value",d.text())}return function(a,d,e){var h=d.parent(),l=h.data("$selectController")||h.parent().data("$selectController");l&&l.databound?d.prop("selected",!1):l=c;g?a.$watch(g,function(a,c){e.$set("value",
a);a!==c&&l.removeOption(c);l.addOption(a)}):l.addOption(e.value);d.on("$destroy",function(){l.removeOption(e.value)})}}}}],hd=$({restrict:"E",terminal:!0});T.angular.bootstrap?console.log("WARNING: Tried to load angular more than once."):((Ca=T.jQuery)&&Ca.fn.on?(x=Ca,E(Ca.fn,{scope:Ka.scope,isolateScope:Ka.isolateScope,controller:Ka.controller,injector:Ka.injector,inheritedData:Ka.inheritedData}),Eb("remove",!0,!0,!1),Eb("empty",!1,!1,!1),Eb("html",!1,!1,!0)):x=S,Ta.element=x,$c(Ta),x(V).ready(function(){Xc(V,
cc)}))})(window,document);!window.angular.$$csp()&&window.angular.element(document).find("head").prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}.ng-animate-block-transitions{transition:0s all!important;-webkit-transition:0s all!important;}.ng-hide-add-active,.ng-hide-remove{display:block!important;}</style>');
|
MiniverCheevy/string-replicator
|
StringReplicator.Core/Web/js/angular.min.js
|
JavaScript
|
mit
| 106,614
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_31) on Wed Dec 17 20:48:28 PST 2014 -->
<title>Uses of Class java.text.CollationElementIterator (Java Platform SE 8 )</title>
<meta name="date" content="2014-12-17">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class java.text.CollationElementIterator (Java Platform SE 8 )";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../java/text/CollationElementIterator.html" title="class in java.text">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><strong>Java™ Platform<br>Standard Ed. 8</strong></div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?java/text/class-use/CollationElementIterator.html" target="_top">Frames</a></li>
<li><a href="CollationElementIterator.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class java.text.CollationElementIterator" class="title">Uses of Class<br>java.text.CollationElementIterator</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../java/text/CollationElementIterator.html" title="class in java.text">CollationElementIterator</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#java.text">java.text</a></td>
<td class="colLast">
<div class="block">Provides classes and interfaces for handling text, dates, numbers, and messages
in a manner independent of natural languages.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="java.text">
<!-- -->
</a>
<h3>Uses of <a href="../../../java/text/CollationElementIterator.html" title="class in java.text">CollationElementIterator</a> in <a href="../../../java/text/package-summary.html">java.text</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../java/text/package-summary.html">java.text</a> that return <a href="../../../java/text/CollationElementIterator.html" title="class in java.text">CollationElementIterator</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../java/text/CollationElementIterator.html" title="class in java.text">CollationElementIterator</a></code></td>
<td class="colLast"><span class="typeNameLabel">RuleBasedCollator.</span><code><span class="memberNameLink"><a href="../../../java/text/RuleBasedCollator.html#getCollationElementIterator-java.text.CharacterIterator-">getCollationElementIterator</a></span>(<a href="../../../java/text/CharacterIterator.html" title="interface in java.text">CharacterIterator</a> source)</code>
<div class="block">Returns a CollationElementIterator for the given CharacterIterator.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../java/text/CollationElementIterator.html" title="class in java.text">CollationElementIterator</a></code></td>
<td class="colLast"><span class="typeNameLabel">RuleBasedCollator.</span><code><span class="memberNameLink"><a href="../../../java/text/RuleBasedCollator.html#getCollationElementIterator-java.lang.String-">getCollationElementIterator</a></span>(<a href="../../../java/lang/String.html" title="class in java.lang">String</a> source)</code>
<div class="block">Returns a CollationElementIterator for the given String.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../java/text/CollationElementIterator.html" title="class in java.text">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><strong>Java™ Platform<br>Standard Ed. 8</strong></div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?java/text/class-use/CollationElementIterator.html" target="_top">Frames</a></li>
<li><a href="CollationElementIterator.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small><font size="-1"> <a href="http://bugreport.sun.com/bugreport/">Submit a bug or feature</a> <br>For further API reference and developer documentation, see <a href="http://download.oracle.com/javase/8/docs/index.html" target="_blank">Java SE Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.<br> <a href="../../../../legal/cpyr.html">Copyright</a> © 1993, 2015, Oracle and/or its affiliates. All rights reserved. </font></small></p>
</body>
</html>
|
fbiville/annotation-processing-ftw
|
doc/java/jdk8/java/text/class-use/CollationElementIterator.html
|
HTML
|
mit
| 7,996
|
var express = require('express');
var router = express.Router();
var mongoose = require('mongoose');
var fs = require('fs');
/* GET home page. */
router.get('/', function(req, res) {
res.render('index', { title: 'File from renamer' });
});
router.get('/#/Users', function(req, res) {
res.send({"res":"gogo"});
});
//To have launchd start mongodb at login:
// ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents
//Then to load mongodb now:
// launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
//Or, if you don't want/need launchctl, you can just run:
// mongod --config /usr/local/etc/mongod.conf
// >mongod --dbpath
mongoose.connect("mongodb://localhost/files");
// See files.js
mongoose.model('files', {
path: String,
filename: String,
size: Number,
owner: String,
created: Date,
modified: Date
});
router.get("/files", function(req,res){
console.log("Entering in REST api");
mongoose.model('files').find(function(err,files){
res.send(files);
});
});
router.get("/ls/:node/:dir(*)", function(req,res){
console.log("Entering in REST api");
var out = {};
console.log("Dir=" + req.params.dir);
console.log("Node=" + req.params.node);
//out.network = req.params.node;
out.directoryListing = [];
try {
var counter=0;
fs.readdirSync("/" + req.params.dir).forEach(function(filename){
out.directoryListing.push({
"index": counter++,
"filename": filename,
"Owner": "alainlavoie",
"lastModification": 4332,
"fileSize": 142
});
});
res.send(out.directoryListing);
} catch (dirError){
if (dirError instanceof Error && dirError.code === 'ENOENT'){
res.send(404);
} else {
res.send({Error: dirError});
}
}
});
module.exports = router;
|
a-lavoie/BigData.Photos
|
bigd/routes/index.js
|
JavaScript
|
mit
| 1,782
|
#!/usr/bin/env bash
#
# bootstrap installs things.
cd "$(dirname "$0")/.."
DOTFILES_ROOT=$(pwd)
set -e
echo ''
info () {
printf " [ \033[00;34m..\033[0m ] $1"
}
user () {
printf "\r [ \033[0;33m?\033[0m ] $1 "
}
success () {
printf "\r\033[2K [ \033[00;32mOK\033[0m ] $1\n"
}
fail () {
printf "\r\033[2K [\033[0;31mFAIL\033[0m] $1\n"
echo ''
exit
}
setup_gitconfig () {
if ! [ -f git/gitconfig.symlink ]
then
info 'setup gitconfig'
git_credential='cache'
if [ "$(uname -s)" == "Darwin" ]
then
git_credential='osxkeychain'
fi
user ' - What is your github author name?'
read -e git_authorname
user ' - What is your github author email?'
read -e git_authoremail
sed -e "s/AUTHORNAME/$git_authorname/g" -e "s/AUTHOREMAIL/$git_authoremail/g" -e "s/GIT_CREDENTIAL_HELPER/$git_credential/g" git/gitconfig.symlink.example > git/gitconfig.symlink
success 'gitconfig'
fi
}
link_file () {
local src=$1 dst=$2
local overwrite= backup= skip=
local action=
if [ -f "$dst" -o -d "$dst" -o -L "$dst" ]
then
if [ "$overwrite_all" == "false" ] && [ "$backup_all" == "false" ] && [ "$skip_all" == "false" ]
then
local currentSrc="$(readlink $dst)"
if [ "$currentSrc" == "$src" ]
then
skip=true;
else
user "File already exists: $dst ($(basename "$src")), what do you want to do?\n\
[s]kip, [S]kip all, [o]verwrite, [O]verwrite all, [b]ackup, [B]ackup all?"
read -n 1 action
case "$action" in
o )
overwrite=true;;
O )
overwrite_all=true;;
b )
backup=true;;
B )
backup_all=true;;
s )
skip=true;;
S )
skip_all=true;;
* )
;;
esac
fi
fi
overwrite=${overwrite:-$overwrite_all}
backup=${backup:-$backup_all}
skip=${skip:-$skip_all}
if [ "$overwrite" == "true" ]
then
rm -rf "$dst"
success "removed $dst"
fi
if [ "$backup" == "true" ]
then
mv "$dst" "${dst}.backup"
success "moved $dst to ${dst}.backup"
fi
if [ "$skip" == "true" ]
then
success "skipped $src"
fi
fi
if [ "$skip" != "true" ] # "false" or empty
then
ln -s "$1" "$2"
success "linked $1 to $2"
fi
}
install_dotfiles () {
info 'installing dotfiles'
local overwrite_all=false backup_all=false skip_all=false
for src in $(find -H "$DOTFILES_ROOT" -maxdepth 2 -name '*.symlink')
do
dst="$HOME/.$(basename "${src%.*}")"
link_file "$src" "$dst"
done
}
setup_gitconfig
install_dotfiles
# If we're on a Mac, let's install and setup homebrew.
if [ "$(uname -s)" == "Darwin" ]
then
info "installing dependencies"
if source bin/dot > /tmp/dotfiles-dot 2>&1
then
success "dependencies installed"
else
fail "error installing dependencies"
fi
fi
echo ''
echo ' All installed!'
|
maxcnunes/dotfiles
|
script/bootstrap.sh
|
Shell
|
mit
| 2,993
|
package com.tirthal.learning.langfeatures;
import java.util.EnumMap;
//---------------------------------------
//--- STEP 00 - WHAT IS ENUM?
//---------------------------------------
///*
// * Java 1.5 - Language feature - Enum = This flexible object-oriented enumerated type facility allows you to create enumerated types with arbitrary
// * methods and fields. It provides all the benefits of the Typesafe Enum pattern without the verbosity and the error-proneness.
// *
// * Two new collection classes EnumMap and EnumSet are added into collection package to support Java Enum. These classes are high performance
// * implementation of Map and Set interface in Java and we should use this whenever there is any opportunity.
// *
// * --- Caution --- (1) Enum constants are implicitly static and final and you can not change there value once created. Enum in Java provides
// * type-safety and can be used inside switch statement like int variables. Since enum is a keyword you can not use as variable name and since its only
// * introduced in JDK 1.5 all your previous code which has enum as variable name will not work and needs to be re-factored. (2) You can not create
// * instance of enums by using new operator in Java because constructor of Enum in Java can only be private and Enums constants can only be created
// * inside Enums itself. (3) Instance of Enum in Java is created when any Enum constants are first called or referenced in code. (4) Enum in Java can
// * implement the interface and override any method like normal class Its also worth noting that Enum in java implicitly implement
// * both Serializable and Comparable interface. (5) You can define abstract methods inside Enum in Java and can also provide different implementation
// * for different instances of enum in java.
// */
//---------------------------------------
//--- STEP 01 - HOW TO DEFINE ENUM?
//---------------------------------------
/**
* OrderStatus enum. Ideally this should be separate "OrderStatus.java" file with public declaration.
*
* @author tirthalp
*
*/
enum OrderStatus {
// Assign value of code and override isChangeable abstract method for each order status
OPEN("O") {
@Override
public boolean isChangeable() {
return true; // only open order can be changed
}
},
SUBMITTED("S") {
@Override
public boolean isChangeable() {
return false;
}
},
CANCELLED("C") {
@Override
public boolean isChangeable() {
return false;
}
},
DELIEVERED("D") {
@Override
public boolean isChangeable() {
return false;
}
};
private String code;
private OrderStatus(String code) {
this.code = code;
}
// Is order changeble for given order status?
// Allow to change only open order
public abstract boolean isChangeable();
// Override toString method
@Override
public String toString() {
return super.toString(); // By default, it would return enum constant which you may override
}
}
//---------------------------------------
//--- STEP 02 - UNDERSTAND USAGE OF ENUM BY EXAMPLE
//---------------------------------------
/**
* Test class for OrderStatus enum
*
* @author tirthalp
*
*/
public class Enum_TestDrive {
public static void main(String[] args) {
OrderStatus openOder = OrderStatus.OPEN;
// enum comparison
if (openOder == OrderStatus.OPEN) {
System.out.println("enum in java can be compared using ==");
}
if (openOder.equals(OrderStatus.OPEN)) {
System.out.println("enum in java can be compared using equals()");
}
// check is it possible to change order?
if (openOder.isChangeable())
System.out.println("Order can be changed in open status and before submitting it");
if (!OrderStatus.DELIEVERED.isChangeable())
System.out.println("Order cannot be changed after order delivery");
// print enum values
for (OrderStatus ostatus : OrderStatus.values()) {
System.out.println(ostatus); // this will call overrided toString() method
}
// Also this will call overrided toString() method
System.out.println(OrderStatus.SUBMITTED);
System.out.println("----");
// --- Example of EnumMap - creating EnumMap in java with key as enum type
EnumMap<OrderStatus, String> orderStatusMap = new EnumMap<OrderStatus, String>(OrderStatus.class);
orderStatusMap.put(OrderStatus.OPEN, "Open Order");
orderStatusMap.put(OrderStatus.DELIEVERED, "Order Delivered");
orderStatusMap.put(OrderStatus.CANCELLED, "Order Cancelled");
orderStatusMap.put(OrderStatus.SUBMITTED, "Order Submitted");
System.out.println("Size of OrderStatus Enum Map = " + orderStatusMap.size());
System.out.println("OrderStatus Map = " + orderStatusMap);
System.out.println("OrderStatus.OPEN = " + orderStatusMap.get(OrderStatus.OPEN));
}
}
|
tirthalpatel/Learning-Java
|
Java5/src/com/tirthal/learning/langfeatures/Enum_TestDrive.java
|
Java
|
mit
| 4,758
|
<?php
namespace BungieNetPlatform\Exceptions\Platform;
use BungieNetPlatform\Exceptions\PlatformException;
/**
* TagsUnableToLoadPopularTagsFromDatabase
*/
class TagsUnableToLoadPopularTagsFromDatabaseException extends PlatformException {
public function __construct($message, $code = 905, \Exception $previous = null) {
parent::__construct($message, $code, $previous);
}
}
|
dazarobbo/BungieNetPlatform
|
src/Exceptions/Platform/TagsUnableToLoadPopularTagsFromDatabaseException.php
|
PHP
|
mit
| 401
|
module.exports = function (grunt) {
grunt.initConfig({
karma: {
options: {
configFile: 'tests/config/karma.conf.js'
},
watch: {
autoWatch: true
},
singleRun: {
singleRun: true
},
travis: {
singleRun: true,
browsers: ['PhantomJS']
}
}
});
grunt.loadNpmTasks('grunt-karma');
grunt.registerTask('testRun', ['karma:singleRun']);
grunt.registerTask('testWatch', ['karma:watch']);
grunt.registerTask('test', ['karma:travis']);
};
|
kwarkjes/responsive-site-view
|
Gruntfile.js
|
JavaScript
|
mit
| 641
|
using System;
using Agiil.Domain.Capabilities;
using Autofac;
namespace Agiil.Bootstrap.Capabilities
{
public class CapabilitiesEnforcingInterceptorModule : Module
{
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<CapabilitiesEnforcingInterceptor>()
.AsSelf()
.AsImplementedInterfaces();
builder
.RegisterType<NoAmbientAssertionDetector>()
.SingleInstance();
builder
.RegisterType<AssertionInProgressDetector>()
.InstancePerOwned<IAssertsUserHasCapability>();
builder.Register(GetAmbientAssertionDetector);
}
IDetectsAmbientCapabilityAssertion GetAmbientAssertionDetector(IComponentContext ctx)
{
try
{
// Seems that there is no way to try resolving this (from its specialised
// lifetime scope tag) without raising DependencyResolutionException if we
// are not in a lifetime scope of that tag.
return ctx.Resolve<AssertionInProgressDetector>();
}
catch(Autofac.Core.DependencyResolutionException)
{
return ctx.Resolve<NoAmbientAssertionDetector>();
}
}
class NoAmbientAssertionDetector : IDetectsAmbientCapabilityAssertion
{
public bool IsCapabilityAssertionInProgress() => false;
}
class AssertionInProgressDetector : IDetectsAmbientCapabilityAssertion
{
public bool IsCapabilityAssertionInProgress() => true;
}
}
}
|
csf-dev/agiil
|
Agiil.Bootstrap/Capabilities/CapabilitiesEnforcingInterceptorModule.cs
|
C#
|
mit
| 1,687
|
/**
* HatateHoutyouAlarm
*
* Copyright (c) 2014 @inujini_ (https://twitter.com/inujini_)
*
* This software is released under the MIT License.
* http://opensource.org/licenses/mit-license.php
*/
package inujini_.hatate.adapter;
import inujini_.hatate.R;
import inujini_.hatate.data.SpellCard;
import inujini_.hatate.data.TouhouData;
import inujini_.hatate.linq.Linq;
import inujini_.hatate.util.IconUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import lombok.val;
import lombok.experimental.ExtensionMethod;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ImageView;
import android.widget.TextView;
/**
* スペルカード図鑑用BaseExpandableListAdapter.
* @param <K extends TouhouData> Group(親)として表示されるクラス
* @see SpellCardLibraryActivity
*/
@ExtensionMethod({Linq.class})
public class SpellCardLibraryAdapter<K extends TouhouData> extends BaseExpandableListAdapter {
private final Map<K, List<SpellCard>> _items;
private final LayoutInflater _inflater;
static class PViewHolder {
final TextView name;
PViewHolder(View v) {
name = (TextView) v.findViewById(R.id.txvName);
}
}
static class CViewHolder {
final TextView name;
final ImageView icon;
CViewHolder(View v) {
name = (TextView) v.findViewById(R.id.txvName);
icon = (ImageView) v.findViewById(android.R.id.icon);
}
}
/**
* スペルカード図鑑用BaseExpandableListAdapter.
* @param items
* @param context
* @see SpellCardLibraryActivity
*/
public SpellCardLibraryAdapter(Map<K, List<SpellCard>> items, Context context) {
_items = items;
_inflater = LayoutInflater.from(context);
}
@Override
public Object getChild(int groupPosition, int childPosition) {
return getChildren(groupPosition).get(childPosition);
}
/**
* 子要素取得
* @param groupPosition 親要素の位置
* @return groupPositionから割り出した子要素
*/
public List<SpellCard> getChildren(int groupPosition) {
for (val item : _items.entrySet()) {
if(item.getKey().getPosition() == groupPosition) {
return item.getValue();
}
}
return new ArrayList<SpellCard>();
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return ((SpellCard) getChild(groupPosition, childPosition)).getId();
}
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild
, View convertView, ViewGroup parent) {
View view = convertView;
CViewHolder vh = null;
if(view == null) {
view = _inflater.inflate(R.layout.adapter_spellcard_library_child, null);
vh = new CViewHolder(view);
view.setTag(vh);
} else {
vh = (CViewHolder) view.getTag();
}
val item = (SpellCard) getChild(groupPosition, childPosition);
vh.name.setText(item.getName());
val cId = IconUtil.getIconId(item.getCharacterId());
vh.icon.setImageResource(cId);
vh.icon.setVisibility((cId == 0 ? View.GONE : View.VISIBLE));
return view;
}
@Override
public int getChildrenCount(int groupPosition) {
return getChildren(groupPosition).size();
}
@Override
public Object getGroup(int groupPosition) {
for (val item : _items.keySet()) {
if(item.getPosition() == groupPosition) return item;
}
return null;
}
@Override
public int getGroupCount() {
return _items.keySet().size();
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@SuppressWarnings("unchecked")
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
View view = convertView;
PViewHolder vh = null;
if(view == null) {
view = _inflater.inflate(R.layout.adapter_spellcard_library_parent, null);
vh = new PViewHolder(view);
view.setTag(vh);
} else {
vh = (PViewHolder) view.getTag();
}
val item = (K) getGroup(groupPosition);
vh.name.setText(String.format("%s (%d)", item.getName(), getChildrenCount(groupPosition)));
return view;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return false;
}
}
|
tumbling-dice/Hatate
|
src/inujini_/hatate/adapter/SpellCardLibraryAdapter.java
|
Java
|
mit
| 4,306
|
require 'ffi'
require 'singleton'
class Simple
# WARNING: this is not thread safe
def initialize
reset
end
def reset
C.reset
end
def method_missing(name, *arguments)
if arguments.size == 0
get(name)
elsif arguments.size == 1
set(name, arguments.first)
else
super
end
end
def get(name)
return 0 unless C.respond_to?(name)
ruby_value_from_excel_value(C.send(name))
end
def ruby_value_from_excel_value(excel_value)
case excel_value[:type]
when :ExcelNumber; excel_value[:number]
when :ExcelString; excel_value[:string].read_string.force_encoding("utf-8")
when :ExcelBoolean; excel_value[:number] == 1
when :ExcelEmpty; nil
when :ExcelRange
r = excel_value[:rows]
c = excel_value[:columns]
p = excel_value[:array]
s = C::ExcelValue.size
a = Array.new(r) { Array.new(c) }
(0...r).each do |row|
(0...c).each do |column|
a[row][column] = ruby_value_from_excel_value(C::ExcelValue.new(p + (((row*c)+column)*s)))
end
end
return a
when :ExcelError; [:value,:name,:div0,:ref,:na,:num][excel_value[:number]]
else
raise Exception.new("ExcelValue type #{excel_value[:type].inspect} not recognised")
end
end
def set(name, ruby_value)
name = name.to_s
name = "set_#{name[0..-2]}" if name.end_with?('=')
return false unless C.respond_to?(name)
C.send(name, excel_value_from_ruby_value(ruby_value))
end
def excel_value_from_ruby_value(ruby_value, excel_value = C::ExcelValue.new)
case ruby_value
when Numeric
excel_value[:type] = :ExcelNumber
excel_value[:number] = ruby_value
when String
excel_value[:type] = :ExcelString
excel_value[:string] = FFI::MemoryPointer.from_string(ruby_value.encode('utf-8'))
when TrueClass, FalseClass
excel_value[:type] = :ExcelBoolean
excel_value[:number] = ruby_value ? 1 : 0
when nil
excel_value[:type] = :ExcelEmpty
when Array
excel_value[:type] = :ExcelRange
# Presumed to be a row unless specified otherwise
if ruby_value.first.is_a?(Array)
excel_value[:rows] = ruby_value.size
excel_value[:columns] = ruby_value.first.size
else
excel_value[:rows] = 1
excel_value[:columns] = ruby_value.size
end
ruby_values = ruby_value.flatten
pointer = FFI::MemoryPointer.new(C::ExcelValue, ruby_values.size)
excel_value[:array] = pointer
ruby_values.each.with_index do |v,i|
excel_value_from_ruby_value(v, C::ExcelValue.new(pointer[i]))
end
when Symbol
excel_value[:type] = :ExcelError
excel_value[:number] = [:value, :name, :div0, :ref, :na].index(ruby_value)
else
raise Exception.new("Ruby value #{ruby_value.inspect} not translatable into excel")
end
excel_value
end
module C
extend FFI::Library
ffi_lib File.join(File.dirname(__FILE__),FFI.map_library_name('simple'))
ExcelType = enum :ExcelEmpty, :ExcelNumber, :ExcelString, :ExcelBoolean, :ExcelError, :ExcelRange
class ExcelValue < FFI::Struct
layout :type, ExcelType,
:number, :double,
:string, :pointer,
:array, :pointer,
:rows, :int,
:columns, :int
end
# use this function to reset all cell values
attach_function 'reset', [], :void
attach_function 'set_inputs_b1', [ExcelValue.by_value], :void
attach_function 'set_inputs_b2', [ExcelValue.by_value], :void
attach_function 'set_inputs_b4', [ExcelValue.by_value], :void
attach_function 'inputs_a1', [], ExcelValue.by_value
attach_function 'inputs_b1', [], ExcelValue.by_value
attach_function 'inputs_a2', [], ExcelValue.by_value
attach_function 'inputs_b2', [], ExcelValue.by_value
attach_function 'inputs_a4', [], ExcelValue.by_value
attach_function 'inputs_b4', [], ExcelValue.by_value
# end of Inputs
attach_function 'outputs_a1', [], ExcelValue.by_value
attach_function 'outputs_a2', [], ExcelValue.by_value
attach_function 'outputs_a3', [], ExcelValue.by_value
# end of Outputs
# Start of named references
# End of named references
end # C module
end # Simple
|
tamc/excel_to_code
|
examples/simple/c/simple.rb
|
Ruby
|
mit
| 4,309
|
@if (@X)==(@Y) @end /* JScript comment
@echo off
setlocal
for /f "tokens=* delims=" %%v in ('dir /b /s /a:-d /o:-n "%SystemRoot%\Microsoft.NET\Framework\*jsc.exe"') do (
set "jsc=%%v"
)
if not exist "%~n0.exe" (
"%jsc%" /nologo /out:"%~n0.exe" "%~dpsfnx0"
)
"%~n0.exe" %*
del "%~n0.exe"
endlocal & exit /b %errorlevel%
end of jscript comment*/
import System;
import System.Threading;
import System.Diagnostics;
var arguments:String[] = Environment.GetCommandLineArgs();
function printHelp( ) {
print(arguments[0] + " pid prio");
}
if ( arguments.length == 1 || arguments[1].toLowerCase() == "-h" || arguments[1].toLowerCase() == "-help" ) {
printHelp();
Environment.Exit(0);
}
if ( arguments.length != 3) {
print("wrong number of arguments");
Environment.Exit(1);
}
try {
var pid= Int32.Parse(arguments[1]);
}catch(err){
print("process must be a number");
Environment.Exit(2);
}
var prio=arguments[2].toLowerCase();
var proc="";
try{
proc=Process.GetProcessById(pid);
}catch(err){
print("process " + pid + " not found");
Environment.Exit(3);
}
switch(prio) {
case "abovenormal":
proc.PriorityClass = ProcessPriorityClass.AboveNormal;
break;
case "belownormal":
proc.PriorityClass = ProcessPriorityClass.AboveNormal;
break;
case "high":
proc.PriorityClass = ProcessPriorityClass.High;
break;
case "idle":
proc.PriorityClass = ProcessPriorityClass.Idle;
break;
case "normal":
proc.PriorityClass = ProcessPriorityClass.Normal;
break;
case "realTime":
proc.PriorityClass = ProcessPriorityClass.RealTime;
break;
default:
print("invalid prio: " + prio + " given");
Environment.Exit(5);
}
|
npocmaka/batch.scripts
|
hybrids/.net/setPrio.bat
|
Batchfile
|
mit
| 1,738
|
<?xml version="1.0" ?><!DOCTYPE TS><TS language="gu_IN" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About TLGCoin</source>
<translation>બીટકોઈન વિષે</translation>
</message>
<message>
<location line="+39"/>
<source><b>TLGCoin</b> version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+57"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The TLGCoin developers</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your TLGCoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a TLGCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified TLGCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your TLGCoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+33"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR TLGCOINS</b>!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-56"/>
<source>TLGCoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your tlgcoins from being stolen by malware infecting your computer.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Show information about TLGCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-347"/>
<source>Send coins to a TLGCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for TLGCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>TLGCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>&About TLGCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your TLGCoin addresses to prove you own them</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified TLGCoin addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+47"/>
<source>TLGCoin client</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to TLGCoin network</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+70"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid TLGCoin address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. TLGCoin can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid TLGCoin address.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>TLGCoin-Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Automatically start TLGCoin after logging in to the system.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Start TLGCoin on system login</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Automatically open the TLGCoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Connect to the TLGCoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting TLGCoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Whether to show TLGCoin addresses in the transaction list or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting TLGCoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the TLGCoin network after a connection is established, but this process has not completed yet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start tlgcoin: click-to-pay handler</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+339"/>
<source>N/A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the TLGCoin-Qt help message to get a list with possible TLGCoin command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-104"/>
<source>TLGCoin - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>TLGCoin Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Open the TLGCoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the TLGCoin RPC console.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+124"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>123.456 BTC</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a TLGCoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-203"/>
<location line="+213"/>
<source>Alt+A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-203"/>
<source>Paste address from clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Copy the current signature to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this TLGCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified TLGCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a TLGCoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Enter TLGCoin signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The TLGCoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 20 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>TLGCoin version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or tlgcoind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: tlgcoin.conf)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: tlgcoind.pid)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 23069 or testnet: 33069)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 23070 or testnet: 33070)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=tlgcoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "TLGCoin Alert" admin@foo.com
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. TLGCoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong TLGCoin will not work properly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-76"/>
<source>Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the TLGCoin Wiki for SSL setup instructions)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-20"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of TLGCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart TLGCoin to complete</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. TLGCoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-31"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation type="unfinished"/>
</message>
</context>
</TS>
|
TLGCoinProject/TLG-SourceCode
|
src/qt/locale/bitcoin_gu_IN.ts
|
TypeScript
|
mit
| 96,432
|
//Sort a linked list using insertion sort.
//the wiki for insertion sort.
//in-space, fake/dummy head.
//45ms
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) { val = x; }
* }
*/
class Solution {
public ListNode insertionSortList(ListNode head) {
ListNode curr = head, next = null;
ListNode l = new ListNode(-1);
while (curr != null) {
next = curr.next;
ListNode p = l;
while (p.next != null && p.next.val < curr.val) p = p.next;
curr.next = p.next;
p.next = curr;
curr = next;
}
return l.next;
}
}
//the ablove algritm has one improvement. We do not need to go through the entire linkedlist to insert a 'largest'
//new element, we can keep track of the largest element in current linkedlist, and if new node.val > temp tail.val,
//we add it and make it become the new tail directly.
//see following, the rc has been reduced greatly to 7ms.
public ListNode insertionSortList(ListNode head) {
if (head == null || head.next == null)
{
return head;
}
ListNode sortedHead = head, sortedTail = head;
head = head.next;
sortedHead.next = null;
while (head != null)
{
ListNode temp = head;
head = head.next;
temp.next = null;
// new val is less than the head, just insert in the front
if (temp.val <= sortedHead.val)
{
temp.next = sortedHead;
sortedTail = sortedHead.next == null ? sortedHead : sortedTail;
sortedHead = temp;
}
// new val is greater than the tail, just insert at the back
else if (temp.val >= sortedTail.val)
{
sortedTail.next = temp;
sortedTail = sortedTail.next;
}
// new val is somewhere in the middle, we will have to find its proper
// location.
else
{
ListNode current = sortedHead;
while (current.next != null && current.next.val < temp.val)
{
current = current.next;
}
temp.next = current.next;
current.next = temp;
}
}
return sortedHead;
}
|
tikael1011/leetcodejava
|
147. Insertion Sort List.java
|
Java
|
mit
| 2,294
|
extern crate stopwatch;
use stopwatch::{Stopwatch};
fn main() {
let timer = Stopwatch::start_new();
//digits are stored in reverse order (least significant first) as an optimization
match expand(196, 100000) {
Ok(iter) => println!("converged after {} iterations", iter),
Err(max_iters) => println!("did not converge after {} iterations", max_iters)
}
//print status
println!("total execution time: {} ms", timer.elapsed_ms());
}
fn expand(number: u64, max_iters: i64) -> Result<i64, i64> {
println!("expand {}", number);
let mut digits = to_digits(number);
//iterations will continue until palindromicity improves
for iter in 1 .. max_iters + 1 {
reverse_add(&mut digits);
if iter % 10000 == 0 {
println!("{} {}", iter, digits.len());
}
if is_palindrome(&digits) {
return Ok(iter);
}
}
//return iteration count as error value
Err(max_iters)
}
fn to_digits(n:u64) -> Vec<u8> {
let mut rem = n;
let mut digits:Vec<u8> = Vec::new();
while rem > 0 {
let digit = (rem % 10) as u8;
rem /= 10;
digits.push(digit);
}
return digits;
}
/*
note that digits here are in reverse order (least significant digit first)
e.g. the number 349 should be represented as vec![9,4,3]
this lets us easily grow the array when a new digit is created by overflow, as we can simply
append it. Otherwise we'd have to prepend, which is slower.
*/
fn reverse_add(digits: &mut Vec<u8>) {
//first fold in half and sum, to cut down on additions
let digits_len = digits.len();
for i in 0 .. (digits_len + 1) / 2 {
let j = digits_len - 1 - i;
let sum = digits[i] + digits[j];
digits[i] = sum;
digits[j] = sum;
}
//now propagate overflow left to right (least significant digit to most significant)
let mut overflow = 0;
for i in 0 .. digits_len {
digits[i] += overflow;
if digits[i] >= 10 {
digits[i] -= 10;
overflow = 1;
} else {
overflow = 0;
}
}
//finally add extra digit if we need it
if overflow > 0 {
//digits are in reverse order, so this new most-significant digit can just be put on the end
digits.push(overflow);
}
}
fn is_palindrome(digits: &Vec<u8>) -> bool {
let digits_len = digits.len();
for i in 0 .. digits_len/2 {
if digits[i] != digits[digits_len - 1 - i] {
return false;
}
}
return true;
}
|
jffry/rust-lychrel
|
src/main.rs
|
Rust
|
mit
| 2,560
|
<?php
require_once 'Interface.php';
require_once realpath(dirname(__FILE__)) . '/../Exception.php';
if (!function_exists('json_decode')) {
throw new Exception("Please install the PHP JSON extension");
}
if (!function_exists('curl_init')) {
throw new Exception("Please install the PHP cURL extension");
}
/**
* Services_Paymill cURL HTTP client
*/
class Services_Paymill_Apiclient_Curl implements Services_Paymill_Apiclient_Interface
{
/**
* Paymill API merchant key
*
* @var string
*/
private $_apiKey = null;
private $_responseArray = null;
/**
* Paymill API base url
*
* @var string
*/
private $_apiUrl = '/';
const USER_AGENT = 'Paymill-OXID/2.8.1';
public static $lastRawResponse;
public static $lastRawCurlOptions;
/**
* cURL HTTP client constructor
*
* @param string $apiKey
* @param string $apiEndpoint
*/
public function __construct($apiKey, $apiEndpoint)
{
$this->_apiKey = $apiKey;
$this->_apiUrl = $apiEndpoint;
}
/**
* Perform API and handle exceptions
*
* @param $action
* @param array $params
* @param string $method
* @return mixed
* @throws Services_Paymill_Exception
* @throws Exception
*/
public function request($action, $params = array(), $method = 'POST')
{
if (!is_array($params))
$params = array();
try {
$this->_responseArray = $this->_requestApi($action, $params, $method);
$httpStatusCode = $this->_responseArray['header']['status'];
if ($httpStatusCode != 200) {
$errorMessage = 'Client returned HTTP status code ' . $httpStatusCode;
if (isset($this->_responseArray['body']['error'])) {
$errorMessage = $this->_responseArray['body']['error'];
}
$responseCode = '';
if (isset($this->_responseArray['body']['response_code'])) {
$responseCode = $this->_responseArray['body']['response_code'];
}
if ($responseCode === '' && isset($this->_responseArray['body']['data']['response_code'])) {
$responseCode = $this->_responseArray['body']['data']['response_code'];
}
return array("data" => array(
"error" => $errorMessage,
"response_code" => $responseCode,
"http_status_code" => $httpStatusCode
));
}
return $this->_responseArray['body'];
} catch (Exception $e) {
return array("data" => array("error" => $e->getMessage()));
}
}
/**
* Perform HTTP request to REST endpoint
*
* @param string $action
* @param array $params
* @param string $method
* @return array
*/
protected function _requestApi($action = '', $params = array(), $method = 'POST')
{
$curlOpts = array(
CURLOPT_URL => $this->_apiUrl . $action,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => $method,
CURLOPT_USERAGENT => self::USER_AGENT,
CURLOPT_SSL_VERIFYPEER => true
);
if (Services_Paymill_Apiclient_Interface::HTTP_GET === $method) {
if (0 !== count($params)) {
$curlOpts[CURLOPT_URL] .= false === strpos($curlOpts[CURLOPT_URL], '?') ? '?' : '&';
$curlOpts[CURLOPT_URL] .= http_build_query($params, null, '&');
}
} else {
$curlOpts[CURLOPT_POSTFIELDS] = http_build_query($params, null, '&');
}
if ($this->_apiKey) {
$curlOpts[CURLOPT_USERPWD] = $this->_apiKey . ':';
}
$curl = curl_init();
curl_setopt_array($curl, $curlOpts);
$responseBody = curl_exec($curl);
self::$lastRawCurlOptions = $curlOpts;
self::$lastRawResponse = $responseBody;
$responseInfo = curl_getinfo($curl);
if ($responseBody === false) {
$responseBody = array('error' => curl_error($curl));
}
curl_close($curl);
if ('application/json' === $responseInfo['content_type']) {
$responseBody = json_decode($responseBody, true);
}
return array(
'header' => array(
'status' => $responseInfo['http_code'],
'reason' => null,
),
'body' => $responseBody
);
}
/**
* Returns the response of the request as an array.
* @return mixed Response
* @todo Create Unit Test
*/
public function getResponse()
{
return $this->_responseArray;
}
}
|
paymill/paymill-oxid
|
modules/paymill/lib/Services/Paymill/Apiclient/Curl.php
|
PHP
|
mit
| 4,818
|
/*
MIT License
Copyright (c) 2016 Eren Okka
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "sdl.h"
namespace sdl {
Engine::~Engine() {
if (audio_device_) {
SDL_ClearQueuedAudio(audio_device_);
SDL_CloseAudioDevice(audio_device_);
audio_device_ = 0;
}
if (renderer_) {
SDL_DestroyRenderer(renderer_);
renderer_ = nullptr;
}
if (window_) {
SDL_DestroyWindow(window_);
window_ = nullptr;
}
SDL_Quit();
}
const SDL_Window* Engine::window() const {
return window_;
}
const SDL_Renderer* Engine::renderer() const {
return renderer_;
}
bool Engine::Initialize() {
const Uint32 flags = SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS;
return SDL_Init(flags) == 0;
}
bool Engine::CreateWindow(const std::string& title, int width, int height) {
window_ = SDL_CreateWindow(title.c_str(),
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
width, height,
SDL_WINDOW_SHOWN);
return window_ != nullptr;
}
bool Engine::CreateRenderer() {
const Uint32 flags = SDL_RENDERER_ACCELERATED;
renderer_ = SDL_CreateRenderer(window_, -1, flags);
return renderer_ != nullptr;
}
void Engine::Loop() {
SDL_Event e;
running_ = true;
while (running_) {
while (SDL_PollEvent(&e)) {
switch (e.type) {
case SDL_QUIT:
running_ = false;
break;
case SDL_KEYDOWN:
case SDL_KEYUP:
OnKeyEvent(e.key);
break;
}
}
OnLoop();
OnRender();
SDL_Delay(1);
}
}
bool Engine::OpenAudioDevice(const SDL_AudioSpec& audio_spec) {
audio_device_ = SDL_OpenAudioDevice(nullptr, 0, &audio_spec, nullptr, 0);
return audio_device_ != 0;
}
void Engine::PauseAudioDevice(int pause_on) const {
SDL_PauseAudioDevice(audio_device_, pause_on);
}
bool Engine::QueueAudio(const void* data, Uint32 len) const {
return SDL_QueueAudio(audio_device_, data, len) == 0;
}
////////////////////////////////////////////////////////////////////////////////
Timer::Timer(Uint32 target)
: counter_(SDL_GetPerformanceCounter()),
frequency_(SDL_GetPerformanceFrequency()),
target_(target) {
}
bool Timer::Check() {
const auto now = SDL_GetPerformanceCounter();
const auto delta = ((now - counter_) * 1000.0f) / frequency_;
if (delta >= 1000.0f / target_) {
counter_ = now;
return true;
} else {
return false;
}
}
} // namespace sdl
|
erengy/chip-8
|
src/sdl.cpp
|
C++
|
mit
| 3,462
|
/**
* @ngdoc directive
* @name mdMenu
* @module material.components.menu
* @restrict E
* @description
*
* Menus are elements that open when clicked. They are useful for displaying
* additional options within the context of an action.
*
* Every `md-menu` must specify exactly two child elements. The first element is what is
* left in the DOM and is used to open the menu. This element is called the trigger element.
* The trigger element's scope has access to `$mdOpenMenu($event)`
* which it may call to open the menu. By passing $event as argument, the
* corresponding event is stopped from propagating up the DOM-tree.
*
* The second element is the `md-menu-content` element which represents the
* contents of the menu when it is open. Typically this will contain `md-menu-item`s,
* but you can do custom content as well.
*
* <hljs lang="html">
* <md-menu>
* <!-- Trigger element is a md-button with an icon -->
* <md-button ng-click="$mdOpenMenu($event)" class="md-icon-button" aria-label="Open sample menu">
* <md-icon md-svg-icon="call:phone"></md-icon>
* </md-button>
* <md-menu-content>
* <md-menu-item><md-button ng-click="doSomething()">Do Something</md-button></md-menu-item>
* </md-menu-content>
* </md-menu>
* </hljs>
* ## Sizing Menus
*
* The width of the menu when it is open may be specified by specifying a `width`
* attribute on the `md-menu-content` element.
* See the [Material Design Spec](http://www.google.com/design/spec/components/menus.html#menus-specs)
* for more information.
*
*
* ## Aligning Menus
*
* When a menu opens, it is important that the content aligns with the trigger element.
* Failure to align menus can result in jarring experiences for users as content
* suddenly shifts. To help with this, `md-menu` provides serveral APIs to help
* with alignment.
*
* ### Target Mode
*
* By default, `md-menu` will attempt to align the `md-menu-content` by aligning
* designated child elements in both the trigger and the menu content.
*
* To specify the alignment element in the `trigger` you can use the `md-menu-origin`
* attribute on a child element. If no `md-menu-origin` is specified, the `md-menu`
* will be used as the origin element.
*
* Similarly, the `md-menu-content` may specify a `md-menu-align-target` for a
* `md-menu-item` to specify the node that it should try and align with.
*
* In this example code, we specify an icon to be our origin element, and an
* icon in our menu content to be our alignment target. This ensures that both
* icons are aligned when the menu opens.
*
* <hljs lang="html">
* <md-menu>
* <md-button ng-click="$mdOpenMenu($event)" class="md-icon-button" aria-label="Open some menu">
* <md-icon md-menu-origin md-svg-icon="call:phone"></md-icon>
* </md-button>
* <md-menu-content>
* <md-menu-item>
* <md-button ng-click="doSomething()" aria-label="Do something">
* <md-icon md-menu-align-target md-svg-icon="call:phone"></md-icon>
* Do Something
* </md-button>
* </md-menu-item>
* </md-menu-content>
* </md-menu>
* </hljs>
*
* Sometimes we want to specify alignment on the right side of an element, for example
* if we have a menu on the right side a toolbar, we want to right align our menu content.
*
* We can specify the origin by using the `md-position-mode` attribute on both
* the `x` and `y` axis. Right now only the `x-axis` has more than one option.
* You may specify the default mode of `target target` or
* `target-right target` to specify a right-oriented alignment target. See the
* position section of the demos for more examples.
*
* ### Menu Offsets
*
* It is sometimes unavoidable to need to have a deeper level of control for
* the positioning of a menu to ensure perfect alignment. `md-menu` provides
* the `md-offset` attribute to allow pixel level specificty of adjusting the
* exact positioning.
*
* This offset is provided in the format of `x y` or `n` where `n` will be used
* in both the `x` and `y` axis.
*
* For example, to move a menu by `2px` from the top, we can use:
* <hljs lang="html">
* <md-menu md-offset="2 0">
* <!-- menu-content -->
* </md-menu>
* </hljs>
*
* ### Auto Focus
* By default, when a menu opens, `md-menu` focuses the first button in the menu content.
*
* But sometimes you would like to focus another specific menu item instead of the first.<br/>
* This can be done by applying the `md-autofocus` directive on the given element.
*
* <hljs lang="html">
* <md-menu-item>
* <md-button md-autofocus ng-click="doSomething()">
* Auto Focus
* </md-button>
* </md-menu-item>
* </hljs>
*
*
* ### Preventing close
*
* Sometimes you would like to be able to click on a menu item without having the menu
* close. To do this, ngMaterial exposes the `md-prevent-menu-close` attribute which
* can be added to a button inside a menu to stop the menu from automatically closing.
* You can then close the menu programatically by injecting `$mdMenu` and calling
* `$mdMenu.hide()`.
*
* <hljs lang="html">
* <md-menu-item>
* <md-button ng-click="doSomething()" aria-label="Do something" md-prevent-menu-close="md-prevent-menu-close">
* <md-icon md-menu-align-target md-svg-icon="call:phone"></md-icon>
* Do Something
* </md-button>
* </md-menu-item>
* </hljs>
*
* @usage
* <hljs lang="html">
* <md-menu>
* <md-button ng-click="$mdOpenMenu($event)" class="md-icon-button">
* <md-icon md-svg-icon="call:phone"></md-icon>
* </md-button>
* <md-menu-content>
* <md-menu-item><md-button ng-click="doSomething()">Do Something</md-button></md-menu-item>
* </md-menu-content>
* </md-menu>
* </hljs>
*
* @param {string} md-position-mode The position mode in the form of
* `x`, `y`. Default value is `target`,`target`. Right now the `x` axis
* also suppports `target-right`.
* @param {string} md-offset An offset to apply to the dropdown after positioning
* `x`, `y`. Default value is `0`,`0`.
*
*/
angular
.module('material.components.menu')
.directive('mdMenu', MenuDirective);
/**
* @ngInject
*/
function MenuDirective($mdUtil) {
var INVALID_PREFIX = 'Invalid HTML for md-menu: ';
return {
restrict: 'E',
require: ['mdMenu', '?^mdMenuBar'],
controller: 'mdMenuCtrl', // empty function to be built by link
scope: true,
compile: compile
};
function compile(templateElement) {
templateElement.addClass('md-menu');
var triggerElement = templateElement.children()[0];
var prefixer = $mdUtil.prefixer();
if (!prefixer.hasAttribute(triggerElement, 'ng-click')) {
triggerElement = triggerElement
.querySelector(prefixer.buildSelector(['ng-click', 'ng-mouseenter'])) || triggerElement;
}
if (triggerElement && (
triggerElement.nodeName == 'MD-BUTTON' ||
triggerElement.nodeName == 'BUTTON'
) && !triggerElement.hasAttribute('type')) {
triggerElement.setAttribute('type', 'button');
}
if (templateElement.children().length != 2) {
throw Error(INVALID_PREFIX + 'Expected two children elements.');
}
// Default element for ARIA attributes has the ngClick or ngMouseenter expression
triggerElement && triggerElement.setAttribute('aria-haspopup', 'true');
var nestedMenus = templateElement[0].querySelectorAll('md-menu');
var nestingDepth = parseInt(templateElement[0].getAttribute('md-nest-level'), 10) || 0;
if (nestedMenus) {
angular.forEach($mdUtil.nodesToArray(nestedMenus), function(menuEl) {
if (!menuEl.hasAttribute('md-position-mode')) {
menuEl.setAttribute('md-position-mode', 'cascade');
}
menuEl.classList.add('_md-nested-menu');
menuEl.setAttribute('md-nest-level', nestingDepth + 1);
});
}
return link;
}
function link(scope, element, attr, ctrls) {
var mdMenuCtrl = ctrls[0];
var isInMenuBar = ctrls[1] != undefined;
// Move everything into a md-menu-container and pass it to the controller
var menuContainer = angular.element( '<div class="_md md-open-menu-container md-whiteframe-z2"></div>');
var menuContents = element.children()[1];
element.addClass('_md'); // private md component indicator for styling
if (!menuContents.hasAttribute('role')) {
menuContents.setAttribute('role', 'menu');
}
menuContainer.append(menuContents);
element.on('$destroy', function() {
menuContainer.remove();
});
element.append(menuContainer);
menuContainer[0].style.display = 'none';
mdMenuCtrl.init(menuContainer, { isInMenuBar: isInMenuBar });
}
}
|
welkinhealth/material
|
src/components/menu/js/menuDirective.js
|
JavaScript
|
mit
| 8,686
|
<?php namespace Fisharebest\Localization\Locale;
use Fisharebest\Localization\Language\LanguageVo;
/**
* Class LocaleVo - Volapük
*
* @author Greg Roach <fisharebest@gmail.com>
* @copyright (c) 2015 Greg Roach
* @license GPLv3+
*/
class LocaleVo extends AbstractLocale implements LocaleInterface {
public function endonym() {
return 'Volapük';
}
public function endonymSortable() {
return 'VOLAPUK';
}
public function language() {
return new LanguageVo;
}
}
|
fweber1/Annies-Ancestors
|
webtrees/vendor/fisharebest/localization/src/Locale/LocaleVo.php
|
PHP
|
mit
| 495
|
:import {
-st-from: "../IconButton.st.css";
-st-default: TPAIconButton;
}
.root {
-st-mixin: TPAIconButton(
IconColor '"color(--iconColor)"'
);
}
|
wix/wix-style-react
|
packages/wix-ui-tpa/src/components/IconButton/perf/IconButtonExtendedBad.st.css
|
CSS
|
mit
| 165
|
# Blendplot [](https://travis-ci.org/ExcaliburZero/blender-astro-visualization) [](https://coveralls.io/github/ExcaliburZero/blender-astro-visualization?branch=master) [](http://blendplot.readthedocs.io/en/latest/?badge=latest) [](https://pypi.org/project/blendplot/)
Blendplot is a command line application for generating 3D data plots for use in Blender.
```
$ blendplot abc.csv abc.obj period amplitude_Iband magnitude_Iband -c category
Wrote plot file to abc.obj
Plotted 37099 points in 1.531214 seconds
```

## Installation
### From PyPI
```
pip install blendplot
```
### From source
To install Blendplot from source you can run the following commands.
```
git clone https://github.com/ExcaliburZero/blender-astro-visualization.git
cd blender-astro-visualization
pip install ./
```
## Usage
Blendplot allows you to generate a 3D data plot model by specifying a dataset file, the output model file (`.obj`), and the names of the three (x,y,z) columns you want to plot. Currently it only supports `.csv` input data files. The commad structure to run blendplot is as follows.
```
blendplot INPUT_FILE OUTPUT_FILE X Y Z
```
For example, to create a model from a data file `data.csv` using the columns `height`, `weight`, and `cost` and output to a file `model.obj` you would run the following command.
```
blendplot data.csv model.obj height weight cost
```
Once you have used the script to generate the model file, you can then import it into Blender by going to `File > Import > Wavefront (.obj)` and selecting the model file.

## Documentation
For futher in-depth information on how to use Blendplot, see the documentation at the link below.
* [Blendplot - Read The Docs](https://blendplot.readthedocs.io)
## Licensing
The source code for Blendplot is available under the [MIT License](https://opensource.org/licenses/MIT), see `LICENSE` for more information.
|
ExcaliburZero/blender-astro-visualization
|
README.md
|
Markdown
|
mit
| 2,409
|
html {
background-color: #ffffff;
}
body {
color: #000080;
font-size: 10px;
}
header {
font-weight: bold;
text-align: center;
margin-bottom:0px;
}
h1 {
text-transform:capitalize;
font-variant:small-caps;
font-weight:bold;
font-size: 30px;
}
h2 {
margin-top:0px;
}
h3 {
font-size: 20px;
margin-top: 0px;
}
main {
max-width: 80%;
margin: 0px auto;
}
main ul li {
margin-bottom: 20px;
}
a {
color# 800080;
font-size: 15px;
}
a:visited {
color: #ff0000;
}
.line-divider{
height: 1px;
border-bottom: 1px solid #313030;
}
.column {
width: 45%;
display: inline-block;
vertical-align: top;
}
span {
display: block;
}
aside {
text-align: center;
}
aside a {
font-size: 10px;
}
footer a {
font-size: 16px;
}
footer p a {
font-size: 10px;
}
#warren {
max-width:250px;
position: fixed;
top: 0px;
right: 0px;
}
/*
What is important to know when linking an external file (like a stylesheet) to an HTML file?
It is important to know that the stylesheet was designed specifically with that HTML file in mind.
What tricks did you use to help you with positioning? How hard was it to get the site as you wanted it?
It was not too difficult to get the site how we wanted, since the original site has a very clear structure to follow. We looked at each element as a block.
What CSS did you use to modify the element style (like size, color, etc.)
We used size, color, display, position, text-align, vertical-align, border, font-size, max-width, margin.
Did you modify the HTML to include classes or ids? If so, which did you choose and why? If you didn't, how would you know which one to add to your HTML?
We used classes for elements where CSS could be replicated in another instance. The lines, for example, all require the same CSS. Therefore, we used a class. We used ID for special elements with one-of-a-kind styling, like the photo of Warren Buffett.
We used both classes and id.
When you compared your site to the actual code base, which do you think had cleaner code that followed best practices and why?
I believe our code was actually cleaner. We followed best practices, and we were able to do so by having a stylesheet.
*/
|
torihuang/phase-0
|
week-3/stylesheets/my-berkshire-stylesheet.css
|
CSS
|
mit
| 2,211
|
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'umi'
import { Page } from 'components'
import styles from './index.less'
@connect(({ userDetail }) => ({ userDetail }))
class UserDetail extends PureComponent {
render() {
const { userDetail } = this.props
const { data } = userDetail
const content = []
for (let key in data) {
if ({}.hasOwnProperty.call(data, key)) {
content.push(
<div key={key} className={styles.item}>
<div>{key}</div>
<div>{String(data[key])}</div>
</div>
)
}
}
return (
<Page inner>
<div className={styles.content}>{content}</div>
</Page>
)
}
}
UserDetail.propTypes = {
userDetail: PropTypes.object,
}
export default UserDetail
|
zuiidea/antd-admin
|
src/pages/user/[id]/index.js
|
JavaScript
|
mit
| 834
|
"""
WSGI config for photoboard project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "photoboard.settings")
application = get_wsgi_application()
|
photoboard/photoboard-django
|
photoboard/wsgi.py
|
Python
|
mit
| 398
|
/*
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
*
* Copyright (c) 2011 - 2013, Juerg Lehni & Jonathan Puckey
* http://lehni.org/ & http://jonathanpuckey.com/
*
* Distributed under the MIT license. See LICENSE file for details.
*
* All rights reserved.
*/
/**
* @name Item
*
* @class The Item type allows you to access and modify the items in
* Paper.js projects. Its functionality is inherited by different project
* item types such as {@link Path}, {@link CompoundPath}, {@link Group},
* {@link Layer} and {@link Raster}. They each add a layer of functionality that
* is unique to their type, but share the underlying properties and functions
* that they inherit from Item.
*/
var Item = Base.extend(Callback, /** @lends Item# */{
statics: {
/**
* Override Item.extend() to merge the subclass' _serializeFields with
* the parent class' _serializeFields.
*
* @private
*/
extend: function extend(src) {
if (src._serializeFields)
src._serializeFields = Base.merge(
this.prototype._serializeFields, src._serializeFields);
var res = extend.base.apply(this, arguments),
proto = res.prototype,
name = proto._class;
// Derive the _type string from class name
if (name)
proto._type = Base.hyphenate(name);
return res;
}
},
_class: 'Item',
// All items apply their matrix by default.
// Exceptions are Raster, PlacedSymbol, Clip and Shape.
_transformContent: true,
_boundsSelected: false,
// Provide information about fields to be serialized, with their defaults
// that can be ommited.
_serializeFields: {
name: null,
matrix: new Matrix(),
locked: false,
visible: true,
blendMode: 'normal',
opacity: 1,
guide: false,
selected: false,
clipMask: false,
data: {}
},
initialize: function Item() {
// Do nothing.
},
_initialize: function(props, point) {
// Define this Item's unique id.
this._id = Item._id = (Item._id || 0) + 1;
// If _project is already set, the item was already moved into the DOM
// hierarchy. Used by Layer, where it's added to project.layers instead
if (!this._project) {
var project = paper.project,
layer = project.activeLayer;
// Do not insert into DOM if props.insert is false.
if (layer && !(props && props.insert === false)) {
layer.addChild(this);
} else {
this._setProject(project);
}
}
this._style = new Style(this._project._currentStyle, this);
this._matrix = new Matrix();
if (point)
this._matrix.translate(point);
return props ? this._set(props, { insert: true }) : true;
},
_events: new function() {
// Flags defining which native events are required by which Paper events
// as required for counting amount of necessary natives events.
// The mapping is native -> virtual
var mouseFlags = {
mousedown: {
mousedown: 1,
mousedrag: 1,
click: 1,
doubleclick: 1
},
mouseup: {
mouseup: 1,
mousedrag: 1,
click: 1,
doubleclick: 1
},
mousemove: {
mousedrag: 1,
mousemove: 1,
mouseenter: 1,
mouseleave: 1
}
};
// Entry for all mouse events in the _events list
var mouseEvent = {
install: function(type) {
// If the view requires counting of installed mouse events,
// increase the counters now according to mouseFlags
var counters = this._project.view._eventCounters;
if (counters) {
for (var key in mouseFlags) {
counters[key] = (counters[key] || 0)
+ (mouseFlags[key][type] || 0);
}
}
},
uninstall: function(type) {
// If the view requires counting of installed mouse events,
// decrease the counters now according to mouseFlags
var counters = this._project.view._eventCounters;
if (counters) {
for (var key in mouseFlags)
counters[key] -= mouseFlags[key][type] || 0;
}
}
};
return Base.each(['onMouseDown', 'onMouseUp', 'onMouseDrag', 'onClick',
'onDoubleClick', 'onMouseMove', 'onMouseEnter', 'onMouseLeave'],
function(name) {
this[name] = mouseEvent;
}, {
onFrame: {
install: function() {
this._project.view._animateItem(this, true);
},
uninstall: function() {
this._project.view._animateItem(this, false);
}
},
// Only for external sources, e.g. Raster
onLoad: {}
}
);
},
_serialize: function(options, dictionary) {
var props = {},
that = this;
function serialize(fields) {
for (var key in fields) {
var value = that[key];
// Style#leading is a special case, as its default value is
// dependent on the fontSize. Handle this here separately.
if (!Base.equals(value, key === 'leading'
? fields.fontSize * 1.2 : fields[key])) {
props[key] = Base.serialize(value, options,
// Do not use compact mode for data
key !== 'data', dictionary);
}
}
}
// Serialize fields that this Item subclass defines first
serialize(this._serializeFields);
// Serialize style fields, but only if they differ from defaults.
// Do not serialize styles on Groups and Layers, since they just unify
// their children's own styles.
if (!(this instanceof Group))
serialize(this._style._defaults);
// There is no compact form for Item serialization, we always keep the
// class.
return [ this._class, props ];
},
/**
* Private notifier that is called whenever a change occurs in this item or
* its sub-elements, such as Segments, Curves, Styles, etc.
*
* @param {ChangeFlag} flags describes what exactly has changed.
*/
_changed: function(flags) {
var parent = this._parent,
project = this._project,
symbol = this._parentSymbol;
// Reset _drawCount on each change.
this._drawCount = null;
if (flags & /*#=*/ ChangeFlag.GEOMETRY) {
// Clear cached bounds and position whenever geometry changes
delete this._bounds;
delete this._position;
}
if (parent && (flags
& (/*#=*/ ChangeFlag.GEOMETRY | /*#=*/ ChangeFlag.STROKE))) {
// Clear cached bounds of all items that this item contributes to.
// We call this on the parent, since the information is cached on
// the parent, see getBounds().
parent._clearBoundsCache();
}
if (flags & /*#=*/ ChangeFlag.HIERARCHY) {
// Clear cached bounds of all items that this item contributes to.
// We don't call this on the parent, since we're already the parent
// of the child that modified the hierarchy (that's where these
// HIERARCHY notifications go)
this._clearBoundsCache();
}
if (project) {
if (flags & /*#=*/ ChangeFlag.APPEARANCE) {
project._needsRedraw = true;
}
// Have project keep track of changed items so they can be iterated.
// This can be used for example to update the SVG tree. Needs to be
// activated in Project
if (project._changes) {
var entry = project._changesById[this._id];
if (entry) {
entry.flags |= flags;
} else {
entry = { item: this, flags: flags };
project._changesById[this._id] = entry;
project._changes.push(entry);
}
}
}
// If this item is a symbol's definition, notify it of the change too
if (symbol)
symbol._changed(flags);
},
/**
* Sets those properties of the passed object literal on this item to
* the values defined in the object literal, if the item has property of the
* given name (or a setter defined for it).
* @param {Object} props
* @return {Item} the item itself.
*
* @example {@paperscript}
* // Setting properties through an object literal
* var circle = new Path.Circle({
* center: [80, 50],
* radius: 35
* });
*
* circle.set({
* strokeColor: 'red',
* strokeWidth: 10,
* fillColor: 'black',
* selected: true
* });
*/
set: function(props) {
if (props)
this._set(props);
return this;
},
/**
* The unique id of the item.
*
* @type Number
* @bean
*/
getId: function() {
return this._id;
},
/**
* The type of the item as a string.
*
* @type String('group', 'layer', 'path', 'compound-path', 'raster',
* 'placed-symbol', 'point-text')
* @bean
*/
getType: function() {
return this._type;
},
/**
* The name of the item. If the item has a name, it can be accessed by name
* through its parent's children list.
*
* @type String
* @bean
*
* @example {@paperscript}
* var path = new Path.Circle({
* center: [80, 50],
* radius: 35
* });
* // Set the name of the path:
* path.name = 'example';
*
* // Create a group and add path to it as a child:
* var group = new Group();
* group.addChild(path);
*
* // The path can be accessed by name:
* group.children['example'].fillColor = 'red';
*/
getName: function() {
return this._name;
},
setName: function(name, unique) {
// Note: Don't check if the name has changed and bail out if it has not,
// because setName is used internally also to update internal structures
// when an item is moved from one parent to another.
// If the item already had a name, remove the reference to it from the
// parent's children object:
if (this._name)
this._removeNamed();
// See if the name is a simple number, which we cannot support due to
// the named lookup on the children array.
if (name === (+name) + '')
throw new Error(
'Names consisting only of numbers are not supported.');
if (name && this._parent) {
var children = this._parent._children,
namedChildren = this._parent._namedChildren,
orig = name,
i = 1;
// If unique is true, make sure we're not overriding other names
while (unique && children[name])
name = orig + ' ' + (i++);
(namedChildren[name] = namedChildren[name] || []).push(this);
children[name] = this;
}
this._name = name || undefined;
this._changed(/*#=*/ ChangeFlag.ATTRIBUTE);
},
/**
* The path style of the item.
*
* @name Item#getStyle
* @type Style
* @bean
*
* @example {@paperscript}
* // Applying several styles to an item in one go, by passing an object
* // to its style property:
* var circle = new Path.Circle({
* center: [80, 50],
* radius: 30
* });
* circle.style = {
* fillColor: 'blue',
* strokeColor: 'red',
* strokeWidth: 5
* };
*
* @example {@paperscript split=true height=100}
* // Copying the style of another item:
* var path = new Path.Circle({
* center: [50, 50],
* radius: 30,
* fillColor: 'red'
* });
*
* var path2 = new Path.Circle({
* center: new Point(180, 50),
* radius: 20
* });
*
* // Copy the path style of path:
* path2.style = path.style;
*
* @example {@paperscript}
* // Applying the same style object to multiple items:
* var myStyle = {
* fillColor: 'red',
* strokeColor: 'blue',
* strokeWidth: 4
* };
*
* var path = new Path.Circle({
* center: [50, 50],
* radius: 30
* });
* path.style = myStyle;
*
* var path2 = new Path.Circle({
* center: new Point(150, 50),
* radius: 20
* });
* path2.style = myStyle;
*/
getStyle: function() {
return this._style;
},
setStyle: function(style) {
// Don't access _style directly so Path#getStyle() can be overriden for
// CompoundPaths.
this.getStyle().set(style);
},
// DOCS: Item#hasFill()
hasFill: function() {
return this.getStyle().hasFill();
},
// DOCS: Item#hasStroke()
hasStroke: function() {
return this.getStyle().hasStroke();
},
// DOCS: Item#hasShadow()
hasShadow: function() {
return this.getStyle().hasShadow();
}
}, Base.each(['locked', 'visible', 'blendMode', 'opacity', 'guide'],
// Produce getter/setters for properties. We need setters because we want to
// call _changed() if a property was modified.
function(name) {
var part = Base.capitalize(name),
name = '_' + name;
this['get' + part] = function() {
return this[name];
};
this['set' + part] = function(value) {
if (value != this[name]) {
this[name] = value;
// #locked does not change appearance, all others do:
this._changed(name === '_locked'
? /*#=*/ ChangeFlag.ATTRIBUTE : /*#=*/ Change.ATTRIBUTE);
}
};
}, {}), /** @lends Item# */{
// Note: These properties have their getter / setters produced in the
// injection scope above.
/**
* Specifies whether the item is locked.
*
* @name Item#locked
* @type Boolean
* @default false
* @ignore
*/
_locked: false,
/**
* Specifies whether the item is visible. When set to {@code false}, the
* item won't be drawn.
*
* @name Item#visible
* @type Boolean
* @default true
*
* @example {@paperscript}
* // Hiding an item:
* var path = new Path.Circle({
* center: [50, 50],
* radius: 20,
* fillColor: 'red'
* });
*
* // Hide the path:
* path.visible = false;
*/
_visible: true,
/**
* The blend mode with which the item is composited onto the canvas. Both
* the standard canvas compositing modes, as well as the new CSS blend modes
* are supported. If blend-modes cannot be rendered natively, they are
* emulated. Be aware that emulation can have an impact on performance.
*
* @name Item#blendMode
* @type String('normal', 'multiply', 'screen', 'overlay', 'soft-light',
* 'hard-light', 'color-dodge', 'color-burn', 'darken', 'lighten',
* 'difference', 'exclusion', 'hue', 'saturation', 'luminosity', 'color',
* 'add', 'subtract', 'average', 'pin-light', 'negation', 'source-over',
* 'source-in', 'source-out', 'source-atop', 'destination-over',
* 'destination-in', 'destination-out', 'destination-atop', 'lighter',
* 'darker', 'copy', 'xor')
* @default 'normal'
*
* @example {@paperscript}
* // Setting an item's blend mode:
*
* // Create a white rectangle in the background
* // with the same dimensions as the view:
* var background = new Path.Rectangle(view.bounds);
* background.fillColor = 'white';
*
* var circle = new Path.Circle({
* center: [80, 50],
* radius: 35,
* fillColor: 'red'
* });
*
* var circle2 = new Path.Circle({
* center: new Point(120, 50),
* radius: 35,
* fillColor: 'blue'
* });
*
* // Set the blend mode of circle2:
* circle2.blendMode = 'multiply';
*/
_blendMode: 'normal',
/**
* The opacity of the item as a value between {@code 0} and {@code 1}.
*
* @name Item#opacity
* @type Number
* @default 1
*
* @example {@paperscript}
* // Making an item 50% transparent:
* var circle = new Path.Circle({
* center: [80, 50],
* radius: 35,
* fillColor: 'red'
* });
*
* var circle2 = new Path.Circle({
* center: new Point(120, 50),
* radius: 35,
* fillColor: 'blue',
* strokeColor: 'green',
* strokeWidth: 10
* });
*
* // Make circle2 50% transparent:
* circle2.opacity = 0.5;
*/
_opacity: 1,
// TODO: Implement guides
/**
* Specifies whether the item functions as a guide. When set to
* {@code true}, the item will be drawn at the end as a guide.
*
* @name Item#guide
* @type Boolean
* @default true
* @ignore
*/
_guide: false,
/**
* Specifies whether an item is selected and will also return {@code true}
* if the item is partially selected (groups with some selected or partially
* selected paths).
*
* Paper.js draws the visual outlines of selected items on top of your
* project. This can be useful for debugging, as it allows you to see the
* construction of paths, position of path curves, individual segment points
* and bounding boxes of symbol and raster items.
*
* @type Boolean
* @default false
* @bean
* @see Project#selectedItems
* @see Segment#selected
* @see Point#selected
*
* @example {@paperscript}
* // Selecting an item:
* var path = new Path.Circle({
* center: [80, 50],
* radius: 35
* });
* path.selected = true; // Select the path
*/
isSelected: function() {
if (this._children) {
for (var i = 0, l = this._children.length; i < l; i++)
if (this._children[i].isSelected())
return true;
}
return this._selected;
},
setSelected: function(selected /*, noChildren */) {
// Don't recursively call #setSelected() if it was called with
// noChildren set to true, see #setFullySelected().
if (this._children && !arguments[1]) {
for (var i = 0, l = this._children.length; i < l; i++)
this._children[i].setSelected(selected);
}
if ((selected = !!selected) != this._selected) {
this._selected = selected;
this._project._updateSelection(this);
this._changed(/*#=*/ Change.ATTRIBUTE);
}
},
_selected: false,
isFullySelected: function() {
if (this._children && this._selected) {
for (var i = 0, l = this._children.length; i < l; i++)
if (!this._children[i].isFullySelected())
return false;
return true;
}
// If there are no children, this is the same as #selected
return this._selected;
},
setFullySelected: function(selected) {
if (this._children) {
for (var i = 0, l = this._children.length; i < l; i++)
this._children[i].setFullySelected(selected);
}
// Pass true for hidden noChildren argument
this.setSelected(selected, true);
},
/**
* Specifies whether the item defines a clip mask. This can only be set on
* paths, compound paths, and text frame objects, and only if the item is
* already contained within a clipping group.
*
* @type Boolean
* @default false
* @bean
*/
isClipMask: function() {
return this._clipMask;
},
setClipMask: function(clipMask) {
// On-the-fly conversion to boolean:
if (this._clipMask != (clipMask = !!clipMask)) {
this._clipMask = clipMask;
if (clipMask) {
this.setFillColor(null);
this.setStrokeColor(null);
}
this._changed(/*#=*/ Change.ATTRIBUTE);
// Tell the parent the clipping mask has changed
if (this._parent)
this._parent._changed(/*#=*/ ChangeFlag.CLIPPING);
}
},
_clipMask: false,
// TODO: get/setIsolated (print specific feature)
// TODO: get/setKnockout (print specific feature)
// TODO: get/setAlphaIsShape
/**
* A plain javascript object which can be used to store
* arbitrary data on the item.
*
* @type Object
* @bean
*
* @example
* var path = new Path();
* path.data.remember = 'milk';
*
* @example
* var path = new Path();
* path.data.malcolm = new Point(20, 30);
* console.log(path.data.malcolm.x); // 20
*
* @example
* var path = new Path();
* path.data = {
* home: 'Omicron Theta',
* found: 2338,
* pets: ['Spot']
* };
* console.log(path.data.pets.length); // 1
*
* @example
* var path = new Path({
* data: {
* home: 'Omicron Theta',
* found: 2338,
* pets: ['Spot']
* }
* });
* console.log(path.data.pets.length); // 1
*/
getData: function() {
if (!this._data)
this._data = {};
return this._data;
},
setData: function(data) {
this._data = data;
},
/**
* {@grouptitle Position and Bounding Boxes}
*
* The item's position within the project. This is the
* {@link Rectangle#center} of the item's {@link #bounds} rectangle.
*
* @type Point
* @bean
*
* @example {@paperscript}
* // Changing the position of a path:
*
* // Create a circle at position { x: 10, y: 10 }
* var circle = new Path.Circle({
* center: new Point(10, 10),
* radius: 10,
* fillColor: 'red'
* });
*
* // Move the circle to { x: 20, y: 20 }
* circle.position = new Point(20, 20);
*
* // Move the circle 100 points to the right and 50 points down
* circle.position += new Point(100, 50);
*
* @example {@paperscript split=true height=100}
* // Changing the x coordinate of an item's position:
*
* // Create a circle at position { x: 20, y: 20 }
* var circle = new Path.Circle({
* center: new Point(20, 20),
* radius: 10,
* fillColor: 'red'
* });
*
* // Move the circle 100 points to the right
* circle.position.x += 100;
*/
getPosition: function(/* dontLink */) {
// Cache position value.
// Pass true for dontLink in getCenter(), so receive back a normal point
var pos = this._position
|| (this._position = this.getBounds().getCenter(true));
// Do not cache LinkedPoints directly, since we would not be able to
// use them to calculate the difference in #setPosition, as when it is
// modified, it would hold new values already and only then cause the
// calling of #setPosition.
return new (arguments[0] ? Point : LinkedPoint)
(pos.x, pos.y, this, 'setPosition');
},
setPosition: function(/* point */) {
// Calculate the distance to the current position, by which to
// translate the item. Pass true for dontLink, as we do not need a
// LinkedPoint to simply calculate this distance.
this.translate(Point.read(arguments).subtract(this.getPosition(true)));
},
/**
* The item's transformation matrix, defining position and dimensions in
* relation to its parent item in which it is contained.
*
* @type Matrix
* @bean
*/
getMatrix: function() {
return this._matrix;
},
setMatrix: function(matrix) {
// Use Matrix#initialize to easily copy over values.
this._matrix.initialize(matrix);
if (this._transformContent)
this.applyMatrix(true);
this._changed(/*#=*/ Change.GEOMETRY);
},
/**
* The item's global transformation matrix in relation to the global project
* coordinate space.
*
* @type Matrix
* @bean
*/
getGlobalMatrix: function() {
// TODO: if drawCount is out of sync, we still need to walk up the chain
// and concatenate the matrices.
return this._drawCount === this._project._drawCount
&& this._globalMatrix || null;
},
/**
* Converts the specified point from global project coordinates to local
* coordinates in relation to the the item's own coordinate space.
*
* @param {Point} point the point to be transformed
* @return {Point} the transformed point as a new instance
*/
globalToLocal: function(/* point */) {
var matrix = this.getGlobalMatrix();
return matrix && matrix._transformPoint(Point.read(arguments));
},
/**
* Converts the specified point from local coordinates to global coordinates
* in relation to the the project coordinate space.
*
* @param {Point} point the point to be transformed
* @return {Point} the transformed point as a new instance
*/
localToGlobal: function(/* point */) {
var matrix = this.getGlobalMatrix();
return matrix && matrix._inverseTransform(Point.read(arguments));
},
/**
* Specifies whether the item has any content or not. The meaning of what
* content is differs from type to type. For example, a {@link Group} with
* no children, a {@link TextItem} with no text content and a {@link Path}
* with no segments all are considered empty.
*
* @type Boolean
*/
isEmpty: function() {
return !this._children || this._children.length == 0;
}
}, Base.each(['getBounds', 'getStrokeBounds', 'getHandleBounds', 'getRoughBounds'],
function(name) {
// Produce getters for bounds properties. These handle caching, matrices
// and redirect the call to the private _getBounds, which can be
// overridden by subclasses, see below.
this[name] = function(/* matrix */) {
var getter = this._boundsGetter,
// Allow subclasses to override _boundsGetter if they use
// the same calculations for multiple type of bounds.
// The default is name:
bounds = this._getCachedBounds(typeof getter == 'string'
? getter : getter && getter[name] || name, arguments[0]);
// If we're returning 'bounds', create a LinkedRectangle that uses
// the setBounds() setter to update the Item whenever the bounds are
// changed:
return name === 'getBounds'
? new LinkedRectangle(bounds.x, bounds.y, bounds.width,
bounds.height, this, 'setBounds')
: bounds;
};
},
/** @lends Item# */{
/**
* Private method that deals with the calling of _getBounds, recursive
* matrix concatenation and handles all the complicated caching mechanisms.
*/
_getCachedBounds: function(getter, matrix, cacheItem) {
// See if we can cache these bounds. We only cache the bounds
// transformed with the internally stored _matrix, (the default if no
// matrix is passed).
var cache = (!matrix || matrix.equals(this._matrix)) && getter;
// Set up a boundsCache structure that keeps track of items that keep
// cached bounds that depend on this item. We store this in our parent,
// for multiple reasons:
// The parent receives HIERARCHY change notifications for when its
// children are added or removed and can thus clear the cache, and we
// save a lot of memory, e.g. when grouping 100 items and asking the
// group for its bounds. If stored on the children, we would have 100
// times the same structure.
// Note: This needs to happen before returning cached values, since even
// then, _boundsCache needs to be kept up-to-date.
if (cacheItem && this._parent) {
// Set-up the parent's boundsCache structure if it does not
// exist yet and add the cacheItem to it.
var id = cacheItem._id,
ref = this._parent._boundsCache
= this._parent._boundsCache || {
// Use both a hashtable for ids and an array for the list,
// so we can keep track of items that were added already
ids: {},
list: []
};
if (!ref.ids[id]) {
ref.list.push(cacheItem);
ref.ids[id] = cacheItem;
}
}
if (cache && this._bounds && this._bounds[cache])
return this._bounds[cache].clone();
// If the result of concatinating the passed matrix with our internal
// one is an identity transformation, set it to null for faster
// processing
var identity = this._matrix.isIdentity();
matrix = !matrix || matrix.isIdentity()
? identity ? null : this._matrix
: identity ? matrix : matrix.clone().concatenate(this._matrix);
// If we're caching bounds on this item, pass it on as cacheItem, so the
// children can setup the _boundsCache structures for it.
var bounds = this._getBounds(getter, matrix, cache ? this : cacheItem);
// If we can cache the result, update the _bounds cache structure
// before returning
if (cache) {
if (!this._bounds)
this._bounds = {};
this._bounds[cache] = bounds.clone();
}
return bounds;
},
/**
* Clears cached bounds of all items that the children of this item are
* contributing to. See #_getCachedBounds() for an explanation why this
* information is stored on parents, not the children themselves.
*/
_clearBoundsCache: function() {
if (this._boundsCache) {
for (var i = 0, list = this._boundsCache.list, l = list.length;
i < l; i++) {
var item = list[i];
delete item._bounds;
// We need to recursively call _clearBoundsCache, because if the
// cache for this item's children is not valid anymore, that
// propagates up the DOM tree.
if (item != this && item._boundsCache)
item._clearBoundsCache();
}
delete this._boundsCache;
}
},
/**
* Protected method used in all the bounds getters. It loops through all the
* children, gets their bounds and finds the bounds around all of them.
* Subclasses override it to define calculations for the various required
* bounding types.
*/
_getBounds: function(getter, matrix, cacheItem) {
// Note: We cannot cache these results here, since we do not get
// _changed() notifications here for changing geometry in children.
// But cacheName is used in sub-classes such as PlacedSymbol and Raster.
var children = this._children;
// TODO: What to return if nothing is defined, e.g. empty Groups?
// Scriptographer behaves weirdly then too.
if (!children || children.length == 0)
return new Rectangle();
var x1 = Infinity,
x2 = -x1,
y1 = x1,
y2 = x2;
for (var i = 0, l = children.length; i < l; i++) {
var child = children[i];
if (child._visible && !child.isEmpty()) {
var rect = child._getCachedBounds(getter, matrix, cacheItem);
x1 = Math.min(rect.x, x1);
y1 = Math.min(rect.y, y1);
x2 = Math.max(rect.x + rect.width, x2);
y2 = Math.max(rect.y + rect.height, y2);
}
}
return isFinite(x1)
? new Rectangle(x1, y1, x2 - x1, y2 - y1)
: new Rectangle();
},
setBounds: function(rect) {
rect = Rectangle.read(arguments);
var bounds = this.getBounds(),
matrix = new Matrix(),
center = rect.getCenter();
// Read this from bottom to top:
// Translate to new center:
matrix.translate(center);
// Scale to new Size, if size changes and avoid divisions by 0:
if (rect.width != bounds.width || rect.height != bounds.height) {
matrix.scale(
bounds.width != 0 ? rect.width / bounds.width : 1,
bounds.height != 0 ? rect.height / bounds.height : 1);
}
// Translate to bounds center:
center = bounds.getCenter();
matrix.translate(-center.x, -center.y);
// Now execute the transformation
this.transform(matrix);
}
/**
* The bounding rectangle of the item excluding stroke width.
*
* @name Item#getBounds
* @type Rectangle
* @bean
*/
/**
* The bounding rectangle of the item including stroke width.
*
* @name Item#getStrokeBounds
* @type Rectangle
* @bean
*/
/**
* The bounding rectangle of the item including handles.
*
* @name Item#getHandleBounds
* @type Rectangle
* @bean
*/
/**
* The rough bounding rectangle of the item that is shure to include all of
* the drawing, including stroke width.
*
* @name Item#getRoughBounds
* @type Rectangle
* @bean
* @ignore
*/
}), /** @lends Item# */{
/**
* {@grouptitle Project Hierarchy}
* The project that this item belongs to.
*
* @type Project
* @bean
*/
getProject: function() {
return this._project;
},
_setProject: function(project) {
if (this._project != project) {
this._project = project;
if (this._children) {
for (var i = 0, l = this._children.length; i < l; i++) {
this._children[i]._setProject(project);
}
}
}
},
/**
* The layer that this item is contained within.
*
* @type Layer
* @bean
*/
getLayer: function() {
var parent = this;
while (parent = parent._parent) {
if (parent instanceof Layer)
return parent;
}
return null;
},
/**
* The item that this item is contained within.
*
* @type Item
* @bean
*
* @example
* var path = new Path();
*
* // New items are placed in the active layer:
* console.log(path.parent == project.activeLayer); // true
*
* var group = new Group();
* group.addChild(path);
*
* // Now the parent of the path has become the group:
* console.log(path.parent == group); // true
*
* @example // Setting the parent of the item to another item
* var path = new Path();
*
* // New items are placed in the active layer:
* console.log(path.parent == project.activeLayer); // true
*
* var group = new Group();
* group.parent = path;
*
* // Now the parent of the path has become the group:
* console.log(path.parent == group); // true
*
* // The path is now contained in the children list of group:
* console.log(group.children[0] == path); // true
*
* @example // Setting the parent of an item in the constructor
* var group = new Group();
*
* var path = new Path({
* parent: group
* });
*
* // The parent of the path is the group:
* console.log(path.parent == group); // true
*
* // The path is contained in the children list of group:
* console.log(group.children[0] == path); // true
*/
getParent: function() {
return this._parent;
},
setParent: function(item) {
return item.addChild(this);
},
/**
* The children items contained within this item. Items that define a
* {@link #name} can also be accessed by name.
*
* <b>Please note:</b> The children array should not be modified directly
* using array functions. To remove single items from the children list, use
* {@link Item#remove()}, to remove all items from the children list, use
* {@link Item#removeChildren()}. To add items to the children list, use
* {@link Item#addChild(item)} or {@link Item#insertChild(index,item)}.
*
* @type Item[]
* @bean
*
* @example {@paperscript}
* // Accessing items in the children array:
* var path = new Path.Circle({
* center: [80, 50],
* radius: 35
* });
*
* // Create a group and move the path into it:
* var group = new Group();
* group.addChild(path);
*
* // Access the path through the group's children array:
* group.children[0].fillColor = 'red';
*
* @example {@paperscript}
* // Accessing children by name:
* var path = new Path.Circle({
* center: [80, 50],
* radius: 35
* });
* // Set the name of the path:
* path.name = 'example';
*
* // Create a group and move the path into it:
* var group = new Group();
* group.addChild(path);
*
* // The path can be accessed by name:
* group.children['example'].fillColor = 'orange';
*
* @example {@paperscript}
* // Passing an array of items to item.children:
* var path = new Path.Circle({
* center: [80, 50],
* radius: 35
* });
*
* var group = new Group();
* group.children = [path];
*
* // The path is the first child of the group:
* group.firstChild.fillColor = 'green';
*/
getChildren: function() {
return this._children;
},
setChildren: function(items) {
this.removeChildren();
this.addChildren(items);
},
/**
* The first item contained within this item. This is a shortcut for
* accessing {@code item.children[0]}.
*
* @type Item
* @bean
*/
getFirstChild: function() {
return this._children && this._children[0] || null;
},
/**
* The last item contained within this item.This is a shortcut for
* accessing {@code item.children[item.children.length - 1]}.
*
* @type Item
* @bean
*/
getLastChild: function() {
return this._children && this._children[this._children.length - 1]
|| null;
},
/**
* The next item on the same level as this item.
*
* @type Item
* @bean
*/
getNextSibling: function() {
return this._parent && this._parent._children[this._index + 1] || null;
},
/**
* The previous item on the same level as this item.
*
* @type Item
* @bean
*/
getPreviousSibling: function() {
return this._parent && this._parent._children[this._index - 1] || null;
},
/**
* The index of this item within the list of its parent's children.
*
* @type Number
* @bean
*/
getIndex: function() {
return this._index;
},
/**
* Checks whether the item and all its parents are inserted into the DOM or
* not.
*
* @return {Boolean} {@true if the item is inserted into the DOM}
*/
isInserted: function() {
return this._parent ? this._parent.isInserted() : false;
},
equals: function(item) {
// Note: We do not compare name and selected state.
return item === this || item && this._class === item._class
&& this._style.equals(item._style)
&& this._matrix.equals(item._matrix)
&& this._locked === item._locked
&& this._visible === item._visible
&& this._blendMode === item._blendMode
&& this._opacity === item._opacity
&& this._clipMask === item._clipMask
&& this._guide === item._guide
&& this._equals(item)
|| false;
},
/**
* A private helper for #equals(), to be overridden in sub-classes. When it
* is called, item is always defined, of the same class as `this` and has
* equal general state attributes such as matrix, style, opacity, etc.
*/
_equals: function(item) {
return Base.equals(this._children, item._children);
},
/**
* Clones the item within the same project and places the copy above the
* item.
*
* @param {Boolean} [insert=true] specifies whether the copy should be
* inserted into the DOM. When set to {@code true}, it is inserted above the
* original.
* @return {Item} the newly cloned item
*
* @example {@paperscript}
* // Cloning items:
* var circle = new Path.Circle({
* center: [50, 50],
* radius: 10,
* fillColor: 'red'
* });
*
* // Make 20 copies of the circle:
* for (var i = 0; i < 20; i++) {
* var copy = circle.clone();
*
* // Distribute the copies horizontally, so we can see them:
* copy.position.x += i * copy.bounds.width;
* }
*/
clone: function(insert) {
return this._clone(new this.constructor({ insert: false }), insert);
},
_clone: function(copy, insert) {
// Copy over style
copy.setStyle(this._style);
// If this item has children, clone and append each of them:
if (this._children) {
// Clone all children and add them to the copy. tell #addChild we're
// cloning, as needed by CompoundPath#insertChild().
for (var i = 0, l = this._children.length; i < l; i++)
copy.addChild(this._children[i].clone(false), true);
}
// Insert is true by default.
if (insert || insert === undefined)
copy.insertAbove(this);
// Only copy over these fields if they are actually defined in 'this',
// meaning the default value has been overwritten (default is on
// prototype).
var keys = ['_locked', '_visible', '_blendMode', '_opacity',
'_clipMask', '_guide'];
for (var i = 0, l = keys.length; i < l; i++) {
var key = keys[i];
if (this.hasOwnProperty(key))
copy[key] = this[key];
}
// Use Matrix#initialize to easily copy over values.
copy._matrix.initialize(this._matrix);
// Copy over the selection state, use setSelected so the item
// is also added to Project#selectedItems if it is selected.
copy.setSelected(this._selected);
// Clone the name too, but make sure we're not overriding the original
// in the same parent, by passing true for the unique parameter.
if (this._name)
copy.setName(this._name, true);
return copy;
},
/**
* When passed a project, copies the item to the project,
* or duplicates it within the same project. When passed an item,
* copies the item into the specified item.
*
* @param {Project|Layer|Group|CompoundPath} item the item or project to
* copy the item to
* @return {Item} the new copy of the item
*/
copyTo: function(itemOrProject) {
var copy = this.clone();
if (itemOrProject.layers) {
itemOrProject.activeLayer.addChild(copy);
} else {
itemOrProject.addChild(copy);
}
return copy;
},
/**
* Rasterizes the item into a newly created Raster object. The item itself
* is not removed after rasterization.
*
* @param {Number} [resolution=72] the resolution of the raster in dpi
* @return {Raster} the newly created raster item
*
* @example {@paperscript}
* // Rasterizing an item:
* var circle = new Path.Circle({
* center: [50, 50],
* radius: 5,
* fillColor: 'red'
* });
*
* // Create a rasterized version of the path:
* var raster = circle.rasterize();
*
* // Move it 100pt to the right:
* raster.position.x += 100;
*
* // Scale the path and the raster by 300%, so we can compare them:
* circle.scale(5);
* raster.scale(5);
*/
rasterize: function(resolution) {
var bounds = this.getStrokeBounds(),
scale = (resolution || 72) / 72,
// floor top-left corner and ceil bottom-right corner, to never
// blur or cut pixels.
topLeft = bounds.getTopLeft().floor(),
bottomRight = bounds.getBottomRight().ceil()
size = new Size(bottomRight.subtract(topLeft)),
canvas = CanvasProvider.getCanvas(size),
ctx = canvas.getContext('2d'),
matrix = new Matrix().scale(scale).translate(topLeft.negate());
ctx.save();
matrix.applyToContext(ctx);
// See Project#draw() for an explanation of Base.merge()
this.draw(ctx, Base.merge({ transforms: [matrix] }));
ctx.restore();
var raster = new Raster({
canvas: canvas,
insert: false
});
raster.setPosition(topLeft.add(size.divide(2)));
raster.insertAbove(this);
// NOTE: We don't need to release the canvas since it now belongs to the
// Raster!
return raster;
},
/**
* Checks whether the item's geometry contains the given point.
*
* @example {@paperscript} // Click within and outside the star below
* // Create a star shaped path:
* var path = new Path.Star({
* center: [50, 50],
* points: 12,
* radius1: 20,
* radius2: 40,
* fillColor: 'black'
* });
*
* // Whenever the user presses the mouse:
* function onMouseDown(event) {
* // If the position of the mouse is within the path,
* // set its fill color to red, otherwise set it to
* // black:
* if (path.contains(event.point)) {
* path.fillColor = 'red';
* } else {
* path.fillColor = 'black';
* }
* }
*
* @param {Point} point The point to check for.
*/
contains: function(/* point */) {
// See CompoundPath#_contains() for the reason for !!
return !!this._contains(
this._matrix._inverseTransform(Point.read(arguments)));
},
_contains: function(point) {
if (this._children) {
for (var i = this._children.length - 1; i >= 0; i--) {
if (this._children[i].contains(point))
return true;
}
return false;
}
// We only implement it here for items with rectangular content,
// for anything else we need to override #contains()
// TODO: There currently is no caching for the results of direct calls
// to this._getBounds('getBounds') (without the application of the
// internal matrix). Performance improvements could be achieved if
// these were cached too. See #_getCachedBounds().
return point.isInside(this._getBounds('getBounds'));
},
/**
* Perform a hit test on the item (and its children, if it is a
* {@link Group} or {@link Layer}) at the location of the specified point.
*
* The options object allows you to control the specifics of the hit test
* and may contain a combination of the following values:
* <b>options.tolerance:</b> {@code Number} – the tolerance of the hit test
* in points. Can also be controlled through
* {@link Project#options}{@code .hitTolerance}.
* <b>options.type:</b> Only hit test again a certain item
* type: {@link PathItem}, {@link Raster}, {@link TextItem}, etc.
* <b>options.fill:</b> {@code Boolean} – hit test the fill of items.
* <b>options.stroke:</b> {@code Boolean} – hit test the curves of path
* items, taking into account stroke width.
* <b>options.segment:</b> {@code Boolean} – hit test for
* {@link Segment#point} of {@link Path} items.
* <b>options.handles:</b> {@code Boolean} – hit test for the handles
* ({@link Segment#handleIn} / {@link Segment#handleOut}) of path segments.
* <b>options.ends:</b> {@code Boolean} – only hit test for the first or
* last segment points of open path items.
* <b>options.bounds:</b> {@code Boolean} – hit test the corners and
* side-centers of the bounding rectangle of items ({@link Item#bounds}).
* <b>options.center:</b> {@code Boolean} – hit test the
* {@link Rectangle#center} of the bounding rectangle of items
* ({@link Item#bounds}).
* <b>options.guides:</b> {@code Boolean} – hit test items that have
* {@link Item#guide} set to {@code true}.
* <b>options.selected:</b> {@code Boolean} – only hit selected items.<b
*
* @param {Point} point The point where the hit test should be performed
* @param {Object} [options={ fill: true, stroke: true, segments: true,
* tolerance: 2 }]
* @return {HitResult} a hit result object that contains more
* information about what exactly was hit or {@code null} if nothing was
* hit
*/
hitTest: function(point, options) {
point = Point.read(arguments);
options = HitResult.getOptions(Base.read(arguments));
if (this._locked || !this._visible || this._guide && !options.guides)
return null;
// Check if the point is withing roughBounds + tolerance, but only if
// this item does not have children, since we'd have to travel up the
// chain already to determine the rough bounds.
if (!this._children && !this.getRoughBounds()
.expand(2 * options.tolerance)._containsPoint(point))
return null;
// Transform point to local coordinates but use untransformed point
// for bounds check above.
point = this._matrix._inverseTransform(point);
var that = this,
res;
function checkBounds(type, part) {
var pt = bounds['get' + part]();
// TODO: We need to transform the point back to the coordinate
// system of the DOM level on which the inquiry was started!
if (point.getDistance(pt) < options.tolerance)
return new HitResult(type, that,
{ name: Base.hyphenate(part), point: pt });
}
if ((options.center || options.bounds) &&
// Ignore top level layers:
!(this instanceof Layer && !this._parent)) {
// Don't get the transformed bounds, check against transformed
// points instead
var bounds = this._getBounds('getBounds');
if (options.center)
res = checkBounds('center', 'Center');
if (!res && options.bounds) {
// TODO: Move these into a private scope
var points = [
'TopLeft', 'TopRight', 'BottomLeft', 'BottomRight',
'LeftCenter', 'TopCenter', 'RightCenter', 'BottomCenter'
];
for (var i = 0; i < 8 && !res; i++)
res = checkBounds('bounds', points[i]);
}
}
// TODO: Support option.type even for things like CompoundPath where
// children are matched but the parent is returned.
// Filter for guides or selected items if that's required
if ((res || (res = this._children || !(options.guides && !this._guide
|| options.selected && !this._selected)
? this._hitTest(point, options) : null))
&& res.point) {
// Transform the point back to the outer coordinate system.
res.point = that._matrix.transform(res.point);
}
return res;
},
_hitTest: function(point, options) {
var children = this._children;
if (children) {
// Loop backwards, so items that get drawn last are tested first
for (var i = children.length - 1, res; i >= 0; i--)
if (res = children[i].hitTest(point, options))
return res;
} else if (options.fill && this.hasFill() && this._contains(point)) {
return new HitResult('fill', this);
}
},
// DOCS: Item#matches
matches: function(match) {
// matchObject() is used to match against objects in a nested manner.
// This is useful for matching against Item#data.
function matchObject(obj1, obj2) {
for (var i in obj1) {
if (obj1.hasOwnProperty(i)) {
var val1 = obj1[i],
val2 = obj2[i];
if (Base.isPlainObject(val1) && Base.isPlainObject(val2)) {
if (!matchObject(val1, val2))
return false;
} else if (!Base.equals(val1, val2)) {
return false;
}
}
}
return true;
}
for (var key in match) {
if (match.hasOwnProperty(key)) {
var value = this[key],
compare = match[key];
if (compare instanceof RegExp) {
if (!compare.test(value))
return false;
} else if (typeof compare === 'function') {
if (!compare(value))
return false;
} else if (Base.isPlainObject(compare)) {
if (!matchObject(compare, value))
return false;
} else if (!Base.equals(value, compare)) {
return false;
}
}
}
return true;
}
}, new function() {
function getItems(item, match, list) {
var children = item._children,
items = list && [];
for (var i = 0, l = children && children.length; i < l; i++) {
var child = children[i];
if (child.matches(match)) {
if (list) {
items.push(child);
} else {
return child;
}
}
var res = getItems(child, match, list);
if (list) {
items.push.apply(items, res);
} else if (res) {
return res;
}
}
return list ? items : null;
}
return /** @lends Item# */{
// DOCS: Item#getItems
getItems: function(match) {
return getItems(this, match, true);
},
// DOCS: Item#getItem
getItem: function(match) {
return getItems(this, match, false);
}
};
}, /** @lends Item# */{
/**
* {@grouptitle Importing / Exporting JSON and SVG}
*
* Exports (serializes) the item with its content and child items to a JSON
* data string.
*
* The options object offers control over some aspects of the SVG export:
* <b>options.precision:</b> {@code Number} – the amount of fractional
* digits in numbers used in JSON data.
*
* @name Item#exportJSON
* @function
* @param {Object} [options={ precision: 5 }] the serialization options
* @return {String} the exported JSON data
*/
/**
* Imports (deserializes) the stored JSON data into this item. If the data
* describes an item of the same class or a parent class of the item, the
* data is imported into the item itself. If not, the imported item is added
* to this item's {@link Item#children} list. Note that not all type of
* items can have children.
*
* @param {String} json the JSON data to import from.
*/
importJSON: function(json) {
// Try importing into `this`. If another item is returned, try adding
// it as a child (this won't be successful on some classes, returning
// null).
var res = Base.importJSON(json, this);
return res !== this
? this.addChild(res)
: res;
},
/**
* Exports the item with its content and child items as an SVG DOM.
*
* The options object offers control over some aspects of the SVG export:
* <b>options.asString:</b> {@code Boolean} – wether a SVG node or a String
* is to be returned.
* <b>options.precision:</b> {@code Number} – the amount of fractional
* digits in numbers used in SVG data.
* <b>options.matchShapes:</b> {@code Boolean} – wether imported path
* items should tried to be converted to shape items, if their geometries
* match.
*
* @name Item#exportSVG
* @function
* @param {Object} [options={ asString: false, precision: 5,
* matchShapes: false }] the export options.
* @return {SVGSVGElement} the item converted to an SVG node
*/
/**
* Converts the provided SVG content into Paper.js items and adds them to
* the this item's children list.
* Note that the item is not cleared first. You can call
* {@link Item#removeChildren()} to do so.
*
* The options object offers control over some aspects of the SVG import:
* <b>options.expandShapes:</b> {@code Boolean} – wether imported shape
* items should be expanded to path items.
*
* @name Item#importSVG
* @function
* @param {SVGSVGElement|String} svg the SVG content to import
* @param {Object} [options={ expandShapes: false }] the import options
* @return {Item} the imported Paper.js parent item
*/
/**
* {@grouptitle Hierarchy Operations}
* Adds the specified item as a child of this item at the end of the
* its children list. You can use this function for groups, compound
* paths and layers.
*
* @param {Item} item the item to be added as a child
* @return {Item} the added item, or {@code null} if adding was not
* possible.
*/
addChild: function(item, _preserve) {
return this.insertChild(undefined, item, _preserve);
},
/**
* Inserts the specified item as a child of this item at the specified
* index in its {@link #children} list. You can use this function for
* groups, compound paths and layers.
*
* @param {Number} index
* @param {Item} item the item to be inserted as a child
* @return {Item} the inserted item, or {@code null} if inserting was not
* possible.
*/
insertChild: function(index, item, _preserve) {
var res = this.insertChildren(index, [item], _preserve);
return res && res[0];
},
/**
* Adds the specified items as children of this item at the end of the
* its children list. You can use this function for groups, compound
* paths and layers.
*
* @param {Item[]} items The items to be added as children
* @return {Item[]} the added items, or {@code null} if adding was not
* possible.
*/
addChildren: function(items, _preserve) {
return this.insertChildren(this._children.length, items, _preserve);
},
/**
* Inserts the specified items as children of this item at the specified
* index in its {@link #children} list. You can use this function for
* groups, compound paths and layers.
*
* @param {Number} index
* @param {Item[]} items The items to be appended as children
* @return {Item[]} the inserted items, or {@code null} if inserted was not
* possible.
*/
insertChildren: function(index, items, _preserve, _type) {
// CompoundPath#insertChildren() requires _preserve and _type:
// _preserve avoids changing of the children's path orientation
// _type enforces the inserted type.
var children = this._children;
if (children && items && items.length > 0) {
// We need to clone items because it might be
// an Item#children array. Also, we're removing elements if they
// don't match _type. Use Array.prototype.slice becaus items can be
// an arguments object.
items = Array.prototype.slice.apply(items);
// Remove the items from their parents first, since they might be
// inserted into their own parents, affecting indices.
// Use the loop also to filter out wrong _type.
for (var i = items.length - 1; i >= 0; i--) {
var item = items[i];
if (_type && item._type !== _type)
items.splice(i, 1);
else
item._remove(true);
}
Base.splice(children, items, index, 0);
for (var i = 0, l = items.length; i < l; i++) {
var item = items[i];
item._parent = this;
item._setProject(this._project);
// Setting the name again makes sure all name lookup structures
// are kept in sync.
if (item._name)
item.setName(item._name);
}
this._changed(/*#=*/ Change.HIERARCHY);
} else {
items = null;
}
return items;
},
// Private helper for #insertAbove() / #insertBelow()
_insert: function(above, item, _preserve) {
if (!item._parent)
return null;
var index = item._index + (above ? 1 : 0);
// If the item is removed and inserted it again further above,
// the index needs to be adjusted accordingly.
if (item._parent === this._parent && index > this._index)
index--;
return item._parent.insertChild(index, this, _preserve);
},
/**
* Inserts this item above the specified item.
*
* @param {Item} item the item above which it should be inserted
* @return {Item} the inserted item, or {@code null} if inserting was not
* possible.
*/
insertAbove: function(item, _preserve) {
return this._insert(true, item, _preserve);
},
/**
* Inserts this item below the specified item.
*
* @param {Item} item the item above which it should be inserted
* @return {Item} the inserted item, or {@code null} if inserting was not
* possible.
*/
insertBelow: function(item, _preserve) {
return this._insert(false, item, _preserve);
},
/**
* Sends this item to the back of all other items within the same parent.
*/
sendToBack: function() {
return this._parent.insertChild(0, this);
},
/**
* Brings this item to the front of all other items within the same parent.
*/
bringToFront: function() {
return this._parent.addChild(this);
},
/**
* Inserts the specified item as a child of this item by appending it to
* the list of children and moving it above all other children. You can
* use this function for groups, compound paths and layers.
*
* @param {Item} item The item to be appended as a child
* @deprecated use {@link #addChild(item)} instead.
*/
appendTop: '#addChild',
/**
* Inserts the specified item as a child of this item by appending it to
* the list of children and moving it below all other children. You can
* use this function for groups, compound paths and layers.
*
* @param {Item} item The item to be appended as a child
* @deprecated use {@link #insertChild(index, item)} instead.
*/
appendBottom: function(item) {
return this.insertChild(0, item);
},
/**
* Moves this item above the specified item.
*
* @param {Item} item The item above which it should be moved
* @return {Boolean} {@true it was moved}
* @deprecated use {@link #insertAbove(item)} instead.
*/
moveAbove: '#insertAbove',
/**
* Moves the item below the specified item.
*
* @param {Item} item the item below which it should be moved
* @return {Boolean} {@true it was moved}
* @deprecated use {@link #insertBelow(item)} instead.
*/
moveBelow: '#insertBelow',
/**
* If this is a group, layer or compound-path with only one child-item,
* the child-item is moved outside and the parent is erased. Otherwise, the
* item itself is returned unmodified.
*
* @return {Item} the reduced item
*/
reduce: function() {
if (this._children && this._children.length === 1) {
var child = this._children[0];
child.insertAbove(this);
this.remove();
return child;
}
return this;
},
/**
* Removes the item from its parent's named children list.
*/
_removeNamed: function() {
var children = this._parent._children,
namedChildren = this._parent._namedChildren,
name = this._name,
namedArray = namedChildren[name],
index = namedArray ? namedArray.indexOf(this) : -1;
if (index == -1)
return;
// Remove the named reference
if (children[name] == this)
delete children[name];
// Remove this entry
namedArray.splice(index, 1);
// If there are any items left in the named array, set
// the last of them to be this.parent.children[this.name]
if (namedArray.length) {
children[name] = namedArray[namedArray.length - 1];
} else {
// Otherwise delete the empty array
delete namedChildren[name];
}
},
/**
* Removes the item from its parent's children list.
*/
_remove: function(notify) {
if (this._parent) {
if (this._name)
this._removeNamed();
if (this._index != null)
Base.splice(this._parent._children, null, this._index, 1);
// Notify parent of changed hierarchy
if (notify)
this._parent._changed(/*#=*/ Change.HIERARCHY);
this._parent = null;
return true;
}
return false;
},
/**
* Removes the item from the project. If the item has children, they are also
* removed.
*
* @return {Boolean} {@true the item was removed}
*/
remove: function() {
return this._remove(true);
},
/**
* Removes all of the item's {@link #children} (if any).
*
* @name Item#removeChildren
* @alias Item#clear
* @function
* @return {Item[]} an array containing the removed items
*/
/**
* Removes the children from the specified {@code from} index to the
* {@code to} index from the parent's {@link #children} array.
*
* @name Item#removeChildren
* @function
* @param {Number} from the beginning index, inclusive
* @param {Number} [to=children.length] the ending index, exclusive
* @return {Item[]} an array containing the removed items
*/
removeChildren: function(from, to) {
if (!this._children)
return null;
from = from || 0;
to = Base.pick(to, this._children.length);
// Use Base.splice(), wich adjusts #_index for the items above, and
// deletes it for the removed items. Calling #_remove() afterwards is
// fine, since it only calls Base.splice() if #_index is set.
var removed = Base.splice(this._children, null, from, to - from);
for (var i = removed.length - 1; i >= 0; i--)
removed[i]._remove(false);
if (removed.length > 0)
this._changed(/*#=*/ Change.HIERARCHY);
return removed;
},
clear: '#removeChildren',
/**
* Reverses the order of the item's children
*/
reverseChildren: function() {
if (this._children) {
this._children.reverse();
// Adjust inidces
for (var i = 0, l = this._children.length; i < l; i++)
this._children[i]._index = i;
this._changed(/*#=*/ Change.HIERARCHY);
}
},
// TODO: Item#isEditable is currently ignored in the documentation, as
// locking an item currently has no effect
/**
* {@grouptitle Tests}
* Checks whether the item is editable.
*
* @return {Boolean} {@true when neither the item, nor its parents are
* locked or hidden}
* @ignore
*/
isEditable: function() {
var item = this;
while (item) {
if (!item._visible || item._locked)
return false;
item = item._parent;
}
return true;
},
/**
* Checks whether the item is valid, i.e. it hasn't been removed.
*
* @return {Boolean} {@true the item is valid}
*/
// TODO: isValid / checkValid
/**
* Returns -1 if 'this' is above 'item', 1 if below, 0 if their order is not
* defined in such a way, e.g. if one is a descendant of the other.
*/
_getOrder: function(item) {
// Private method that produces a list of anchestors, starting with the
// root and ending with the actual element as the last entry.
function getList(item) {
var list = [];
do {
list.unshift(item);
} while (item = item._parent);
return list;
}
var list1 = getList(this),
list2 = getList(item);
for (var i = 0, l = Math.min(list1.length, list2.length); i < l; i++) {
if (list1[i] != list2[i]) {
// Found the position in the parents list where the two start
// to differ. Look at who's above who.
return list1[i]._index < list2[i]._index ? 1 : -1;
}
}
return 0;
},
/**
* {@grouptitle Hierarchy Tests}
*
* Checks if the item contains any children items.
*
* @return {Boolean} {@true it has one or more children}
*/
hasChildren: function() {
return this._children && this._children.length > 0;
},
/**
* Checks if this item is above the specified item in the stacking order
* of the project.
*
* @param {Item} item The item to check against
* @return {Boolean} {@true if it is above the specified item}
*/
isAbove: function(item) {
return this._getOrder(item) === -1;
},
/**
* Checks if the item is below the specified item in the stacking order of
* the project.
*
* @param {Item} item The item to check against
* @return {Boolean} {@true if it is below the specified item}
*/
isBelow: function(item) {
return this._getOrder(item) === 1;
},
/**
* Checks whether the specified item is the parent of the item.
*
* @param {Item} item The item to check against
* @return {Boolean} {@true if it is the parent of the item}
*/
isParent: function(item) {
return this._parent === item;
},
/**
* Checks whether the specified item is a child of the item.
*
* @param {Item} item The item to check against
* @return {Boolean} {@true it is a child of the item}
*/
isChild: function(item) {
return item && item._parent === this;
},
/**
* Checks if the item is contained within the specified item.
*
* @param {Item} item The item to check against
* @return {Boolean} {@true if it is inside the specified item}
*/
isDescendant: function(item) {
var parent = this;
while (parent = parent._parent) {
if (parent == item)
return true;
}
return false;
},
/**
* Checks if the item is an ancestor of the specified item.
*
* @param {Item} item the item to check against
* @return {Boolean} {@true if the item is an ancestor of the specified
* item}
*/
isAncestor: function(item) {
return item ? item.isDescendant(this) : false;
},
/**
* Checks whether the item is grouped with the specified item.
*
* @param {Item} item
* @return {Boolean} {@true if the items are grouped together}
*/
isGroupedWith: function(item) {
var parent = this._parent;
while (parent) {
// Find group parents. Check for parent._parent, since don't want
// top level layers, because they also inherit from Group
if (parent._parent
&& /^(group|layer|compound-path)$/.test(parent._type)
&& item.isDescendant(parent))
return true;
// Keep walking up otherwise
parent = parent._parent;
}
return false;
},
// Document all style properties which get injected into Item by Style:
/**
* {@grouptitle Stroke Style}
*
* The color of the stroke.
*
* @name Item#strokeColor
* @property
* @type Color
*
* @example {@paperscript}
* // Setting the stroke color of a path:
*
* // Create a circle shaped path at { x: 80, y: 50 }
* // with a radius of 35:
* var circle = new Path.Circle({
* center: [80, 50],
* radius: 35
* });
*
* // Set its stroke color to RGB red:
* circle.strokeColor = new Color(1, 0, 0);
*/
/**
* The width of the stroke.
*
* @name Item#strokeWidth
* @property
* @type Number
*
* @example {@paperscript}
* // Setting an item's stroke width:
*
* // Create a circle shaped path at { x: 80, y: 50 }
* // with a radius of 35:
* var circle = new Path.Circle({
* center: [80, 50],
* radius: 35,
* strokeColor: 'red'
* });
*
* // Set its stroke width to 10:
* circle.strokeWidth = 10;
*/
/**
* The shape to be used at the end of open {@link Path} items, when they
* have a stroke.
*
* @name Item#strokeCap
* @property
* @default 'butt'
* @type String('round', 'square', 'butt')
*
* @example {@paperscript height=200}
* // A look at the different stroke caps:
*
* var line = new Path({
* segments: [[80, 50], [420, 50]],
* strokeColor: 'black',
* strokeWidth: 20,
* selected: true
* });
*
* // Set the stroke cap of the line to be round:
* line.strokeCap = 'round';
*
* // Copy the path and set its stroke cap to be square:
* var line2 = line.clone();
* line2.position.y += 50;
* line2.strokeCap = 'square';
*
* // Make another copy and set its stroke cap to be butt:
* var line2 = line.clone();
* line2.position.y += 100;
* line2.strokeCap = 'butt';
*/
/**
* The shape to be used at the corners of paths when they have a stroke.
*
* @name Item#strokeJoin
* @property
* @default 'miter'
* @type String('miter', 'round', 'bevel')
*
*
* @example {@paperscript height=120}
* // A look at the different stroke joins:
* var path = new Path({
* segments: [[80, 100], [120, 40], [160, 100]],
* strokeColor: 'black',
* strokeWidth: 20,
* // Select the path, in order to see where the stroke is formed:
* selected: true
* });
*
* var path2 = path.clone();
* path2.position.x += path2.bounds.width * 1.5;
* path2.strokeJoin = 'round';
*
* var path3 = path2.clone();
* path3.position.x += path3.bounds.width * 1.5;
* path3.strokeJoin = 'bevel';
*/
/**
* The dash offset of the stroke.
*
* @name Item#dashOffset
* @property
* @default 0
* @type Number
*/
/**
* Specifies an array containing the dash and gap lengths of the stroke.
*
* @example {@paperscript}
* var path = new Path.Circle({
* center: [80, 50],
* radius: 40,
* strokeWidth: 2,
* strokeColor: 'black'
* });
*
* // Set the dashed stroke to [10pt dash, 4pt gap]:
* path.dashArray = [10, 4];
*
* @name Item#dashArray
* @property
* @default []
* @type Array
*/
/**
* The miter limit of the stroke.
* When two line segments meet at a sharp angle and miter joins have been
* specified for {@link Item#strokeJoin}, it is possible for the miter to
* extend far beyond the {@link Item#strokeWidth} of the path. The
* miterLimit imposes a limit on the ratio of the miter length to the
* {@link Item#strokeWidth}.
*
* @property
* @name Item#miterLimit
* @default 10
* @type Number
*/
/**
* The winding-rule with which the shape gets filled. Please note that only
* modern browsers support winding-rules other than {@code 'nonzero'}.
*
* @property
* @name Item#windingRule
* @default 'nonzero'
* @type String('nonzero', 'evenodd')
*/
/**
* {@grouptitle Fill Style}
*
* The fill color of the item.
*
* @name Item#fillColor
* @property
* @type Color
*
* @example {@paperscript}
* // Setting the fill color of a path to red:
*
* // Create a circle shaped path at { x: 80, y: 50 }
* // with a radius of 35:
* var circle = new Path.Circle({
* center: [80, 50],
* radius: 35
* });
*
* // Set the fill color of the circle to RGB red:
* circle.fillColor = new Color(1, 0, 0);
*/
// TODO: Find a better name than selectedColor. It should also be used for
// guides, etc.
/**
* {@grouptitle Selection Style}
*
* The color the item is highlighted with when selected. If the item does
* not specify its own color, the color defined by its layer is used instead.
*
* @name Item#selectedColor
* @property
* @type Color
*/
// DOCS: Document the different arguments that this function can receive.
/**
* {@grouptitle Transform Functions}
*
* Scales the item by the given value from its center point, or optionally
* from a supplied point.
*
* @name Item#scale
* @function
* @param {Number} scale the scale factor
* @param {Point} [center={@link Item#position}]
*
* @example {@paperscript}
* // Scaling an item from its center point:
*
* // Create a circle shaped path at { x: 80, y: 50 }
* // with a radius of 20:
* var circle = new Path.Circle({
* center: [80, 50],
* radius: 20,
* fillColor: 'red'
* });
*
* // Scale the path by 150% from its center point
* circle.scale(1.5);
*
* @example {@paperscript}
* // Scaling an item from a specific point:
*
* // Create a circle shaped path at { x: 80, y: 50 }
* // with a radius of 20:
* var circle = new Path.Circle({
* center: [80, 50],
* radius: 20,
* fillColor: 'red'
* });
*
* // Scale the path 150% from its bottom left corner
* circle.scale(1.5, circle.bounds.bottomLeft);
*/
/**
* Scales the item by the given values from its center point, or optionally
* from a supplied point.
*
* @name Item#scale
* @function
* @param {Number} hor the horizontal scale factor
* @param {Number} ver the vertical scale factor
* @param {Point} [center={@link Item#position}]
*
* @example {@paperscript}
* // Scaling an item horizontally by 300%:
*
* // Create a circle shaped path at { x: 100, y: 50 }
* // with a radius of 20:
* var circle = new Path.Circle({
* center: [100, 50],
* radius: 20,
* fillColor: 'red'
* });
*
* // Scale the path horizontally by 300%
* circle.scale(3, 1);
*/
scale: function(hor, ver /* | scale */, center) {
// See Matrix#scale for explanation of this:
if (arguments.length < 2 || typeof ver === 'object') {
center = ver;
ver = hor;
}
return this.transform(new Matrix().scale(hor, ver,
center || this.getPosition(true)));
},
/**
* Translates (moves) the item by the given offset point.
*
* @param {Point} delta the offset to translate the item by
*/
translate: function(/* delta */) {
var mx = new Matrix();
return this.transform(mx.translate.apply(mx, arguments));
},
/**
* Rotates the item by a given angle around the given point.
*
* Angles are oriented clockwise and measured in degrees.
*
* @param {Number} angle the rotation angle
* @param {Point} [center={@link Item#position}]
* @see Matrix#rotate
*
* @example {@paperscript}
* // Rotating an item:
*
* // Create a rectangle shaped path with its top left
* // point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
* var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
* path.fillColor = 'black';
*
* // Rotate the path by 30 degrees:
* path.rotate(30);
*
* @example {@paperscript height=200}
* // Rotating an item around a specific point:
*
* // Create a rectangle shaped path with its top left
* // point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
* var topLeft = new Point(175, 50);
* var size = new Size(100, 100);
* var path = new Path.Rectangle(topLeft, size);
* path.fillColor = 'black';
*
* // Draw a circle shaped path in the center of the view,
* // to show the rotation point:
* var circle = new Path.Circle({
* center: view.center,
* radius: 5,
* fillColor: 'white'
* });
*
* // Each frame rotate the path 3 degrees around the center point
* // of the view:
* function onFrame(event) {
* path.rotate(3, view.center);
* }
*/
rotate: function(angle, center) {
return this.transform(new Matrix().rotate(angle,
center || this.getPosition(true)));
},
// TODO: Add test for item shearing, as it might be behaving oddly.
/**
* Shears the item by the given value from its center point, or optionally
* by a supplied point.
*
* @name Item#shear
* @function
* @param {Point} point
* @param {Point} [center={@link Item#position}]
* @see Matrix#shear
*/
/**
* Shears the item by the given values from its center point, or optionally
* by a supplied point.
*
* @name Item#shear
* @function
* @param {Number} hor the horizontal shear factor.
* @param {Number} ver the vertical shear factor.
* @param {Point} [center={@link Item#position}]
* @see Matrix#shear
*/
shear: function(hor, ver, center) {
// See Matrix#scale for explanation of this:
if (arguments.length < 2 || typeof ver === 'object') {
center = ver;
ver = hor;
}
return this.transform(new Matrix().shear(hor, ver,
center || this.getPosition(true)));
},
/**
* Transform the item.
*
* @param {Matrix} matrix the matrix by which the item shall be transformed.
*/
// Remove this for now:
// @param {String[]} flags Array of any of the following: 'objects',
// 'children', 'fill-gradients', 'fill-patterns', 'stroke-patterns',
// 'lines'. Default: ['objects', 'children']
transform: function(matrix /*, applyMatrix */) {
// Calling _changed will clear _bounds and _position, but depending
// on matrix we can calculate and set them again.
var bounds = this._bounds,
position = this._position;
// Simply preconcatenate the internal matrix with the passed one:
this._matrix.preConcatenate(matrix);
// Call applyMatrix if we need to directly apply the accumulated
// transformations to the item's content.
if (this._transformContent || arguments[1])
this.applyMatrix(true);
// We always need to call _changed since we're caching bounds on all
// items, including Group.
this._changed(/*#=*/ Change.GEOMETRY);
// Detect matrices that contain only translations and scaling
// and transform the cached _bounds and _position without having to
// fully recalculate each time.
if (bounds && matrix.getRotation() % 90 === 0) {
// Transform the old bound by looping through all the cached bounds
// in _bounds and transform each.
for (var key in bounds) {
var rect = bounds[key];
matrix._transformBounds(rect, rect);
}
// If we have cached bounds, update _position again as its
// center. We need to take into account _boundsGetter here too, in
// case another getter is assigned to it, e.g. 'getStrokeBounds'.
var getter = this._boundsGetter,
rect = bounds[getter && getter.getBounds || getter || 'getBounds'];
if (rect)
this._position = rect.getCenter(true);
this._bounds = bounds;
} else if (position) {
// Transform position as well.
this._position = matrix._transformPoint(position, position);
}
// Allow chaining here, since transform() is related to Matrix functions
return this;
},
_applyMatrix: function(matrix, applyMatrix) {
var children = this._children;
if (children && children.length > 0) {
for (var i = 0, l = children.length; i < l; i++)
children[i].transform(matrix, applyMatrix);
return true;
}
},
applyMatrix: function(_dontNotify) {
// Call #_applyMatrix() with the internal _matrix and pass true for
// applyMatrix. Application is not possible on Raster, PointText,
// PlacedSymbol, since the matrix is where the actual location /
// transformation state is stored.
// Pass on the transformation to the content, and apply it there too,
// by passing true for the 2nd hidden parameter.
var matrix = this._matrix;
if (this._applyMatrix(matrix, true)) {
// When the matrix could be applied, we also need to transform
// color styles with matrices (only gradients so far):
var style = this._style,
// pass true for dontMerge so we don't recursively transform
// styles on groups' children.
fillColor = style.getFillColor(true),
strokeColor = style.getStrokeColor(true);
if (fillColor)
fillColor.transform(matrix);
if (strokeColor)
strokeColor.transform(matrix);
// Reset the internal matrix to the identity transformation if it
// was possible to apply it.
matrix.reset();
}
if (!_dontNotify)
this._changed(/*#=*/ Change.GEOMETRY);
},
/**
* Transform the item so that its {@link #bounds} fit within the specified
* rectangle, without changing its aspect ratio.
*
* @param {Rectangle} rectangle
* @param {Boolean} [fill=false]
*
* @example {@paperscript height=100}
* // Fitting an item to the bounding rectangle of another item's bounding
* // rectangle:
*
* // Create a rectangle shaped path with its top left corner
* // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
* var path = new Path.Rectangle({
* point: [80, 25],
* size: [75, 50],
* fillColor: 'black'
* });
*
* // Create a circle shaped path with its center at {x: 80, y: 50}
* // and a radius of 30.
* var circlePath = new Path.Circle({
* center: [80, 50],
* radius: 30,
* fillColor: 'red'
* });
*
* // Fit the circlePath to the bounding rectangle of
* // the rectangular path:
* circlePath.fitBounds(path.bounds);
*
* @example {@paperscript height=100}
* // Fitting an item to the bounding rectangle of another item's bounding
* // rectangle with the fill parameter set to true:
*
* // Create a rectangle shaped path with its top left corner
* // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
* var path = new Path.Rectangle({
* point: [80, 25],
* size: [75, 50],
* fillColor: 'black'
* });
*
* // Create a circle shaped path with its center at {x: 80, y: 50}
* // and a radius of 30.
* var circlePath = new Path.Circle({
* center: [80, 50],
* radius: 30,
* fillColor: 'red'
* });
*
* // Fit the circlePath to the bounding rectangle of
* // the rectangular path:
* circlePath.fitBounds(path.bounds, true);
*
* @example {@paperscript height=200}
* // Fitting an item to the bounding rectangle of the view
* var path = new Path.Circle({
* center: [80, 50],
* radius: 30,
* fillColor: 'red'
* });
*
* // Fit the path to the bounding rectangle of the view:
* path.fitBounds(view.bounds);
*/
fitBounds: function(rectangle, fill) {
// TODO: Think about passing options with various ways of defining
// fitting.
rectangle = Rectangle.read(arguments);
var bounds = this.getBounds(),
itemRatio = bounds.height / bounds.width,
rectRatio = rectangle.height / rectangle.width,
scale = (fill ? itemRatio > rectRatio : itemRatio < rectRatio)
? rectangle.width / bounds.width
: rectangle.height / bounds.height,
newBounds = new Rectangle(new Point(),
new Size(bounds.width * scale, bounds.height * scale));
newBounds.setCenter(rectangle.getCenter());
this.setBounds(newBounds);
},
/**
* {@grouptitle Event Handlers}
* Item level handler function to be called on each frame of an animation.
* The function receives an event object which contains information about
* the frame event:
*
* <b>{@code event.count}</b>: the number of times the frame event was
* fired.
* <b>{@code event.time}</b>: the total amount of time passed since the
* first frame event in seconds.
* <b>{@code event.delta}</b>: the time passed in seconds since the last
* frame event.
*
* @see View#onFrame
* @example {@paperscript}
* // Creating an animation:
*
* // Create a rectangle shaped path with its top left point at:
* // {x: 50, y: 25} and a size of {width: 50, height: 50}
* var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
* path.fillColor = 'black';
*
* path.onFrame = function(event) {
* // Every frame, rotate the path by 3 degrees:
* this.rotate(3);
* }
*
* @name Item#onFrame
* @property
* @type Function
*/
/**
* The function to be called when the mouse button is pushed down on the
* item. The function receives a {@link MouseEvent} object which contains
* information about the mouse event.
*
* @name Item#onMouseDown
* @property
* @type Function
*
* @example {@paperscript}
* // Press the mouse button down on the circle shaped path, to make it red:
*
* // Create a circle shaped path at the center of the view:
* var path = new Path.Circle({
* center: view.center,
* radius: 25,
* fillColor: 'black'
* });
*
* // When the mouse is pressed on the item,
* // set its fill color to red:
* path.onMouseDown = function(event) {
* this.fillColor = 'red';
* }
*
* @example {@paperscript}
* // Press the mouse on the circle shaped paths to remove them:
*
* // Loop 30 times:
* for (var i = 0; i < 30; i++) {
* // Create a circle shaped path at a random position
* // in the view:
* var path = new Path.Circle({
* center: Point.random() * view.size,
* radius: 25,
* fillColor: 'black',
* strokeColor: 'white'
* });
*
* // When the mouse is pressed on the item, remove it:
* path.onMouseDown = function(event) {
* this.remove();
* }
* }
*/
/**
* The function to be called when the mouse button is released over the item.
* The function receives a {@link MouseEvent} object which contains
* information about the mouse event.
*
* @name Item#onMouseUp
* @property
* @type Function
*
* @example {@paperscript}
* // Release the mouse button over the circle shaped path, to make it red:
*
* // Create a circle shaped path at the center of the view:
* var path = new Path.Circle({
* center: view.center,
* radius: 25,
* fillColor: 'black'
* });
*
* // When the mouse is released over the item,
* // set its fill color to red:
* path.onMouseUp = function(event) {
* this.fillColor = 'red';
* }
*/
/**
* The function to be called when the mouse clicks on the item. The function
* receives a {@link MouseEvent} object which contains information about the
* mouse event.
*
* @name Item#onClick
* @property
* @type Function
*
* @example {@paperscript}
* // Click on the circle shaped path, to make it red:
*
* // Create a circle shaped path at the center of the view:
* var path = new Path.Circle({
* center: view.center,
* radius: 25,
* fillColor: 'black'
* });
*
* // When the mouse is clicked on the item,
* // set its fill color to red:
* path.onClick = function(event) {
* this.fillColor = 'red';
* }
*
* @example {@paperscript}
* // Click on the circle shaped paths to remove them:
*
* // Loop 30 times:
* for (var i = 0; i < 30; i++) {
* // Create a circle shaped path at a random position
* // in the view:
* var path = new Path.Circle({
* center: Point.random() * view.size,
* radius: 25,
* fillColor: 'black',
* strokeColor: 'white'
* });
*
* // When the mouse clicks on the item, remove it:
* path.onClick = function(event) {
* this.remove();
* }
* }
*/
/**
* The function to be called when the mouse double clicks on the item. The
* function receives a {@link MouseEvent} object which contains information
* about the mouse event.
*
* @name Item#onDoubleClick
* @property
* @type Function
*
* @example {@paperscript}
* // Double click on the circle shaped path, to make it red:
*
* // Create a circle shaped path at the center of the view:
* var path = new Path.Circle({
* center: view.center,
* radius: 25,
* fillColor: 'black'
* });
*
* // When the mouse is double clicked on the item,
* // set its fill color to red:
* path.onDoubleClick = function(event) {
* this.fillColor = 'red';
* }
*
* @example {@paperscript}
* // Double click on the circle shaped paths to remove them:
*
* // Loop 30 times:
* for (var i = 0; i < 30; i++) {
* // Create a circle shaped path at a random position
* // in the view:
* var path = new Path.Circle({
* center: Point.random() * view.size,
* radius: 25,
* fillColor: 'black',
* strokeColor: 'white'
* });
*
* // When the mouse is double clicked on the item, remove it:
* path.onDoubleClick = function(event) {
* this.remove();
* }
* }
*/
/**
* The function to be called repeatedly when the mouse moves on top of the
* item. The function receives a {@link MouseEvent} object which contains
* information about the mouse event.
*
* @name Item#onMouseMove
* @property
* @type Function
*
* @example {@paperscript}
* // Move over the circle shaped path, to change its opacity:
*
* // Create a circle shaped path at the center of the view:
* var path = new Path.Circle({
* center: view.center,
* radius: 25,
* fillColor: 'black'
* });
*
* // When the mouse moves on top of the item, set its opacity
* // to a random value between 0 and 1:
* path.onMouseMove = function(event) {
* this.opacity = Math.random();
* }
*/
/**
* The function to be called when the mouse moves over the item. This
* function will only be called again, once the mouse moved outside of the
* item first. The function receives a {@link MouseEvent} object which
* contains information about the mouse event.
*
* @name Item#onMouseEnter
* @property
* @type Function
*
* @example {@paperscript}
* // When you move the mouse over the item, its fill color is set to red.
* // When you move the mouse outside again, its fill color is set back
* // to black.
*
* // Create a circle shaped path at the center of the view:
* var path = new Path.Circle({
* center: view.center,
* radius: 25,
* fillColor: 'black'
* });
*
* // When the mouse enters the item, set its fill color to red:
* path.onMouseEnter = function(event) {
* this.fillColor = 'red';
* }
*
* // When the mouse leaves the item, set its fill color to black:
* path.onMouseLeave = function(event) {
* this.fillColor = 'black';
* }
* @example {@paperscript}
* // When you click the mouse, you create new circle shaped items. When you
* // move the mouse over the item, its fill color is set to red. When you
* // move the mouse outside again, its fill color is set back
* // to black.
*
* function enter(event) {
* this.fillColor = 'red';
* }
*
* function leave(event) {
* this.fillColor = 'black';
* }
*
* // When the mouse is pressed:
* function onMouseDown(event) {
* // Create a circle shaped path at the position of the mouse:
* var path = new Path.Circle(event.point, 25);
* path.fillColor = 'black';
*
* // When the mouse enters the item, set its fill color to red:
* path.onMouseEnter = enter;
*
* // When the mouse leaves the item, set its fill color to black:
* path.onMouseLeave = leave;
* }
*/
/**
* The function to be called when the mouse moves out of the item.
* The function receives a {@link MouseEvent} object which contains
* information about the mouse event.
*
* @name Item#onMouseLeave
* @property
* @type Function
*
* @example {@paperscript}
* // Move the mouse over the circle shaped path and then move it out
* // of it again to set its fill color to red:
*
* // Create a circle shaped path at the center of the view:
* var path = new Path.Circle({
* center: view.center,
* radius: 25,
* fillColor: 'black'
* });
*
* // When the mouse leaves the item, set its fill color to red:
* path.onMouseLeave = function(event) {
* this.fillColor = 'red';
* }
*/
/**
* {@grouptitle Event Handling}
*
* Attaches an event handler to the item.
*
* @name Item#attach
* @alias Item#on
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'click',
* 'doubleclick', 'mousemove', 'mouseenter', 'mouseleave')} type the event
* type
* @param {Function} function The function to be called when the event
* occurs
*
* @example {@paperscript}
* // Change the fill color of the path to red when the mouse enters its
* // shape and back to black again, when it leaves its shape.
*
* // Create a circle shaped path at the center of the view:
* var path = new Path.Circle({
* center: view.center,
* radius: 25,
* fillColor: 'black'
* });
*
* // When the mouse enters the item, set its fill color to red:
* path.on('mouseenter', function() {
* this.fillColor = 'red';
* });
*
* // When the mouse leaves the item, set its fill color to black:
* path.on('mouseleave', function() {
* this.fillColor = 'black';
* });
*/
/**
* Attaches one or more event handlers to the item.
*
* @name Item#attach
* @alias Item#on
* @function
* @param {Object} object an object literal containing one or more of the
* following properties: {@code mousedown, mouseup, mousedrag, click,
* doubleclick, mousemove, mouseenter, mouseleave}.
*
* @example {@paperscript}
* // Change the fill color of the path to red when the mouse enters its
* // shape and back to black again, when it leaves its shape.
*
* // Create a circle shaped path at the center of the view:
* var path = new Path.Circle({
* center: view.center,
* radius: 25
* });
* path.fillColor = 'black';
*
* // When the mouse enters the item, set its fill color to red:
* path.on({
* mouseenter: function(event) {
* this.fillColor = 'red';
* },
* mouseleave: function(event) {
* this.fillColor = 'black';
* }
* });
* @example {@paperscript}
* // When you click the mouse, you create new circle shaped items. When you
* // move the mouse over the item, its fill color is set to red. When you
* // move the mouse outside again, its fill color is set black.
*
* var pathHandlers = {
* mouseenter: function(event) {
* this.fillColor = 'red';
* },
* mouseleave: function(event) {
* this.fillColor = 'black';
* }
* }
*
* // When the mouse is pressed:
* function onMouseDown(event) {
* // Create a circle shaped path at the position of the mouse:
* var path = new Path.Circle({
* center: event.point,
* radius: 25,
* fillColor: 'black'
* });
*
* // Attach the handers inside the object literal to the path:
* path.on(pathHandlers);
* }
*/
/**
* Detach an event handler from the item.
*
* @name Item#detach
* @alias Item#off
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'click',
* 'doubleclick', 'mousemove', 'mouseenter', 'mouseleave')} type the event
* type
* @param {Function} function The function to be detached
*/
/**
* Detach one or more event handlers to the item.
*
* @name Item#detach
* @alias Item#off
* @function
* @param {Object} object an object literal containing one or more of the
* following properties: {@code mousedown, mouseup, mousedrag, click,
* doubleclick, mousemove, mouseenter, mouseleave}
*/
/**
* Fire an event on the item.
*
* @name Item#fire
* @alias Item#trigger
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'click',
* 'doubleclick', 'mousemove', 'mouseenter', 'mouseleave')} type the event
* type
* @param {Object} event an object literal containing properties describing
* the event.
*/
/**
* Check if the item has one or more event handlers of the specified type.
*
* @name Item#responds
* @function
* @param {String('mousedown', 'mouseup', 'mousedrag', 'click',
* 'doubleclick', 'mousemove', 'mouseenter', 'mouseleave')} type the event
* type
* @return {Boolean} {@true if the item has one or more event handlers of
* the specified type}
*/
/**
* Private method that sets Path related styles on the canvas context.
* Not defined in Path as it is required by other classes too,
* e.g. PointText.
*/
_setStyles: function(ctx) {
// We can access internal properties since we're only using this on
// items without children, where styles would be merged.
var style = this._style,
fillColor = style.getFillColor(),
strokeColor = style.getStrokeColor(),
shadowColor = style.getShadowColor();
if (fillColor)
ctx.fillStyle = fillColor.toCanvasStyle(ctx);
if (strokeColor) {
var strokeWidth = style.getStrokeWidth();
if (strokeWidth > 0) {
ctx.strokeStyle = strokeColor.toCanvasStyle(ctx);
ctx.lineWidth = strokeWidth;
var strokeJoin = style.getStrokeJoin(),
strokeCap = style.getStrokeCap(),
miterLimit = style.getMiterLimit();
if (strokeJoin)
ctx.lineJoin = strokeJoin;
if (strokeCap)
ctx.lineCap = strokeCap;
if (miterLimit)
ctx.miterLimit = miterLimit;
if (paper.support.nativeDash) {
var dashArray = style.getDashArray(),
dashOffset = style.getDashOffset();
if (dashArray && dashArray.length) {
if ('setLineDash' in ctx) {
ctx.setLineDash(dashArray);
ctx.lineDashOffset = dashOffset;
} else {
ctx.mozDash = dashArray;
ctx.mozDashOffset = dashOffset;
}
}
}
}
}
if (shadowColor) {
var shadowBlur = style.getShadowBlur();
if (shadowBlur > 0) {
ctx.shadowColor = shadowColor.toCanvasStyle(ctx);
ctx.shadowBlur = shadowBlur;
var offset = this.getShadowOffset();
ctx.shadowOffsetX = offset.x;
ctx.shadowOffsetY = offset.y;
}
}
},
// TODO: Implement View into the drawing.
// TODO: Optimize temporary canvas drawing to ignore parts that are
// outside of the visible view.
draw: function(ctx, param) {
if (!this._visible || this._opacity === 0)
return;
// Each time the project gets drawn, it's _drawCount is increased.
// Keep the _drawCount of drawn items in sync, so we have an easy
// way to know for which selected items we need to draw selection info.
this._drawCount = this._project._drawCount;
// Keep calculating the current global matrix, by keeping a history
// and pushing / popping as we go along.
var trackTransforms = param.trackTransforms,
transforms = param.transforms,
parentMatrix = transforms[transforms.length - 1],
globalMatrix = parentMatrix.clone().concatenate(this._matrix);
// Only keep track of transformation if told so. See Project#draw()
if (trackTransforms)
transforms.push(this._globalMatrix = globalMatrix);
// If the item has a blendMode or is defining an opacity, draw it on
// a temporary canvas first and composite the canvas afterwards.
// Paths with an opacity < 1 that both define a fillColor
// and strokeColor also need to be drawn on a temporary canvas
// first, since otherwise their stroke is drawn half transparent
// over their fill.
// Exclude Raster items since they never draw a stroke and handle
// opacity by themselves (they also don't call _setStyles)
var blendMode = this._blendMode,
opacity = this._opacity,
normalBlend = blendMode === 'normal',
nativeBlend = BlendMode.nativeModes[blendMode],
// Determine if we can draw directly, or if we need to draw into a
// separate canvas and then composite onto the main canvas.
direct = normalBlend && opacity === 1
// If native blending is possible, see if the item allows it
|| (nativeBlend || normalBlend && opacity < 1)
&& this._canComposite(),
mainCtx, itemOffset, prevOffset;
if (!direct) {
// Apply the paren't global matrix to the calculation of correct
// bounds.
var bounds = this.getStrokeBounds(parentMatrix);
if (!bounds.width || !bounds.height)
return;
// Store previous offset and save the main context, so we can
// draw onto it later.
prevOffset = param.offset;
// Floor the offset and ceil the size, so we don't cut off any
// antialiased pixels when drawing onto the temporary canvas.
itemOffset = param.offset = bounds.getTopLeft().floor();
// Set ctx to the context of the temporary canvas, so we draw onto
// it, instead of the mainCtx.
mainCtx = ctx;
ctx = CanvasProvider.getContext(
bounds.getSize().ceil().add(new Size(1, 1)), param.ratio);
}
ctx.save();
// If drawing directly, handle opacity and native blending now,
// otherwise we will do it later when the temporary canvas is composited.
if (direct) {
ctx.globalAlpha = opacity;
if (nativeBlend)
ctx.globalCompositeOperation = blendMode;
} else {
// Translate the context so the topLeft of the item is at (0, 0)
// on the temporary canvas.
ctx.translate(-itemOffset.x, -itemOffset.y);
}
// Apply globalMatrix when drawing into temporary canvas.
(direct ? this._matrix : globalMatrix).applyToContext(ctx);
// If we're drawing into a separate canvas and a clipItem is defined for
// the current rendering loop, we need to draw the clip item again.
if (!direct && param.clipItem)
param.clipItem.draw(ctx, param.extend({ clip: true }));
this._draw(ctx, param);
ctx.restore();
if (trackTransforms)
transforms.pop();
if (param.clip)
ctx.clip();
// If a temporary canvas was created, composite it onto the main canvas:
if (!direct) {
// Use BlendMode.process even for processing normal blendMode with
// opacity.
BlendMode.process(blendMode, ctx, mainCtx, opacity,
// Calculate the pixel offset of the temporary canvas to the
// main canvas. We also need to factor in the pixel ratio.
itemOffset.subtract(prevOffset).multiply(param.ratio));
// Return the temporary context, so it can be reused
CanvasProvider.release(ctx);
// Restore previous offset.
param.offset = prevOffset;
}
},
_canComposite: function() {
return false;
}
}, Base.each(['down', 'drag', 'up', 'move'], function(name) {
this['removeOn' + Base.capitalize(name)] = function() {
var hash = {};
hash[name] = true;
return this.removeOn(hash);
};
}, /** @lends Item# */{
/**
* {@grouptitle Remove On Event}
*
* Removes the item when the events specified in the passed object literal
* occur.
* The object literal can contain the following values:
* Remove the item when the next {@link Tool#onMouseMove} event is
* fired: {@code object.move = true}
*
* Remove the item when the next {@link Tool#onMouseDrag} event is
* fired: {@code object.drag = true}
*
* Remove the item when the next {@link Tool#onMouseDown} event is
* fired: {@code object.down = true}
*
* Remove the item when the next {@link Tool#onMouseUp} event is
* fired: {@code object.up = true}
*
* @name Item#removeOn
* @function
* @param {Object} object
*
* @example {@paperscript height=200}
* // Click and drag below:
* function onMouseDrag(event) {
* // Create a circle shaped path at the mouse position,
* // with a radius of 10:
* var path = new Path.Circle({
* center: event.point,
* radius: 10,
* fillColor: 'black'
* });
*
* // Remove the path on the next onMouseDrag or onMouseDown event:
* path.removeOn({
* drag: true,
* down: true
* });
* }
*/
/**
* Removes the item when the next {@link Tool#onMouseMove} event is fired.
*
* @name Item#removeOnMove
* @function
*
* @example {@paperscript height=200}
* // Move your mouse below:
* function onMouseMove(event) {
* // Create a circle shaped path at the mouse position,
* // with a radius of 10:
* var path = new Path.Circle({
* center: event.point,
* radius: 10,
* fillColor: 'black'
* });
*
* // On the next move event, automatically remove the path:
* path.removeOnMove();
* }
*/
/**
* Removes the item when the next {@link Tool#onMouseDown} event is fired.
*
* @name Item#removeOnDown
* @function
*
* @example {@paperscript height=200}
* // Click a few times below:
* function onMouseDown(event) {
* // Create a circle shaped path at the mouse position,
* // with a radius of 10:
* var path = new Path.Circle({
* center: event.point,
* radius: 10,
* fillColor: 'black'
* });
*
* // Remove the path, next time the mouse is pressed:
* path.removeOnDown();
* }
*/
/**
* Removes the item when the next {@link Tool#onMouseDrag} event is fired.
*
* @name Item#removeOnDrag
* @function
*
* @example {@paperscript height=200}
* // Click and drag below:
* function onMouseDrag(event) {
* // Create a circle shaped path at the mouse position,
* // with a radius of 10:
* var path = new Path.Circle({
* center: event.point,
* radius: 10,
* fillColor: 'black'
* });
*
* // On the next drag event, automatically remove the path:
* path.removeOnDrag();
* }
*/
/**
* Removes the item when the next {@link Tool#onMouseUp} event is fired.
*
* @name Item#removeOnUp
* @function
*
* @example {@paperscript height=200}
* // Click a few times below:
* function onMouseDown(event) {
* // Create a circle shaped path at the mouse position,
* // with a radius of 10:
* var path = new Path.Circle({
* center: event.point,
* radius: 10,
* fillColor: 'black'
* });
*
* // Remove the path, when the mouse is released:
* path.removeOnUp();
* }
*/
// TODO: implement Item#removeOnFrame
removeOn: function(obj) {
for (var name in obj) {
if (obj[name]) {
var key = 'mouse' + name,
project = this._project,
sets = project._removeSets = project._removeSets || {};
sets[key] = sets[key] || {};
sets[key][this._id] = this;
}
}
return this;
}
}));
|
Mitali-Sodhi/CodeLingo
|
Dataset/javascript/Item.js
|
JavaScript
|
mit
| 101,186
|
projetointegrador
=================
Este é o projeto integrador do 3º semestre de BSI
|
mentalizador/projetointegrador
|
README.md
|
Markdown
|
mit
| 89
|
Should you wish to refer to this repository or any of its contents, please cite the url https://github.com/ryanmccrickerd/extended_rbergomi.
|
ryanmccrickerd/extended_rbergomi
|
CITATION.md
|
Markdown
|
mit
| 141
|
/*!
* CanJS - 2.2.5
* http://canjs.com/
* Copyright (c) 2015 Bitovi
* Wed, 22 Apr 2015 15:03:29 GMT
* Licensed MIT
*/
/*can@2.2.5#control/route/route*/
steal('can/util', 'can/route', 'can/control', function (can) {
// ## control/route.js
// _Controller route integration._
can.Control.processors.route = function (el, event, selector, funcName, controller) {
selector = selector || "";
if (!can.route.routes[selector]) {
if (selector[0] === '/') {
selector = selector.substring(1);
}
can.route(selector);
}
var batchNum,
check = function (ev, attr, how) {
if (can.route.attr('route') === (selector) &&
(ev.batchNum === undefined || ev.batchNum !== batchNum)) {
batchNum = ev.batchNum;
var d = can.route.attr();
delete d.route;
if (can.isFunction(controller[funcName])) {
controller[funcName](d);
} else {
controller[controller[funcName]](d);
}
}
};
can.route.bind('change', check);
return function () {
can.route.unbind('change', check);
};
};
return can;
});
|
tka/goyangi
|
frontend/canjs/static/bower_components/canjs/steal/can/control/route/route.js
|
JavaScript
|
mit
| 1,070
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_92) on Wed Mar 01 10:26:34 ICT 2017 -->
<title>Triple</title>
<meta name="date" content="2017-03-01">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Triple";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Triple.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-files/index-1.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../com/history/BoardHistory.html" title="class in com.model.history"><span class="typeNameLink">Prev Class</span></a></li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../index.html?com/history/Triple.html" target="_top">Frames</a></li>
<li><a href="Triple.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field.summary">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.model.history</div>
<h2 title="Class Triple" class="title">Class Triple</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>com.model.history.Triple</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">Triple</span>
extends java.lang.Object</pre>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>Sat 25/Feb/2017 - 2:31 AM</dd>
<dt><span class="simpleTagLabel">Version:</span></dt>
<dd>1.0</dd>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd>kamontat</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private <a href="../../com/board/Board.html" title="class in com.model.board">Board</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../com/history/Triple.html#board">board</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private <a href="../../com/player/Player.html" title="class in com.model.player">Player</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../com/history/Triple.html#player">player</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private <a href="../../com/player/Location.html" title="class in com.model.player">Location</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../com/history/Triple.html#position">position</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private java.time.LocalDateTime</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../com/history/Triple.html#time">time</a></span></code> </td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../com/history/Triple.html#Triple-com.board.Board-com.player.Player-com.player.Location-">Triple</a></span>(<a href="../../com/board/Board.html" title="class in com.model.board">Board</a> board,
<a href="../../com/player/Player.html" title="class in com.model.player">Player</a> player,
<a href="../../com/player/Location.html" title="class in com.model.player">Location</a> position)</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code><a href="../../com/board/Board.html" title="class in com.model.board">Board</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../com/history/Triple.html#getBoard--">getBoard</a></span>()</code> </td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code><a href="../../com/player/Player.html" title="class in com.model.player">Player</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../com/history/Triple.html#getPlayer--">getPlayer</a></span>()</code> </td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="../../com/player/Location.html" title="class in com.model.player">Location</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../com/history/Triple.html#getPosition--">getPosition</a></span>()</code> </td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>java.time.LocalDateTime</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../com/history/Triple.html#getTime--">getTime</a></span>()</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="board">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>board</h4>
<pre>private <a href="../../com/board/Board.html" title="class in com.model.board">Board</a> board</pre>
</li>
</ul>
<a name="player">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>player</h4>
<pre>private <a href="../../com/player/Player.html" title="class in com.model.player">Player</a> player</pre>
</li>
</ul>
<a name="time">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>time</h4>
<pre>private java.time.LocalDateTime time</pre>
</li>
</ul>
<a name="position">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>position</h4>
<pre>private <a href="../../com/player/Location.html" title="class in com.model.player">Location</a> position</pre>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="Triple-com.board.Board-com.player.Player-com.player.Location-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>Triple</h4>
<pre>Triple(<a href="../../com/board/Board.html" title="class in com.model.board">Board</a> board,
<a href="../../com/player/Player.html" title="class in com.model.player">Player</a> player,
<a href="../../com/player/Location.html" title="class in com.model.player">Location</a> position)</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getBoard--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBoard</h4>
<pre>public <a href="../../com/board/Board.html" title="class in com.model.board">Board</a> getBoard()</pre>
</li>
</ul>
<a name="getPlayer--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPlayer</h4>
<pre>public <a href="../../com/player/Player.html" title="class in com.model.player">Player</a> getPlayer()</pre>
</li>
</ul>
<a name="getTime--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTime</h4>
<pre>public java.time.LocalDateTime getTime()</pre>
</li>
</ul>
<a name="getPosition--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getPosition</h4>
<pre>public <a href="../../com/player/Location.html" title="class in com.model.player">Location</a> getPosition()</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Triple.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-files/index-1.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../com/history/BoardHistory.html" title="class in com.model.history"><span class="typeNameLink">Prev Class</span></a></li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../index.html?com/history/Triple.html" target="_top">Frames</a></li>
<li><a href="Triple.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field.summary">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field.detail">Field</a> | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
|
Bubblebitoey/Softspec-Hw1-5810546056-5810546552
|
docs/com/history/Triple.html
|
HTML
|
mit
| 13,880
|
package gofakeit
import (
"fmt"
"reflect"
"sort"
"testing"
"github.com/brianvoe/gofakeit/v6/data"
)
func ExampleBool() {
Seed(11)
fmt.Println(Bool())
// Output: true
}
func ExampleFaker_Bool() {
f := New(11)
fmt.Println(f.Bool())
// Output: true
}
func BenchmarkBool(b *testing.B) {
b.Run("package", func(b *testing.B) {
for i := 0; i < b.N; i++ {
Bool()
}
})
b.Run("Faker math", func(b *testing.B) {
f := New(0)
for i := 0; i < b.N; i++ {
f.Bool()
}
})
b.Run("Faker crypto", func(b *testing.B) {
f := NewCrypto()
for i := 0; i < b.N; i++ {
f.Bool()
}
})
}
func TestUUID(t *testing.T) {
id := UUID()
if len(id) != 36 {
t.Error("unique length does not equal requested length")
}
}
func ExampleUUID() {
Seed(11)
fmt.Println(UUID())
// Output: 590c1440-9888-45b0-bd51-a817ee07c3f2
}
func ExampleFaker_UUID() {
f := New(11)
fmt.Println(f.UUID())
// Output: 590c1440-9888-45b0-bd51-a817ee07c3f2
}
func BenchmarkUUID(b *testing.B) {
b.Run("package", func(b *testing.B) {
for i := 0; i < b.N; i++ {
UUID()
}
})
b.Run("Faker math", func(b *testing.B) {
f := New(0)
for i := 0; i < b.N; i++ {
f.UUID()
}
})
b.Run("Faker crypto", func(b *testing.B) {
f := NewCrypto()
for i := 0; i < b.N; i++ {
f.UUID()
}
})
}
func TestShuffleAnySlice(t *testing.T) {
ShuffleAnySlice(nil) // Should do nothing
ShuffleAnySlice("b") // Should do nothing
ShuffleAnySlice([]string{"b"}) // If single value should do nothing
a := []string{"a", "b", "c", "d", "e", "f", "g", "h"}
b := make([]string, len(a))
copy(b, a)
ShuffleAnySlice(a)
if equalSliceString(a, b) {
t.Errorf("shuffle strings resulted in the same permutation, the odds are slim")
}
n := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 0}
m := make([]int, len(n))
copy(m, n)
ShuffleAnySlice(n)
if equalSliceInt(n, m) {
t.Errorf("shuffle ints resulted in the same permutation, the odds are slim")
}
i := []interface{}{"a", 1, "c", 3, []string{"a", "b", "c"}, -555, []byte{1, 5}, "h"}
ii := make([]interface{}, len(i))
copy(ii, i)
ShuffleAnySlice(i)
if equalSliceInterface(i, ii) {
t.Errorf("shuffle interface resulted in the same permutation, the odds are slim")
}
}
func ExampleShuffleAnySlice() {
Seed(11)
strings := []string{"happy", "times", "for", "everyone", "have", "a", "good", "day"}
ShuffleAnySlice(strings)
fmt.Println(strings)
ints := []int{52, 854, 941, 74125, 8413, 777, 89416, 841657}
ShuffleAnySlice(ints)
fmt.Println(ints)
// Output:
// [good everyone have for times a day happy]
// [777 74125 941 854 89416 52 8413 841657]
}
func ExampleFaker_ShuffleAnySlice() {
f := New(11)
strings := []string{"happy", "times", "for", "everyone", "have", "a", "good", "day"}
f.ShuffleAnySlice(strings)
fmt.Println(strings)
ints := []int{52, 854, 941, 74125, 8413, 777, 89416, 841657}
f.ShuffleAnySlice(ints)
fmt.Println(ints)
// Output:
// [good everyone have for times a day happy]
// [777 74125 941 854 89416 52 8413 841657]
}
func BenchmarkShuffleAnySlice(b *testing.B) {
b.Run("package", func(b *testing.B) {
a := []interface{}{"a", 1, "c", 3, []string{"a", "b", "c"}, -555, []byte{1, 5}, "h"}
for i := 0; i < b.N; i++ {
ShuffleAnySlice(a)
}
})
b.Run("Faker math", func(b *testing.B) {
a := []interface{}{"a", 1, "c", 3, []string{"a", "b", "c"}, -555, []byte{1, 5}, "h"}
f := New(0)
for i := 0; i < b.N; i++ {
f.ShuffleAnySlice(a)
}
})
b.Run("Faker crypto", func(b *testing.B) {
a := []interface{}{"a", 1, "c", 3, []string{"a", "b", "c"}, -555, []byte{1, 5}, "h"}
f := NewCrypto()
for i := 0; i < b.N; i++ {
f.ShuffleAnySlice(a)
}
})
}
func ExampleFlipACoin() {
Seed(11)
fmt.Println(FlipACoin())
// Output: Heads
}
func ExampleFaker_FlipACoin() {
f := New(11)
fmt.Println(f.FlipACoin())
// Output: Heads
}
func TestFlipACoin(t *testing.T) {
for i := 0; i < 100; i++ {
FlipACoin()
}
}
func BenchmarkFlipACoin(b *testing.B) {
b.Run("package", func(b *testing.B) {
for i := 0; i < b.N; i++ {
FlipACoin()
}
})
b.Run("Faker math", func(b *testing.B) {
f := New(0)
for i := 0; i < b.N; i++ {
f.FlipACoin()
}
})
b.Run("Faker crypto", func(b *testing.B) {
f := NewCrypto()
for i := 0; i < b.N; i++ {
f.FlipACoin()
}
})
}
func TestRandomMapKey(t *testing.T) {
mStr := map[string]int{
"a": 1,
"b": 2,
"c": 3,
}
for i := 0; i < 100; i++ {
key := RandomMapKey(mStr)
if _, ok := mStr[key.(string)]; !ok {
t.Errorf("key %s not found in map", key)
}
}
mInt := map[int]string{
1: "a",
2: "b",
3: "c",
}
for i := 0; i < 100; i++ {
f := New(11)
key := f.RandomMapKey(mInt)
if _, ok := mInt[key.(int)]; !ok {
t.Errorf("key %d not found in map", key)
}
}
}
func TestCategories(t *testing.T) {
var got, expected []string
for k := range Categories() {
got = append(got, k)
}
for k := range data.Data {
expected = append(expected, k)
}
sort.Strings(got)
sort.Strings(expected)
if !reflect.DeepEqual(got, expected) {
t.Error("Type arrays are not the same.\nExpected: ", expected, "\nGot: ", got)
}
}
|
brianvoe/gofakeit
|
misc_test.go
|
GO
|
mit
| 5,131
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.